dsh-github-copilot 0.4.0-alpha.27 → 0.4.0-alpha.29

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.
@@ -0,0 +1,23 @@
1
+ /** Local Copilot pressure signalling over the stock compaction recovery path. */
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ import type { GenerateOptions } from '@deepseek-ai/dsh-llm';
4
+ /** Conservative input threshold already resolved from authenticated model facts and current policy. */
5
+ export interface CopilotCompactionPressureBudget {
6
+ readonly inputBudgetTokens: number;
7
+ }
8
+ /** Snapshot access belongs to the account route; pressure signalling never starts discovery. */
9
+ export interface CopilotCompactionPressureCallbacks {
10
+ /** Return the exact owned request's current budget, or undefined when disabled or unavailable. */
11
+ resolve(request: GenerateOptions): CopilotCompactionPressureBudget | undefined;
12
+ }
13
+ /**
14
+ * Request a stock overflow reduction before sending an estimated over-budget
15
+ * conversation. The loop has already logged and frozen this exact request;
16
+ * only its owner can rebuild it after a durable compaction. Never rewrite the
17
+ * request, invoke compaction concurrently, or intercept auxiliary summaries.
18
+ * @param ctx - Host context owning the reversible stream listener.
19
+ * @param callbacks - synchronous authenticated budget lookup, without discovery.
20
+ * @returns disposer for the listener, also owned by its Cordis context.
21
+ */
22
+ export declare function installCopilotCompactionPressure(ctx: Context, callbacks: CopilotCompactionPressureCallbacks): () => void;
23
+ //# sourceMappingURL=compaction-pressure.d.ts.map
@@ -5,6 +5,7 @@
5
5
  * @module dsh-github-copilot/config
6
6
  */
7
7
  import z from '@deepseek-ai/schemastery';
8
+ import type { RequestBudgetPolicy } from './request-budget.ts';
8
9
  /** Plugin configuration. Defaults make the current chat route decide. */
