dsh-github-copilot 0.4.2-alpha.3 → 0.4.2-alpha.5
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 +2 -2
- package/CHANGELOG.md +28 -0
- package/README.md +18 -7
- package/README.zh.md +15 -7
- package/deployment-baseline.json +11 -1
- package/docs/copilot-compaction.md +1 -1
- package/docs/plugin-diagnostics.md +87 -8
- package/lib/client.js +166 -19
- package/lib/client.js.map +1 -1
- package/lib/diagnostics-analysis.js +4 -2
- package/lib/{diagnostics-types-Bl3QCfR0.js → diagnostics-types-Cd4BmeOe.js} +108 -13
- package/lib/index.js +527 -8
- package/lib/manual-compaction-recovery.js +1 -1
- package/lib/remote.js +115 -12
- package/lib/types/config.d.ts +6 -2
- package/lib/types/copilot-usage-remote.d.ts +1 -1
- package/lib/types/diagnostics-analysis.d.ts +1 -0
- package/lib/types/diagnostics-collector.d.ts +7 -0
- package/lib/types/diagnostics-host.d.ts +51 -1
- package/lib/types/diagnostics-remote.d.ts +3 -2
- package/lib/types/diagnostics-types.d.ts +187 -6
- package/lib/types/preview-provider.d.ts +6 -0
- 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 +196 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DiagnosticsPendingSchema, c as DiagnosticsViewSchema, n as DIAGNOSTICS_OPERATIONS, r as DIAGNOSTICS_REASONS, s as DiagnosticsSnapshotSchema } from "./diagnostics-types-
|
|
1
|
+
import { a as DiagnosticsPendingSchema, c as DiagnosticsViewSchema, n as DIAGNOSTICS_OPERATIONS, r as DIAGNOSTICS_REASONS, s as DiagnosticsSnapshotSchema } from "./diagnostics-types-Cd4BmeOe.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region lib/types/diagnostics-analysis.js
|
|
4
4
|
const RETENTION_MS = 12096e5;
|
|
@@ -42,7 +42,8 @@ const gaps = [
|
|
|
42
42
|
"no-collection-coverage-clock",
|
|
43
43
|
"no-calibrated-alert-thresholds",
|
|
44
44
|
"no-baseline-trend",
|
|
45
|
-
"no-root-cause-proof"
|
|
45
|
+
"no-root-cause-proof",
|
|
46
|
+
"request-observations-not-analyzed"
|
|
46
47
|
];
|
|
47
48
|
const intervals = [
|
|
48
49
|
{
|
|
@@ -326,6 +327,7 @@ function analyzeSnapshot(input, options) {
|
|
|
326
327
|
if (snapshot.pending.length) gapSet.add("stored-pending-is-not-live");
|
|
327
328
|
}
|
|
328
329
|
if (!populations.length) gapSet.add("no-retained-operation-observations");
|
|
330
|
+
if (snapshot.requests !== void 0) gapSet.add("request-observations-not-analyzed");
|
|
329
331
|
if (!populations.some((row) => [
|
|
330
332
|
"account-global-switch",
|
|
331
333
|
"account-session-select",
|
|
@@ -111,10 +111,10 @@ function allocateAutoModel(pool, highCostModelIds, previousModelId, seed) {
|
|
|
111
111
|
const AUTO_ALLOCATION_DIAGNOSTIC_MAX_ROWS = 1024;
|
|
112
112
|
const AUTO_ALLOCATION_DIAGNOSTIC_RETENTION_MS = 12096e5;
|
|
113
113
|
const dayMs = 864e5;
|
|
114
|
-
const integer$
|
|
114
|
+
const integer$2 = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
115
115
|
const version$1 = z.string().max(64).regex(/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/);
|
|
116
116
|
const allocationRow = z.object({
|
|
117
|
-
day: integer$
|
|
117
|
+
day: integer$2.multipleOf(dayMs),
|
|
118
118
|
version: version$1,
|
|
119
119
|
policyVersion: z.string().min(1).max(64),
|
|
120
120
|
modelId: z.string().min(1).max(512),
|
|
@@ -141,12 +141,12 @@ const allocationRow = z.object({
|
|
|
141
141
|
highCost: z.boolean(),
|
|
142
142
|
previous: z.boolean(),
|
|
143
143
|
weight: z.number().positive().max(1.5),
|
|
144
|
-
opportunities: integer$
|
|
144
|
+
opportunities: integer$2.min(1),
|
|
145
145
|
expectedSelections: z.number().finite().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
146
|
-
selections: integer$
|
|
146
|
+
selections: integer$2
|
|
147
147
|
}).strict();
|
|
148
148
|
const noFitRow = z.object({
|
|
149
|
-
day: integer$
|
|
149
|
+
day: integer$2.multipleOf(dayMs),
|
|
150
150
|
version: version$1,
|
|
151
151
|
policyVersion: z.string().min(1).max(64),
|
|
152
152
|
targetCategory: z.enum([
|
|
@@ -167,20 +167,20 @@ const noFitRow = z.object({
|
|
|
167
167
|
"unknown"
|
|
168
168
|
]),
|
|
169
169
|
assessmentSource: z.enum(["local", "semantic"]),
|
|
170
|
-
decisions: integer$
|
|
170
|
+
decisions: integer$2.min(1)
|
|
171
171
|
}).strict();
|
|
172
172
|
const AutoAllocationDiagnosticsSchema = z.object({
|
|
173
173
|
status: z.enum(["observed", "not-collected"]),
|
|
174
174
|
rows: z.array(allocationRow).max(AUTO_ALLOCATION_DIAGNOSTIC_MAX_ROWS),
|
|
175
175
|
noFitRows: z.array(noFitRow).max(AUTO_ALLOCATION_DIAGNOSTIC_MAX_ROWS),
|
|
176
|
-
observationStart: integer$
|
|
177
|
-
observationEnd: integer$
|
|
176
|
+
observationStart: integer$2.nullable(),
|
|
177
|
+
observationEnd: integer$2.nullable(),
|
|
178
178
|
completeHistory: z.literal(false),
|
|
179
179
|
rowsTruncated: z.boolean(),
|
|
180
|
-
dropped: integer$
|
|
181
|
-
expired: integer$
|
|
182
|
-
saturated: integer$
|
|
183
|
-
restarts: integer$
|
|
180
|
+
dropped: integer$2,
|
|
181
|
+
expired: integer$2,
|
|
182
|
+
saturated: integer$2,
|
|
183
|
+
restarts: integer$2
|
|
184
184
|
}).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");
|
|
185
185
|
function emptyAutoAllocationDiagnostics() {
|
|
186
186
|
return {
|
|
@@ -324,6 +324,99 @@ var AutoAllocationDiagnosticsCollector = class {
|
|
|
324
324
|
}
|
|
325
325
|
};
|
|
326
326
|
//#endregion
|
|
327
|
+
//#region lib/types/request-diagnostics.js
|
|
328
|
+
const integer$1 = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
329
|
+
const composition = z.discriminatedUnion("state", [z.object({
|
|
330
|
+
state: z.literal("complete"),
|
|
331
|
+
totalBytes: integer$1,
|
|
332
|
+
conversationBytes: integer$1,
|
|
333
|
+
toolSchemaBytes: integer$1,
|
|
334
|
+
systemBytes: integer$1,
|
|
335
|
+
otherBytes: integer$1,
|
|
336
|
+
imageBlockBytes: integer$1,
|
|
337
|
+
opaqueReplayBytes: integer$1,
|
|
338
|
+
remainingConversationBytes: integer$1
|
|
339
|
+
}).strict(), z.object({
|
|
340
|
+
state: z.enum([
|
|
341
|
+
"unavailable",
|
|
342
|
+
"size-limit",
|
|
343
|
+
"work-limit",
|
|
344
|
+
"invalid-json",
|
|
345
|
+
"unsupported-shape",
|
|
346
|
+
"cancelled",
|
|
347
|
+
"time-limit"
|
|
348
|
+
]),
|
|
349
|
+
totalBytes: integer$1.optional()
|
|
350
|
+
}).strict()]);
|
|
351
|
+
const upload = z.discriminatedUnion("state", [
|
|
352
|
+
z.object({
|
|
353
|
+
state: z.literal("observed"),
|
|
354
|
+
bodyWrite: z.enum(["observed", "not-observed"]),
|
|
355
|
+
bodyWriteCompleteMs: integer$1.optional(),
|
|
356
|
+
nativeResponseHeadersMs: integer$1.optional(),
|
|
357
|
+
alpn: z.enum([
|
|
358
|
+
"h2",
|
|
359
|
+
"http/1.1",
|
|
360
|
+
"unavailable"
|
|
361
|
+
]),
|
|
362
|
+
nodeWritableBufferBytes: integer$1.optional()
|
|
363
|
+
}).strict(),
|
|
364
|
+
z.object({ state: z.enum(["unavailable", "work-limit"]) }).strict(),
|
|
365
|
+
z.object({
|
|
366
|
+
state: z.literal("ambiguous"),
|
|
367
|
+
requestCount: integer$1
|
|
368
|
+
}).strict()
|
|
369
|
+
]);
|
|
370
|
+
const REQUEST_DIAGNOSTICS_RETENTION_MS = 864e5;
|
|
371
|
+
const RequestDiagnosticSchema = z.object({
|
|
372
|
+
streamId: z.string().uuid(),
|
|
373
|
+
dispatchIndex: integer$1.min(1),
|
|
374
|
+
version: z.string().max(64).regex(/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/),
|
|
375
|
+
startedAt: integer$1,
|
|
376
|
+
elapsedMs: integer$1,
|
|
377
|
+
model: z.string().max(128).regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/),
|
|
378
|
+
protocol: z.enum([
|
|
379
|
+
"openai-responses",
|
|
380
|
+
"openai-completions",
|
|
381
|
+
"anthropic-messages"
|
|
382
|
+
]),
|
|
383
|
+
composition,
|
|
384
|
+
encoding: z.enum([
|
|
385
|
+
"identity",
|
|
386
|
+
"gzip",
|
|
387
|
+
"unknown"
|
|
388
|
+
]),
|
|
389
|
+
wireBytes: integer$1.optional(),
|
|
390
|
+
upload: upload.optional(),
|
|
391
|
+
responseHeadersMs: integer$1.optional(),
|
|
392
|
+
httpStatus: integer$1.min(100).max(599).optional(),
|
|
393
|
+
outcome: z.enum([
|
|
394
|
+
"http-error",
|
|
395
|
+
"transport-error",
|
|
396
|
+
"stream-done",
|
|
397
|
+
"stream-error",
|
|
398
|
+
"cancelled",
|
|
399
|
+
"interrupted"
|
|
400
|
+
]),
|
|
401
|
+
reason: z.enum([
|
|
402
|
+
"none",
|
|
403
|
+
"unknown",
|
|
404
|
+
"request-body-timeout",
|
|
405
|
+
"caller-abort",
|
|
406
|
+
"credential-changed",
|
|
407
|
+
"disposed",
|
|
408
|
+
"byte-idle-timeout",
|
|
409
|
+
"signal-abort"
|
|
410
|
+
])
|
|
411
|
+
}).strict();
|
|
412
|
+
const RequestDiagnosticsSchema = z.object({
|
|
413
|
+
rows: z.array(RequestDiagnosticSchema).max(128),
|
|
414
|
+
dropped: integer$1,
|
|
415
|
+
evicted: integer$1,
|
|
416
|
+
pending: integer$1.max(128).optional(),
|
|
417
|
+
interruptedOnReopen: integer$1.optional()
|
|
418
|
+
}).strict();
|
|
419
|
+
//#endregion
|
|
327
420
|
//#region lib/types/diagnostics-types.js
|
|
328
421
|
const DIAGNOSTICS_OPERATIONS = [
|
|
329
422
|
"account-global-switch",
|
|
@@ -432,6 +525,7 @@ const DiagnosticsSnapshotSchema = z.object({
|
|
|
432
525
|
updatedAt: integer,
|
|
433
526
|
rows: z.array(DiagnosticsRowSchema).max(DIAGNOSTICS_MAX_ROWS),
|
|
434
527
|
autoAllocation: AutoAllocationDiagnosticsSchema.optional(),
|
|
528
|
+
requests: RequestDiagnosticsSchema.optional(),
|
|
435
529
|
pending: z.array(DiagnosticsPendingSchema).max(128),
|
|
436
530
|
dropped: integer,
|
|
437
531
|
clientDropped: integer,
|
|
@@ -443,6 +537,7 @@ const DiagnosticsSnapshotSchema = z.object({
|
|
|
443
537
|
const DiagnosticsViewSchema = z.object({
|
|
444
538
|
enabled: z.boolean(),
|
|
445
539
|
autoAllocationEnabled: z.boolean(),
|
|
540
|
+
requestEnabled: z.boolean().optional(),
|
|
446
541
|
state: z.enum([
|
|
447
542
|
"loading",
|
|
448
543
|
"ready",
|
|
@@ -506,4 +601,4 @@ function diagnosticsOutcome(reason) {
|
|
|
506
601
|
return "failed";
|
|
507
602
|
}
|
|
508
603
|
//#endregion
|
|
509
|
-
export {
|
|
604
|
+
export { normalizeExcludedModelIds as S, AutoAllocationSchema as _, DiagnosticsPendingSchema as a, ModelExclusionTurns as b, DiagnosticsViewSchema as c, diagnosticsReason as d, REQUEST_DIAGNOSTICS_RETENTION_MS as f, AUTO_ALLOCATION_POLICY as g, emptyAutoAllocationDiagnostics as h, DIAGNOSTICS_RETENTION_MS as i, diagnosticsBucket as l, AutoAllocationDiagnosticsCollector as m, DIAGNOSTICS_OPERATIONS as n, DiagnosticsRowSchema as o, RequestDiagnosticSchema as p, DIAGNOSTICS_REASONS as r, DiagnosticsSnapshotSchema as s, DIAGNOSTICS_MAX_ROWS as t, diagnosticsOutcome as u, allocateAutoModel as v, excludedModelSet as x, normalizeHighCostModelIds as y };
|