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

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.126",
313
+ version: "0.4.0-alpha.128",
314
314
  publishConfig: {
315
315
  "access": "public",
316
316
  "registry": "https://registry.npmjs.org/",
@@ -6117,6 +6117,33 @@ const sampleSchema = z.object({
6117
6117
  seq: count$2,
6118
6118
  route: routeSchema
6119
6119
  }).strict();
6120
+ const stepSchema = z.object({
6121
+ turn: count$2,
6122
+ step: count$2
6123
+ }).strict();
6124
+ const compactionSchema = z.object({
6125
+ id: z.string().min(1).max(256),
6126
+ startSeq: count$2,
6127
+ endSeq: count$2.nullable(),
6128
+ state: z.enum([
6129
+ "running",
6130
+ "completed",
6131
+ "failed",
6132
+ "unknown"
6133
+ ]),
6134
+ checkpoint: z.boolean(),
6135
+ headerSeq: count$2.nullable(),
6136
+ requestRoute: routeSchema.nullable(),
6137
+ step: stepSchema.nullable(),
6138
+ request: z.enum([
6139
+ "idle",
6140
+ "pending",
6141
+ "succeeded",
6142
+ "failed",
6143
+ "cancelled",
6144
+ "unknown"
6145
+ ])
6146
+ }).strict();
6120
6147
  const ContextEvidenceSchema = z.object({
6121
6148
  route: routeSchema.nullable(),
6122
6149
  sample: sampleSchema.nullable(),
@@ -6127,7 +6154,9 @@ const ContextEvidenceSchema = z.object({
6127
6154
  "compaction",
6128
6155
  "selection",
6129
6156
  "unknown"
6130
- ])
6157
+ ]),
6158
+ compaction: compactionSchema.nullable().optional(),
6159
+ activeStep: stepSchema.nullable().optional()
6131
6160
  }).strict();
