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.
- package/AGENTS.md +42 -6
- package/CHANGELOG.md +126 -0
- package/README.md +75 -25
- package/README.zh.md +55 -20
- package/deployment-baseline.json +30 -3
- package/docs/auto-high-cost.md +51 -20
- package/docs/auto-iteration-review.json +13 -13
- package/docs/auto-task-routing.md +118 -19
- package/docs/automatic-model-routing.md +2 -1
- package/docs/copilot-accounts.md +6 -0
- package/docs/copilot-compaction.md +1 -1
- package/docs/plugin-diagnostics.md +159 -6
- package/lib/client.js +814 -59
- package/lib/client.js.map +1 -1
- package/lib/diagnostics-analysis.js +4 -2
- package/lib/diagnostics-types-qvtuvM5E.js +661 -0
- package/lib/index.js +8775 -7934
- package/lib/manual-compaction-recovery.js +1 -1
- package/lib/remote.js +278 -6
- package/lib/routed-web.js +1 -1
- package/lib/types/auto-allocation-diagnostics.d.ts +126 -0
- package/lib/types/auto-allocation-evidence.d.ts +5 -1
- package/lib/types/auto-allocation.d.ts +7 -2
- package/lib/types/auto-assessment-evidence.d.ts +65 -0
- package/lib/types/auto-model-host.d.ts +1 -0
- package/lib/types/auto-model-routing.d.ts +1 -1
- package/lib/types/auto-task-assessment.d.ts +4 -2
- package/lib/types/auto-task-classifier.d.ts +2 -1
- package/lib/types/compaction-continuation.d.ts +1 -1
- package/lib/types/config.d.ts +18 -2
- package/lib/types/context-evidence.d.ts +4 -4
- package/lib/types/copilot-auth.d.ts +2 -1
- package/lib/types/copilot-usage-remote.d.ts +1 -1
- package/lib/types/diagnostics-analysis.d.ts +3 -2
- package/lib/types/diagnostics-card.d.ts +1 -0
- package/lib/types/diagnostics-collector.d.ts +14 -0
- package/lib/types/diagnostics-host.d.ts +114 -3
- package/lib/types/diagnostics-remote.d.ts +11 -9
- package/lib/types/diagnostics-types.d.ts +486 -30
- package/lib/types/native-settings-style.d.ts +1 -1
- package/lib/types/preview-provider.d.ts +8 -2
- package/lib/types/preview-route.d.ts +1 -1
- package/lib/types/remote.d.ts +1 -1
- package/lib/types/request-body-composition.d.ts +17 -0
- package/lib/types/request-body-evidence.d.ts +2 -1
- package/lib/types/request-diagnostics.d.ts +278 -0
- package/lib/types/session-continuation-types.d.ts +2 -2
- package/lib/types/turn-selection-host.d.ts +2 -1
- package/lib/types/turn-selection.d.ts +39 -2
- package/package.json +2 -2
- package/lib/diagnostics-types-FVf6zjob.js +0 -182
|
@@ -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 {
|
|
@@ -62,9 +68,9 @@ export type AccountPiModel = Model<AccountModelApi> & {
|
|
|
62
68
|
};
|
|
63
69
|
export declare function copilotPublicHeaders(): Readonly<Record<string, string>>;
|
|
64
70
|
/** Materialize advertised capabilities only; model names and the local static catalog never select the API. */
|
|
65
|
-
export declare function accountModelFromDescriptor(descriptor: AccountModelDescriptor, baseURL: string): AccountPiModel;
|
|
71
|
+
export declare function accountModelFromDescriptor(descriptor: AccountModelDescriptor, baseURL: string, classifierReasoningOff?: boolean): AccountPiModel;
|
|
66
72
|
/** Create a descriptor-driven, OAuth-only provider using native SDK serialization for all supported endpoints. */
|
|
67
|
-
export declare function createAccountProvider(descriptors: readonly AccountModelDescriptor[], guard: AccountProviderGuard, baseURL: string): {
|
|
73
|
+
export declare function createAccountProvider(descriptors: readonly AccountModelDescriptor[], guard: AccountProviderGuard, baseURL: string, classifierReasoningOff?: boolean): {
|
|
68
74
|
provider: CoreCompatibleProvider;
|
|
69
75
|
models: readonly AccountPiModel[];
|
|
70
76
|
};
|
|
@@ -10,7 +10,7 @@ import type { RequestBudgetPolicy } from './request-budget.ts';
|
|
|
10
10
|
export type PreviewRouteConfig = Pick<PiAiProviderProfile, 'reasoning' | 'cacheRetention' | 'transport' | 'timeoutMs' | 'websocketConnectTimeoutMs' | 'streamIdleTimeoutMs' | 'maxRequestImageBytes' | 'requestImagePixelBudget' | 'requestImageMaxBytes' | 'retryPolicy'> & Pick<InlineConfig, 'accountModelTtlMs' | 'accountModelFailureCooldownMs'> & {
|
|
11
11
|
readonly streamLiveness?: boolean;
|
|
12
12
|
readonly chatRequestSettings?: () => Pick<InlineConfig, 'chatStreamIdleTimeoutMs' | 'chatStreamLiveness' | 'chatMaxRequestImageBytes' | 'responsesRequestCompression' | 'responsesOmitTemperature'>;
|
|
13
|
-
readonly accountModelSettings?: () => Pick<InlineConfig, 'accountModelTtlMs' | 'accountModelFailureCooldownMs' | 'excludedModelIds' | 'highCostModelIds' | 'parentModelFollow' | 'followParentModel' | 'autoSemanticAssessment' | 'autoAllocationEvidence'>;
|
|
13
|
+
readonly accountModelSettings?: () => Pick<InlineConfig, 'accountModelTtlMs' | 'accountModelFailureCooldownMs' | 'excludedModelIds' | 'highCostModelIds' | 'parentModelFollow' | 'followParentModel' | 'autoSemanticAssessment' | 'autoSemanticAssessmentTimeoutMs' | 'autoSemanticAssessmentModel' | 'autoAllocationEvidence'>;
|
|
14
14
|
readonly requestBudget?: Partial<RequestBudgetPolicy>;
|
|
15
15
|
readonly requestBudgetSettings?: () => Partial<RequestBudgetPolicy>;
|
|
16
16
|
};
|
package/lib/types/remote.d.ts
CHANGED
|
@@ -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<{
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RequestBodyEvidence, RequestBodyProtocol } from './request-body-evidence.ts';
|
|
2
|
+
export declare const REQUEST_BODY_COMPOSITION_LIMITS: Readonly<{
|
|
3
|
+
bytes: number;
|
|
4
|
+
sliceCharacters: 65536;
|
|
5
|
+
elapsedMs: 2000;
|
|
6
|
+
concurrent: 4;
|
|
7
|
+
values: 65536;
|
|
8
|
+
tokens: 131072;
|
|
9
|
+
depth: 64;
|
|
10
|
+
keyCharacters: 128;
|
|
11
|
+
}>;
|
|
12
|
+
/** Only bounded keys/discriminators are decoded; payload values never form an object graph. */
|
|
13
|
+
export declare function requestBodyComposition(payload: string | undefined, protocol: RequestBodyProtocol, options?: {
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
isCurrent?: () => boolean;
|
|
16
|
+
}): Promise<RequestBodyEvidence>;
|
|
17
|
+
//# sourceMappingURL=request-body-composition.d.ts.map
|
|
@@ -20,11 +20,12 @@ export type RequestBodyEvidence = {
|
|
|
20
20
|
readonly opaqueReplayBytes: number;
|
|
21
21
|
readonly remainingConversationBytes: number;
|
|
22
22
|
} | {
|
|
23
|
-
readonly state: 'unavailable' | 'size-limit' | 'work-limit' | 'invalid-json' | 'unsupported-shape';
|
|
23
|
+
readonly state: 'unavailable' | 'size-limit' | 'work-limit' | 'invalid-json' | 'unsupported-shape' | 'cancelled' | 'time-limit';
|
|
24
24
|
readonly totalBytes?: number;
|
|
25
25
|
};
|
|
26
26
|
export interface RequestBodyDispatchEvidence {
|
|
27
27
|
readonly protocol: RequestBodyProtocol;
|
|
28
|
+
readonly composition?: Promise<RequestBodyEvidence>;
|
|
28
29
|
/** Fetch invocation to response headers, not upload duration or clone-observation time. */
|
|
29
30
|
readonly responseHeadersMs: number;
|
|
30
31
|
readonly upload?: RequestUploadEvidence;
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { RequestBodyEvidence } from './request-body-evidence.ts';
|
|
3
|
+
import type { RequestUploadEvidence } from './request-upload-evidence.ts';
|
|
4
|
+
export declare const REQUEST_DIAGNOSTICS_MAX_ROWS = 128;
|
|
5
|
+
export declare const REQUEST_DIAGNOSTICS_RETENTION_MS: number;
|
|
6
|
+
export declare const CredentialChangeReasonSchema: z.ZodEnum<{
|
|
7
|
+
expired: "expired";
|
|
8
|
+
qualified: "qualified";
|
|
9
|
+
"unknown-source": "unknown-source";
|
|
10
|
+
"account-changed": "account-changed";
|
|
11
|
+
"endpoint-changed": "endpoint-changed";
|
|
12
|
+
"entitlements-changed": "entitlements-changed";
|
|
13
|
+
"auth-mismatch": "auth-mismatch";
|
|
14
|
+
"duplicate-notification": "duplicate-notification";
|
|
15
|
+
"missing-notification": "missing-notification";
|
|
16
|
+
"commit-mismatch": "commit-mismatch";
|
|
17
|
+
"write-failed": "write-failed";
|
|
18
|
+
"write-conflict": "write-conflict";
|
|
19
|
+
}>;
|
|
20
|
+
export declare const CredentialChangeSchema: z.ZodObject<{
|
|
21
|
+
changeId: z.ZodString;
|
|
22
|
+
observedAt: z.ZodNumber;
|
|
23
|
+
version: z.ZodString;
|
|
24
|
+
phase: z.ZodEnum<{
|
|
25
|
+
notification: "notification";
|
|
26
|
+
commit: "commit";
|
|
27
|
+
}>;
|
|
28
|
+
reason: z.ZodEnum<{
|
|
29
|
+
expired: "expired";
|
|
30
|
+
qualified: "qualified";
|
|
31
|
+
"unknown-source": "unknown-source";
|
|
32
|
+
"account-changed": "account-changed";
|
|
33
|
+
"endpoint-changed": "endpoint-changed";
|
|
34
|
+
"entitlements-changed": "entitlements-changed";
|
|
35
|
+
"auth-mismatch": "auth-mismatch";
|
|
36
|
+
"duplicate-notification": "duplicate-notification";
|
|
37
|
+
"missing-notification": "missing-notification";
|
|
38
|
+
"commit-mismatch": "commit-mismatch";
|
|
39
|
+
"write-failed": "write-failed";
|
|
40
|
+
"write-conflict": "write-conflict";
|
|
41
|
+
}>;
|
|
42
|
+
preparing: z.ZodNumber;
|
|
43
|
+
dispatched: z.ZodNumber;
|
|
44
|
+
alreadyAborted: z.ZodNumber;
|
|
45
|
+
preserved: z.ZodNumber;
|
|
46
|
+
revoked: z.ZodNumber;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
export type CredentialChangeReason = z.infer<typeof CredentialChangeReasonSchema>;
|
|
49
|
+
export type CredentialChangeEvidence = Omit<z.infer<typeof CredentialChangeSchema>, 'changeId' | 'observedAt' | 'version'>;
|
|
50
|
+
export interface CredentialChangeHandle {
|
|
51
|
+
record(evidence: CredentialChangeEvidence): void;
|
|
52
|
+
cancel(): void;
|
|
53
|
+
}
|
|
54
|
+
export declare const RequestDiagnosticSchema: z.ZodObject<{
|
|
55
|
+
streamId: z.ZodString;
|
|
56
|
+
dispatchIndex: z.ZodNumber;
|
|
57
|
+
version: z.ZodString;
|
|
58
|
+
startedAt: z.ZodNumber;
|
|
59
|
+
elapsedMs: z.ZodNumber;
|
|
60
|
+
model: z.ZodString;
|
|
61
|
+
protocol: z.ZodEnum<{
|
|
62
|
+
"openai-completions": "openai-completions";
|
|
63
|
+
"openai-responses": "openai-responses";
|
|
64
|
+
"anthropic-messages": "anthropic-messages";
|
|
65
|
+
}>;
|
|
66
|
+
composition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
67
|
+
state: z.ZodLiteral<"complete">;
|
|
68
|
+
totalBytes: z.ZodNumber;
|
|
69
|
+
conversationBytes: z.ZodNumber;
|
|
70
|
+
toolSchemaBytes: z.ZodNumber;
|
|
71
|
+
systemBytes: z.ZodNumber;
|
|
72
|
+
otherBytes: z.ZodNumber;
|
|
73
|
+
imageBlockBytes: z.ZodNumber;
|
|
74
|
+
opaqueReplayBytes: z.ZodNumber;
|
|
75
|
+
remainingConversationBytes: z.ZodNumber;
|
|
76
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
77
|
+
state: z.ZodEnum<{
|
|
78
|
+
unavailable: "unavailable";
|
|
79
|
+
"work-limit": "work-limit";
|
|
80
|
+
"size-limit": "size-limit";
|
|
81
|
+
"invalid-json": "invalid-json";
|
|
82
|
+
"unsupported-shape": "unsupported-shape";
|
|
83
|
+
cancelled: "cancelled";
|
|
84
|
+
"time-limit": "time-limit";
|
|
85
|
+
}>;
|
|
86
|
+
totalBytes: z.ZodOptional<z.ZodNumber>;
|
|
87
|
+
}, z.core.$strict>], "state">;
|
|
88
|
+
encoding: z.ZodEnum<{
|
|
89
|
+
unknown: "unknown";
|
|
90
|
+
identity: "identity";
|
|
91
|
+
gzip: "gzip";
|
|
92
|
+
}>;
|
|
93
|
+
wireBytes: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
upload: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
95
|
+
state: z.ZodLiteral<"observed">;
|
|
96
|
+
bodyWrite: z.ZodEnum<{
|
|
97
|
+
observed: "observed";
|
|
98
|
+
"not-observed": "not-observed";
|
|
99
|
+
}>;
|
|
100
|
+
bodyWriteCompleteMs: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
nativeResponseHeadersMs: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
alpn: z.ZodEnum<{
|
|
103
|
+
h2: "h2";
|
|
104
|
+
unavailable: "unavailable";
|
|
105
|
+
"http/1.1": "http/1.1";
|
|
106
|
+
}>;
|
|
107
|
+
nodeWritableBufferBytes: z.ZodOptional<z.ZodNumber>;
|
|
108
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
109
|
+
state: z.ZodEnum<{
|
|
110
|
+
unavailable: "unavailable";
|
|
111
|
+
"work-limit": "work-limit";
|
|
112
|
+
}>;
|
|
113
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
114
|
+
state: z.ZodLiteral<"ambiguous">;
|
|
115
|
+
requestCount: z.ZodNumber;
|
|
116
|
+
}, z.core.$strict>], "state">>;
|
|
117
|
+
responseHeadersMs: z.ZodOptional<z.ZodNumber>;
|
|
118
|
+
httpStatus: z.ZodOptional<z.ZodNumber>;
|
|
119
|
+
outcome: z.ZodEnum<{
|
|
120
|
+
cancelled: "cancelled";
|
|
121
|
+
"http-error": "http-error";
|
|
122
|
+
"transport-error": "transport-error";
|
|
123
|
+
"stream-done": "stream-done";
|
|
124
|
+
"stream-error": "stream-error";
|
|
125
|
+
interrupted: "interrupted";
|
|
126
|
+
}>;
|
|
127
|
+
reason: z.ZodEnum<{
|
|
128
|
+
none: "none";
|
|
129
|
+
unknown: "unknown";
|
|
130
|
+
"request-body-timeout": "request-body-timeout";
|
|
131
|
+
"caller-abort": "caller-abort";
|
|
132
|
+
"credential-changed": "credential-changed";
|
|
133
|
+
disposed: "disposed";
|
|
134
|
+
"byte-idle-timeout": "byte-idle-timeout";
|
|
135
|
+
"signal-abort": "signal-abort";
|
|
136
|
+
}>;
|
|
137
|
+
}, z.core.$strict>;
|
|
138
|
+
export declare const RequestDiagnosticsSchema: z.ZodObject<{
|
|
139
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
140
|
+
streamId: z.ZodString;
|
|
141
|
+
dispatchIndex: z.ZodNumber;
|
|
142
|
+
version: z.ZodString;
|
|
143
|
+
startedAt: z.ZodNumber;
|
|
144
|
+
elapsedMs: z.ZodNumber;
|
|
145
|
+
model: z.ZodString;
|
|
146
|
+
protocol: z.ZodEnum<{
|
|
147
|
+
"openai-completions": "openai-completions";
|
|
148
|
+
"openai-responses": "openai-responses";
|
|
149
|
+
"anthropic-messages": "anthropic-messages";
|
|
150
|
+
}>;
|
|
151
|
+
composition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
152
|
+
state: z.ZodLiteral<"complete">;
|
|
153
|
+
totalBytes: z.ZodNumber;
|
|
154
|
+
conversationBytes: z.ZodNumber;
|
|
155
|
+
toolSchemaBytes: z.ZodNumber;
|
|
156
|
+
systemBytes: z.ZodNumber;
|
|
157
|
+
otherBytes: z.ZodNumber;
|
|
158
|
+
imageBlockBytes: z.ZodNumber;
|
|
159
|
+
opaqueReplayBytes: z.ZodNumber;
|
|
160
|
+
remainingConversationBytes: z.ZodNumber;
|
|
161
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
162
|
+
state: z.ZodEnum<{
|
|
163
|
+
unavailable: "unavailable";
|
|
164
|
+
"work-limit": "work-limit";
|
|
165
|
+
"size-limit": "size-limit";
|
|
166
|
+
"invalid-json": "invalid-json";
|
|
167
|
+
"unsupported-shape": "unsupported-shape";
|
|
168
|
+
cancelled: "cancelled";
|
|
169
|
+
"time-limit": "time-limit";
|
|
170
|
+
}>;
|
|
171
|
+
totalBytes: z.ZodOptional<z.ZodNumber>;
|
|
172
|
+
}, z.core.$strict>], "state">;
|
|
173
|
+
encoding: z.ZodEnum<{
|
|
174
|
+
unknown: "unknown";
|
|
175
|
+
identity: "identity";
|
|
176
|
+
gzip: "gzip";
|
|
177
|
+
}>;
|
|
178
|
+
wireBytes: z.ZodOptional<z.ZodNumber>;
|
|
179
|
+
upload: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
180
|
+
state: z.ZodLiteral<"observed">;
|
|
181
|
+
bodyWrite: z.ZodEnum<{
|
|
182
|
+
observed: "observed";
|
|
183
|
+
"not-observed": "not-observed";
|
|
184
|
+
}>;
|
|
185
|
+
bodyWriteCompleteMs: z.ZodOptional<z.ZodNumber>;
|
|
186
|
+
nativeResponseHeadersMs: z.ZodOptional<z.ZodNumber>;
|
|
187
|
+
alpn: z.ZodEnum<{
|
|
188
|
+
h2: "h2";
|
|
189
|
+
unavailable: "unavailable";
|
|
190
|
+
"http/1.1": "http/1.1";
|
|
191
|
+
}>;
|
|
192
|
+
nodeWritableBufferBytes: z.ZodOptional<z.ZodNumber>;
|
|
193
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
194
|
+
state: z.ZodEnum<{
|
|
195
|
+
unavailable: "unavailable";
|
|
196
|
+
"work-limit": "work-limit";
|
|
197
|
+
}>;
|
|
198
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
199
|
+
state: z.ZodLiteral<"ambiguous">;
|
|
200
|
+
requestCount: z.ZodNumber;
|
|
201
|
+
}, z.core.$strict>], "state">>;
|
|
202
|
+
responseHeadersMs: z.ZodOptional<z.ZodNumber>;
|
|
203
|
+
httpStatus: z.ZodOptional<z.ZodNumber>;
|
|
204
|
+
outcome: z.ZodEnum<{
|
|
205
|
+
cancelled: "cancelled";
|
|
206
|
+
"http-error": "http-error";
|
|
207
|
+
"transport-error": "transport-error";
|
|
208
|
+
"stream-done": "stream-done";
|
|
209
|
+
"stream-error": "stream-error";
|
|
210
|
+
interrupted: "interrupted";
|
|
211
|
+
}>;
|
|
212
|
+
reason: z.ZodEnum<{
|
|
213
|
+
none: "none";
|
|
214
|
+
unknown: "unknown";
|
|
215
|
+
"request-body-timeout": "request-body-timeout";
|
|
216
|
+
"caller-abort": "caller-abort";
|
|
217
|
+
"credential-changed": "credential-changed";
|
|
218
|
+
disposed: "disposed";
|
|
219
|
+
"byte-idle-timeout": "byte-idle-timeout";
|
|
220
|
+
"signal-abort": "signal-abort";
|
|
221
|
+
}>;
|
|
222
|
+
}, z.core.$strict>>;
|
|
223
|
+
dropped: z.ZodNumber;
|
|
224
|
+
evicted: z.ZodNumber;
|
|
225
|
+
pending: z.ZodOptional<z.ZodNumber>;
|
|
226
|
+
interruptedOnReopen: z.ZodOptional<z.ZodNumber>;
|
|
227
|
+
credentialChanges: z.ZodOptional<z.ZodObject<{
|
|
228
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
229
|
+
changeId: z.ZodString;
|
|
230
|
+
observedAt: z.ZodNumber;
|
|
231
|
+
version: z.ZodString;
|
|
232
|
+
phase: z.ZodEnum<{
|
|
233
|
+
notification: "notification";
|
|
234
|
+
commit: "commit";
|
|
235
|
+
}>;
|
|
236
|
+
reason: z.ZodEnum<{
|
|
237
|
+
expired: "expired";
|
|
238
|
+
qualified: "qualified";
|
|
239
|
+
"unknown-source": "unknown-source";
|
|
240
|
+
"account-changed": "account-changed";
|
|
241
|
+
"endpoint-changed": "endpoint-changed";
|
|
242
|
+
"entitlements-changed": "entitlements-changed";
|
|
243
|
+
"auth-mismatch": "auth-mismatch";
|
|
244
|
+
"duplicate-notification": "duplicate-notification";
|
|
245
|
+
"missing-notification": "missing-notification";
|
|
246
|
+
"commit-mismatch": "commit-mismatch";
|
|
247
|
+
"write-failed": "write-failed";
|
|
248
|
+
"write-conflict": "write-conflict";
|
|
249
|
+
}>;
|
|
250
|
+
preparing: z.ZodNumber;
|
|
251
|
+
dispatched: z.ZodNumber;
|
|
252
|
+
alreadyAborted: z.ZodNumber;
|
|
253
|
+
preserved: z.ZodNumber;
|
|
254
|
+
revoked: z.ZodNumber;
|
|
255
|
+
}, z.core.$strict>>;
|
|
256
|
+
dropped: z.ZodNumber;
|
|
257
|
+
evicted: z.ZodNumber;
|
|
258
|
+
pending: z.ZodOptional<z.ZodNumber>;
|
|
259
|
+
interruptedOnReopen: z.ZodOptional<z.ZodNumber>;
|
|
260
|
+
}, z.core.$strict>>;
|
|
261
|
+
}, z.core.$strict>;
|
|
262
|
+
export type RequestDiagnostic = z.infer<typeof RequestDiagnosticSchema>;
|
|
263
|
+
export interface RequestDiagnosticHandle {
|
|
264
|
+
composition?(evidence: RequestBodyEvidence): void;
|
|
265
|
+
isCurrent?(): boolean;
|
|
266
|
+
headers(status: number | undefined, ms: number | undefined, upload?: RequestUploadEvidence): void;
|
|
267
|
+
finish(outcome: RequestDiagnostic['outcome'], reason?: RequestDiagnostic['reason']): void;
|
|
268
|
+
}
|
|
269
|
+
export interface RequestDiagnosticStart {
|
|
270
|
+
streamId: string;
|
|
271
|
+
dispatchIndex: number;
|
|
272
|
+
model: string;
|
|
273
|
+
protocol: RequestDiagnostic['protocol'];
|
|
274
|
+
composition: RequestBodyEvidence;
|
|
275
|
+
encoding: RequestDiagnostic['encoding'];
|
|
276
|
+
wireBytes?: number;
|
|
277
|
+
}
|
|
278
|
+
//# sourceMappingURL=request-diagnostics.d.ts.map
|
|
@@ -4,8 +4,8 @@ export declare const CompactionContinuationStatusSchema: z.ZodObject<{
|
|
|
4
4
|
id: z.ZodString;
|
|
5
5
|
state: z.ZodEnum<{
|
|
6
6
|
running: "running";
|
|
7
|
-
cancelled: "cancelled";
|
|
8
7
|
failed: "failed";
|
|
8
|
+
cancelled: "cancelled";
|
|
9
9
|
completed: "completed";
|
|
10
10
|
blocked: "blocked";
|
|
11
11
|
}>;
|
|
@@ -51,8 +51,8 @@ export declare const SessionContinuationViewSchema: z.ZodObject<{
|
|
|
51
51
|
id: z.ZodString;
|
|
52
52
|
state: z.ZodEnum<{
|
|
53
53
|
running: "running";
|
|
54
|
-
cancelled: "cancelled";
|
|
55
54
|
failed: "failed";
|
|
55
|
+
cancelled: "cancelled";
|
|
56
56
|
completed: "completed";
|
|
57
57
|
blocked: "blocked";
|
|
58
58
|
}>;
|
|
@@ -9,7 +9,7 @@ export declare class TurnSelectionController extends TypertRemoteService {
|
|
|
9
9
|
constructor(ctx: Context, selections: TurnSelectionStore);
|
|
10
10
|
get(agent: Agent, turn: number): TurnSelection;
|
|
11
11
|
allocationSummary(agent: Agent): {
|
|
12
|
-
policyVersion: "high-cost-v1";
|
|
12
|
+
policyVersion: "high-cost-v1" | "high-cost-v2";
|
|
13
13
|
scope: "viewed-session-host-lifetime";
|
|
14
14
|
status: "observed" | "not-collected";
|
|
15
15
|
retainedDecisions: number;
|
|
@@ -28,6 +28,7 @@ export declare class TurnSelectionController extends TypertRemoteService {
|
|
|
28
28
|
expectedSelections: number;
|
|
29
29
|
selections: number;
|
|
30
30
|
}[];
|
|
31
|
+
omittedPolicyDecisions?: number | undefined;
|
|
31
32
|
};
|
|
32
33
|
requestedModels(agent: Agent, turn: number): RequestedModels;
|
|
33
34
|
}
|
|
@@ -45,10 +45,10 @@ export declare const TurnSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
45
45
|
diagnostic: z.ZodOptional<z.ZodEnum<{
|
|
46
46
|
disabled: "disabled";
|
|
47
47
|
unavailable: "unavailable";
|
|
48
|
-
failed: "failed";
|
|
49
48
|
"context-omitted": "context-omitted";
|
|
50
49
|
"invalid-result": "invalid-result";
|
|
51
50
|
timeout: "timeout";
|
|
51
|
+
failed: "failed";
|
|
52
52
|
}>>;
|
|
53
53
|
semantic: z.ZodOptional<z.ZodObject<{
|
|
54
54
|
modelId: z.ZodOptional<z.ZodString>;
|
|
@@ -74,6 +74,37 @@ export declare const TurnSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
74
74
|
valid: "valid";
|
|
75
75
|
"context-omitted": "context-omitted";
|
|
76
76
|
}>;
|
|
77
|
+
candidateScan: z.ZodOptional<z.ZodObject<{
|
|
78
|
+
candidates: z.ZodNumber;
|
|
79
|
+
eligible: z.ZodNumber;
|
|
80
|
+
rejected: z.ZodRecord<z.ZodEnum<{
|
|
81
|
+
input: "input";
|
|
82
|
+
category: "category";
|
|
83
|
+
excluded: "excluded";
|
|
84
|
+
"configured-id": "configured-id";
|
|
85
|
+
"reasoning-disable-unproven": "reasoning-disable-unproven";
|
|
86
|
+
budget: "budget";
|
|
87
|
+
}> & z.core.$partial, z.ZodNumber>;
|
|
88
|
+
}, z.core.$strict>>;
|
|
89
|
+
preparationFailure: z.ZodOptional<z.ZodEnum<{
|
|
90
|
+
"native-off-unavailable": "native-off-unavailable";
|
|
91
|
+
}>>;
|
|
92
|
+
projection: z.ZodOptional<z.ZodObject<{
|
|
93
|
+
retainedMessages: z.ZodNumber;
|
|
94
|
+
historyOmitted: z.ZodBoolean;
|
|
95
|
+
taskTextLimited: z.ZodBoolean;
|
|
96
|
+
continuationAnchor: z.ZodEnum<{
|
|
97
|
+
missing: "missing";
|
|
98
|
+
"not-needed": "not-needed";
|
|
99
|
+
retained: "retained";
|
|
100
|
+
}>;
|
|
101
|
+
}, z.core.$strict>>;
|
|
102
|
+
classifierDemand: z.ZodOptional<z.ZodEnum<{
|
|
103
|
+
unknown: "unknown";
|
|
104
|
+
simple: "simple";
|
|
105
|
+
routine: "routine";
|
|
106
|
+
complex: "complex";
|
|
107
|
+
}>>;
|
|
77
108
|
}, z.core.$strict>>;
|
|
78
109
|
}, z.core.$strict>;
|
|
79
110
|
targetCategory: z.ZodEnum<{
|
|
@@ -97,7 +128,11 @@ export declare const TurnSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
97
128
|
}>;
|
|
98
129
|
fallback: z.ZodBoolean;
|
|
99
130
|
allocation: z.ZodOptional<z.ZodObject<{
|
|
100
|
-
policyVersion: z.
|
|
131
|
+
policyVersion: z.ZodEnum<{
|
|
132
|
+
"high-cost-v1": "high-cost-v1";
|
|
133
|
+
"high-cost-v2": "high-cost-v2";
|
|
134
|
+
}>;
|
|
135
|
+
deferredHighCostCount: z.ZodOptional<z.ZodNumber>;
|
|
101
136
|
selectedModelId: z.ZodString;
|
|
102
137
|
candidates: z.ZodArray<z.ZodObject<{
|
|
103
138
|
modelId: z.ZodString;
|
|
@@ -123,8 +158,10 @@ export type TurnSelection = {
|
|
|
123
158
|
};
|
|
124
159
|
/** Ephemeral decision evidence only; never session content, model usage or credentials. */
|
|
125
160
|
export declare class TurnSelectionStore {
|
|
161
|
+
private readonly onAutoDecision?;
|
|
126
162
|
private readonly agents;
|
|
127
163
|
private timestamps;
|
|
164
|
+
constructor(onAutoDecision?: ((explanation: AutoSelectionExplanation) => void) | undefined);
|
|
128
165
|
record(agent: object, turn: number, selection: TurnSelection): void;
|
|
129
166
|
get(agent: object, turn: number): TurnSelection;
|
|
130
167
|
allocationSummary(agent: object): AutoAllocationSummary;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-github-copilot",
|
|
3
3
|
"description": "DSH companion for GitHub Copilot sign-in, account-aware model profiles, tool compatibility, and provider-hosted search.",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.2-alpha.11",
|
|
5
5
|
"releaseNotes": "CHANGELOG.md",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public",
|
|
8
8
|
"registry": "https://registry.npmjs.org/",
|
|
9
|
-
"tag": "
|
|
9
|
+
"tag": "alpha"
|
|
10
10
|
},
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
//#region lib/types/diagnostics-types.js
|
|
3
|
-
const DIAGNOSTICS_OPERATIONS = [
|
|
4
|
-
"account-global-switch",
|
|
5
|
-
"account-session-select",
|
|
6
|
-
"account-session-inherit",
|
|
7
|
-
"identity-read",
|
|
8
|
-
"identity-flight",
|
|
9
|
-
"compaction",
|
|
10
|
-
"compaction-summary",
|
|
11
|
-
"collection"
|
|
12
|
-
];
|
|
13
|
-
const DIAGNOSTICS_STAGES = [
|
|
14
|
-
"admitted",
|
|
15
|
-
"rpc-invoked",
|
|
16
|
-
"host-received",
|
|
17
|
-
"identity-validation",
|
|
18
|
-
"model-validation",
|
|
19
|
-
"cas",
|
|
20
|
-
"readback",
|
|
21
|
-
"response-received",
|
|
22
|
-
"decoded",
|
|
23
|
-
"client-settled",
|
|
24
|
-
"summary-attempt",
|
|
25
|
-
"checkpoint-committed",
|
|
26
|
-
"ended",
|
|
27
|
-
"cache-hit",
|
|
28
|
-
"joined-flight",
|
|
29
|
-
"cooldown",
|
|
30
|
-
"dispatched"
|
|
31
|
-
];
|
|
32
|
-
const DIAGNOSTICS_METRICS = [
|
|
33
|
-
"started",
|
|
34
|
-
"stage",
|
|
35
|
-
"success",
|
|
36
|
-
"no-op",
|
|
37
|
-
"cancelled",
|
|
38
|
-
"policy-rejected",
|
|
39
|
-
"revoked",
|
|
40
|
-
"environment-fault",
|
|
41
|
-
"failed",
|
|
42
|
-
"unknown",
|
|
43
|
-
"interrupted",
|
|
44
|
-
"dropped",
|
|
45
|
-
"paused",
|
|
46
|
-
"expired",
|
|
47
|
-
"clock-discontinuity",
|
|
48
|
-
"pending-sample"
|
|
49
|
-
];
|
|
50
|
-
const DIAGNOSTICS_REASONS = [
|
|
51
|
-
"none",
|
|
52
|
-
"unknown",
|
|
53
|
-
"rpc-unavailable",
|
|
54
|
-
"decode-invalid",
|
|
55
|
-
"COPILOT_ACCOUNTS_BUSY",
|
|
56
|
-
"COPILOT_ACCOUNTS_CONFLICT",
|
|
57
|
-
"COPILOT_ACCOUNTS_CHANGED",
|
|
58
|
-
"COPILOT_ACCOUNTS_COMMIT_UNCERTAIN",
|
|
59
|
-
"COPILOT_ACCOUNTS_IDENTITY_TIMEOUT",
|
|
60
|
-
"COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE",
|
|
61
|
-
"COPILOT_ACCOUNTS_MODELS_FAILED",
|
|
62
|
-
"COPILOT_ACCOUNTS_SETTINGS_UNAVAILABLE",
|
|
63
|
-
"COPILOT_ACCOUNTS_IDENTITY_TLS",
|
|
64
|
-
"COPILOT_ACCOUNTS_IDENTITY_NETWORK",
|
|
65
|
-
"COPILOT_ACCOUNTS_IDENTITY_RATE_LIMITED",
|
|
66
|
-
"COPILOT_ACCOUNTS_IDENTITY_AUTH_REJECTED",
|
|
67
|
-
"COPILOT_ACCOUNTS_IDENTITY_HTTP_ERROR",
|
|
68
|
-
"COPILOT_ACCOUNTS_IDENTITY_INVALID",
|
|
69
|
-
"COPILOT_SESSION_ACCOUNTS_UNAVAILABLE",
|
|
70
|
-
"COPILOT_SESSION_ACCOUNTS_SETTINGS_UNAVAILABLE",
|
|
71
|
-
"COPILOT_SESSION_ACCOUNTS_COMMIT_UNCERTAIN",
|
|
72
|
-
"COPILOT_RESPONSES_REPLAY_SCOPE_MISMATCH",
|
|
73
|
-
"CONTEXT_WINDOW_EXCEEDED",
|
|
74
|
-
"COPILOT_MANUAL_RECOVERY_FIXED_PREFIX",
|
|
75
|
-
"COPILOT_MANUAL_RECOVERY_INDIVISIBLE",
|
|
76
|
-
"COPILOT_MANUAL_RECOVERY_CALL_LIMIT",
|
|
77
|
-
"COPILOT_MANUAL_RECOVERY_EMPTY_SUMMARY",
|
|
78
|
-
"COPILOT_MANUAL_RECOVERY_UNBALANCED"
|
|
79
|
-
];
|
|
80
|
-
const DIAGNOSTICS_MAX_ROWS = 4096;
|
|
81
|
-
const DIAGNOSTICS_MAX_BYTES = 2097152;
|
|
82
|
-
const DIAGNOSTICS_RETENTION_MS = 12096e5;
|
|
83
|
-
const integer = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
84
|
-
const version = z.string().max(64).regex(/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/);
|
|
85
|
-
const DiagnosticsRowSchema = z.object({
|
|
86
|
-
hour: integer.multipleOf(36e5),
|
|
87
|
-
version,
|
|
88
|
-
layer: z.enum(["client", "host"]),
|
|
89
|
-
operation: z.enum(DIAGNOSTICS_OPERATIONS),
|
|
90
|
-
stage: z.enum(DIAGNOSTICS_STAGES),
|
|
91
|
-
metric: z.enum(DIAGNOSTICS_METRICS),
|
|
92
|
-
reason: z.enum(DIAGNOSTICS_REASONS),
|
|
93
|
-
bucket: z.number().int().min(0).max(7),
|
|
94
|
-
count: integer.min(1)
|
|
95
|
-
}).strict();
|
|
96
|
-
const DiagnosticsPendingSchema = z.object({
|
|
97
|
-
version,
|
|
98
|
-
operation: z.enum(DIAGNOSTICS_OPERATIONS),
|
|
99
|
-
stage: z.enum(DIAGNOSTICS_STAGES),
|
|
100
|
-
bucket: z.number().int().min(0).max(7),
|
|
101
|
-
count: integer.min(1).max(128)
|
|
102
|
-
}).strict();
|
|
103
|
-
const DiagnosticsSnapshotSchema = z.object({
|
|
104
|
-
schemaVersion: z.literal(1),
|
|
105
|
-
coverageVersion: z.literal(1),
|
|
106
|
-
epoch: integer,
|
|
107
|
-
updatedAt: integer,
|
|
108
|
-
rows: z.array(DiagnosticsRowSchema).max(DIAGNOSTICS_MAX_ROWS),
|
|
109
|
-
pending: z.array(DiagnosticsPendingSchema).max(128),
|
|
110
|
-
dropped: integer,
|
|
111
|
-
clientDropped: integer,
|
|
112
|
-
clientUnconfirmed: integer,
|
|
113
|
-
saturated: integer,
|
|
114
|
-
evicted: integer,
|
|
115
|
-
interrupted: integer
|
|
116
|
-
}).strict().refine((value) => value.pending.reduce((sum, row) => sum + row.count, 0) <= 128, "Diagnostics pending capacity exceeded").refine((value) => JSON.stringify(value).length <= DIAGNOSTICS_MAX_BYTES, "Diagnostics capacity exceeded");
|
|
117
|
-
const DiagnosticsViewSchema = z.object({
|
|
118
|
-
enabled: z.boolean(),
|
|
119
|
-
state: z.enum([
|
|
120
|
-
"loading",
|
|
121
|
-
"ready",
|
|
122
|
-
"unavailable",
|
|
123
|
-
"error"
|
|
124
|
-
]),
|
|
125
|
-
diagnostic: z.enum([
|
|
126
|
-
"none",
|
|
127
|
-
"storage-unavailable",
|
|
128
|
-
"storage-invalid",
|
|
129
|
-
"storage-write-failed",
|
|
130
|
-
"profile-unavailable",
|
|
131
|
-
"settings-unavailable",
|
|
132
|
-
"settings-conflict",
|
|
133
|
-
"client-report-failed",
|
|
134
|
-
"client-report-revoked",
|
|
135
|
-
"closed"
|
|
136
|
-
]),
|
|
137
|
-
persistedAt: integer.optional(),
|
|
138
|
-
dirty: z.boolean(),
|
|
139
|
-
snapshot: DiagnosticsSnapshotSchema
|
|
140
|
-
}).strict();
|
|
141
|
-
function diagnosticsBucket(ms) {
|
|
142
|
-
return [
|
|
143
|
-
100,
|
|
144
|
-
500,
|
|
145
|
-
1e3,
|
|
146
|
-
5e3,
|
|
147
|
-
15e3,
|
|
148
|
-
6e4,
|
|
149
|
-
3e5
|
|
150
|
-
].findIndex((bound) => ms < bound) === -1 ? 7 : [
|
|
151
|
-
100,
|
|
152
|
-
500,
|
|
153
|
-
1e3,
|
|
154
|
-
5e3,
|
|
155
|
-
15e3,
|
|
156
|
-
6e4,
|
|
157
|
-
3e5
|
|
158
|
-
].findIndex((bound) => ms < bound);
|
|
159
|
-
}
|
|
160
|
-
function diagnosticsReason(error) {
|
|
161
|
-
const seen = /* @__PURE__ */ new Set();
|
|
162
|
-
for (let depth = 0; depth < 8 && error instanceof Error && !seen.has(error); depth++) {
|
|
163
|
-
seen.add(error);
|
|
164
|
-
const nativeCode = "code" in error ? error.code : void 0;
|
|
165
|
-
const typed = DIAGNOSTICS_REASONS.find((code) => code !== "none" && code !== "unknown" && code === nativeCode);
|
|
166
|
-
if (typed !== void 0) return typed;
|
|
167
|
-
const message = error.message.slice(0, 4096);
|
|
168
|
-
for (const code of DIAGNOSTICS_REASONS) if (code.startsWith("COPILOT_") || code === "CONTEXT_WINDOW_EXCEEDED") {
|
|
169
|
-
if (new RegExp(`(?:^|[^A-Za-z0-9_])${code}(?:$|[^A-Za-z0-9_])`).test(message)) return code;
|
|
170
|
-
}
|
|
171
|
-
error = error.cause;
|
|
172
|
-
}
|
|
173
|
-
return "unknown";
|
|
174
|
-
}
|
|
175
|
-
function diagnosticsOutcome(reason) {
|
|
176
|
-
if (reason === "COPILOT_ACCOUNTS_BUSY" || reason === "COPILOT_ACCOUNTS_CONFLICT") return "policy-rejected";
|
|
177
|
-
if (reason === "COPILOT_ACCOUNTS_CHANGED") return "revoked";
|
|
178
|
-
if (reason.endsWith("SETTINGS_UNAVAILABLE") || reason === "COPILOT_SESSION_ACCOUNTS_UNAVAILABLE") return "environment-fault";
|
|
179
|
-
return "failed";
|
|
180
|
-
}
|
|
181
|
-
//#endregion
|
|
182
|
-
export { DiagnosticsPendingSchema as a, DiagnosticsViewSchema as c, diagnosticsReason as d, DIAGNOSTICS_RETENTION_MS as i, diagnosticsBucket as l, DIAGNOSTICS_OPERATIONS as n, DiagnosticsRowSchema as o, DIAGNOSTICS_REASONS as r, DiagnosticsSnapshotSchema as s, DIAGNOSTICS_MAX_ROWS as t, diagnosticsOutcome as u };
|