dsh-github-copilot 0.4.0-alpha.128 → 0.4.0-alpha.129

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/index.js CHANGED
@@ -310,7 +310,7 @@ const result$1 = strictRemoteCodec("dsh-github-copilot#DiagnosticsView", Diagnos
310
310
  var package_default = {
311
311
  name: "dsh-github-copilot",
312
312
  description: "DSH companion for GitHub Copilot sign-in, account-aware model profiles, tool compatibility, and provider-hosted search.",
313
- version: "0.4.0-alpha.128",
313
+ version: "0.4.0-alpha.129",
314
314
  publishConfig: {
315
315
  "access": "public",
316
316
  "registry": "https://registry.npmjs.org/",
@@ -6117,6 +6117,10 @@ const sampleSchema = z.object({
6117
6117
  seq: count$2,
6118
6118
  route: routeSchema
6119
6119
  }).strict();
6120
+ const incidentSchema = z.object({
6121
+ kind: z.enum(["failed-zero", "invalid-sample"]),
6122
+ seq: count$2
6123
+ }).strict();
6120
6124
  const stepSchema = z.object({
6121
6125
  turn: count$2,
6122
6126
  step: count$2
@@ -6151,10 +6155,12 @@ const ContextEvidenceSchema = z.object({
6151
6155
  reason: z.enum([
6152
6156
  "none",
6153
6157
  "failed-zero",
6158
+ "invalid-sample",
6154
6159
  "compaction",
6155
6160
  "selection",
6156
6161
  "unknown"
6157
6162
  ]),
6163
+ incident: incidentSchema.nullable(),
6158
6164
  compaction: compactionSchema.nullable().optional(),
6159
6165
  activeStep: stepSchema.nullable().optional()
6160
6166
  }).strict();
@@ -6181,6 +6187,7 @@ function initialContextEvidence() {
6181
6187
  sample: null,
6182
6188
  invalid: false,
6183
6189
  reason: "none",
6190
+ incident: null,
6184
6191
  compaction: null,
6185
6192
  activeStep: null
6186
6193
  };
@@ -6204,8 +6211,9 @@ function foldContextEvidence(state, event) {
6204
6211
  return {
6205
6212
  ...state,
6206
6213
  sample: null,
6207
- invalid: true,
6214
+ invalid: false,
6208
6215
  reason: "compaction",
6216
+ incident: null,
6209
6217
  compaction: id.success && seq.success ? {
6210
6218
  id: id.data,
6211
6219
  startSeq: seq.data,
@@ -6226,8 +6234,6 @@ function foldContextEvidence(state, event) {
6226
6234
  });
6227
6235
  return {
6228
6236
  ...state,
6229
- invalid: true,
6230
- reason: "unknown",
6231
6237
  compaction: {
6232
6238
  ...state.compaction,
6233
6239
  step: step.success ? step.data : null,
@@ -6281,6 +6287,7 @@ function foldContextEvidence(state, event) {
6281
6287
  sample: null,
6282
6288
  invalid: true,
6283
6289
  reason: "unknown",
6290
+ incident: null,
6284
6291
  compaction: revoke()
6285
6292
  };
6286
6293
  const parsed = routeSchema.safeParse({
@@ -6293,6 +6300,7 @@ function foldContextEvidence(state, event) {
6293
6300
  sample: null,
6294
6301
  invalid: true,
6295
6302
  reason: "unknown",
6303
+ incident: null,
6296
6304
  compaction: revoke()
6297
6305
  };
6298
6306
  const route = parsed.data;
@@ -6318,7 +6326,9 @@ function foldContextEvidence(state, event) {
6318
6326
  ...state,
6319
6327
  route,
6320
6328
  sample: null,
6321
- reason: "selection"
6329
+ invalid: false,
6330
+ reason: "selection",
6331
+ incident: null
6322
6332
  };
6323
6333
  }
6324
6334
  if (event.type.startsWith("compaction/") || event.surfaceOp !== void 0 && event.surfaceOp !== "append") {
@@ -6326,8 +6336,9 @@ function foldContextEvidence(state, event) {
6326
6336
  return {
6327
6337
  ...state,
6328
6338
  sample: null,
6329
- invalid: true,
6339
+ invalid: false,
6330
6340
  reason: "compaction",
6341
+ incident: null,
6331
6342
  compaction: event.type.startsWith("compaction/") || checkpoint || !state.compaction ? state.compaction : {
6332
6343
  ...state.compaction,
6333
6344
  request: "unknown",
@@ -6345,19 +6356,26 @@ function foldContextEvidence(state, event) {
6345
6356
  provider: source.provider,
6346
6357
  model: source.model
6347
6358
  } : source);
6348
- if (!parsed.success || !sameRoute$1(state.route, parsed.data)) return {
6349
- ...state,
6350
- sample: null,
6351
- invalid: true,
6352
- reason: "unknown",
6353
- compaction: state.compaction ? {
6354
- ...state.compaction,
6355
- request: "unknown",
6356
- step: null,
6357
- headerSeq: null,
6358
- requestRoute: null
6359
- } : state.compaction
6360
- };
6359
+ if (!parsed.success || !sameRoute$1(state.route, parsed.data)) {
6360
+ const seq = count$2.safeParse(event.seq);
6361
+ return {
6362
+ ...state,
6363
+ sample: null,
6364
+ invalid: true,
6365
+ reason: seq.success ? "invalid-sample" : "unknown",
6366
+ incident: seq.success ? {
6367
+ kind: "invalid-sample",
6368
+ seq: seq.data
6369
+ } : null,
6370
+ compaction: state.compaction ? {
6371
+ ...state.compaction,
6372
+ request: "unknown",
6373
+ step: null,
6374
+ headerSeq: null,
6375
+ requestRoute: null
6376
+ } : state.compaction
6377
+ };
6378
+ }
6361
6379
  }
6362
6380
  const stream = Array.isArray(event.data.stream) ? event.data.stream : [];
6363
6381
  let usage = event.type === "assistant/message" ? event.data.usage : void 0;
@@ -6389,33 +6407,41 @@ function foldContextEvidence(state, event) {
6389
6407
  }
6390
6408
  };
6391
6409
  } else if (compact?.state === "running") return state;
6392
- if (usage === void 0) return compact?.state === "completed" ? {
6393
- ...state,
6394
- invalid: true,
6395
- reason: "unknown"
6396
- } : state;
6410
+ if (usage === void 0) return state;
6397
6411
  const parsed = usageSchema.safeParse(usage);
6398
- if (!parsed.success || !count$2.safeParse(event.seq).success) return {
6399
- ...state,
6400
- sample: null,
6401
- invalid: true,
6402
- reason: "unknown"
6403
- };
6404
- const value = parsed.data;
6405
- if (isZeroContextUsage(value) && !successful) {
6406
- const reason = state.sample !== null || state.reason === "none" ? "failed-zero" : state.reason;
6412
+ if (!parsed.success || !count$2.safeParse(event.seq).success) {
6413
+ const seq = count$2.safeParse(event.seq);
6407
6414
  return {
6408
6415
  ...state,
6416
+ sample: null,
6409
6417
  invalid: true,
6410
- reason
6418
+ reason: seq.success ? "invalid-sample" : "unknown",
6419
+ incident: seq.success ? {
6420
+ kind: "invalid-sample",
6421
+ seq: seq.data
6422
+ } : null
6411
6423
  };
6412
6424
  }
6425
+ const value = parsed.data;
6426
+ if (isZeroContextUsage(value) && !successful) return {
6427
+ ...state,
6428
+ invalid: true,
6429
+ reason: "failed-zero",
6430
+ incident: {
6431
+ kind: "failed-zero",
6432
+ seq: count$2.parse(event.seq)
6433
+ }
6434
+ };
6413
6435
  const tokens = value.inputTokens + (value.cacheReadTokens ?? 0) + (value.cacheWriteTokens ?? 0);
6414
6436
  if (!Number.isSafeInteger(tokens) || state.route === null) return {
6415
6437
  ...state,
6416
6438
  sample: null,
6417
6439
  invalid: true,
6418
- reason: "unknown"
6440
+ reason: "invalid-sample",
6441
+ incident: {
6442
+ kind: "invalid-sample",
6443
+ seq: count$2.parse(event.seq)
6444
+ }
6419
6445
  };
6420
6446
  return {
6421
6447
  ...state,
@@ -6425,13 +6451,14 @@ function foldContextEvidence(state, event) {
6425
6451
  route: state.route
6426
6452
  },
6427
6453
  invalid: false,
6428
- reason: "none"
6454
+ reason: "none",
6455
+ incident: null
6429
6456
  };
6430
6457
  }
6431
6458
  /** Separate bounded replay unit; never register under or modify a Core key. */
6432
6459
  const contextEvidenceDefinition = {
6433
6460
  key: COPILOT_CONTEXT_EVIDENCE,
6434
- stateVersion: 2,
6461
+ stateVersion: 3,
6435
6462
  stateSchema: ContextEvidenceSchema,
6436
6463
  init: initialContextEvidence,
6437
6464
  apply: foldContextEvidence,
@@ -2,13 +2,26 @@ import type { Context } from '@deepseek-ai/cordis';
2
2
  import type { ReactElement } from 'react';
3
3
  import type { ContextEvidence } from './context-evidence.ts';
4
4
  import type { CompactionContinuationStatus } from './session-continuation-types.ts';
5
- export declare function ContextEvidenceNotice({ evidence, locale, applicable, compactionStatus, showCompactionResult, controls }: {
5
+ export declare class ContextIncidentPresentation {
6
+ private dismissed;
7
+ private listeners;
8
+ private version;
9
+ subscribe: (listener: () => void) => () => void;
10
+ snapshot: () => number;
11
+ private key;
12
+ visible(sessionId: string, incident: NonNullable<ContextEvidence['incident']>): boolean;
13
+ dismiss(sessionId: string, incident: NonNullable<ContextEvidence['incident']>): void;
14
+ dispose(): void;
15
+ }
16
+ export declare function ContextEvidenceNotice({ evidence, locale, applicable, compactionStatus, showCompactionResult, controls, sessionId, presentation }: {
6
17
  evidence: ContextEvidence | undefined;
7
18
  locale?: string;
8
19
  applicable?: boolean;
9
20
  compactionStatus?: CompactionContinuationStatus;
10
21
  showCompactionResult?: boolean;
11
22
  controls?: ReactElement | null;
23
+ sessionId?: string;
24
+ presentation?: ContextIncidentPresentation;
12
25
  }): ReactElement | null;
13
26
  /** Additive disclosure only: native input, context ring and billing remain untouched. */
14
27
  export declare function registerContextEvidenceUi(ctx: Context): () => void;
@@ -20,8 +20,16 @@ export declare const ContextEvidenceSchema: z.ZodObject<{
20
20
  compaction: "compaction";
21
21
  unknown: "unknown";
22
22
  "failed-zero": "failed-zero";
23
+ "invalid-sample": "invalid-sample";
23
24
  selection: "selection";
24
25
  }>;
26
+ incident: z.ZodNullable<z.ZodObject<{
27
+ kind: z.ZodEnum<{
28
+ "failed-zero": "failed-zero";
29
+ "invalid-sample": "invalid-sample";
30
+ }>;
31
+ seq: z.ZodNumber;
32
+ }, z.core.$strict>>;
25
33
  compaction: z.ZodOptional<z.ZodNullable<z.ZodObject<{
26
34
  id: z.ZodString;
27
35
  startSeq: z.ZodNumber;
@@ -91,8 +99,16 @@ export declare const contextEvidenceDefinition: {
91
99
  compaction: "compaction";
92
100
  unknown: "unknown";
93
101
  "failed-zero": "failed-zero";
102
+ "invalid-sample": "invalid-sample";
94
103
  selection: "selection";
95
104
  }>;
105
+ incident: z.ZodNullable<z.ZodObject<{
106
+ kind: z.ZodEnum<{
107
+ "failed-zero": "failed-zero";
108
+ "invalid-sample": "invalid-sample";
109
+ }>;
110
+ seq: z.ZodNumber;
111
+ }, z.core.$strict>>;
96
112
  compaction: z.ZodOptional<z.ZodNullable<z.ZodObject<{
97
113
  id: z.ZodString;
98
114
  startSeq: z.ZodNumber;
@@ -149,8 +165,16 @@ export declare const contextEvidenceDefinition: {
149
165
  compaction: "compaction";
150
166
  unknown: "unknown";
151
167
  "failed-zero": "failed-zero";
168
+ "invalid-sample": "invalid-sample";
152
169
  selection: "selection";
153
170
  }>;
171
+ incident: z.ZodNullable<z.ZodObject<{
172
+ kind: z.ZodEnum<{
173
+ "failed-zero": "failed-zero";
174
+ "invalid-sample": "invalid-sample";
175
+ }>;
176
+ seq: z.ZodNumber;
177
+ }, z.core.$strict>>;
154
178
  compaction: z.ZodOptional<z.ZodNullable<z.ZodObject<{
155
179
  id: z.ZodString;
156
180
  startSeq: z.ZodNumber;
@@ -199,7 +223,11 @@ export declare const contextEvidenceDefinition: {
199
223
  };
200
224
  } | null;
201
225
  invalid: boolean;
202
- reason: "none" | "compaction" | "unknown" | "failed-zero" | "selection";
226
+ reason: "none" | "compaction" | "unknown" | "failed-zero" | "invalid-sample" | "selection";
227
+ incident: {
228
+ kind: "failed-zero" | "invalid-sample";
229
+ seq: number;
230
+ } | null;
203
231
  compaction?: {
204
232
  id: string;
205
233
  startSeq: number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
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.0-alpha.128",
4
+ "version": "0.4.0-alpha.129",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "registry": "https://registry.npmjs.org/",