6132
6161
  const usageSchema = z.object({
6133
6162
  inputTokens: count$2,
@@ -6151,20 +6180,108 @@ function initialContextEvidence() {
6151
6180
  route: null,
6152
6181
  sample: null,
6153
6182
  invalid: false,
6154
- reason: "none"
6183
+ reason: "none",
6184
+ compaction: null,
6185
+ activeStep: null
6155
6186
  };
6156
6187
  }
6157
6188
  /** Read only counts and routing leaves; never message content or opaque replay. */
6158
6189
  function foldContextEvidence(state, event) {
6159
6190
  if (!record$12(event) || typeof event.type !== "string" || !record$12(event.data)) return state;
6191
+ if (event.type === "step/start") {
6192
+ const step = stepSchema.safeParse({
6193
+ turn: event.data.turn,
6194
+ step: event.data.step
6195
+ });
6196
+ state = {
6197
+ ...state,
6198
+ activeStep: step.success ? step.data : null
6199
+ };
6200
+ }
6201
+ if (event.type === "compaction/start") {
6202
+ const id = compactionSchema.shape.id.safeParse(event.data.compactionId);
6203
+ const seq = count$2.safeParse(event.seq);
6204
+ return {
6205
+ ...state,
6206
+ sample: null,
6207
+ invalid: true,
6208
+ reason: "compaction",
6209
+ compaction: id.success && seq.success ? {
6210
+ id: id.data,
6211
+ startSeq: seq.data,
6212
+ endSeq: null,
6213
+ state: "running",
6214
+ checkpoint: false,
6215
+ headerSeq: null,
6216
+ requestRoute: null,
6217
+ step: null,
6218
+ request: "idle"
6219
+ } : null
6220
+ };
6221
+ }
6222
+ if (event.type === "step/start" && state.compaction?.state === "completed" && state.compaction.endSeq !== null && count$2.safeParse(event.seq).success && Number(event.seq) > state.compaction.endSeq) {
6223
+ const step = compactionSchema.shape.step.safeParse({
6224
+ turn: event.data.turn,
6225
+ step: event.data.step
6226
+ });
6227
+ return {
6228
+ ...state,
6229
+ invalid: true,
6230
+ reason: "unknown",
6231
+ compaction: {
6232
+ ...state.compaction,
6233
+ step: step.success ? step.data : null,
6234
+ headerSeq: step.success ? count$2.parse(event.seq) : null,
6235
+ requestRoute: state.route,
6236
+ request: step.success && copilot(state.route) ? "pending" : "unknown"
6237
+ }
6238
+ };
6239
+ }
6240
+ if ((event.type === "step/end" || event.type === "turn/end") && state.compaction?.request === "pending" && event.data.turn === state.compaction.step?.turn && (event.type === "turn/end" || event.data.step === state.compaction.step?.step)) state = {
6241
+ ...state,
6242
+ compaction: {
6243
+ ...state.compaction,
6244
+ request: "unknown"
6245
+ }
6246
+ };
6247
+ if ((event.type === "step/end" || event.type === "turn/end") && event.data.turn === state.activeStep?.turn && (event.type === "turn/end" || event.data.step === state.activeStep?.step)) return {
6248
+ ...state,
6249
+ activeStep: null
6250
+ };
6251
+ const operation = state.compaction;
6252
+ if (operation?.state === "running" && count$2.safeParse(event.seq).success && Number(event.seq) > operation.startSeq) {
6253
+ if (event.type === "user/message" && record$12(event.data.source) && event.data.source.kind === "compact-checkpoint" && event.data.source.compactionId === operation.id) state = {
6254
+ ...state,
6255
+ compaction: {
6256
+ ...operation,
6257
+ checkpoint: true
6258
+ }
6259
+ };
6260
+ if (event.type === "compaction/end" && event.data.compactionId === operation.id) state = {
6261
+ ...state,
6262
+ compaction: {
6263
+ ...operation,
6264
+ endSeq: count$2.parse(event.seq),
6265
+ state: event.data.error !== void 0 ? "failed" : operation.checkpoint ? "completed" : "unknown"
6266
+ }
6267
+ };
6268
+ }
6160
6269
  if (event.type === "request/header" || event.type === "model/selection") {
6161
6270
  const raw = event.type === "request/header" ? record$12(event.data.header) ? event.data.header.config : void 0 : event.data;
6271
+ const revoke = () => state.compaction ? {
6272
+ ...state.compaction,
6273
+ headerSeq: null,
6274
+ requestRoute: null,
6275
+ step: null,
6276
+ request: "unknown"
6277
+ } : state.compaction;
6162
6278
  if (!record$12(raw)) return {
6163
6279
  ...state,
6164
6280
  route: null,
6165
6281
  sample: null,
6166
6282
  invalid: true,
6167
- reason: "unknown"
6283
+ reason: "unknown",
6284
+ compaction: revoke()
6168
6285
  };
6169
6286
  const parsed = routeSchema.safeParse({
6170
6287
  provider: raw.provider,
@@ -6175,9 +6292,27 @@ function foldContextEvidence(state, event) {
6175
6292
  route: null,
6176
6293
  sample: null,
6177
6294
  invalid: true,
6178
- reason: "unknown"
6295
+ reason: "unknown",
6296
+ compaction: revoke()
6179
6297
  };
6180
6298
  const route = parsed.data;
6299
+ const compact = state.compaction;
6300
+ if (compact?.state === "completed") {
6301
+ if (event.type === "request/header" && compact.endSeq !== null && count$2.safeParse(event.seq).success && Number(event.seq) > compact.endSeq && copilot(route)) state = {
6302
+ ...state,
6303
+ compaction: {
6304
+ ...compact,
6305
+ headerSeq: count$2.parse(event.seq),
6306
+ requestRoute: route,
6307
+ step: state.activeStep ?? null,
6308
+ request: "pending"
6309
+ }
6310
+ };
6311
+ else if (!sameRoute$1(state.route, route)) state = {
6312
+ ...state,
6313
+ compaction: revoke()
6314
+ };
6315
+ }
6181
6316
  if (sameRoute$1(state.route, route)) return state;
6182
6317
  return {
6183
6318
  ...state,
@@ -6187,17 +6322,25 @@ function foldContextEvidence(state, event) {
6187
6322
  };
6188
6323
  }
6189
6324
  if (event.type.startsWith("compaction/") || event.surfaceOp !== void 0 && event.surfaceOp !== "append") {
6190
- if (state.sample === null) return state;
6325
+ const checkpoint = event.type === "user/message" && record$12(event.data.source) && event.data.source.kind === "compact-checkpoint" && event.data.source.compactionId === state.compaction?.id;
6191
6326
  return {
6192
6327
  ...state,
6193
6328
  sample: null,
6194
- reason: "compaction"
6329
+ invalid: true,
6330
+ reason: "compaction",
6331
+ compaction: event.type.startsWith("compaction/") || checkpoint || !state.compaction ? state.compaction : {
6332
+ ...state.compaction,
6333
+ request: "unknown",
6334
+ step: null,
6335
+ headerSeq: null,
6336
+ requestRoute: null
6337
+ }
6195
6338
  };
6196
6339
  }
6197
6340
  if (event.type !== "assistant/message" && event.type !== "assistant/attempt") return state;
6198
6341
  if (!copilot(state.route)) return state;
6199
- if (event.type === "assistant/message" && event.data.source !== void 0) {
6200
- const source = event.data.source;
6342
+ const source = record$12(event.data.message) ? event.data.message.source : event.data.source;
6343
+ if (event.type === "assistant/message" && source !== void 0) {
6201
6344
  const parsed = routeSchema.safeParse(record$12(source) ? {
6202
6345
  provider: source.provider,
6203
6346
  model: source.model
@@ -6206,7 +6349,14 @@ function foldContextEvidence(state, event) {
6206
6349
  ...state,
6207
6350
  sample: null,
6208
6351
  invalid: true,
6209
- reason: "unknown"
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
6210
6360
  };
6211
6361
  }
6212
6362
  const stream = Array.isArray(event.data.stream) ? event.data.stream : [];
@@ -6218,7 +6368,32 @@ function foldContextEvidence(state, event) {
6218
6368
  if (!settledUsage && entry.chunk.type === "usage") usage = entry.chunk.usage;
6219
6369
  if (entry.chunk.type === "finish") terminal = entry.chunk.reason;
6220
6370
  }
6221
- if (usage === void 0) return state;
6371
+ const successful = event.data.interrupted !== true && record$12(terminal) && (terminal.kind === "stop" || terminal.kind === "max-tokens" || terminal.kind === "tool-calls");
6372
+ const compact = state.compaction;
6373
+ if (compact?.state === "completed") {
6374
+ if (compact.headerSeq === null || !count$2.safeParse(event.seq).success || Number(event.seq) <= compact.headerSeq) return state;
6375
+ if (!sameRoute$1(compact.requestRoute, state.route)) return state;
6376
+ if (compact.step === null) return {
6377
+ ...state,
6378
+ compaction: {
6379
+ ...compact,
6380
+ request: "unknown"
6381
+ }
6382
+ };
6383
+ if (event.data.turn !== compact.step.turn || event.data.step !== compact.step.step) return state;
6384
+ state = {
6385
+ ...state,
6386
+ compaction: {
6387
+ ...compact,
6388
+ request: event.type === "assistant/message" && successful && source !== void 0 ? "succeeded" : record$12(terminal) && terminal.kind === "aborted" ? "cancelled" : record$12(terminal) && terminal.kind === "error" ? "failed" : "unknown"
6389
+ }
6390
+ };
6391
+ } 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;
6222
6397
  const parsed = usageSchema.safeParse(usage);
6223
6398
  if (!parsed.success || !count$2.safeParse(event.seq).success) return {
6224
6399
  ...state,
@@ -6227,9 +6402,7 @@ function foldContextEvidence(state, event) {
6227
6402
  reason: "unknown"
6228
6403
  };
6229
6404
  const value = parsed.data;
6230
- const zero = isZeroContextUsage(value);
6231
- const successful = record$12(terminal) && (terminal.kind === "stop" || terminal.kind === "max-tokens" || terminal.kind === "tool-calls");
6232
- if (zero && !successful) {
6405
+ if (isZeroContextUsage(value) && !successful) {
6233
6406
  const reason = state.sample !== null || state.reason === "none" ? "failed-zero" : state.reason;
6234
6407
  return {
6235
6408
  ...state,
@@ -6258,7 +6431,7 @@ function foldContextEvidence(state, event) {
6258
6431
  /** Separate bounded replay unit; never register under or modify a Core key. */
6259
6432
  const contextEvidenceDefinition = {
6260
6433
  key: COPILOT_CONTEXT_EVIDENCE,
6261
- stateVersion: 1,
6434
+ stateVersion: 2,
6262
6435
  stateSchema: ContextEvidenceSchema,
6263
6436
  init: initialContextEvidence,
6264
6437
  apply: foldContextEvidence,
@@ -1,11 +1,29 @@
1
+ import type { ReactElement } from 'react';
1
2
  import type { SessionContinuationRemote } from './session-continuation-ui.ts';
2
- export declare function CompactionContinuationNotice({ sessionId, remote, lifecycle, locale }: {
3
+ import type { CompactionContinuationStatus } from './session-continuation-types.ts';
4
+ type NoticeState = CompactionContinuationStatus['state'] | 'unavailable';
5
+ /** Presentation only, retained across incidental mounts by the Client slot registration. */
6
+ export declare class CompactionNoticePresentation {
7
+ private entries;
8
+ private listeners;
9
+ private version;
10
+ subscribe: (listener: () => void) => () => void;
11
+ snapshot: () => number;
12
+ private key;
13
+ private remember;
14
+ observe(sessionId: string, id: string, state: NoticeState): void;
15
+ remaining(sessionId: string, id: string): number | undefined;
16
+ visible(sessionId: string, id: string, state: NoticeState): boolean;
17
+ dismiss(sessionId: string, id: string, state: NoticeState): void;
18
+ dispose(): void;
19
+ }
20
+ export declare function CompactionContinuationNotice({ sessionId, remote, lifecycle, locale, renderEvidence, presentation: sharedPresentation }: {
3
21
  sessionId: string;
4
22
  remote?: SessionContinuationRemote;
5
23
  lifecycle: unknown;
6
24
  locale?: string;
7
- }): import("react").DetailedReactHTMLElement<{
8
- 'data-copilot-composer-notice': string;
9
- style: import("react").CSSProperties;
10
- }, HTMLElement> | null;
25
+ presentation?: CompactionNoticePresentation;
26
+ renderEvidence?: (status?: CompactionContinuationStatus, controls?: ReactElement | null, transient?: boolean) => ReactElement | null;
27
+ }): ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
28
+ export {};
11
29
  //# sourceMappingURL=compaction-continuation-ui.d.ts.map
@@ -1,10 +1,14 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
2
  import type { ReactElement } from 'react';
3
3
  import type { ContextEvidence } from './context-evidence.ts';
4
- export declare function ContextEvidenceNotice({ evidence, locale, applicable }: {
4
+ import type { CompactionContinuationStatus } from './session-continuation-types.ts';
5
+ export declare function ContextEvidenceNotice({ evidence, locale, applicable, compactionStatus, showCompactionResult, controls }: {
5
6
  evidence: ContextEvidence | undefined;
6
7
  locale?: string;
7
8
  applicable?: boolean;
9
+ compactionStatus?: CompactionContinuationStatus;
10
+ showCompactionResult?: boolean;
11
+ controls?: ReactElement | null;
8
12
  }): ReactElement | null;
9
13
  /** Additive disclosure only: native input, context ring and billing remain untouched. */
10
14
  export declare function registerContextEvidenceUi(ctx: Context): () => void;
@@ -22,6 +22,39 @@ export declare const ContextEvidenceSchema: z.ZodObject<{
22
22
  "failed-zero": "failed-zero";
23
23
  selection: "selection";
24
24
  }>;
25
+ compaction: z.ZodOptional<z.ZodNullable<z.ZodObject<{
26
+ id: z.ZodString;
27
+ startSeq: z.ZodNumber;
28
+ endSeq: z.ZodNullable<z.ZodNumber>;
29
+ state: z.ZodEnum<{
30
+ running: "running";
31
+ unknown: "unknown";
32
+ failed: "failed";
33
+ completed: "completed";
34
+ }>;
35
+ checkpoint: z.ZodBoolean;
36
+ headerSeq: z.ZodNullable<z.ZodNumber>;
37
+ requestRoute: z.ZodNullable<z.ZodObject<{
38
+ provider: z.ZodString;
39
+ model: z.ZodString;
40
+ }, z.core.$strict>>;
41
+ step: z.ZodNullable<z.ZodObject<{
42
+ turn: z.ZodNumber;
43
+ step: z.ZodNumber;
44
+ }, z.core.$strict>>;
45
+ request: z.ZodEnum<{
46
+ unknown: "unknown";
47
+ cancelled: "cancelled";
48
+ failed: "failed";
49
+ pending: "pending";
50
+ idle: "idle";
51
+ succeeded: "succeeded";
52
+ }>;
53
+ }, z.core.$strict>>>;
54
+ activeStep: z.ZodOptional<z.ZodNullable<z.ZodObject<{
55
+ turn: z.ZodNumber;
56
+ step: z.ZodNumber;
57
+ }, z.core.$strict>>>;
25
58
  }, z.core.$strict>;
26
59
  export type ContextEvidence = z.infer<typeof ContextEvidenceSchema>;
27
60
  declare module '@deepseek-ai/dsh-session-projection/types' {
@@ -60,6 +93,39 @@ export declare const contextEvidenceDefinition: {
60
93
  "failed-zero": "failed-zero";
61
94
  selection: "selection";
62
95
  }>;
96
+ compaction: z.ZodOptional<z.ZodNullable<z.ZodObject<{
97
+ id: z.ZodString;
98
+ startSeq: z.ZodNumber;
99
+ endSeq: z.ZodNullable<z.ZodNumber>;
100
+ state: z.ZodEnum<{
101
+ running: "running";
102
+ unknown: "unknown";
103
+ failed: "failed";
104
+ completed: "completed";
105
+ }>;
106
+ checkpoint: z.ZodBoolean;
107
+ headerSeq: z.ZodNullable<z.ZodNumber>;
108
+ requestRoute: z.ZodNullable<z.ZodObject<{
109
+ provider: z.ZodString;
110
+ model: z.ZodString;
111
+ }, z.core.$strict>>;
112
+ step: z.ZodNullable<z.ZodObject<{
113
+ turn: z.ZodNumber;
114
+ step: z.ZodNumber;
115
+ }, z.core.$strict>>;
116
+ request: z.ZodEnum<{
117
+ unknown: "unknown";
118
+ cancelled: "cancelled";
119
+ failed: "failed";
120
+ pending: "pending";
121
+ idle: "idle";
122
+ succeeded: "succeeded";
123
+ }>;
124
+ }, z.core.$strict>>>;
125
+ activeStep: z.ZodOptional<z.ZodNullable<z.ZodObject<{
126
+ turn: z.ZodNumber;
127
+ step: z.ZodNumber;
128
+ }, z.core.$strict>>>;
63
129
  }, z.core.$strict>;
64
130
  init: typeof initialContextEvidence;
65
131
  apply: typeof foldContextEvidence;
@@ -85,6 +151,39 @@ export declare const contextEvidenceDefinition: {
85
151
  "failed-zero": "failed-zero";
86
152
  selection: "selection";
87
153
  }>;
154
+ compaction: z.ZodOptional<z.ZodNullable<z.ZodObject<{
155
+ id: z.ZodString;
156
+ startSeq: z.ZodNumber;
157
+ endSeq: z.ZodNullable<z.ZodNumber>;
158
+ state: z.ZodEnum<{
159
+ running: "running";
160
+ unknown: "unknown";
161
+ failed: "failed";
162
+ completed: "completed";
163
+ }>;
164
+ checkpoint: z.ZodBoolean;
165
+ headerSeq: z.ZodNullable<z.ZodNumber>;
166
+ requestRoute: z.ZodNullable<z.ZodObject<{
167
+ provider: z.ZodString;
168
+ model: z.ZodString;
169
+ }, z.core.$strict>>;
170
+ step: z.ZodNullable<z.ZodObject<{
171
+ turn: z.ZodNumber;
172
+ step: z.ZodNumber;
173
+ }, z.core.$strict>>;
174
+ request: z.ZodEnum<{
175
+ unknown: "unknown";
176
+ cancelled: "cancelled";
177
+ failed: "failed";
178
+ pending: "pending";
179
+ idle: "idle";
180
+ succeeded: "succeeded";
181
+ }>;
182
+ }, z.core.$strict>>>;
183
+ activeStep: z.ZodOptional<z.ZodNullable<z.ZodObject<{
184
+ turn: z.ZodNumber;
185
+ step: z.ZodNumber;
186
+ }, z.core.$strict>>>;
88
187
  }, z.core.$strict>;
89
188
  view: (state: ContextEvidence) => {
90
189
  route: {
@@ -101,6 +200,27 @@ export declare const contextEvidenceDefinition: {
101
200
  } | null;
102
201
  invalid: boolean;
103
202
  reason: "none" | "compaction" | "unknown" | "failed-zero" | "selection";
203
+ compaction?: {
204
+ id: string;
205
+ startSeq: number;
206
+ endSeq: number | null;
207
+ state: "running" | "unknown" | "failed" | "completed";
208
+ checkpoint: boolean;
209
+ headerSeq: number | null;
210
+ requestRoute: {
211
+ provider: string;
212
+ model: string;
213
+ } | null;
214
+ step: {
215
+ turn: number;
216
+ step: number;
217
+ } | null;
218
+ request: "unknown" | "cancelled" | "failed" | "pending" | "idle" | "succeeded";
219
+ } | null | undefined;
220
+ activeStep?: {
221
+ turn: number;
222
+ step: number;
223
+ } | null | undefined;
104
224
  };
105
225
  };
106
226
  };
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.126",
4
+ "version": "0.4.0-alpha.128",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "registry": "https://registry.npmjs.org/",