9
10
  export interface InlineConfig {
10
11
  /** Master switch; false sends every request down the normal adapter path. */
@@ -28,11 +29,17 @@ export interface InlineConfig {
28
29
  accountModelTtlMs?: number;
29
30
  /** Minimum delay after failed passive discovery; explicit Refresh bypasses it. */
30
31
  accountModelFailureCooldownMs?: number;
32
+ /** Estimated managed-route input headroom, separate from truthful catalog capacities. */
33
+ requestBudgetSafetyTokens?: number;
34
+ /** Fraction of admissible input used by eligible automatic-compaction requests. */
35
+ requestBudgetPressureRatio?: number;
36
+ /** Supported low effort only for summary calls with no already resolved effort. */
37
+ compactionReasoning?: RequestBudgetPolicy['compactionReasoning'];
31
38
  /** Route the official web-search consumer by initiating Session when the bundle isolate is mounted. */
32
39
  routeWebSearch?: boolean;
33
40
  /** Automatic fallback, disclosed in results; no per-search approval dialog. */
34
41
  searchFallback?: 'none' | 'deepseek';
35
- /** Copilot model used when `github-copilot-hosted` serves independently of the initiating chat model. */
42
+ /** Optional authoritative legacy override; otherwise hosted search resolves bounded account-owned candidates independently of Chat. */
36
43
  searchModel?: string;
37
44
  /** Internal JSON backup of route leaves temporarily owned by the GPT-6 overlay. */
38
45
  temporaryRouteBackup?: string;
@@ -1,4 +1,4 @@
1
- import type { Api, Model, StreamOptions } from '@earendil-works/pi-ai';
1
+ import type { Api, Context as PiContext, Model, StreamOptions } from '@earendil-works/pi-ai';
2
2
  import type { AccountModelApi, AccountModelDescriptor } from './account-model-catalog.ts';
3
3
  import type { CoreCompatibleProvider } from './pi-provider-bridge.ts';
4
4
  import type { GitHubCopilotOAuthCredential } from './copilot-grant.ts';
@@ -15,6 +15,8 @@ export interface PreviewProviderGuard {
15
15
  /** Guard for one selected model in an account-bound descriptor snapshot. */
16
16
  export interface AccountProviderGuard extends PreviewProviderGuard {
17
17
  readonly selectedModelId?: string;
18
+ /** Per-dispatch admission after native context conversion, before starting a model wire. */
19
+ inspectRequest?(model: Model<Api>, context: PiContext, options?: StreamOptions): void;
18
20
  assertEntitled(credential: GitHubCopilotOAuthCredential, modelId: string): void;
19
21
  }
20
22
  /** The independent prompt limit is retained for the route's budget guard, not folded into context capacity. */
@@ -4,9 +4,12 @@ import { GITHUB_COPILOT_PREVIEW_PROVIDER_ID } from './copilot-identity.ts';
4
4
  import type { AccountModelLoadOptions } from './account-model-source.ts';
5
5
  import type { AccountModelRejection } from './account-model-catalog.ts';
6
6
  import type { InlineConfig } from './config.ts';
7
+ import type { RequestBudgetPolicy } from './request-budget.ts';
7
8
  /** Safe request knobs; identities, model tables, endpoints and credentials are not configurable. */
8
9
  export type PreviewRouteConfig = Pick<PiAiProviderProfile, 'reasoning' | 'cacheRetention' | 'transport' | 'timeoutMs' | 'websocketConnectTimeoutMs' | 'streamIdleTimeoutMs' | 'maxRequestImageBytes' | 'requestImagePixelBudget' | 'requestImageMaxBytes' | 'retryPolicy'> & Pick<InlineConfig, 'accountModelTtlMs' | 'accountModelFailureCooldownMs'> & {
9
10
  readonly accountModelSettings?: () => Pick<InlineConfig, 'accountModelTtlMs' | 'accountModelFailureCooldownMs'>;
11
+ readonly requestBudget?: Partial<RequestBudgetPolicy>;
12
+ readonly requestBudgetSettings?: () => Partial<RequestBudgetPolicy>;
10
13
  };
11
14
  export interface GitHubCopilotPreviewView {
12
15
  readonly provider: typeof GITHUB_COPILOT_PREVIEW_PROVIDER_ID;
@@ -0,0 +1,58 @@
1
+ import type { AccountModelDescriptor } from './account-model-catalog.ts';
2
+ /** Managed-route admission and compaction defaults; these never replace catalog capacities. */
3
+ export interface RequestBudgetPolicy {
4
+ /** Estimated framing/tokenization headroom deducted from admissible input, once. */
5
+ readonly safetyTokens: number;
6
+ /** Fraction of hard input headroom used only by callers eligible for proactive compaction. */
7
+ readonly pressureRatio: number;
8
+ /** Used only for compaction with no caller or adapter-resolved effort. */
9
+ readonly compactionReasoning: 'prefer-low' | 'preserve';
10
+ }
11
+ /** The safety allowance matches the pinned native SDK; pressure is a separate opt-in check. */
12
+ export declare const DEFAULT_REQUEST_BUDGET_POLICY: Readonly<RequestBudgetPolicy>;
13
+ /** Validate deployment policy before applying defaults; unknown keys fail rather than silently drift. */
14
+ export declare function resolveRequestBudgetPolicy(config?: Partial<RequestBudgetPolicy>): Readonly<RequestBudgetPolicy>;
15
+ export type RequestBudgetLimits = Pick<AccountModelDescriptor, 'contextWindow' | 'maxInputTokens' | 'maxTokens'>;
16
+ /** A detached operational budget alongside, not in place of, the supplier capacities. */
17
+ export interface RequestBudget {
18
+ readonly contextWindow: number;
19
+ readonly maxInputTokens?: number;
20
+ readonly maxOutputTokens: number;
21
+ /** Explicit request cap, or the model's output capability when the request omits one. */
22
+ readonly outputReservation: number;
23
+ readonly hardInputLimit: number;
24
+ readonly pressureInputLimit: number;
25
+ readonly limitingFactor: 'prompt' | 'context';
26
+ }
27
+ export type RequestBudgetFailureCode = 'COPILOT_REQUEST_INVALID_LIMITS' | 'COPILOT_REQUEST_INVALID_OUTPUT_LIMIT' | 'COPILOT_REQUEST_OUTPUT_LIMIT_EXCEEDED' | 'COPILOT_REQUEST_NO_INPUT_HEADROOM' | 'COPILOT_REQUEST_INVALID_ESTIMATE' | 'COPILOT_REQUEST_INPUT_LIMIT_EXCEEDED' | 'COPILOT_REQUEST_CONTEXT_LIMIT_EXCEEDED' | 'COPILOT_REQUEST_PRESSURE_EXCEEDED';
28
+ /** Owned diagnostics only; no credentials, request content, or provider error bodies. */
29
+ export interface RequestBudgetFailure {
30
+ readonly ok: false;
31
+ readonly code: RequestBudgetFailureCode;
32
+ readonly message: string;
33
+ }
34
+ export type RequestBudgetResult = Readonly<{
35
+ ok: true;
36
+ budget: Readonly<RequestBudget>;
37
+ }> | RequestBudgetFailure;
38
+ export type RequestBudgetAdmission = Readonly<{
39
+ ok: true;
40
+ }> | RequestBudgetFailure;
41
+ /**
42
+ * Reserve output under the combined context and independently enforce the prompt ceiling.
43
+ * `policy` must come from resolveRequestBudgetPolicy; no caller cap or catalog object is changed.
44
+ */
45
+ export declare function calculateRequestBudget(limits: RequestBudgetLimits, requestedMaxTokens?: number, policy?: Readonly<RequestBudgetPolicy>): RequestBudgetResult;
46
+ /**
47
+ * Check an estimated full prompt; estimates are not provider-exact token counts.
48
+ * Enable pressure only for an owned ordinary loop call with a compaction recovery path.
49
+ * Auxiliary and agentless calls use hard admission, including compaction itself.
50
+ */
51
+ export declare function assessRequestBudget(estimatedInput: number, budget: Readonly<RequestBudget>, pressure?: boolean): RequestBudgetAdmission;
52
+ /**
53
+ * Select a low-cost supported effort only for a caller-confirmed compaction request.
54
+ * A supplied effort, including a materialized provider default, wins unchanged; native validation
55
+ * remains authoritative. Unsupported low-cost controls preserve the provider default, never off/none.
56
+ */
57
+ export declare function selectCompactionReasoning<Effort extends string>(supportedEfforts: readonly Effort[], requestedEffort?: Effort, mode?: RequestBudgetPolicy['compactionReasoning']): Effort | undefined;
58
+ //# sourceMappingURL=request-budget.d.ts.map
@@ -2,10 +2,9 @@ import type { Context as ClientContext } from '@deepseek-ai/cordis';
2
2
  import type { ReactElement } from 'react';
3
3
  interface SearchRoutingCardProps {
4
4
  readonly settings: ClientContext['remote']['settings'];
5
- readonly copilot: ClientContext['remote']['githubCopilot'];
6
5
  readonly routing: ClientContext['remote']['githubCopilotSearchRouting'];
7
6
  }
8
- /** Provider-level primary and final fallback; model choice stays with each provider. */
7
+ /** Save provider routing independently of account discovery and provider-specific model settings. */
9
8
  export declare function WebSearchRoutingCard(props: SearchRoutingCardProps): ReactElement;
10
9
  export {};
11
10
  //# sourceMappingURL=web-search-routing-card.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.27",
4
+ "version": "0.4.0-alpha.29",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "registry": "https://registry.npmjs.org/",
@@ -55,6 +55,7 @@
55
55
  "docs/npm-distribution.md",
56
56
  "docs/dual-model.md",
57
57
  "docs/official-first-016-alpha2.md",
58
+ "docs/copilot-compaction.md",
58
59
  "docs/images/dual-model-provenance.json",
59
60
  "scripts/check-search-composition.mjs",
60
61
  "docs/images/"