dsh-github-copilot 0.4.2-alpha.11 → 0.4.2-alpha.12

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.
@@ -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-qvtuvM5E.js";
1
+ import { a as DiagnosticsPendingSchema, c as DiagnosticsViewSchema, n as DIAGNOSTICS_OPERATIONS, r as DIAGNOSTICS_REASONS, s as DiagnosticsSnapshotSchema } from "./diagnostics-types-DEo3UrOO.js";
2
2
  import { z } from "zod";
3
3
  //#region lib/types/diagnostics-analysis.js
4
4
  const RETENTION_MS = 12096e5;
@@ -48,8 +48,12 @@ function excludedModelSet(value) {
48
48
  }
49
49
  //#endregion
50
50
  //#region lib/types/auto-allocation.js
51
- const AUTO_ALLOCATION_POLICIES = ["high-cost-v1", "high-cost-v2"];
52
- const AUTO_ALLOCATION_POLICY = "high-cost-v2";
51
+ const AUTO_ALLOCATION_POLICIES = [
52
+ "high-cost-v1",
53
+ "high-cost-v2",
54
+ "high-cost-v3"
55
+ ];
56
+ const AUTO_ALLOCATION_POLICY = "high-cost-v3";
53
57
  const AutoAllocationSchema = z.object({
54
58
  policyVersion: z.enum(AUTO_ALLOCATION_POLICIES),
55
59
  deferredHighCostCount: z.number().int().min(0).max(511).optional(),
@@ -64,7 +68,8 @@ const AutoAllocationSchema = z.object({
64
68
  }).strict().refine((value) => {
65
69
  const total = value.candidates.reduce((sum, row) => sum + row.weight, 0);
66
70
  const legacy = value.policyVersion === "high-cost-v1";
67
- return (legacy ? value.deferredHighCostCount === void 0 : value.deferredHighCostCount !== void 0 && value.candidates.length + value.deferredHighCostCount <= 512 && value.candidates.every((row) => row.highCost === value.candidates[0].highCost) && (!value.candidates[0].highCost || value.deferredHighCostCount === 0)) && new Set(value.candidates.map((row) => row.modelId)).size === value.candidates.length && value.candidates.some((row) => row.modelId === value.selectedModelId) && value.candidates.filter((row) => row.previous).length <= 1 && value.candidates.every((row) => row.weight === (row.highCost ? 2 : 10) * (row.previous && (legacy || !row.highCost) ? 1.5 : 1) / 10 && Math.abs(row.expectedShare - row.weight / total) <= 1e-12);
71
+ const decay = value.policyVersion === "high-cost-v3";
72
+ return (legacy || decay ? value.deferredHighCostCount === void 0 : value.deferredHighCostCount !== void 0 && value.candidates.length + value.deferredHighCostCount <= 512 && value.candidates.every((row) => row.highCost === value.candidates[0].highCost) && (!value.candidates[0].highCost || value.deferredHighCostCount === 0)) && new Set(value.candidates.map((row) => row.modelId)).size === value.candidates.length && value.candidates.some((row) => row.modelId === value.selectedModelId) && value.candidates.filter((row) => row.previous).length <= 1 && value.candidates.every((row) => row.weight === (decay && row.highCost && row.previous ? 2 : (row.highCost ? 20 : 100) * (row.previous && (legacy || !row.highCost) ? 1.5 : 1)) / 100 && Math.abs(row.expectedShare - row.weight / total) <= 1e-12);
68
73
  }, { message: "Invalid allocation policy evidence" });
69
74
  function normalizeHighCostModelIds(value) {
70
75
  try {
@@ -78,12 +83,10 @@ function normalizeHighCostModelIds(value) {
78
83
  function allocateAutoModel(pool, highCostModelIds, previousModelId, seed) {
79
84
  if (!Number.isSafeInteger(seed) || pool.length === 0 || pool.length > 512 || normalizeExcludedModelIds(pool.map((model) => model.id)).length !== pool.length) throw new Error("COPILOT_AUTO_ALLOCATION_INVALID");
80
85
  const marked = new Set(normalizeHighCostModelIds(highCostModelIds));
81
- const unmarked = pool.filter((model) => !marked.has(model.id));
82
- const participating = unmarked.length > 0 ? unmarked : pool;
83
- const rows = participating.map((model) => {
86
+ const rows = pool.map((model) => {
84
87
  const highCost = marked.has(model.id);
85
88
  const previous = model.id === previousModelId;
86
- const units = (highCost ? 2 : 10) * (previous && !highCost ? 1.5 : 1);
89
+ const units = highCost ? previous ? 2 : 20 : previous ? 150 : 100;
87
90
  return {
88
91
  modelId: model.id,
89
92
  highCost,
@@ -103,11 +106,10 @@ function allocateAutoModel(pool, highCostModelIds, previousModelId, seed) {
103
106
  });
104
107
  return Object.freeze({
105
108
  policyVersion: AUTO_ALLOCATION_POLICY,
106
- deferredHighCostCount: pool.length - participating.length,
107
109
  selectedModelId: selected.modelId,
108
110
  candidates: Object.freeze(rows.map(({ units, ...row }) => Object.freeze({
109
111
  ...row,
110
- weight: units / 10,
112
+ weight: units / 100,
111
113
  expectedShare: units / total
112
114
  })))
113
115
  });
@@ -254,7 +256,7 @@ var AutoAllocationDiagnosticsCollector = class {
254
256
  this.data.observationStart = this.data.observationStart === null ? day : Math.min(this.data.observationStart, day);
255
257
  this.data.observationEnd = this.data.observationEnd === null ? day : Math.max(this.data.observationEnd, day);
256
258
  if (explanation.method === "no-fit") {
257
- const row = this.data.noFitRows.find((item) => item.day === day && item.version === this.version && item.policyVersion === "high-cost-v2" && item.targetCategory === explanation.targetCategory && item.category === explanation.selectedCategory && item.demand === explanation.assessment.demand && item.assessmentSource === explanation.assessment.source && item.assessmentOutcome === outcome);
259
+ const row = this.data.noFitRows.find((item) => item.day === day && item.version === this.version && item.policyVersion === "high-cost-v3" && item.targetCategory === explanation.targetCategory && item.category === explanation.selectedCategory && item.demand === explanation.assessment.demand && item.assessmentSource === explanation.assessment.source && item.assessmentOutcome === outcome);
258
260
  if (row) row.decisions = this.add(row.decisions, 1);
259
261
  else if (this.data.rows.length + this.data.noFitRows.length < 1024) this.data.noFitRows.push({
260
262
  day,
@@ -277,7 +279,7 @@ var AutoAllocationDiagnosticsCollector = class {
277
279
  }
278
280
  if (explanation.method !== "weighted-distribution" && explanation.method !== "only-candidate") return;
279
281
  const parsed = AutoAllocationSchema.safeParse(explanation.allocation);
280
- if (!parsed.success || parsed.data.policyVersion !== "high-cost-v2") {
282
+ if (!parsed.success || parsed.data.policyVersion !== "high-cost-v3") {
281
283
  this.data.dropped = this.add(this.data.dropped, 1);
282
284
  this.changed();
283
285
  return;
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as GITHUB_COPILOT_PREVIEW_PROVIDER_ID, i as GITHUB_COPILOT_CREDENTIAL_KEY, n as GITHUB_COPILOT_AUTO_INTELLIGENCE_MODEL_ID, o as GITHUB_COPILOT_PROVIDER_ID, r as GITHUB_COPILOT_AUTO_MODEL_ID, s as autoModelPreference, t as GITHUB_COPILOT_AUTO_EFFICIENCY_MODEL_ID } from "./copilot-identity-DRZY_d2X.js";
2
- import { C as excludedModelSet, S as ModelExclusionTurns, _ as AUTO_ALLOCATION_POLICIES, b as allocateAutoModel, c as DiagnosticsViewSchema, d as diagnosticsReason, f as CredentialChangeSchema, g as emptyAutoAllocationDiagnostics, h as AutoAllocationDiagnosticsCollector, i as DIAGNOSTICS_RETENTION_MS, l as diagnosticsBucket, m as RequestDiagnosticSchema, o as DiagnosticsRowSchema, p as REQUEST_DIAGNOSTICS_RETENTION_MS, s as DiagnosticsSnapshotSchema, u as diagnosticsOutcome, v as AUTO_ALLOCATION_POLICY, w as normalizeExcludedModelIds, x as normalizeHighCostModelIds, y as AutoAllocationSchema } from "./diagnostics-types-qvtuvM5E.js";
2
+ import { C as excludedModelSet, S as ModelExclusionTurns, _ as AUTO_ALLOCATION_POLICIES, b as allocateAutoModel, c as DiagnosticsViewSchema, d as diagnosticsReason, f as CredentialChangeSchema, g as emptyAutoAllocationDiagnostics, h as AutoAllocationDiagnosticsCollector, i as DIAGNOSTICS_RETENTION_MS, l as diagnosticsBucket, m as RequestDiagnosticSchema, o as DiagnosticsRowSchema, p as REQUEST_DIAGNOSTICS_RETENTION_MS, s as DiagnosticsSnapshotSchema, u as diagnosticsOutcome, v as AUTO_ALLOCATION_POLICY, w as normalizeExcludedModelIds, x as normalizeHighCostModelIds, y as AutoAllocationSchema } from "./diagnostics-types-DEo3UrOO.js";
3
3
  import { C as providerErrorMessage, D as onSettingsNamespaceUpdated, E as readCopilotCatalog, O as readConfigValue, S as isAbortError, T as isPluginPreviewProvider, _ as sameCandidates, a as COPILOT_HOSTED_SEARCH_PROVIDER_ID, b as currentSearchSelection, c as applyRequestAuth, d as ANTHROPIC_WEB_SEARCH_TOOL_TYPE, f as GITHUB_COPILOT_CREDENTIAL_KEY$1, g as candidatesForRoute, h as WEB_SEARCH_TOOL_TYPE, i as describeSearchBackend, k as readSettingsNamespace, l as normalizeRequestAuth, m as SearchPlan, n as routeSessionSearch, o as GITHUB_COPILOT_HOSTED_SEARCH_PROVIDER_ID, p as RESPONSES_WEB_SEARCH_TOOL_TYPE, r as DescribedSearchFallbackError, s as createTraditionalSearchProvider, t as isCopilotSearchSelection, u as providerRequestHeaders, v as currentChatRoute, w as readBounded, x as abortable$1, y as currentSearchInitiator } from "./search-routing-CV2hs8as.js";
4
4
  import { a as selectCompactionReasoning, i as resolveRequestBudgetPolicy, n as assessRequestBudget, r as calculateRequestBudget, t as DEFAULT_REQUEST_BUDGET_POLICY } from "./request-budget-DLY_aRq0.js";
5
5
  import { Remote, RemoteError, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
@@ -581,7 +581,7 @@ const result$1 = strictRemoteCodec("dsh-github-copilot#DiagnosticsView", Diagnos
581
581
  var package_default = {
582
582
  name: "dsh-github-copilot",
583
583
  description: "DSH companion for GitHub Copilot sign-in, account-aware model profiles, tool compatibility, and provider-hosted search.",
584
- version: "0.4.2-alpha.11",
584
+ version: "0.4.2-alpha.12",
585
585
  releaseNotes: "CHANGELOG.md",
586
586
  publishConfig: {
587
587
  "access": "public",
@@ -12343,7 +12343,7 @@ function targetCategory(assessment, preference) {
12343
12343
  }
12344
12344
  /**
12345
12345
  * Filter input headroom before task-aware supplier categories.
12346
- * Prefer the unmarked tier, with finite ordinary continuity, inside the fitting category.
12346
+ * Apply positive cost weights and marked recency decay inside the fitting category.
12347
12347
  * Preserves Core compaction ownership if no candidate currently fits.
12348
12348
  */
12349
12349
  function selectAutoModel(models, messages, preference = "balance", context) {
@@ -12481,7 +12481,7 @@ function summarizeAutoAllocations(explanations, window) {
12481
12481
  let noFitDecisions = 0;
12482
12482
  let retainedDecisions = 0;
12483
12483
  let rowsTruncated = false;
12484
- const policyVersion = explanations.some((row) => row.allocation?.policyVersion === "high-cost-v2") ? AUTO_ALLOCATION_POLICY : explanations.find((row) => row.allocation !== void 0)?.allocation?.policyVersion ?? "high-cost-v2";
12484
+ const policyVersion = explanations.some((row) => row.allocation?.policyVersion === "high-cost-v3") ? AUTO_ALLOCATION_POLICY : explanations.find((row) => row.allocation !== void 0)?.allocation?.policyVersion ?? "high-cost-v3";
12485
12485
  let omittedPolicyDecisions = 0;
12486
12486
  for (const explanation of explanations) {
12487
12487
  if (explanation.method === "no-fit") {
@@ -1,5 +1,5 @@
1
1
  import "./copilot-identity-DRZY_d2X.js";
2
- import { d as diagnosticsReason, u as diagnosticsOutcome } from "./diagnostics-types-qvtuvM5E.js";
2
+ import { d as diagnosticsReason, u as diagnosticsOutcome } from "./diagnostics-types-DEo3UrOO.js";
3
3
  import { i as resolveRequestBudgetPolicy, r as calculateRequestBudget } from "./request-budget-DLY_aRq0.js";
4
4
  import z from "@deepseek-ai/schemastery";
5
5
  import { LlmError, createUserMessage } from "@deepseek-ai/dsh-llm";
package/lib/remote.js CHANGED
@@ -320,7 +320,11 @@ const TaskAssessmentSchema = z.object({
320
320
  }).strict();
321
321
  //#endregion
322
322
  //#region lib/types/auto-allocation.js
323
- const AUTO_ALLOCATION_POLICIES = ["high-cost-v1", "high-cost-v2"];
323
+ const AUTO_ALLOCATION_POLICIES = [
324
+ "high-cost-v1",
325
+ "high-cost-v2",
326
+ "high-cost-v3"
327
+ ];
324
328
  const AutoAllocationSchema = z.object({
325
329
  policyVersion: z.enum(AUTO_ALLOCATION_POLICIES),
326
330
  deferredHighCostCount: z.number().int().min(0).max(511).optional(),
@@ -335,7 +339,8 @@ const AutoAllocationSchema = z.object({
335
339
  }).strict().refine((value) => {
336
340
  const total = value.candidates.reduce((sum, row) => sum + row.weight, 0);
337
341
  const legacy = value.policyVersion === "high-cost-v1";
338
- return (legacy ? value.deferredHighCostCount === void 0 : value.deferredHighCostCount !== void 0 && value.candidates.length + value.deferredHighCostCount <= 512 && value.candidates.every((row) => row.highCost === value.candidates[0].highCost) && (!value.candidates[0].highCost || value.deferredHighCostCount === 0)) && new Set(value.candidates.map((row) => row.modelId)).size === value.candidates.length && value.candidates.some((row) => row.modelId === value.selectedModelId) && value.candidates.filter((row) => row.previous).length <= 1 && value.candidates.every((row) => row.weight === (row.highCost ? 2 : 10) * (row.previous && (legacy || !row.highCost) ? 1.5 : 1) / 10 && Math.abs(row.expectedShare - row.weight / total) <= 1e-12);
342
+ const decay = value.policyVersion === "high-cost-v3";
343
+ return (legacy || decay ? value.deferredHighCostCount === void 0 : value.deferredHighCostCount !== void 0 && value.candidates.length + value.deferredHighCostCount <= 512 && value.candidates.every((row) => row.highCost === value.candidates[0].highCost) && (!value.candidates[0].highCost || value.deferredHighCostCount === 0)) && new Set(value.candidates.map((row) => row.modelId)).size === value.candidates.length && value.candidates.some((row) => row.modelId === value.selectedModelId) && value.candidates.filter((row) => row.previous).length <= 1 && value.candidates.every((row) => row.weight === (decay && row.highCost && row.previous ? 2 : (row.highCost ? 20 : 100) * (row.previous && (legacy || !row.highCost) ? 1.5 : 1)) / 100 && Math.abs(row.expectedShare - row.weight / total) <= 1e-12);
339
344
  }, { message: "Invalid allocation policy evidence" });
340
345
  //#endregion
341
346
  //#region lib/types/auto-allocation-evidence.js
@@ -4,6 +4,7 @@ export declare const AutoAllocationSummarySchema: z.ZodObject<{
4
4
  policyVersion: z.ZodEnum<{
5
5
  "high-cost-v1": "high-cost-v1";
6
6
  "high-cost-v2": "high-cost-v2";
7
+ "high-cost-v3": "high-cost-v3";
7
8
  }>;
8
9
  scope: z.ZodLiteral<"viewed-session-host-lifetime">;
9
10
  status: z.ZodEnum<{
@@ -1,10 +1,11 @@
1
1
  import { z } from 'zod';
2
- export declare const AUTO_ALLOCATION_POLICIES: readonly ["high-cost-v1", "high-cost-v2"];
3
- export declare const AUTO_ALLOCATION_POLICY = "high-cost-v2";
2
+ export declare const AUTO_ALLOCATION_POLICIES: readonly ["high-cost-v1", "high-cost-v2", "high-cost-v3"];
3
+ export declare const AUTO_ALLOCATION_POLICY = "high-cost-v3";
4
4
  export declare const AutoAllocationSchema: z.ZodObject<{
5
5
  policyVersion: z.ZodEnum<{
6
6
  "high-cost-v1": "high-cost-v1";
7
7
  "high-cost-v2": "high-cost-v2";
8
+ "high-cost-v3": "high-cost-v3";
8
9
  }>;
9
10
  deferredHighCostCount: z.ZodOptional<z.ZodNumber>;
10
11
  selectedModelId: z.ZodString;
@@ -55,7 +55,7 @@ export declare function classifyAutoModelTurn(messages: readonly unknown[]): Aut
55
55
  export declare function estimateTurnInputTokens(messages: readonly unknown[], estimateMessage?: (message: unknown) => number): number;
56
56
  /**
57
57
  * Filter input headroom before task-aware supplier categories.
58
- * Prefer the unmarked tier, with finite ordinary continuity, inside the fitting category.
58
+ * Apply positive cost weights and marked recency decay inside the fitting category.
59
59
  * Preserves Core compaction ownership if no candidate currently fits.
60
60
  */
61
61
  export declare function selectAutoModel(models: readonly AccountModelDescriptor[], messages: readonly unknown[], preference?: AutoModelPreference, context?: AutoModelRoutingContext): AutoModelDecision;
@@ -9,7 +9,7 @@ export declare class TurnSelectionController extends TypertRemoteService {
9
9
  constructor(ctx: Context, selections: TurnSelectionStore);
10
10
  get(agent: Agent, turn: number): TurnSelection;
11
11
  allocationSummary(agent: Agent): {
12
- policyVersion: "high-cost-v1" | "high-cost-v2";
12
+ policyVersion: "high-cost-v1" | "high-cost-v2" | "high-cost-v3";
13
13
  scope: "viewed-session-host-lifetime";
14
14
  status: "observed" | "not-collected";
15
15
  retainedDecisions: number;
@@ -131,6 +131,7 @@ export declare const TurnSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
131
131
  policyVersion: z.ZodEnum<{
132
132
  "high-cost-v1": "high-cost-v1";
133
133
  "high-cost-v2": "high-cost-v2";
134
+ "high-cost-v3": "high-cost-v3";
134
135
  }>;
135
136
  deferredHighCostCount: z.ZodOptional<z.ZodNumber>;
136
137
  selectedModelId: z.ZodString;
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.2-alpha.11",
4
+ "version": "0.4.2-alpha.12",
5
5
  "releaseNotes": "CHANGELOG.md",
6
6
  "publishConfig": {
7
7
  "access": "public",