dsh-github-copilot 0.4.2-alpha.11 → 0.4.2-alpha.13
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/AGENTS.md +12 -6
- package/CHANGELOG.md +23 -1
- package/README.md +13 -12
- package/README.zh.md +14 -10
- package/deployment-baseline.json +8 -3
- package/docs/auto-high-cost.md +90 -20
- package/docs/auto-iteration-review.json +6 -6
- package/docs/auto-task-routing.md +18 -12
- package/docs/automatic-model-routing.md +4 -2
- package/lib/client.js +50 -6
- package/lib/client.js.map +1 -1
- package/lib/diagnostics-analysis.js +1 -1
- package/lib/{diagnostics-types-qvtuvM5E.js → diagnostics-types-D5T4fto9.js} +59 -14
- package/lib/index.js +13 -28
- package/lib/manual-compaction-recovery.js +1 -1
- package/lib/remote.js +45 -2
- package/lib/types/auto-allocation-evidence.d.ts +2 -0
- package/lib/types/auto-allocation.d.ts +21 -3
- package/lib/types/auto-model-routing.d.ts +2 -1
- package/lib/types/turn-selection-host.d.ts +1 -1
- package/lib/types/turn-selection.d.ts +15 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -6331,13 +6331,51 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6331
6331
|
}
|
|
6332
6332
|
//#endregion
|
|
6333
6333
|
//#region lib/types/auto-allocation.js
|
|
6334
|
-
const AUTO_ALLOCATION_POLICIES = [
|
|
6334
|
+
const AUTO_ALLOCATION_POLICIES = [
|
|
6335
|
+
"high-cost-v1",
|
|
6336
|
+
"high-cost-v2",
|
|
6337
|
+
"high-cost-v3",
|
|
6338
|
+
"high-cost-v4"
|
|
6339
|
+
];
|
|
6340
|
+
const categories = [
|
|
6341
|
+
"powerful",
|
|
6342
|
+
"versatile",
|
|
6343
|
+
"lightweight",
|
|
6344
|
+
"unknown"
|
|
6345
|
+
];
|
|
6346
|
+
function autoCategoryWeight(category, target) {
|
|
6347
|
+
if (category === "unknown") return .02;
|
|
6348
|
+
return [
|
|
6349
|
+
1,
|
|
6350
|
+
.25,
|
|
6351
|
+
.05
|
|
6352
|
+
][(target === "powerful" ? [
|
|
6353
|
+
"powerful",
|
|
6354
|
+
"versatile",
|
|
6355
|
+
"lightweight"
|
|
6356
|
+
] : target === "lightweight" ? [
|
|
6357
|
+
"lightweight",
|
|
6358
|
+
"versatile",
|
|
6359
|
+
"powerful"
|
|
6360
|
+
] : [
|
|
6361
|
+
"versatile",
|
|
6362
|
+
"powerful",
|
|
6363
|
+
"lightweight"
|
|
6364
|
+
]).indexOf(category)];
|
|
6365
|
+
}
|
|
6335
6366
|
const AutoAllocationSchema = object({
|
|
6336
6367
|
policyVersion: _enum(AUTO_ALLOCATION_POLICIES),
|
|
6368
|
+
targetCategory: _enum([
|
|
6369
|
+
"powerful",
|
|
6370
|
+
"versatile",
|
|
6371
|
+
"lightweight"
|
|
6372
|
+
]).optional(),
|
|
6337
6373
|
deferredHighCostCount: number().int().min(0).max(511).optional(),
|
|
6338
6374
|
selectedModelId: string().min(1).max(512),
|
|
6339
6375
|
candidates: array(object({
|
|
6340
6376
|
modelId: string().min(1).max(512),
|
|
6377
|
+
category: _enum(categories).optional(),
|
|
6378
|
+
categoryWeight: number().positive().max(1).optional(),
|
|
6341
6379
|
highCost: boolean(),
|
|
6342
6380
|
previous: boolean(),
|
|
6343
6381
|
weight: number().positive().max(1.5),
|
|
@@ -6346,7 +6384,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6346
6384
|
}).strict().refine((value) => {
|
|
6347
6385
|
const total = value.candidates.reduce((sum, row) => sum + row.weight, 0);
|
|
6348
6386
|
const legacy = value.policyVersion === "high-cost-v1";
|
|
6349
|
-
|
|
6387
|
+
const soft = value.policyVersion === "high-cost-v4";
|
|
6388
|
+
const decay = value.policyVersion === "high-cost-v3" || soft;
|
|
6389
|
+
const categoryValid = soft ? value.targetCategory !== void 0 && value.candidates.every((row) => row.category !== void 0 && row.categoryWeight === autoCategoryWeight(row.category, value.targetCategory)) : value.targetCategory === void 0 && value.candidates.every((row) => row.category === void 0 && row.categoryWeight === void 0);
|
|
6390
|
+
const tierValid = 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);
|
|
6391
|
+
return categoryValid && tierValid && 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)) * (soft ? Math.round(row.categoryWeight * 100) : 100) / 1e4 && Math.abs(row.expectedShare - row.weight / total) <= 1e-12);
|
|
6350
6392
|
}, { message: "Invalid allocation policy evidence" });
|
|
6351
6393
|
//#endregion
|
|
6352
6394
|
//#region lib/types/auto-allocation-evidence.js
|
|
@@ -6380,6 +6422,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6380
6422
|
//#endregion
|
|
6381
6423
|
//#region lib/types/turn-selection.js
|
|
6382
6424
|
const ExplanationSchema = object({
|
|
6425
|
+
allocationPolicy: literal("high-cost-v4").optional(),
|
|
6383
6426
|
assessment: TaskAssessmentSchema.extend({
|
|
6384
6427
|
source: _enum(["local", "semantic"]),
|
|
6385
6428
|
diagnostic: _enum([
|
|
@@ -7509,7 +7552,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7509
7552
|
};
|
|
7510
7553
|
//#endregion
|
|
7511
7554
|
//#region package.json
|
|
7512
|
-
var version = "0.4.2-alpha.
|
|
7555
|
+
var version = "0.4.2-alpha.13";
|
|
7513
7556
|
//#endregion
|
|
7514
7557
|
//#region lib/types/diagnostics-client.js
|
|
7515
7558
|
let owner;
|
|
@@ -8413,11 +8456,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8413
8456
|
"context-omitted": zh ? "判断上下文不完整" : "incomplete assessment context",
|
|
8414
8457
|
"insufficient-evidence": zh ? "本地规则尚不能确定任务需求" : "local rules cannot establish task demand"
|
|
8415
8458
|
};
|
|
8416
|
-
const
|
|
8459
|
+
const soft = explanation.allocationPolicy === "high-cost-v4" || explanation.allocation?.policyVersion === "high-cost-v4";
|
|
8460
|
+
const conclusion = explanation.method === "no-fit" ? zh ? "没有候选能直接容纳估算输入;选中输入预算最大的模型,保留原生压缩或失败处理。" : "No candidate fits the estimated input. Selected the largest input budget for native recovery or failure." : soft ? zh ? `本轮判断为${demand[explanation.assessment.demand]};偏向 ${category[explanation.targetCategory]},本轮抽中 ${category[explanation.selectedCategory]}。${explanation.fallback ? "目标分类没有可容纳的合格候选。" : ""}` : `This task was assessed as ${demand[explanation.assessment.demand]}; weights favor ${category[explanation.targetCategory]}, and this draw selected ${category[explanation.selectedCategory]}.${explanation.fallback ? " No eligible fitting target-category candidate remains." : ""}` : explanation.fallback ? zh ? `目标分类 ${category[explanation.targetCategory]} 没有合格的可容纳候选,回退到 ${category[explanation.selectedCategory]}。` : `No eligible fitting ${category[explanation.targetCategory]} candidate; fell back to ${category[explanation.selectedCategory]}.` : explanation.assessment.diagnostic === "timeout" && explanation.assessment.demand === "unknown" ? zh ? `任务难度判断超时,需求仍不确定;按当前偏好兜底选择 ${category[explanation.selectedCategory]}。` : `Task assessment timed out; demand remains uncertain. The preference policy selected ${category[explanation.selectedCategory]} as a fallback.` : zh ? `本轮判断为${demand[explanation.assessment.demand]};按当前偏好选择 ${category[explanation.selectedCategory]} 类模型。` : `This task was assessed as ${demand[explanation.assessment.demand]}; the preference policy selected ${category[explanation.selectedCategory]}.`;
|
|
8417
8461
|
const allocation = explanation.allocation;
|
|
8418
8462
|
const selected = allocation?.candidates.find((row) => row.modelId === allocation.selectedModelId);
|
|
8419
|
-
const tier = allocation?.policyVersion !== "high-cost-v2" ? "" : (allocation.deferredHighCostCount ?? 0) > 0 ? zh ? `本轮成本层有未标记候选,暂缓 ${allocation.deferredHighCostCount} 个同类高成本候选。` : `The unmarked cost tier deferred ${allocation.deferredHighCostCount} fitting high-cost category candidates.` : selected?.highCost ? zh ? "该分类无可容纳的未标记候选,使用高成本兜底层;高成本模型不享受连续性加权。" : "No fitting unmarked candidate exists in this category; the high-cost fallback tier has no continuity bonus." : "";
|
|
8420
|
-
const weightedChoice = explanation.method === "weighted-distribution" ? selected === void 0 ? zh ? "
|
|
8463
|
+
const tier = soft ? zh ? "所有合格且可容纳输入的模型保留正机会;目标、第二、第三分类权重为 1 / 0.25 / 0.05,分类未知为 0.02。再乘成本与近期因素:普通 1,普通上一轮 1.5,高成本 0.2,高成本上一轮 0.02。系数是未校准试验,不是能力或实际费用判断。" : "Every eligible fitting model retains positive opportunity. Target/second/third category factors are 1 / 0.25 / 0.05; unclassified is 0.02. Multiply by cost/recency factors: ordinary 1, previous ordinary 1.5, high cost 0.2, previous high cost 0.02. These are uncalibrated trial coefficients, not capability or actual cost evidence." : allocation?.policyVersion === "high-cost-v3" ? zh ? "所有可容纳的同类候选保留正机会;高成本基础权重 0.2,上一轮高成本模型衰减至 0.02,普通上一轮模型加权至 1.5。这是一轮近期惩罚,不是能力或实际费用判断。" : "All fitting category candidates retain positive opportunity. High-cost base weight is 0.2; a previous high-cost model decays to 0.02, while an ordinary previous model has weight 1.5. This is one-turn recency decay, not capability or actual cost evidence." : allocation?.policyVersion !== "high-cost-v2" ? "" : (allocation.deferredHighCostCount ?? 0) > 0 ? zh ? `本轮成本层有未标记候选,暂缓 ${allocation.deferredHighCostCount} 个同类高成本候选。` : `The unmarked cost tier deferred ${allocation.deferredHighCostCount} fitting high-cost category candidates.` : selected?.highCost ? zh ? "该分类无可容纳的未标记候选,使用高成本兜底层;高成本模型不享受连续性加权。" : "No fitting unmarked candidate exists in this category; the high-cost fallback tier has no continuity bonus." : "";
|
|
8464
|
+
const weightedChoice = explanation.method === "weighted-distribution" ? selected === void 0 ? zh ? `按${soft ? "跨分类" : "同类"}正权重政策分配;本轮候选观察未保留,不从当前设置推断。连续性仅为有限加权。` : `Allocated by positive ${soft ? "cross-category" : "within-category"} weights. Candidate observations were not retained; current settings cannot reconstruct them. Continuity is a finite bonus.` : zh ? `在 ${explanation.categoryCandidateCount} 个${soft ? "跨分类" : "同类"}可容纳候选中按正权重分配;选中模型${selected.highCost ? "已标记高成本" : "未标记高成本"},有效权重 ${selected.weight},本轮条件份额 ${(selected.expectedShare * 100).toFixed(1)}%。连续性仅为有限加权,不保证保留;这不是质量排名或实际费用。` : `Positive weighted allocation among ${explanation.categoryCandidateCount} fitting ${soft ? "cross-category" : "category"} candidates. Selected model is ${selected.highCost ? "marked high cost" : "unmarked"}, effective weight ${selected.weight}, conditional share ${(selected.expectedShare * 100).toFixed(1)}%. Continuity is a finite bonus, not a lock; this is not quality ranking or actual cost.` : explanation.method === "continuity" ? zh ? `该分类有 ${explanation.categoryCandidateCount} 个可容纳候选;上一轮模型仍合格,因此按连续性策略保留。这不是语义排名,也不证明它最适合任务。` : `This category has ${explanation.categoryCandidateCount} fitting candidates. Kept the previous model because it remains eligible, prioritizing continuity; this is not a semantic ranking or proof it is best for the task.` : explanation.method === "only-candidate" ? zh ? `${soft ? "所有分类中" : "该分类"}只有一个可容纳的合格候选。` : `Only one eligible fitting candidate remains ${soft ? "across all categories" : "in this category"}.` : explanation.method === "equal-distribution" ? zh ? `该分类有 ${explanation.categoryCandidateCount} 个可容纳候选;按本轮稳定等权规则选中,不代表质量排名。` : `Selected among ${explanation.categoryCandidateCount} fitting category candidates by stable equal-weight allocation, not a quality ranking.` : zh ? "所有候选均不适配;这不是成功的偏好匹配。" : "All candidates are oversized; this is not a successful preference match.";
|
|
8421
8465
|
const choice = tier === "" ? weightedChoice : `${tier} ${weightedChoice}`;
|
|
8422
8466
|
const diagnostic = explanation.assessment.diagnostic === void 0 ? void 0 : explanation.assessment.diagnostic === "disabled" ? zh ? "语义判断实验未开启;这是本地规则的判断边界,不代表会话没有上下文。" : "Semantic assessment is disabled; this is a limit of local rules, not proof that the conversation lacks context." : explanation.assessment.diagnostic === "timeout" ? zh ? "辅助判断未在等待预算内完成,不代表正式回答超时或任务简单;本轮保留需求不确定,再按偏好策略选模。" : "The auxiliary assessment did not complete within its waiting budget. This is not a timeout of the main answer or evidence of simplicity; selection used the unknown-demand preference policy." : zh ? `语义判断未提供完整可用依据(${{
|
|
8423
8467
|
unavailable: "没有可用分类模型",
|