dsh-github-copilot 0.4.2-alpha.3 → 0.4.2-alpha.4

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.
package/lib/remote.js CHANGED
@@ -764,10 +764,10 @@ const contribution$2 = {
764
764
  //#region lib/types/auto-allocation-diagnostics.js
765
765
  const AUTO_ALLOCATION_DIAGNOSTIC_MAX_ROWS = 1024;
766
766
  const dayMs = 864e5;
767
- const integer$1 = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
767
+ const integer$2 = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
768
768
  const version$1 = z.string().max(64).regex(/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/);
769
769
  const allocationRow = z.object({
770
- day: integer$1.multipleOf(dayMs),
770
+ day: integer$2.multipleOf(dayMs),
771
771
  version: version$1,
772
772
  policyVersion: z.string().min(1).max(64),
773
773
  modelId: z.string().min(1).max(512),
@@ -794,12 +794,12 @@ const allocationRow = z.object({
794
794
  highCost: z.boolean(),
795
795
  previous: z.boolean(),
796
796
  weight: z.number().positive().max(1.5),
797
- opportunities: integer$1.min(1),
797
+ opportunities: integer$2.min(1),
798
798
  expectedSelections: z.number().finite().nonnegative().max(Number.MAX_SAFE_INTEGER),
799
- selections: integer$1
799
+ selections: integer$2
800
800
  }).strict();
801
801
  const noFitRow = z.object({
802
- day: integer$1.multipleOf(dayMs),
802
+ day: integer$2.multipleOf(dayMs),
803
803
  version: version$1,
804
804
  policyVersion: z.string().min(1).max(64),
805
805
  targetCategory: z.enum([
@@ -820,22 +820,112 @@ const noFitRow = z.object({
820
820
  "unknown"
821
821
  ]),
822
822
  assessmentSource: z.enum(["local", "semantic"]),
823
- decisions: integer$1.min(1)
823
+ decisions: integer$2.min(1)
824
824
  }).strict();
825
825
  const AutoAllocationDiagnosticsSchema = z.object({
826
826
  status: z.enum(["observed", "not-collected"]),
827
827
  rows: z.array(allocationRow).max(AUTO_ALLOCATION_DIAGNOSTIC_MAX_ROWS),
828
828
  noFitRows: z.array(noFitRow).max(AUTO_ALLOCATION_DIAGNOSTIC_MAX_ROWS),
829
- observationStart: integer$1.nullable(),
830
- observationEnd: integer$1.nullable(),
829
+ observationStart: integer$2.nullable(),
830
+ observationEnd: integer$2.nullable(),
831
831
  completeHistory: z.literal(false),
832
832
  rowsTruncated: z.boolean(),
833
- dropped: integer$1,
834
- expired: integer$1,
835
- saturated: integer$1,
836
- restarts: integer$1
833
+ dropped: integer$2,
834
+ expired: integer$2,
835
+ saturated: integer$2,
836
+ restarts: integer$2
837
837
  }).strict().refine((value) => JSON.stringify(value).length <= 15e5, "Auto allocation diagnostic capacity exceeded").refine((value) => value.rows.length + value.noFitRows.length <= AUTO_ALLOCATION_DIAGNOSTIC_MAX_ROWS, "Auto allocation row capacity exceeded").refine(({ observationStart, observationEnd }) => observationStart === null ? observationEnd === null : observationEnd !== null && observationEnd >= observationStart, "Auto allocation observation window is inconsistent");
838
838
  //#endregion
839
+ //#region lib/types/request-diagnostics.js
840
+ const integer$1 = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
841
+ const composition = z.discriminatedUnion("state", [z.object({
842
+ state: z.literal("complete"),
843
+ totalBytes: integer$1,
844
+ conversationBytes: integer$1,
845
+ toolSchemaBytes: integer$1,
846
+ systemBytes: integer$1,
847
+ otherBytes: integer$1,
848
+ imageBlockBytes: integer$1,
849
+ opaqueReplayBytes: integer$1,
850
+ remainingConversationBytes: integer$1
851
+ }).strict(), z.object({
852
+ state: z.enum([
853
+ "unavailable",
854
+ "size-limit",
855
+ "work-limit",
856
+ "invalid-json",
857
+ "unsupported-shape"
858
+ ]),
859
+ totalBytes: integer$1.optional()
860
+ }).strict()]);
861
+ const upload = z.discriminatedUnion("state", [
862
+ z.object({
863
+ state: z.literal("observed"),
864
+ bodyWrite: z.enum(["observed", "not-observed"]),
865
+ bodyWriteCompleteMs: integer$1.optional(),
866
+ nativeResponseHeadersMs: integer$1.optional(),
867
+ alpn: z.enum([
868
+ "h2",
869
+ "http/1.1",
870
+ "unavailable"
871
+ ]),
872
+ nodeWritableBufferBytes: integer$1.optional()
873
+ }).strict(),
874
+ z.object({ state: z.enum(["unavailable", "work-limit"]) }).strict(),
875
+ z.object({
876
+ state: z.literal("ambiguous"),
877
+ requestCount: integer$1
878
+ }).strict()
879
+ ]);
880
+ const RequestDiagnosticSchema = z.object({
881
+ streamId: z.string().uuid(),
882
+ dispatchIndex: integer$1.min(1),
883
+ version: z.string().max(64).regex(/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/),
884
+ startedAt: integer$1,
885
+ elapsedMs: integer$1,
886
+ model: z.string().max(128).regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/),
887
+ protocol: z.enum([
888
+ "openai-responses",
889
+ "openai-completions",
890
+ "anthropic-messages"
891
+ ]),
892
+ composition,
893
+ encoding: z.enum([
894
+ "identity",
895
+ "gzip",
896
+ "unknown"
897
+ ]),
898
+ wireBytes: integer$1.optional(),
899
+ upload: upload.optional(),
900
+ responseHeadersMs: integer$1.optional(),
901
+ httpStatus: integer$1.min(100).max(599).optional(),
902
+ outcome: z.enum([
903
+ "http-error",
904
+ "transport-error",
905
+ "stream-done",
906
+ "stream-error",
907
+ "cancelled",
908
+ "interrupted"
909
+ ]),
910
+ reason: z.enum([
911
+ "none",
912
+ "unknown",
913
+ "request-body-timeout",
914
+ "caller-abort",
915
+ "credential-changed",
916
+ "disposed",
917
+ "byte-idle-timeout",
918
+ "signal-abort"
919
+ ])
920
+ }).strict();
921
+ const RequestDiagnosticsSchema = z.object({
922
+ rows: z.array(RequestDiagnosticSchema).max(128),
923
+ dropped: integer$1,
924
+ evicted: integer$1,
925
+ pending: integer$1.max(128).optional(),
926
+ interruptedOnReopen: integer$1.optional()
927
+ }).strict();
928
+ //#endregion
839
929
  //#region lib/types/diagnostics-types.js
840
930
  const DIAGNOSTICS_OPERATIONS = [
841
931
  "account-global-switch",
@@ -943,6 +1033,7 @@ const DiagnosticsSnapshotSchema = z.object({
943
1033
  updatedAt: integer,
944
1034
  rows: z.array(DiagnosticsRowSchema).max(DIAGNOSTICS_MAX_ROWS),
945
1035
  autoAllocation: AutoAllocationDiagnosticsSchema.optional(),
1036
+ requests: RequestDiagnosticsSchema.optional(),
946
1037
  pending: z.array(DiagnosticsPendingSchema).max(128),
947
1038
  dropped: integer,
948
1039
  clientDropped: integer,
@@ -954,6 +1045,7 @@ const DiagnosticsSnapshotSchema = z.object({
954
1045
  const DiagnosticsViewSchema = z.object({
955
1046
  enabled: z.boolean(),
956
1047
  autoAllocationEnabled: z.boolean(),
1048
+ requestEnabled: z.boolean().optional(),
957
1049
  state: z.enum([
958
1050
  "loading",
959
1051
  "ready",
@@ -1014,6 +1106,15 @@ const contribution$1 = {
1014
1106
  codec: strictRemoteCodec("dsh-github-copilot#AutoAllocationDiagnosticsEnabled", z.boolean())
1015
1107
  }]
1016
1108
  },
1109
+ {
1110
+ method: "setRequestEnabled",
1111
+ parameters: [{
1112
+ name: "enabled",
1113
+ wire: "enabled",
1114
+ source: "json",
1115
+ codec: strictRemoteCodec("dsh-github-copilot#RequestDiagnosticsEnabled", z.boolean())
1116
+ }]
1117
+ },
1017
1118
  {
1018
1119
  method: "recordClient",
1019
1120
  parameters: [{
@@ -16,6 +16,8 @@ export interface InlineConfig {
16
16
  diagnosticsEnabled?: boolean;
17
17
  /** Independent opt-in persistence of Auto allocation aggregates. */
18
18
  autoAllocationDiagnosticsEnabled?: boolean;
19
+ /** Separate opt-in content-free physical request observations. */
20
+ requestDiagnosticsEnabled?: boolean;
19
21
  /** Hosted-search switch; managed chat requests remain enabled. */
20
22
  enabled: boolean;
21
23
  /**
@@ -86,7 +88,7 @@ export interface InlineConfig {
86
88
  /** Internal JSON backup of route leaves temporarily owned by the GPT-6 overlay. */
87
89
  temporaryRouteBackup?: string;
88
90
  }
89
- export type LiveInlineConfig = Omit<InlineConfig, 'diagnosticsEnabled' | 'autoAllocationDiagnosticsEnabled' | 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds' | 'highCostModelIds' | 'parentModelFollow' | 'followParentModel' | 'activeAccountId' | 'sessionAccounts' | 'sessionContinuation' | 'continuationDefaultHistory'> & {
91
+ export type LiveInlineConfig = Omit<InlineConfig, 'diagnosticsEnabled' | 'autoAllocationDiagnosticsEnabled' | 'requestDiagnosticsEnabled' | 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds' | 'highCostModelIds' | 'parentModelFollow' | 'followParentModel' | 'activeAccountId' | 'sessionAccounts' | 'sessionContinuation' | 'continuationDefaultHistory'> & {
90
92
  continuationDefaultHistory?: InlineConfig['continuationDefaultHistory'] | LiveSetting<ArrayLike<{
91
93
  enabled: boolean;
92
94
  changedAt: number;
@@ -95,6 +97,7 @@ export type LiveInlineConfig = Omit<InlineConfig, 'diagnosticsEnabled' | 'autoAl
95
97
  sessionAccounts?: SessionAccountPreference[] | LiveSetting<ArrayLike<SessionAccountPreference>>;
96
98
  diagnosticsEnabled?: boolean | LiveSetting<boolean>;
97
99
  autoAllocationDiagnosticsEnabled?: boolean | LiveSetting<boolean>;
100
+ requestDiagnosticsEnabled?: boolean | LiveSetting<boolean>;
98
101
  activeAccountId?: string | LiveSetting<string | undefined>;
99
102
  followParentModel?: boolean | LiveSetting<boolean>;
100
103
  parentModelFollow?: ParentModelBinding[] | LiveSetting<ArrayLike<ParentModelBinding>>;
@@ -104,9 +107,10 @@ export type LiveInlineConfig = Omit<InlineConfig, 'diagnosticsEnabled' | 'autoAl
104
107
  searchRouting?: WebSearchRoutingConfig | LiveSetting<WebSearchRoutingConfig | undefined>;
105
108
  temporaryRouteBackup?: string | LiveSetting<string | undefined>;
106
109
  };
107
- export type ResolvedInlineConfig = Omit<InlineConfig, 'diagnosticsEnabled' | 'autoAllocationDiagnosticsEnabled' | 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds' | 'highCostModelIds' | 'parentModelFollow' | 'followParentModel' | 'activeAccountId' | 'sessionAccounts' | 'sessionContinuation' | 'continuationDefaultHistory'> & {
110
+ export type ResolvedInlineConfig = Omit<InlineConfig, 'diagnosticsEnabled' | 'autoAllocationDiagnosticsEnabled' | 'requestDiagnosticsEnabled' | 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds' | 'highCostModelIds' | 'parentModelFollow' | 'followParentModel' | 'activeAccountId' | 'sessionAccounts' | 'sessionContinuation' | 'continuationDefaultHistory'> & {
108
111
  diagnosticsEnabled: LiveSetting<boolean>;
109
112
  autoAllocationDiagnosticsEnabled: LiveSetting<boolean>;
113
+ requestDiagnosticsEnabled: LiveSetting<boolean>;
110
114
  continuationDefaultHistory: LiveSetting<ArrayLike<{
111
115
  enabled: boolean;
112
116
  changedAt: number;
@@ -20,8 +20,8 @@ export declare const CopilotUsageViewSchema: z.ZodObject<{
20
20
  }>;
21
21
  billing: z.ZodEnum<{
22
22
  unknown: "unknown";
23
- credits: "credits";
24
23
  requests: "requests";
24
+ credits: "credits";
25
25
  }>;
26
26
  budget: z.ZodEnum<{
27
27
  unknown: "unknown";
@@ -44,6 +44,7 @@ export declare const DiagnosticsAnalysisReportSchema: z.ZodObject<{
44
44
  "no-calibrated-alert-thresholds": "no-calibrated-alert-thresholds";
45
45
  "no-baseline-trend": "no-baseline-trend";
46
46
  "no-root-cause-proof": "no-root-cause-proof";
47
+ "request-observations-not-analyzed": "request-observations-not-analyzed";
47
48
  }>>;
48
49
  collection: z.ZodObject<{
49
50
  enabled: z.ZodNullable<z.ZodBoolean>;
@@ -1,5 +1,6 @@
1
1
  import type { DiagnosticsOperation, DiagnosticsStage, DiagnosticsOutcome, DiagnosticsReason, DiagnosticsRow, DiagnosticsSnapshot } from './diagnostics-types.ts';
2
2
  import type { AutoSelectionExplanation } from './auto-model-routing.ts';
3
+ import type { RequestDiagnosticHandle, RequestDiagnosticStart } from './request-diagnostics.ts';
3
4
  export interface DiagnosticsHandle {
4
5
  stage(stage: DiagnosticsStage): void;
5
6
  finish(outcome: DiagnosticsOutcome, reason?: DiagnosticsReason): void;
@@ -16,6 +17,8 @@ export declare class DiagnosticsCollector {
16
17
  private readonly live;
17
18
  private enabled;
18
19
  private autoAllocationEnabled;
20
+ private requestEnabled;
21
+ private readonly requestHandles;
19
22
  private lastWall;
20
23
  private readonly autoAllocation;
21
24
  constructor(version: string, layer: 'client' | 'host', changed?: () => void, wall?: () => number, mono?: () => number);
@@ -32,6 +35,9 @@ export declare class DiagnosticsCollector {
32
35
  private oldestIndex;
33
36
  snapshot(): DiagnosticsSnapshot;
34
37
  close(): void;
38
+ setRequestEnabled(enabled: boolean): void;
39
+ beginRequest(start: RequestDiagnosticStart): RequestDiagnosticHandle | undefined;
40
+ isRequestEnabled(): boolean;
35
41
  noteDropped(): void;
36
42
  noteClientGaps(dropped: number, unconfirmed: number): void;
37
43
  recordAutoAllocation(explanation: AutoSelectionExplanation): void;
@@ -20,7 +20,7 @@ export declare const diagnosticsDomain: {
20
20
  layer: "client" | "host";
21
21
  operation: "compaction" | "account-global-switch" | "account-session-select" | "account-session-inherit" | "identity-read" | "identity-flight" | "compaction-summary" | "collection";
22
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" | "success" | "stage" | "failed" | "dropped" | "expired" | "started" | "no-op" | "cancelled" | "policy-rejected" | "revoked" | "environment-fault" | "interrupted" | "clock-discontinuity" | "pending-sample";
23
+ metric: "paused" | "unknown" | "success" | "stage" | "failed" | "dropped" | "expired" | "cancelled" | "interrupted" | "started" | "no-op" | "policy-rejected" | "revoked" | "environment-fault" | "clock-discontinuity" | "pending-sample";
24
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
25
  bucket: number;
26
26
  count: number;
@@ -77,6 +77,54 @@ export declare const diagnosticsDomain: {
77
77
  saturated: number;
78
78
  restarts: number;
79
79
  } | undefined;
80
+ requests?: {
81
+ rows: {
82
+ streamId: string;
83
+ dispatchIndex: number;
84
+ version: string;
85
+ startedAt: number;
86
+ elapsedMs: number;
87
+ model: string;
88
+ protocol: "openai-completions" | "openai-responses" | "anthropic-messages";
89
+ composition: {
90
+ state: "complete";
91
+ totalBytes: number;
92
+ conversationBytes: number;
93
+ toolSchemaBytes: number;
94
+ systemBytes: number;
95
+ otherBytes: number;
96
+ imageBlockBytes: number;
97
+ opaqueReplayBytes: number;
98
+ remainingConversationBytes: number;
99
+ } | {
100
+ state: "unavailable" | "work-limit" | "size-limit" | "invalid-json" | "unsupported-shape";
101
+ totalBytes?: number | undefined;
102
+ };
103
+ encoding: "unknown" | "identity" | "gzip";
104
+ outcome: "http-error" | "transport-error" | "stream-done" | "stream-error" | "cancelled" | "interrupted";
105
+ reason: "none" | "unknown" | "request-body-timeout" | "caller-abort" | "credential-changed" | "disposed" | "byte-idle-timeout" | "signal-abort";
106
+ wireBytes?: number | undefined;
107
+ upload?: {
108
+ state: "observed";
109
+ bodyWrite: "observed" | "not-observed";
110
+ alpn: "h2" | "unavailable" | "http/1.1";
111
+ bodyWriteCompleteMs?: number | undefined;
112
+ nativeResponseHeadersMs?: number | undefined;
113
+ nodeWritableBufferBytes?: number | undefined;
114
+ } | {
115
+ state: "unavailable" | "work-limit";
116
+ } | {
117
+ state: "ambiguous";
118
+ requestCount: number;
119
+ } | undefined;
120
+ responseHeadersMs?: number | undefined;
121
+ httpStatus?: number | undefined;
122
+ }[];
123
+ dropped: number;
124
+ evicted: number;
125
+ pending?: number | undefined;
126
+ interruptedOnReopen?: number | undefined;
127
+ } | undefined;
80
128
  }>;
81
129
  };
82
130
  export declare function diagnosticsDomainForProfile(profileId: string): typeof diagnosticsDomain;
@@ -94,6 +142,7 @@ export declare class DiagnosticsController extends TypertRemoteService {
94
142
  private problem;
95
143
  private enabled;
96
144
  private autoAllocationEnabled;
145
+ private requestEnabled;
97
146
  private dirty;
98
147
  private persistedAt;
99
148
  private revision;
@@ -105,6 +154,7 @@ export declare class DiagnosticsController extends TypertRemoteService {
105
154
  flush(): Promise<void>;
106
155
  markCompactionCancelled(session: object): void;
107
156
  get(): DiagnosticsView;
157
+ setRequestEnabled(enabled: boolean): Promise<DiagnosticsView>;
108
158
  setEnabled(enabled: boolean): Promise<DiagnosticsView>;
109
159
  setAutoAllocationEnabled(enabled: boolean): Promise<DiagnosticsView>;
110
160
  clear(): Promise<DiagnosticsView>;
@@ -47,13 +47,13 @@ export declare const ClientDiagnosticsBatchSchema: z.ZodObject<{
47
47
  failed: "failed";
48
48
  dropped: "dropped";
49
49
  expired: "expired";
50
+ cancelled: "cancelled";
51
+ interrupted: "interrupted";
50
52
  started: "started";
51
53
  "no-op": "no-op";
52
- cancelled: "cancelled";
53
54
  "policy-rejected": "policy-rejected";
54
55
  revoked: "revoked";
55
56
  "environment-fault": "environment-fault";
56
- interrupted: "interrupted";
57
57
  "clock-discontinuity": "clock-discontinuity";
58
58
  "pending-sample": "pending-sample";
59
59
  }>;
@@ -100,6 +100,7 @@ declare module '@deepseek-ai/dsh-typert-protocol' {
100
100
  get(): Promise<RemoteResult<DiagnosticsView>>;
101
101
  setEnabled(enabled: boolean): Promise<RemoteResult<DiagnosticsView>>;
102
102
  setAutoAllocationEnabled(enabled: boolean): Promise<RemoteResult<DiagnosticsView>>;
103
+ setRequestEnabled(enabled: boolean): Promise<RemoteResult<DiagnosticsView>>;
103
104
  clear(): Promise<RemoteResult<DiagnosticsView>>;
104
105
  recordClient(batch: ClientDiagnosticsBatch): Promise<RemoteResult<DiagnosticsView>>;
105
106
  };
@@ -51,13 +51,13 @@ export declare const DiagnosticsRowSchema: z.ZodObject<{
51
51
  failed: "failed";
52
52
  dropped: "dropped";
53
53
  expired: "expired";
54
+ cancelled: "cancelled";
55
+ interrupted: "interrupted";
54
56
  started: "started";
55
57
  "no-op": "no-op";
56
- cancelled: "cancelled";
57
58
  "policy-rejected": "policy-rejected";
58
59
  revoked: "revoked";
59
60
  "environment-fault": "environment-fault";
60
- interrupted: "interrupted";
61
61
  "clock-discontinuity": "clock-discontinuity";
62
62
  "pending-sample": "pending-sample";
63
63
  }>;
@@ -177,13 +177,13 @@ export declare const DiagnosticsSnapshotSchema: z.ZodObject<{
177
177
  failed: "failed";
178
178
  dropped: "dropped";
179
179
  expired: "expired";
180
+ cancelled: "cancelled";
181
+ interrupted: "interrupted";
180
182
  started: "started";
181
183
  "no-op": "no-op";
182
- cancelled: "cancelled";
183
184
  "policy-rejected": "policy-rejected";
184
185
  revoked: "revoked";
185
186
  "environment-fault": "environment-fault";
186
- interrupted: "interrupted";
187
187
  "clock-discontinuity": "clock-discontinuity";
188
188
  "pending-sample": "pending-sample";
189
189
  }>;
@@ -299,6 +299,94 @@ export declare const DiagnosticsSnapshotSchema: z.ZodObject<{
299
299
  saturated: z.ZodNumber;
300
300
  restarts: z.ZodNumber;
301
301
  }, z.core.$strict>>;
302
+ requests: z.ZodOptional<z.ZodObject<{
303
+ rows: z.ZodArray<z.ZodObject<{
304
+ streamId: z.ZodString;
305
+ dispatchIndex: z.ZodNumber;
306
+ version: z.ZodString;
307
+ startedAt: z.ZodNumber;
308
+ elapsedMs: z.ZodNumber;
309
+ model: z.ZodString;
310
+ protocol: z.ZodEnum<{
311
+ "openai-completions": "openai-completions";
312
+ "openai-responses": "openai-responses";
313
+ "anthropic-messages": "anthropic-messages";
314
+ }>;
315
+ composition: z.ZodDiscriminatedUnion<[z.ZodObject<{
316
+ state: z.ZodLiteral<"complete">;
317
+ totalBytes: z.ZodNumber;
318
+ conversationBytes: z.ZodNumber;
319
+ toolSchemaBytes: z.ZodNumber;
320
+ systemBytes: z.ZodNumber;
321
+ otherBytes: z.ZodNumber;
322
+ imageBlockBytes: z.ZodNumber;
323
+ opaqueReplayBytes: z.ZodNumber;
324
+ remainingConversationBytes: z.ZodNumber;
325
+ }, z.core.$strict>, z.ZodObject<{
326
+ state: z.ZodEnum<{
327
+ unavailable: "unavailable";
328
+ "work-limit": "work-limit";
329
+ "size-limit": "size-limit";
330
+ "invalid-json": "invalid-json";
331
+ "unsupported-shape": "unsupported-shape";
332
+ }>;
333
+ totalBytes: z.ZodOptional<z.ZodNumber>;
334
+ }, z.core.$strict>], "state">;
335
+ encoding: z.ZodEnum<{
336
+ unknown: "unknown";
337
+ identity: "identity";
338
+ gzip: "gzip";
339
+ }>;
340
+ wireBytes: z.ZodOptional<z.ZodNumber>;
341
+ upload: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
342
+ state: z.ZodLiteral<"observed">;
343
+ bodyWrite: z.ZodEnum<{
344
+ observed: "observed";
345
+ "not-observed": "not-observed";
346
+ }>;
347
+ bodyWriteCompleteMs: z.ZodOptional<z.ZodNumber>;
348
+ nativeResponseHeadersMs: z.ZodOptional<z.ZodNumber>;
349
+ alpn: z.ZodEnum<{
350
+ h2: "h2";
351
+ unavailable: "unavailable";
352
+ "http/1.1": "http/1.1";
353
+ }>;
354
+ nodeWritableBufferBytes: z.ZodOptional<z.ZodNumber>;
355
+ }, z.core.$strict>, z.ZodObject<{
356
+ state: z.ZodEnum<{
357
+ unavailable: "unavailable";
358
+ "work-limit": "work-limit";
359
+ }>;
360
+ }, z.core.$strict>, z.ZodObject<{
361
+ state: z.ZodLiteral<"ambiguous">;
362
+ requestCount: z.ZodNumber;
363
+ }, z.core.$strict>], "state">>;
364
+ responseHeadersMs: z.ZodOptional<z.ZodNumber>;
365
+ httpStatus: z.ZodOptional<z.ZodNumber>;
366
+ outcome: z.ZodEnum<{
367
+ "http-error": "http-error";
368
+ "transport-error": "transport-error";
369
+ "stream-done": "stream-done";
370
+ "stream-error": "stream-error";
371
+ cancelled: "cancelled";
372
+ interrupted: "interrupted";
373
+ }>;
374
+ reason: z.ZodEnum<{
375
+ none: "none";
376
+ unknown: "unknown";
377
+ "request-body-timeout": "request-body-timeout";
378
+ "caller-abort": "caller-abort";
379
+ "credential-changed": "credential-changed";
380
+ disposed: "disposed";
381
+ "byte-idle-timeout": "byte-idle-timeout";
382
+ "signal-abort": "signal-abort";
383
+ }>;
384
+ }, z.core.$strict>>;
385
+ dropped: z.ZodNumber;
386
+ evicted: z.ZodNumber;
387
+ pending: z.ZodOptional<z.ZodNumber>;
388
+ interruptedOnReopen: z.ZodOptional<z.ZodNumber>;
389
+ }, z.core.$strict>>;
302
390
  pending: z.ZodArray<z.ZodObject<{
303
391
  version: z.ZodString;
304
392
  operation: z.ZodEnum<{
@@ -343,6 +431,7 @@ export declare const DiagnosticsSnapshotSchema: z.ZodObject<{
343
431
  export declare const DiagnosticsViewSchema: z.ZodObject<{
344
432
  enabled: z.ZodBoolean;
345
433
  autoAllocationEnabled: z.ZodBoolean;
434
+ requestEnabled: z.ZodOptional<z.ZodBoolean>;
346
435
  state: z.ZodEnum<{
347
436
  error: "error";
348
437
  ready: "ready";
@@ -412,13 +501,13 @@ export declare const DiagnosticsViewSchema: z.ZodObject<{
412
501
  failed: "failed";
413
502
  dropped: "dropped";
414
503
  expired: "expired";
504
+ cancelled: "cancelled";
505
+ interrupted: "interrupted";
415
506
  started: "started";
416
507
  "no-op": "no-op";
417
- cancelled: "cancelled";
418
508
  "policy-rejected": "policy-rejected";
419
509
  revoked: "revoked";
420
510
  "environment-fault": "environment-fault";
421
- interrupted: "interrupted";
422
511
  "clock-discontinuity": "clock-discontinuity";
423
512
  "pending-sample": "pending-sample";
424
513
  }>;
@@ -534,6 +623,94 @@ export declare const DiagnosticsViewSchema: z.ZodObject<{
534
623
  saturated: z.ZodNumber;
535
624
  restarts: z.ZodNumber;
536
625
  }, z.core.$strict>>;
626
+ requests: z.ZodOptional<z.ZodObject<{
627
+ rows: z.ZodArray<z.ZodObject<{
628
+ streamId: z.ZodString;
629
+ dispatchIndex: z.ZodNumber;
630
+ version: z.ZodString;
631
+ startedAt: z.ZodNumber;
632
+ elapsedMs: z.ZodNumber;
633
+ model: z.ZodString;
634
+ protocol: z.ZodEnum<{
635
+ "openai-completions": "openai-completions";
636
+ "openai-responses": "openai-responses";
637
+ "anthropic-messages": "anthropic-messages";
638
+ }>;
639
+ composition: z.ZodDiscriminatedUnion<[z.ZodObject<{
640
+ state: z.ZodLiteral<"complete">;
641
+ totalBytes: z.ZodNumber;
642
+ conversationBytes: z.ZodNumber;
643
+ toolSchemaBytes: z.ZodNumber;
644
+ systemBytes: z.ZodNumber;
645
+ otherBytes: z.ZodNumber;
646
+ imageBlockBytes: z.ZodNumber;
647
+ opaqueReplayBytes: z.ZodNumber;
648
+ remainingConversationBytes: z.ZodNumber;
649
+ }, z.core.$strict>, z.ZodObject<{
650
+ state: z.ZodEnum<{
651
+ unavailable: "unavailable";
652
+ "work-limit": "work-limit";
653
+ "size-limit": "size-limit";
654
+ "invalid-json": "invalid-json";
655
+ "unsupported-shape": "unsupported-shape";
656
+ }>;
657
+ totalBytes: z.ZodOptional<z.ZodNumber>;
658
+ }, z.core.$strict>], "state">;
659
+ encoding: z.ZodEnum<{
660
+ unknown: "unknown";
661
+ identity: "identity";
662
+ gzip: "gzip";
663
+ }>;
664
+ wireBytes: z.ZodOptional<z.ZodNumber>;
665
+ upload: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
666
+ state: z.ZodLiteral<"observed">;
667
+ bodyWrite: z.ZodEnum<{
668
+ observed: "observed";
669
+ "not-observed": "not-observed";
670
+ }>;
671
+ bodyWriteCompleteMs: z.ZodOptional<z.ZodNumber>;
672
+ nativeResponseHeadersMs: z.ZodOptional<z.ZodNumber>;
673
+ alpn: z.ZodEnum<{
674
+ h2: "h2";
675
+ unavailable: "unavailable";
676
+ "http/1.1": "http/1.1";
677
+ }>;
678
+ nodeWritableBufferBytes: z.ZodOptional<z.ZodNumber>;
679
+ }, z.core.$strict>, z.ZodObject<{
680
+ state: z.ZodEnum<{
681
+ unavailable: "unavailable";
682
+ "work-limit": "work-limit";
683
+ }>;
684
+ }, z.core.$strict>, z.ZodObject<{
685
+ state: z.ZodLiteral<"ambiguous">;
686
+ requestCount: z.ZodNumber;
687
+ }, z.core.$strict>], "state">>;
688
+ responseHeadersMs: z.ZodOptional<z.ZodNumber>;
689
+ httpStatus: z.ZodOptional<z.ZodNumber>;
690
+ outcome: z.ZodEnum<{
691
+ "http-error": "http-error";
692
+ "transport-error": "transport-error";
693
+ "stream-done": "stream-done";
694
+ "stream-error": "stream-error";
695
+ cancelled: "cancelled";
696
+ interrupted: "interrupted";
697
+ }>;
698
+ reason: z.ZodEnum<{
699
+ none: "none";
700
+ unknown: "unknown";
701
+ "request-body-timeout": "request-body-timeout";
702
+ "caller-abort": "caller-abort";
703
+ "credential-changed": "credential-changed";
704
+ disposed: "disposed";
705
+ "byte-idle-timeout": "byte-idle-timeout";
706
+ "signal-abort": "signal-abort";
707
+ }>;
708
+ }, z.core.$strict>>;
709
+ dropped: z.ZodNumber;
710
+ evicted: z.ZodNumber;
711
+ pending: z.ZodOptional<z.ZodNumber>;
712
+ interruptedOnReopen: z.ZodOptional<z.ZodNumber>;
713
+ }, z.core.$strict>>;
537
714
  pending: z.ZodArray<z.ZodObject<{
538
715
  version: z.ZodString;
539
716
  operation: z.ZodEnum<{
@@ -4,6 +4,7 @@ import type { CoreCompatibleProvider } from './pi-provider-bridge.ts';
4
4
  import type { GitHubCopilotOAuthCredential } from './copilot-grant.ts';
5
5
  import { CopilotResponsesReplayError } from './responses-replay-compat.ts';
6
6
  import type { ResponsesRetryReplay } from './responses-replay-compat.ts';
7
+ import type { RequestDiagnosticHandle, RequestDiagnosticStart } from './request-diagnostics.ts';
7
8
  import { CopilotStreamIdleError, CopilotStreamLiveness } from './copilot-stream-liveness.ts';
8
9
  export type ManagedWireAbortCode = 'COPILOT_PREVIEW_CREDENTIAL_CHANGED' | 'COPILOT_PREVIEW_DISPOSED';
9
10
  /** Identity, not upstream error text, proves that the plugin revoked this wire. */
@@ -33,6 +34,11 @@ export interface PreviewProviderGuard {
33
34
  readonly streamIdleTimeoutMs?: number;
34
35
  onStreamLiveness?(control: Pick<CopilotStreamLiveness, 'pause' | 'resume'>): void;
35
36
  onStreamIdleTimeout?(error: CopilotStreamIdleError): void;
37
+ requestDiagnostics?: {
38
+ enabled(): boolean;
39
+ begin(start: RequestDiagnosticStart): RequestDiagnosticHandle | undefined;
40
+ failed(): void;
41
+ };
36
42
  }
37
43
  /** Guard for one selected model in an account-bound descriptor snapshot. */
38
44
  export interface AccountProviderGuard extends PreviewProviderGuard {
@@ -56,10 +56,10 @@ export declare const GitHubCopilotAuthorizationViewSchema: z.ZodObject<{
56
56
  error: "error";
57
57
  ready: "ready";
58
58
  unavailable: "unavailable";
59
+ disposed: "disposed";
59
60
  loading: "loading";
60
61
  idle: "idle";
61
62
  stale: "stale";
62
- disposed: "disposed";
63
63
  unconfigured: "unconfigured";
64
64
  }>;
65
65
  models: z.ZodArray<z.ZodObject<{