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

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
@@ -17,6 +17,7 @@ import { WebError } from "@deepseek-ai/dsh-web";
17
17
  import { buildCopilotDynamicHeaders, hasCopilotVisionInput } from "@earendil-works/pi-ai/api/github-copilot-headers";
18
18
  import { AsyncLocalStorage } from "node:async_hooks";
19
19
  import { channel } from "node:diagnostics_channel";
20
+ import { constants, gzip } from "node:zlib";
20
21
  import * as dshLlm from "@deepseek-ai/dsh-llm";
21
22
  import { CONTEXT_WINDOW_EXCEEDED_CODE, LlmError, ReasoningEffortId, attributionHeaders, boundContextSummary, callConfigEquals, contentHasImage, createUserMessage, isAgentLoopRequest, resolveImageAttachmentAccess, resolveRetryPolicy } from "@deepseek-ai/dsh-llm";
22
23
  import { setImmediate } from "node:timers/promises";
@@ -309,7 +310,7 @@ const result$1 = strictRemoteCodec("dsh-github-copilot#DiagnosticsView", Diagnos
309
310
  var package_default = {
310
311
  name: "dsh-github-copilot",
311
312
  description: "DSH companion for GitHub Copilot sign-in, account-aware model profiles, tool compatibility, and provider-hosted search.",
312
- version: "0.4.0-alpha.124",
313
+ version: "0.4.0-alpha.126",
313
314
  publishConfig: {
314
315
  "access": "public",
315
316
  "registry": "https://registry.npmjs.org/",
@@ -2876,11 +2877,11 @@ const REQUEST_BODY_EVIDENCE_LIMITS = Object.freeze({
2876
2877
  depth: 64,
2877
2878
  keyCharacters: 128
2878
2879
  });
2879
- function formatRequestBodyEvidence(evidence, responseHeadersMs) {
2880
+ function formatRequestBodyEvidence(evidence, responseHeadersMs, compression) {
2880
2881
  const elapsed = responseHeadersMs === void 0 ? void 0 : Math.round(responseHeadersMs);
2881
2882
  const timing = responseHeadersMs !== void 0 && responseHeadersMs >= 0 && elapsed !== void 0 && Number.isSafeInteger(elapsed) ? `Fetch-to-response-headers: ${elapsed} ms (round trip, not upload duration).` : "Fetch-to-response-headers timing unavailable.";
2882
2883
  if (evidence.state !== "complete") return `Composition unavailable (${evidence.state}); no partial totals inferred. ${timing}`;
2883
- return `Composition (wire UTF-8 bytes): conversation ${evidence.conversationBytes}, tool definitions ${evidence.toolSchemaBytes}, top-level system/instructions ${evidence.systemBytes}, other/framing ${evidence.otherBytes}. Within conversation (disjoint subsets): image blocks ${evidence.imageBlockBytes}, opaque replay ${evidence.opaqueReplayBytes}, remaining ${evidence.remainingConversationBytes} (text/tool history, framing and unrecognized fields). Image blocks include URLs/references, not decoded image sizes; unknown encodings stay in remaining/other. ${timing}`;
2884
+ return `${compression?.encoding === "gzip" ? "Original JSON composition (UTF-8 bytes, not gzip wire bytes)" : "Composition (wire UTF-8 bytes)"}: conversation ${evidence.conversationBytes}, tool definitions ${evidence.toolSchemaBytes}, top-level system/instructions ${evidence.systemBytes}, other/framing ${evidence.otherBytes}. Within conversation (disjoint subsets): image blocks ${evidence.imageBlockBytes}, opaque replay ${evidence.opaqueReplayBytes}, remaining ${evidence.remainingConversationBytes} (text/tool history, framing and unrecognized fields). Image blocks include URLs/references, not decoded image sizes; unknown encodings stay in remaining/other. ${timing}`;
2884
2885
  }
2885
2886
  var EvidenceParseError = class extends Error {
2886
2887
  state;
@@ -3401,10 +3402,119 @@ async function requestBodyTimeoutDiagnostic(response, body, signal, dispatch) {
3401
3402
  if (signal?.aborted || !record$13(value)) return void 0;
3402
3403
  const error = Object.hasOwn(value, "error") ? value.error : value;
3403
3404
  if (!record$13(error) || error.code !== "user_request_timeout" || error.message !== observedMessage || value.code !== void 0 && value.code !== error.code || value.message !== void 0 && value.message !== error.message) return void 0;
3404
- const size = body === void 0 ? "Request body size unavailable." : `Request body: ${Buffer.byteLength(body, "utf8")} UTF-8 bytes (not context tokens).`;
3405
- const composition = formatRequestBodyEvidence(dispatch === void 0 ? { state: "unavailable" } : requestBodyEvidence(body, dispatch.protocol), dispatch?.responseHeadersMs);
3405
+ const compression = dispatch?.compression;
3406
+ const encoding = compression?.encoding === "gzip" ? ` Encoded body: ${compression.wireBytes} gzip bytes (prepared HTTP body, excluding transport framing; not confirmed delivered bytes). Lossless content encoding does not reduce context tokens or prove remote receipt.` : compression !== void 0 && compression.reason !== "disabled" ? ` Request compression not applied: ${compression.reason}; original request retained.` : "";
3407
+ const size = body === void 0 ? "Request body size unavailable." : `Request body${compression?.encoding === "gzip" ? " (original JSON)" : ""}: ${Buffer.byteLength(body, "utf8")} UTF-8 bytes (not context tokens).`;
3408
+ const composition = formatRequestBodyEvidence(dispatch === void 0 ? { state: "unavailable" } : requestBodyEvidence(body, dispatch.protocol), dispatch?.responseHeadersMs, compression);
3406
3409
  const upload = formatRequestUploadEvidence(dispatch?.upload);
3407
- return `${REQUEST_BODY_TIMEOUT_MARKER} ${size} ${composition} ${upload} Native retry policy is unchanged. If retries exhaust, use these numbers to choose an explicit attachment/image-offload budget change or native compaction for compressible history; tool definitions and opaque replay may remain. Also check network/proxy health and GitHub service status. Composition alone does not establish a cause or supplier size limit. A larger client timeout does not change this server timeout. No history was trimmed or model switched.`;
3410
+ return `${REQUEST_BODY_TIMEOUT_MARKER} ${size}${encoding} ${composition} ${upload} Native retry policy is unchanged. If retries exhaust, use these numbers to choose an explicit attachment/image-offload budget change or native compaction for compressible history; tool definitions and opaque replay may remain. Also check network/proxy health and GitHub service status. Composition alone does not establish a cause or supplier size limit. A larger client timeout does not change this server timeout. No history was trimmed or model switched.`;
3411
+ }
3412
+ //#endregion
3413
+ //#region lib/types/responses-request-compression.js
3414
+ const MINIMUM_BODY_BYTES = 262144;
3415
+ const MAXIMUM_WORK_BYTES = 33554432;
3416
+ const MINIMUM_SAVINGS_BYTES = 4096;
3417
+ function skipped(input, init, reason, originalBytes) {
3418
+ return {
3419
+ input,
3420
+ init,
3421
+ applied: false,
3422
+ reason,
3423
+ evidence: {
3424
+ encoding: "identity",
3425
+ reason,
3426
+ ...originalBytes === void 0 ? {} : { originalBytes }
3427
+ },
3428
+ ...originalBytes === void 0 ? {} : { originalBytes }
3429
+ };
3430
+ }
3431
+ function requestUrl(input) {
3432
+ try {
3433
+ return new URL(input instanceof Request ? input.url : input.toString());
3434
+ } catch {
3435
+ return;
3436
+ }
3437
+ }
3438
+ function compress(bytes) {
3439
+ return new Promise((resolve, reject) => {
3440
+ gzip(bytes, { level: constants.Z_BEST_SPEED }, (error, result) => {
3441
+ if (error !== null) reject(error);
3442
+ else resolve(result);
3443
+ });
3444
+ });
3445
+ }
3446
+ function satisfiesCompressionSavings(originalBytes, wireBytes) {
3447
+ const savings = originalBytes - wireBytes;
3448
+ return savings >= MINIMUM_SAVINGS_BYTES && savings * 100 >= originalBytes * 5;
3449
+ }
3450
+ /** Prepares one dispatch without changing the native request when compression is ineligible. */
3451
+ async function prepareResponsesRequest(input, init, accountBaseUrl, enabled, customFetch, signal, api = "openai-responses") {
3452
+ if (!enabled) return skipped(input, init, "disabled");
3453
+ if (api !== "openai-responses") return skipped(input, init, "unsupported-protocol");
3454
+ if (customFetch) return skipped(input, init, "custom-fetch");
3455
+ const url = requestUrl(input);
3456
+ let trustedOrigin;
3457
+ try {
3458
+ const accountUrl = new URL(accountBaseUrl);
3459
+ if (accountUrl.protocol !== "https:" || accountUrl.username !== "" || accountUrl.password !== "" || accountUrl.port !== "" || accountUrl.pathname !== "/" || accountUrl.search !== "" || accountUrl.hash !== "") return skipped(input, init, "untrusted-origin");
3460
+ if (!/^api(?:\.[a-z0-9-]+)*\.githubcopilot\.com$/u.test(accountUrl.hostname)) return skipped(input, init, "untrusted-origin");
3461
+ trustedOrigin = accountUrl.origin;
3462
+ } catch {
3463
+ return skipped(input, init, "untrusted-origin");
3464
+ }
3465
+ if (url === void 0 || url.protocol !== "https:" || url.origin !== trustedOrigin || !/^api(?:\.[a-z0-9-]+)*\.githubcopilot\.com$/u.test(url.hostname) || url.username !== "" || url.password !== "" || url.port !== "" || url.pathname !== "/responses" || url.search !== "" || url.hash !== "") return skipped(input, init, "untrusted-origin");
3466
+ const request = input instanceof Request ? input : void 0;
3467
+ if ((init?.method ?? request?.method ?? "GET").toUpperCase() !== "POST") return skipped(input, init, "unsupported-request");
3468
+ if (typeof init?.body !== "string") return skipped(input, init, "unsupported-body");
3469
+ let headers;
3470
+ try {
3471
+ headers = new Headers(init.headers ?? request?.headers);
3472
+ } catch {
3473
+ return skipped(input, init, "unsupported-request");
3474
+ }
3475
+ if (headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase() !== "application/json") return skipped(input, init, "unsupported-content-type");
3476
+ if (headers.has("content-encoding")) return skipped(input, init, "existing-encoding");
3477
+ if (headers.has("transfer-encoding")) return skipped(input, init, "transfer-encoding");
3478
+ const body = init.body;
3479
+ if (body.length > MAXIMUM_WORK_BYTES) return skipped(input, init, "work-limit");
3480
+ if (body.length < Math.ceil(MINIMUM_BODY_BYTES / 3)) return skipped(input, init, "below-minimum");
3481
+ const originalBytes = Buffer.byteLength(body, "utf8");
3482
+ if (originalBytes > MAXIMUM_WORK_BYTES) return skipped(input, init, "work-limit", originalBytes);
3483
+ if (originalBytes < MINIMUM_BODY_BYTES) return skipped(input, init, "below-minimum", originalBytes);
3484
+ const contentLength = headers.get("content-length");
3485
+ if (contentLength !== null) {
3486
+ const parsedLength = /^\d+$/u.test(contentLength) ? Number(contentLength) : NaN;
3487
+ if (!Number.isSafeInteger(parsedLength) || parsedLength !== originalBytes) return skipped(input, init, "invalid-content-length", originalBytes);
3488
+ }
3489
+ if (signal?.aborted) return skipped(input, init, "aborted", originalBytes);
3490
+ let compressed;
3491
+ try {
3492
+ compressed = await compress(Buffer.from(body, "utf8"));
3493
+ } catch {
3494
+ return skipped(input, init, "compression-failed", originalBytes);
3495
+ }
3496
+ if (signal?.aborted) return skipped(input, init, "aborted", originalBytes);
3497
+ const wireBytes = compressed.byteLength;
3498
+ if (!satisfiesCompressionSavings(originalBytes, wireBytes)) return skipped(input, init, "not-beneficial", originalBytes);
3499
+ headers.set("content-encoding", "gzip");
3500
+ headers.set("content-length", String(wireBytes));
3501
+ return {
3502
+ input,
3503
+ init: {
3504
+ ...init,
3505
+ body: new Uint8Array(compressed),
3506
+ headers
3507
+ },
3508
+ applied: true,
3509
+ evidence: {
3510
+ encoding: "gzip",
3511
+ reason: "compressed",
3512
+ originalBytes,
3513
+ wireBytes
3514
+ },
3515
+ originalBytes,
3516
+ wireBytes
3517
+ };
3408
3518
  }
3409
3519
  //#endregion
3410
3520
  //#region lib/types/copilot-stream-liveness.js
@@ -3751,18 +3861,35 @@ function createAccountProvider(descriptors, guard, baseURL) {
3751
3861
  const observeResponse = async (input, init) => {
3752
3862
  guard.requestCheckpoint?.();
3753
3863
  guard.onRequestBodyTimeout?.(void 0);
3754
- liveness?.beginRequest(typeof init?.body === "string" ? init.body : void 0);
3864
+ const originalBody = typeof init?.body === "string" ? init.body : void 0;
3755
3865
  const replayHeaders = responses && init?.headers !== void 0 ? new Headers(init.headers) : void 0;
3756
3866
  const replayDispatch = responses ? {
3757
- body: typeof init?.body === "string" ? init.body : void 0,
3867
+ body: originalBody,
3758
3868
  sessionHeader: replayHeaders?.has("session_id"),
3759
3869
  clientRequestHeader: replayHeaders?.has("x-client-request-id")
3760
3870
  } : void 0;
3871
+ let dispatchInput = input;
3872
+ let dispatchInit = init;
3873
+ let compression;
3874
+ if (responses && guard.responsesRequestCompression === true) {
3875
+ const signals = [lease.signal];
3876
+ if (options.signal != null) signals.push(options.signal);
3877
+ if (init?.signal != null) signals.push(init.signal);
3878
+ const signal = AbortSignal.any(signals);
3879
+ const prepared = await prepareResponsesRequest(input, init, model.baseUrl, true, options.fetch !== void 0, signal, entry.api);
3880
+ guard.assertActive();
3881
+ guard.requestCheckpoint?.();
3882
+ signal.throwIfAborted();
3883
+ dispatchInput = prepared.input;
3884
+ dispatchInit = prepared.init;
3885
+ compression = prepared.evidence;
3886
+ }
3887
+ liveness?.beginRequest(originalBody);
3761
3888
  let response;
3762
3889
  const upload = guard.onRequestBodyTimeout === void 0 ? void 0 : createRequestUploadObserver();
3763
3890
  const startedAt = performance.now();
3764
3891
  try {
3765
- response = await (upload === void 0 ? fetch(input, init) : upload.run(() => fetch(input, init)));
3892
+ response = await (upload === void 0 ? fetch(dispatchInput, dispatchInit) : upload.run(() => fetch(dispatchInput, dispatchInit)));
3766
3893
  } catch (error) {
3767
3894
  retry?.observe(void 0, 0);
3768
3895
  throw error;
@@ -3770,12 +3897,13 @@ function createAccountProvider(descriptors, guard, baseURL) {
3770
3897
  upload?.close();
3771
3898
  }
3772
3899
  const responseHeadersMs = performance.now() - startedAt;
3773
- retry?.observe(typeof init?.body === "string" ? init.body : void 0, response.status);
3900
+ retry?.observe(originalBody, response.status);
3774
3901
  if (response.status === 408 && guard.onRequestBodyTimeout !== void 0) {
3775
- const diagnostic = await requestBodyTimeoutDiagnostic(response, typeof init?.body === "string" ? init.body : void 0, lease.signal, {
3902
+ const diagnostic = await requestBodyTimeoutDiagnostic(response, originalBody, lease.signal, {
3776
3903
  protocol: entry.api,
3777
3904
  responseHeadersMs,
3778
- ...upload === void 0 ? {} : { upload: upload.snapshot() }
3905
+ ...upload === void 0 ? {} : { upload: upload.snapshot() },
3906
+ ...compression === void 0 ? {} : { compression }
3779
3907
  });
3780
3908
  if (!lease.signal.aborted && !options.signal?.aborted) guard.onRequestBodyTimeout(diagnostic);
3781
3909
  }
@@ -6535,6 +6663,7 @@ const Config = z$1.object({
6535
6663
  chatStreamIdleTimeoutMs: z$1.number().step(1).min(1).max(MAX_TIMEOUT_MS).default(3e5),
6536
6664
  chatStreamLiveness: z$1.boolean().default(true),
6537
6665
  chatMaxRequestImageBytes: z$1.number().step(1).min(1).max(Number.MAX_SAFE_INTEGER).default(20971520),
6666
+ responsesRequestCompression: z$1.boolean().default(false),
6538
6667
  probe: z$1.boolean().default(true),
6539
6668
  probeTimeoutMs: z$1.number().step(1).min(1).max(MAX_TIMEOUT_MS).default(3e4),
6540
6669
  accountModelTtlMs: z$1.number().step(1).min(0).max(MAX_TIMEOUT_MS).default(864e5),
@@ -13183,6 +13312,7 @@ function createAccountRuntime(ctx, config, binding, exclusionTurns, replayRecove
13183
13312
  const guard = {
13184
13313
  ...lifetime.guard(lease),
13185
13314
  ...hooks,
13315
+ responsesRequestCompression: settings?.responsesRequestCompression === true && (template.transport === void 0 || template.transport === "sse"),
13186
13316
  onReplayFailure(error) {
13187
13317
  if (error.dispatchEvidence !== void 0) ctx.logger.warn(`[github-copilot] ${error.dispatchEvidence}`);
13188
13318
  hooks.onReplayFailure?.(error);
@@ -33,6 +33,8 @@ export interface InlineConfig {
33
33
  chatStreamLiveness?: boolean;
34
34
  /** Native request image projection budget; changing it can offload older images. */
35
35
  chatMaxRequestImageBytes?: number;
36
+ /** Default-off lossless gzip for eligible managed Responses HTTP requests. */
37
+ responsesRequestCompression?: boolean;
36
38
  /** Verify the endpoint executes native search before serving. */
37
39
  probe: boolean;
38
40
  /** Bound on one probe request, in milliseconds. */
@@ -5,6 +5,7 @@ export declare function DiagnosticsCard({ remote }: {
5
5
  remote?: DiagnosticsRemote;
6
6
  }): import("react").DetailedReactHTMLElement<{
7
7
  'aria-label': string;
8
+ 'data-copilot-native-ui': boolean;
8
9
  style: CSSProperties;
9
10
  }, HTMLElement>;
10
11
  //# sourceMappingURL=diagnostics-card.d.ts.map
@@ -0,0 +1,10 @@
1
+ import type { CSSProperties } from 'react';
2
+ export declare const nativeSettingsStyle: CSSProperties;
3
+ export declare const nativeHeadingStyle: CSSProperties;
4
+ export declare const nativeCaptionStyle: CSSProperties;
5
+ export declare const nativeButtonStyle: CSSProperties;
6
+ export declare const nativeCompactButtonStyle: CSSProperties;
7
+ export declare const nativeInputStyle: CSSProperties;
8
+ export declare const nativeCardStyle: CSSProperties;
9
+ export declare const nativeSettingsCss = "\n[data-copilot-native-ui] :is(h3, strong, th) { font-weight: 500; }\n[data-copilot-native-ui] button:not(:disabled):hover {\n background: var(--dsw-alias-interactive-bg-hover, var(--dsw-specific-settings-secondary-hover-solid, ButtonFace));\n}\n[data-copilot-native-ui] :is(button, input, select, textarea, summary, a):focus-visible {\n outline: 2px solid var(--dsw-focus-ring-color, Highlight); outline-offset: 2px;\n}\n[data-copilot-native-ui] :is(button, input, select, textarea):disabled { opacity: 0.4; cursor: not-allowed; }\n[data-copilot-native-ui] summary {\n width: fit-content; max-width: 100%; padding: 2px 4px; margin-left: -4px;\n border-radius: var(--dsw-radius-sm, 8px); cursor: pointer;\n font-size: 12px; line-height: 18px; font-weight: 500;\n color: var(--dsw-alias-label-secondary, GrayText); list-style: none;\n}\n[data-copilot-native-ui] summary::-webkit-details-marker { display: none; }\n[data-copilot-native-ui] summary::before {\n content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 8px;\n border-right: 1px solid currentColor; border-bottom: 1px solid currentColor;\n transform: rotate(-45deg); transition: transform 120ms ease;\n}\n[data-copilot-native-ui] details[open] > summary::before,\n[data-copilot-native-ui][open] > summary::before { transform: rotate(45deg); }\n[data-copilot-native-ui] summary:hover { background: var(--dsw-alias-interactive-bg-hover, ButtonFace); }\n@media (prefers-reduced-motion: reduce) {\n [data-copilot-native-ui] summary::before { transition: none; }\n}\n";
10
+ //# sourceMappingURL=native-settings-style.d.ts.map
@@ -1,4 +1,5 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
+ import type { ReactElement } from 'react';
2
3
  type Settings = Context['remote']['settings'];
3
4
  interface Snapshot {
4
5
  enabled: boolean;
@@ -26,16 +27,6 @@ export declare function saveParentFollowSettings(settings: Settings, saved: Snap
26
27
  next: number;
27
28
  };
28
29
  }>;
29
- export declare function ParentModelFollowCard({ settings, onSaved }: Props): import("react").DetailedReactHTMLElement<{
30
- 'data-dsh-parent-model-follow': boolean;
31
- 'aria-busy': boolean;
32
- style: {
33
- padding: string;
34
- marginTop: string;
35
- display: "grid";
36
- gap: string;
37
- minWidth: number;
38
- };
39
- }, HTMLElement>;
30
+ export declare function ParentModelFollowCard({ settings, onSaved }: Props): ReactElement;
40
31
  export {};
41
32
  //# sourceMappingURL=parent-model-follow-card.d.ts.map
@@ -35,6 +35,8 @@ export interface PreviewProviderGuard {
35
35
  }
36
36
  /** Guard for one selected model in an account-bound descriptor snapshot. */
37
37
  export interface AccountProviderGuard extends PreviewProviderGuard {
38
+ /** Explicit lossless HTTP encoding; default-off and independent of context admission. */
39
+ readonly responsesRequestCompression?: boolean;
38
40
  /** Explicit, request-admitted recovery; absent by default. */
39
41
  recoverReplay?(payload: unknown): unknown;
40
42
  /** Only exact verified scope HTTP failures may offer recovery evidence. */
@@ -9,7 +9,7 @@ import type { RequestBudgetPolicy } from './request-budget.ts';
9
9
  /** Safe request knobs; identities, model tables, endpoints and credentials are not configurable. */
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
- readonly chatRequestSettings?: () => Pick<InlineConfig, 'chatStreamIdleTimeoutMs' | 'chatStreamLiveness' | 'chatMaxRequestImageBytes'>;
12
+ readonly chatRequestSettings?: () => Pick<InlineConfig, 'chatStreamIdleTimeoutMs' | 'chatStreamLiveness' | 'chatMaxRequestImageBytes' | 'responsesRequestCompression'>;
13
13
  readonly accountModelSettings?: () => Pick<InlineConfig, 'accountModelTtlMs' | 'accountModelFailureCooldownMs' | 'excludedModelIds' | 'highCostModelIds' | 'parentModelFollow' | 'followParentModel' | 'autoSemanticAssessment' | 'autoAllocationEvidence'>;
14
14
  readonly requestBudget?: Partial<RequestBudgetPolicy>;
15
15
  readonly requestBudgetSettings?: () => Partial<RequestBudgetPolicy>;
@@ -1,4 +1,5 @@
1
1
  import type { RequestUploadEvidence } from './request-upload-evidence.ts';
2
+ import type { RequestCompressionEvidence } from './responses-request-compression.ts';
2
3
  export type RequestBodyProtocol = 'openai-responses' | 'openai-completions' | 'anthropic-messages';
3
4
  export declare const REQUEST_BODY_EVIDENCE_LIMITS: Readonly<{
4
5
  bytes: number;
@@ -27,8 +28,9 @@ export interface RequestBodyDispatchEvidence {
27
28
  /** Fetch invocation to response headers, not upload duration or clone-observation time. */
28
29
  readonly responseHeadersMs: number;
29
30
  readonly upload?: RequestUploadEvidence;
31
+ readonly compression?: RequestCompressionEvidence;
30
32
  }
31
- export declare function formatRequestBodyEvidence(evidence: RequestBodyEvidence, responseHeadersMs?: number): string;
33
+ export declare function formatRequestBodyEvidence(evidence: RequestBodyEvidence, responseHeadersMs?: number, compression?: RequestCompressionEvidence): string;
32
34
  /** Diagnostic-only traversal of the original JSON spans; never reserializes or changes a request. */
33
35
  export declare function requestBodyEvidence(body: string | undefined, protocol: RequestBodyProtocol): RequestBodyEvidence;
34
36
  //# sourceMappingURL=request-body-evidence.d.ts.map
@@ -0,0 +1,33 @@
1
+ export type ResponsesCompressionSkipReason = 'disabled' | 'unsupported-protocol' | 'custom-fetch' | 'untrusted-origin' | 'unsupported-request' | 'unsupported-body' | 'unsupported-content-type' | 'existing-encoding' | 'transfer-encoding' | 'invalid-content-length' | 'below-minimum' | 'work-limit' | 'not-beneficial' | 'compression-failed' | 'aborted';
2
+ export type RequestCompressionEvidence = {
3
+ readonly encoding: 'identity';
4
+ readonly reason: ResponsesCompressionSkipReason;
5
+ readonly originalBytes?: number;
6
+ } | {
7
+ readonly encoding: 'gzip';
8
+ readonly reason: 'compressed';
9
+ readonly originalBytes: number;
10
+ readonly wireBytes: number;
11
+ };
12
+ type PreparedRequest = {
13
+ readonly input: RequestInfo | URL;
14
+ readonly init: RequestInit | undefined;
15
+ readonly evidence: RequestCompressionEvidence;
16
+ };
17
+ export type PreparedResponsesRequest = (PreparedRequest & {
18
+ readonly applied: false;
19
+ readonly reason: ResponsesCompressionSkipReason;
20
+ readonly originalBytes?: number;
21
+ }) | (PreparedRequest & {
22
+ readonly applied: true;
23
+ readonly evidence: Extract<RequestCompressionEvidence, {
24
+ encoding: 'gzip';
25
+ }>;
26
+ readonly originalBytes: number;
27
+ readonly wireBytes: number;
28
+ });
29
+ export declare function satisfiesCompressionSavings(originalBytes: number, wireBytes: number): boolean;
30
+ /** Prepares one dispatch without changing the native request when compression is ineligible. */
31
+ export declare function prepareResponsesRequest(input: RequestInfo | URL, init: RequestInit | undefined, accountBaseUrl: string, enabled: boolean, customFetch: boolean, signal?: AbortSignal, api?: string): Promise<PreparedResponsesRequest>;
32
+ export {};
33
+ //# sourceMappingURL=responses-request-compression.d.ts.map
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.124",
4
+ "version": "0.4.0-alpha.126",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "registry": "https://registry.npmjs.org/",