dsh-github-copilot 0.4.0 → 0.4.2-alpha.2
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 +8 -0
- package/CHANGELOG.md +24 -0
- package/README.md +29 -19
- package/README.zh.md +22 -15
- package/deployment-baseline.json +1 -1
- package/docs/auto-high-cost.md +20 -8
- package/docs/copilot-accounts.md +33 -0
- package/docs/npm-distribution.md +9 -1
- package/docs/plugin-diagnostics.md +18 -3
- package/lib/client.js +108 -7
- package/lib/client.js.map +1 -1
- package/lib/diagnostics-analysis.js +1 -1
- package/lib/diagnostics-types-Bl3QCfR0.js +509 -0
- package/lib/index.js +208 -135
- package/lib/manual-compaction-recovery.js +1 -1
- package/lib/remote.js +86 -0
- package/lib/routed-web.js +1 -1
- package/lib/types/auto-allocation-diagnostics.d.ts +102 -0
- package/lib/types/compaction-continuation.d.ts +1 -1
- package/lib/types/config.d.ts +6 -2
- package/lib/types/context-evidence.d.ts +4 -4
- package/lib/types/copilot-auth.d.ts +6 -1
- package/lib/types/diagnostics-analysis.d.ts +1 -1
- package/lib/types/diagnostics-collector.d.ts +5 -0
- package/lib/types/diagnostics-host.d.ts +42 -1
- package/lib/types/diagnostics-remote.d.ts +6 -5
- package/lib/types/diagnostics-types.d.ts +174 -15
- package/lib/types/preview-provider.d.ts +1 -0
- package/lib/types/session-continuation-types.d.ts +2 -2
- package/lib/types/turn-selection.d.ts +3 -1
- package/package.json +12 -11
- package/lib/diagnostics-types-FVf6zjob.js +0 -182
|
@@ -46,18 +46,18 @@ export declare const DiagnosticsRowSchema: z.ZodObject<{
|
|
|
46
46
|
metric: z.ZodEnum<{
|
|
47
47
|
paused: "paused";
|
|
48
48
|
unknown: "unknown";
|
|
49
|
-
started: "started";
|
|
50
|
-
stage: "stage";
|
|
51
49
|
success: "success";
|
|
50
|
+
stage: "stage";
|
|
51
|
+
failed: "failed";
|
|
52
|
+
dropped: "dropped";
|
|
53
|
+
expired: "expired";
|
|
54
|
+
started: "started";
|
|
52
55
|
"no-op": "no-op";
|
|
53
56
|
cancelled: "cancelled";
|
|
54
57
|
"policy-rejected": "policy-rejected";
|
|
55
58
|
revoked: "revoked";
|
|
56
59
|
"environment-fault": "environment-fault";
|
|
57
|
-
failed: "failed";
|
|
58
60
|
interrupted: "interrupted";
|
|
59
|
-
dropped: "dropped";
|
|
60
|
-
expired: "expired";
|
|
61
61
|
"clock-discontinuity": "clock-discontinuity";
|
|
62
62
|
"pending-sample": "pending-sample";
|
|
63
63
|
}>;
|
|
@@ -172,18 +172,18 @@ export declare const DiagnosticsSnapshotSchema: z.ZodObject<{
|
|
|
172
172
|
metric: z.ZodEnum<{
|
|
173
173
|
paused: "paused";
|
|
174
174
|
unknown: "unknown";
|
|
175
|
-
started: "started";
|
|
176
|
-
stage: "stage";
|
|
177
175
|
success: "success";
|
|
176
|
+
stage: "stage";
|
|
177
|
+
failed: "failed";
|
|
178
|
+
dropped: "dropped";
|
|
179
|
+
expired: "expired";
|
|
180
|
+
started: "started";
|
|
178
181
|
"no-op": "no-op";
|
|
179
182
|
cancelled: "cancelled";
|
|
180
183
|
"policy-rejected": "policy-rejected";
|
|
181
184
|
revoked: "revoked";
|
|
182
185
|
"environment-fault": "environment-fault";
|
|
183
|
-
failed: "failed";
|
|
184
186
|
interrupted: "interrupted";
|
|
185
|
-
dropped: "dropped";
|
|
186
|
-
expired: "expired";
|
|
187
187
|
"clock-discontinuity": "clock-discontinuity";
|
|
188
188
|
"pending-sample": "pending-sample";
|
|
189
189
|
}>;
|
|
@@ -220,6 +220,85 @@ export declare const DiagnosticsSnapshotSchema: z.ZodObject<{
|
|
|
220
220
|
bucket: z.ZodNumber;
|
|
221
221
|
count: z.ZodNumber;
|
|
222
222
|
}, z.core.$strict>>;
|
|
223
|
+
autoAllocation: z.ZodOptional<z.ZodObject<{
|
|
224
|
+
status: z.ZodEnum<{
|
|
225
|
+
observed: "observed";
|
|
226
|
+
"not-collected": "not-collected";
|
|
227
|
+
}>;
|
|
228
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
229
|
+
day: z.ZodNumber;
|
|
230
|
+
version: z.ZodString;
|
|
231
|
+
policyVersion: z.ZodString;
|
|
232
|
+
modelId: z.ZodString;
|
|
233
|
+
targetCategory: z.ZodEnum<{
|
|
234
|
+
powerful: "powerful";
|
|
235
|
+
versatile: "versatile";
|
|
236
|
+
lightweight: "lightweight";
|
|
237
|
+
}>;
|
|
238
|
+
category: z.ZodEnum<{
|
|
239
|
+
unknown: "unknown";
|
|
240
|
+
powerful: "powerful";
|
|
241
|
+
versatile: "versatile";
|
|
242
|
+
lightweight: "lightweight";
|
|
243
|
+
}>;
|
|
244
|
+
demand: z.ZodEnum<{
|
|
245
|
+
unknown: "unknown";
|
|
246
|
+
simple: "simple";
|
|
247
|
+
routine: "routine";
|
|
248
|
+
complex: "complex";
|
|
249
|
+
}>;
|
|
250
|
+
assessmentSource: z.ZodEnum<{
|
|
251
|
+
local: "local";
|
|
252
|
+
semantic: "semantic";
|
|
253
|
+
}>;
|
|
254
|
+
method: z.ZodEnum<{
|
|
255
|
+
"weighted-distribution": "weighted-distribution";
|
|
256
|
+
"only-candidate": "only-candidate";
|
|
257
|
+
}>;
|
|
258
|
+
fallback: z.ZodBoolean;
|
|
259
|
+
highCost: z.ZodBoolean;
|
|
260
|
+
previous: z.ZodBoolean;
|
|
261
|
+
weight: z.ZodNumber;
|
|
262
|
+
opportunities: z.ZodNumber;
|
|
263
|
+
expectedSelections: z.ZodNumber;
|
|
264
|
+
selections: z.ZodNumber;
|
|
265
|
+
}, z.core.$strict>>;
|
|
266
|
+
noFitRows: z.ZodArray<z.ZodObject<{
|
|
267
|
+
day: z.ZodNumber;
|
|
268
|
+
version: z.ZodString;
|
|
269
|
+
policyVersion: z.ZodString;
|
|
270
|
+
targetCategory: z.ZodEnum<{
|
|
271
|
+
powerful: "powerful";
|
|
272
|
+
versatile: "versatile";
|
|
273
|
+
lightweight: "lightweight";
|
|
274
|
+
}>;
|
|
275
|
+
category: z.ZodEnum<{
|
|
276
|
+
unknown: "unknown";
|
|
277
|
+
powerful: "powerful";
|
|
278
|
+
versatile: "versatile";
|
|
279
|
+
lightweight: "lightweight";
|
|
280
|
+
}>;
|
|
281
|
+
demand: z.ZodEnum<{
|
|
282
|
+
unknown: "unknown";
|
|
283
|
+
simple: "simple";
|
|
284
|
+
routine: "routine";
|
|
285
|
+
complex: "complex";
|
|
286
|
+
}>;
|
|
287
|
+
assessmentSource: z.ZodEnum<{
|
|
288
|
+
local: "local";
|
|
289
|
+
semantic: "semantic";
|
|
290
|
+
}>;
|
|
291
|
+
decisions: z.ZodNumber;
|
|
292
|
+
}, z.core.$strict>>;
|
|
293
|
+
observationStart: z.ZodNullable<z.ZodNumber>;
|
|
294
|
+
observationEnd: z.ZodNullable<z.ZodNumber>;
|
|
295
|
+
completeHistory: z.ZodLiteral<false>;
|
|
296
|
+
rowsTruncated: z.ZodBoolean;
|
|
297
|
+
dropped: z.ZodNumber;
|
|
298
|
+
expired: z.ZodNumber;
|
|
299
|
+
saturated: z.ZodNumber;
|
|
300
|
+
restarts: z.ZodNumber;
|
|
301
|
+
}, z.core.$strict>>;
|
|
223
302
|
pending: z.ZodArray<z.ZodObject<{
|
|
224
303
|
version: z.ZodString;
|
|
225
304
|
operation: z.ZodEnum<{
|
|
@@ -263,6 +342,7 @@ export declare const DiagnosticsSnapshotSchema: z.ZodObject<{
|
|
|
263
342
|
}, z.core.$strict>;
|
|
264
343
|
export declare const DiagnosticsViewSchema: z.ZodObject<{
|
|
265
344
|
enabled: z.ZodBoolean;
|
|
345
|
+
autoAllocationEnabled: z.ZodBoolean;
|
|
266
346
|
state: z.ZodEnum<{
|
|
267
347
|
error: "error";
|
|
268
348
|
ready: "ready";
|
|
@@ -327,18 +407,18 @@ export declare const DiagnosticsViewSchema: z.ZodObject<{
|
|
|
327
407
|
metric: z.ZodEnum<{
|
|
328
408
|
paused: "paused";
|
|
329
409
|
unknown: "unknown";
|
|
330
|
-
started: "started";
|
|
331
|
-
stage: "stage";
|
|
332
410
|
success: "success";
|
|
411
|
+
stage: "stage";
|
|
412
|
+
failed: "failed";
|
|
413
|
+
dropped: "dropped";
|
|
414
|
+
expired: "expired";
|
|
415
|
+
started: "started";
|
|
333
416
|
"no-op": "no-op";
|
|
334
417
|
cancelled: "cancelled";
|
|
335
418
|
"policy-rejected": "policy-rejected";
|
|
336
419
|
revoked: "revoked";
|
|
337
420
|
"environment-fault": "environment-fault";
|
|
338
|
-
failed: "failed";
|
|
339
421
|
interrupted: "interrupted";
|
|
340
|
-
dropped: "dropped";
|
|
341
|
-
expired: "expired";
|
|
342
422
|
"clock-discontinuity": "clock-discontinuity";
|
|
343
423
|
"pending-sample": "pending-sample";
|
|
344
424
|
}>;
|
|
@@ -375,6 +455,85 @@ export declare const DiagnosticsViewSchema: z.ZodObject<{
|
|
|
375
455
|
bucket: z.ZodNumber;
|
|
376
456
|
count: z.ZodNumber;
|
|
377
457
|
}, z.core.$strict>>;
|
|
458
|
+
autoAllocation: z.ZodOptional<z.ZodObject<{
|
|
459
|
+
status: z.ZodEnum<{
|
|
460
|
+
observed: "observed";
|
|
461
|
+
"not-collected": "not-collected";
|
|
462
|
+
}>;
|
|
463
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
464
|
+
day: z.ZodNumber;
|
|
465
|
+
version: z.ZodString;
|
|
466
|
+
policyVersion: z.ZodString;
|
|
467
|
+
modelId: z.ZodString;
|
|
468
|
+
targetCategory: z.ZodEnum<{
|
|
469
|
+
powerful: "powerful";
|
|
470
|
+
versatile: "versatile";
|
|
471
|
+
lightweight: "lightweight";
|
|
472
|
+
}>;
|
|
473
|
+
category: z.ZodEnum<{
|
|
474
|
+
unknown: "unknown";
|
|
475
|
+
powerful: "powerful";
|
|
476
|
+
versatile: "versatile";
|
|
477
|
+
lightweight: "lightweight";
|
|
478
|
+
}>;
|
|
479
|
+
demand: z.ZodEnum<{
|
|
480
|
+
unknown: "unknown";
|
|
481
|
+
simple: "simple";
|
|
482
|
+
routine: "routine";
|
|
483
|
+
complex: "complex";
|
|
484
|
+
}>;
|
|
485
|
+
assessmentSource: z.ZodEnum<{
|
|
486
|
+
local: "local";
|
|
487
|
+
semantic: "semantic";
|
|
488
|
+
}>;
|
|
489
|
+
method: z.ZodEnum<{
|
|
490
|
+
"weighted-distribution": "weighted-distribution";
|
|
491
|
+
"only-candidate": "only-candidate";
|
|
492
|
+
}>;
|
|
493
|
+
fallback: z.ZodBoolean;
|
|
494
|
+
highCost: z.ZodBoolean;
|
|
495
|
+
previous: z.ZodBoolean;
|
|
496
|
+
weight: z.ZodNumber;
|
|
497
|
+
opportunities: z.ZodNumber;
|
|
498
|
+
expectedSelections: z.ZodNumber;
|
|
499
|
+
selections: z.ZodNumber;
|
|
500
|
+
}, z.core.$strict>>;
|
|
501
|
+
noFitRows: z.ZodArray<z.ZodObject<{
|
|
502
|
+
day: z.ZodNumber;
|
|
503
|
+
version: z.ZodString;
|
|
504
|
+
policyVersion: z.ZodString;
|
|
505
|
+
targetCategory: z.ZodEnum<{
|
|
506
|
+
powerful: "powerful";
|
|
507
|
+
versatile: "versatile";
|
|
508
|
+
lightweight: "lightweight";
|
|
509
|
+
}>;
|
|
510
|
+
category: z.ZodEnum<{
|
|
511
|
+
unknown: "unknown";
|
|
512
|
+
powerful: "powerful";
|
|
513
|
+
versatile: "versatile";
|
|
514
|
+
lightweight: "lightweight";
|
|
515
|
+
}>;
|
|
516
|
+
demand: z.ZodEnum<{
|
|
517
|
+
unknown: "unknown";
|
|
518
|
+
simple: "simple";
|
|
519
|
+
routine: "routine";
|
|
520
|
+
complex: "complex";
|
|
521
|
+
}>;
|
|
522
|
+
assessmentSource: z.ZodEnum<{
|
|
523
|
+
local: "local";
|
|
524
|
+
semantic: "semantic";
|
|
525
|
+
}>;
|
|
526
|
+
decisions: z.ZodNumber;
|
|
527
|
+
}, z.core.$strict>>;
|
|
528
|
+
observationStart: z.ZodNullable<z.ZodNumber>;
|
|
529
|
+
observationEnd: z.ZodNullable<z.ZodNumber>;
|
|
530
|
+
completeHistory: z.ZodLiteral<false>;
|
|
531
|
+
rowsTruncated: z.ZodBoolean;
|
|
532
|
+
dropped: z.ZodNumber;
|
|
533
|
+
expired: z.ZodNumber;
|
|
534
|
+
saturated: z.ZodNumber;
|
|
535
|
+
restarts: z.ZodNumber;
|
|
536
|
+
}, z.core.$strict>>;
|
|
378
537
|
pending: z.ZodArray<z.ZodObject<{
|
|
379
538
|
version: z.ZodString;
|
|
380
539
|
operation: z.ZodEnum<{
|
|
@@ -19,6 +19,7 @@ export interface PreviewProviderGuard {
|
|
|
19
19
|
beforeWire(model: Model<Api>, options?: StreamOptions): Promise<{
|
|
20
20
|
signal: AbortSignal;
|
|
21
21
|
release(): void;
|
|
22
|
+
dispatch?(): void;
|
|
22
23
|
}>;
|
|
23
24
|
/** Actual model HTTP 401, excluding proven Responses replay-scope failures; no request replay. */
|
|
24
25
|
onUnauthorized?(): void;
|
|
@@ -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
|
}>;
|
|
@@ -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>;
|
|
@@ -123,8 +123,10 @@ export type TurnSelection = {
|
|
|
123
123
|
};
|
|
124
124
|
/** Ephemeral decision evidence only; never session content, model usage or credentials. */
|
|
125
125
|
export declare class TurnSelectionStore {
|
|
126
|
+
private readonly onAutoDecision?;
|
|
126
127
|
private readonly agents;
|
|
127
128
|
private timestamps;
|
|
129
|
+
constructor(onAutoDecision?: ((explanation: AutoSelectionExplanation) => void) | undefined);
|
|
128
130
|
record(agent: object, turn: number, selection: TurnSelection): void;
|
|
129
131
|
get(agent: object, turn: number): TurnSelection;
|
|
130
132
|
allocationSummary(agent: object): AutoAllocationSummary;
|
package/package.json
CHANGED
|
@@ -1,11 +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.2",
|
|
5
|
+
"releaseNotes": "CHANGELOG.md",
|
|
5
6
|
"publishConfig": {
|
|
6
7
|
"access": "public",
|
|
7
8
|
"registry": "https://registry.npmjs.org/",
|
|
8
|
-
"tag": "
|
|
9
|
+
"tag": "alpha"
|
|
9
10
|
},
|
|
10
11
|
"repository": {
|
|
11
12
|
"type": "git",
|
|
@@ -107,20 +108,20 @@
|
|
|
107
108
|
"@deepseek-ai/cordis": "^4.0.4",
|
|
108
109
|
"@deepseek-ai/dsh-agent": "0.2.0-rc.2",
|
|
109
110
|
"@deepseek-ai/dsh-agent-default-model": "0.2.0-rc.2",
|
|
110
|
-
"@deepseek-ai/dsh-commands": "0.2.0-rc.2",
|
|
111
|
-
"@deepseek-ai/dsh-compaction": "0.2.0-rc.2",
|
|
112
|
-
"@deepseek-ai/dsh-compaction-basic": "0.2.0-rc.2",
|
|
113
111
|
"@deepseek-ai/dsh-api-remotes": "0.2.0-rc.2",
|
|
114
112
|
"@deepseek-ai/dsh-authorization": "0.2.0-rc.2",
|
|
115
113
|
"@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.2",
|
|
116
114
|
"@deepseek-ai/dsh-client-ui-settings-models": "0.2.0-rc.2",
|
|
117
115
|
"@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2",
|
|
116
|
+
"@deepseek-ai/dsh-commands": "0.2.0-rc.2",
|
|
117
|
+
"@deepseek-ai/dsh-compaction": "0.2.0-rc.2",
|
|
118
|
+
"@deepseek-ai/dsh-compaction-basic": "0.2.0-rc.2",
|
|
118
119
|
"@deepseek-ai/dsh-credentials": "0.2.0-rc.2",
|
|
119
120
|
"@deepseek-ai/dsh-launch-environment": "0.2.0-rc.2",
|
|
120
121
|
"@deepseek-ai/dsh-llm": "0.2.0-rc.2",
|
|
121
122
|
"@deepseek-ai/dsh-llm-pi-ai": "0.2.0-rc.2",
|
|
122
|
-
"@deepseek-ai/dsh-session": "0.2.0-rc.2",
|
|
123
123
|
"@deepseek-ai/dsh-scope": "0.2.0-rc.2",
|
|
124
|
+
"@deepseek-ai/dsh-session": "0.2.0-rc.2",
|
|
124
125
|
"@deepseek-ai/dsh-settings": "0.2.0-rc.2",
|
|
125
126
|
"@deepseek-ai/dsh-typert-protocol": "0.2.0-rc.2",
|
|
126
127
|
"@deepseek-ai/dsh-web": "0.2.0-rc.2",
|
|
@@ -159,22 +160,22 @@
|
|
|
159
160
|
"@deepseek-ai/cordis": "~4.0.4",
|
|
160
161
|
"@deepseek-ai/dsh-agent": "0.2.0-rc.2",
|
|
161
162
|
"@deepseek-ai/dsh-agent-default-model": "0.2.0-rc.2",
|
|
162
|
-
"@deepseek-ai/dsh-commands": "0.2.0-rc.2",
|
|
163
|
-
"@deepseek-ai/dsh-compaction": "0.2.0-rc.2",
|
|
164
|
-
"@deepseek-ai/dsh-compaction-basic": "0.2.0-rc.2",
|
|
165
|
-
"@deepseek-ai/dsh-jobs": "0.2.0-rc.2",
|
|
166
163
|
"@deepseek-ai/dsh-api-gateway": "0.2.0-rc.2",
|
|
167
164
|
"@deepseek-ai/dsh-api-remotes": "0.2.0-rc.2",
|
|
168
165
|
"@deepseek-ai/dsh-app-boot": "0.2.0-rc.2",
|
|
169
|
-
"@deepseek-ai/dsh-config-editor": "0.2.0-rc.2",
|
|
170
166
|
"@deepseek-ai/dsh-attachment": "0.2.0-rc.2",
|
|
171
167
|
"@deepseek-ai/dsh-authorization": "0.2.0-rc.2",
|
|
172
168
|
"@deepseek-ai/dsh-client-connection": "0.2.0-rc.2",
|
|
173
169
|
"@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.2",
|
|
174
170
|
"@deepseek-ai/dsh-client-ui-settings-models": "0.2.0-rc.2",
|
|
175
171
|
"@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2",
|
|
172
|
+
"@deepseek-ai/dsh-commands": "0.2.0-rc.2",
|
|
173
|
+
"@deepseek-ai/dsh-compaction": "0.2.0-rc.2",
|
|
174
|
+
"@deepseek-ai/dsh-compaction-basic": "0.2.0-rc.2",
|
|
175
|
+
"@deepseek-ai/dsh-config-editor": "0.2.0-rc.2",
|
|
176
176
|
"@deepseek-ai/dsh-credentials": "0.2.0-rc.2",
|
|
177
177
|
"@deepseek-ai/dsh-fs": "0.2.0-rc.2",
|
|
178
|
+
"@deepseek-ai/dsh-jobs": "0.2.0-rc.2",
|
|
178
179
|
"@deepseek-ai/dsh-launch-environment": "0.2.0-rc.2",
|
|
179
180
|
"@deepseek-ai/dsh-llm": "0.2.0-rc.2",
|
|
180
181
|
"@deepseek-ai/dsh-llm-pi-ai": "0.2.0-rc.2",
|
|
@@ -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 };
|