dsh-github-copilot 0.4.2-alpha.10 → 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.
- package/AGENTS.md +17 -3
- package/CHANGELOG.md +30 -1
- package/README.md +21 -10
- package/README.zh.md +16 -9
- package/deployment-baseline.json +9 -2
- package/docs/auto-high-cost.md +41 -12
- package/docs/auto-iteration-review.json +9 -9
- package/docs/auto-task-routing.md +34 -9
- package/docs/automatic-model-routing.md +2 -1
- package/lib/client.js +48 -10
- package/lib/client.js.map +1 -1
- package/lib/diagnostics-analysis.js +1 -1
- package/lib/{diagnostics-types-C1BD6ayS.js → diagnostics-types-DEo3UrOO.js} +16 -8
- package/lib/index.js +93 -18
- package/lib/manual-compaction-recovery.js +1 -1
- package/lib/remote.js +31 -6
- package/lib/types/auto-allocation-evidence.d.ts +6 -1
- package/lib/types/auto-allocation.d.ts +8 -2
- package/lib/types/auto-assessment-evidence.d.ts +33 -0
- package/lib/types/auto-model-routing.d.ts +1 -1
- package/lib/types/auto-task-assessment.d.ts +3 -2
- package/lib/types/turn-selection-host.d.ts +2 -1
- package/lib/types/turn-selection.d.ts +22 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -6238,6 +6238,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6238
6238
|
//#region lib/types/auto-assessment-evidence.js
|
|
6239
6239
|
const milliseconds = number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
6240
6240
|
const candidateCount = number().int().min(0).max(512);
|
|
6241
|
+
const AssessmentProjectionSchema = object({
|
|
6242
|
+
retainedMessages: number().int().min(0).max(12),
|
|
6243
|
+
historyOmitted: boolean(),
|
|
6244
|
+
taskTextLimited: boolean(),
|
|
6245
|
+
continuationAnchor: _enum([
|
|
6246
|
+
"not-needed",
|
|
6247
|
+
"retained",
|
|
6248
|
+
"missing"
|
|
6249
|
+
])
|
|
6250
|
+
}).strict().refine((value) => value.taskTextLimited || value.retainedMessages > 0 && value.continuationAnchor !== "missing", "Inconsistent task text evidence");
|
|
6241
6251
|
const candidateScan = object({
|
|
6242
6252
|
candidates: candidateCount,
|
|
6243
6253
|
eligible: candidateCount,
|
|
@@ -6272,7 +6282,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6272
6282
|
"context-omitted"
|
|
6273
6283
|
]),
|
|
6274
6284
|
candidateScan: candidateScan.optional(),
|
|
6275
|
-
preparationFailure: _enum(["native-off-unavailable"]).optional()
|
|
6285
|
+
preparationFailure: _enum(["native-off-unavailable"]).optional(),
|
|
6286
|
+
projection: AssessmentProjectionSchema.optional(),
|
|
6287
|
+
classifierDemand: _enum([
|
|
6288
|
+
"simple",
|
|
6289
|
+
"routine",
|
|
6290
|
+
"complex",
|
|
6291
|
+
"unknown"
|
|
6292
|
+
]).optional()
|
|
6276
6293
|
}).strict().superRefine((value, ctx) => {
|
|
6277
6294
|
if (value.adapterStartedMs !== void 0 && value.adapterStartedMs > value.elapsedMs || value.firstTextMs !== void 0 && (value.adapterStartedMs === void 0 || value.firstTextMs < value.adapterStartedMs || value.firstTextMs > value.elapsedMs)) ctx.addIssue({
|
|
6278
6295
|
code: "custom",
|
|
@@ -6282,7 +6299,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6282
6299
|
"adapter-started",
|
|
6283
6300
|
"text-received",
|
|
6284
6301
|
"finished"
|
|
6285
|
-
].includes(value.stage) && value.adapterStartedMs === void 0 || value.stage === "text-received" && value.firstTextMs === void 0 || value.stage === "finished" && value.nativeFinish === void 0 || value.nativeFinish !== void 0 && value.stage !== "finished" || value.outputCharacters > 0 && value.firstTextMs === void 0 || value.firstTextMs !== void 0 && value.outputCharacters === 0) ctx.addIssue({
|
|
6302
|
+
].includes(value.stage) && value.adapterStartedMs === void 0 || value.stage === "text-received" && value.firstTextMs === void 0 || value.stage === "finished" && value.nativeFinish === void 0 || value.nativeFinish !== void 0 && value.stage !== "finished" || value.outputCharacters > 0 && value.firstTextMs === void 0 || value.firstTextMs !== void 0 && value.outputCharacters === 0 || value.classifierDemand !== void 0 && !["valid", "context-omitted"].includes(value.validation)) ctx.addIssue({
|
|
6286
6303
|
code: "custom",
|
|
6287
6304
|
message: "Inconsistent assessment phase"
|
|
6288
6305
|
});
|
|
@@ -6314,9 +6331,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6314
6331
|
}
|
|
6315
6332
|
//#endregion
|
|
6316
6333
|
//#region lib/types/auto-allocation.js
|
|
6317
|
-
const
|
|
6334
|
+
const AUTO_ALLOCATION_POLICIES = [
|
|
6335
|
+
"high-cost-v1",
|
|
6336
|
+
"high-cost-v2",
|
|
6337
|
+
"high-cost-v3"
|
|
6338
|
+
];
|
|
6318
6339
|
const AutoAllocationSchema = object({
|
|
6319
|
-
policyVersion:
|
|
6340
|
+
policyVersion: _enum(AUTO_ALLOCATION_POLICIES),
|
|
6341
|
+
deferredHighCostCount: number().int().min(0).max(511).optional(),
|
|
6320
6342
|
selectedModelId: string().min(1).max(512),
|
|
6321
6343
|
candidates: array(object({
|
|
6322
6344
|
modelId: string().min(1).max(512),
|
|
@@ -6327,16 +6349,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6327
6349
|
}).strict()).min(1).max(512)
|
|
6328
6350
|
}).strict().refine((value) => {
|
|
6329
6351
|
const total = value.candidates.reduce((sum, row) => sum + row.weight, 0);
|
|
6330
|
-
|
|
6352
|
+
const legacy = value.policyVersion === "high-cost-v1";
|
|
6353
|
+
const decay = value.policyVersion === "high-cost-v3";
|
|
6354
|
+
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);
|
|
6331
6355
|
}, { message: "Invalid allocation policy evidence" });
|
|
6332
6356
|
//#endregion
|
|
6333
6357
|
//#region lib/types/auto-allocation-evidence.js
|
|
6334
6358
|
const AutoAllocationSummarySchema = object({
|
|
6335
|
-
policyVersion:
|
|
6359
|
+
policyVersion: _enum(AUTO_ALLOCATION_POLICIES),
|
|
6336
6360
|
scope: literal("viewed-session-host-lifetime"),
|
|
6337
6361
|
status: _enum(["observed", "not-collected"]),
|
|
6338
6362
|
retainedDecisions: number().int().nonnegative().max(128),
|
|
6339
6363
|
noFitDecisions: number().int().nonnegative().max(128),
|
|
6364
|
+
omittedPolicyDecisions: number().int().nonnegative().max(128).optional(),
|
|
6340
6365
|
rowsTruncated: boolean(),
|
|
6341
6366
|
completeHistory: literal(false),
|
|
6342
6367
|
observationStart: number().int().nonnegative().nullable(),
|
|
@@ -7489,7 +7514,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7489
7514
|
};
|
|
7490
7515
|
//#endregion
|
|
7491
7516
|
//#region package.json
|
|
7492
|
-
var version = "0.4.2-alpha.
|
|
7517
|
+
var version = "0.4.2-alpha.12";
|
|
7493
7518
|
//#endregion
|
|
7494
7519
|
//#region lib/types/diagnostics-client.js
|
|
7495
7520
|
let owner;
|
|
@@ -8396,7 +8421,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8396
8421
|
const conclusion = explanation.method === "no-fit" ? zh ? "没有候选能直接容纳估算输入;选中输入预算最大的模型,保留原生压缩或失败处理。" : "No candidate fits the estimated input. Selected the largest input budget for native recovery or failure." : 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]}.`;
|
|
8397
8422
|
const allocation = explanation.allocation;
|
|
8398
8423
|
const selected = allocation?.candidates.find((row) => row.modelId === allocation.selectedModelId);
|
|
8399
|
-
const
|
|
8424
|
+
const tier = 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." : "";
|
|
8425
|
+
const weightedChoice = explanation.method === "weighted-distribution" ? selected === void 0 ? zh ? "按同类正权重政策分配;本轮候选观察未保留,不从当前设置推断。连续性仅为有限加权。" : "Allocated by positive within-category weights. Candidate observations were not retained; current settings cannot reconstruct them. Continuity is a finite bonus." : zh ? `在 ${explanation.categoryCandidateCount} 个同类可容纳候选中按正权重分配;选中模型${selected.highCost ? "已标记高成本" : "未标记高成本"},有效权重 ${selected.weight},本轮条件份额 ${(selected.expectedShare * 100).toFixed(1)}%。连续性仅为有限加权,不保证保留;这不是质量排名或实际费用。` : `Positive weighted allocation among ${explanation.categoryCandidateCount} fitting 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 ? "该分类只有一个可容纳的合格候选。" : "Only one eligible fitting candidate remains 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.";
|
|
8426
|
+
const choice = tier === "" ? weightedChoice : `${tier} ${weightedChoice}`;
|
|
8400
8427
|
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 ? `语义判断未提供完整可用依据(${{
|
|
8401
8428
|
unavailable: "没有可用分类模型",
|
|
8402
8429
|
"invalid-result": "结果无效",
|
|
@@ -8422,6 +8449,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8422
8449
|
};
|
|
8423
8450
|
const candidateDetail = scan === void 0 ? "" : zh ? ` 候选检查:${scan.candidates} 个模型,${scan.eligible} 个合格。首个排除原因:${Object.entries(scan.rejected).filter(([, count]) => count > 0).map(([reason, count]) => `${rejectionLabels[reason]} ${count}`).join(";") || "无"}。` : ` Candidate scan: ${scan.candidates} models, ${scan.eligible} eligible. First rejection reasons: ${Object.entries(scan.rejected).filter(([, count]) => count > 0).map(([reason, count]) => `${rejectionLabels[reason]} ${count}`).join("; ") || "none"}.`;
|
|
8424
8451
|
const preparationDetail = evidence?.preparationFailure === void 0 ? "" : zh ? " 原生模型准备未提供 off 控制;未发起分类调用。" : "Native model preparation did not expose off; classifier call was not started.";
|
|
8452
|
+
const projection = evidence?.projection;
|
|
8453
|
+
const projectionDetail = projection === void 0 ? "" : zh ? ` 判断文本:保留 ${projection.retainedMessages} 条;历史省略${projection.historyOmitted ? "有" : "无"};任务文本${projection.taskTextLimited ? "受限" : "已保留"};续接目标${{
|
|
8454
|
+
"not-needed": "不适用",
|
|
8455
|
+
retained: "已保留",
|
|
8456
|
+
missing: "未找到"
|
|
8457
|
+
}[projection.continuationAnchor]}。文本保留不保证语义信息充分。` : ` Assessment text: ${projection.retainedMessages} rows retained; historical omissions ${projection.historyOmitted ? "present" : "absent"}; task text ${projection.taskTextLimited ? "limited" : "retained"}; continuation anchor ${{
|
|
8458
|
+
"not-needed": "not applicable",
|
|
8459
|
+
retained: "retained",
|
|
8460
|
+
missing: "missing"
|
|
8461
|
+
}[projection.continuationAnchor]}. Retained text does not guarantee sufficient task evidence.`;
|
|
8462
|
+
const classifierDetail = evidence?.classifierDemand === void 0 ? "" : zh ? ` 分类器返回:${demand[evidence.classifierDemand]}。` : ` Classifier returned: ${evidence.classifierDemand}.`;
|
|
8425
8463
|
const semantic = evidence === void 0 ? void 0 : zh ? `辅助分类模型:${evidence.modelId ?? "未选定"}。判断总耗时 ${evidence.elapsedMs} ms,等待预算 ${evidence.budgetMs} ms。${evidence.adapterStartedMs === void 0 ? "尚未开始适配器调用。" : `适配器调用始于 ${evidence.adapterStartedMs} ms。`}${evidence.firstTextMs === void 0 ? "未观察到文本输出。" : `首次文本输出于 ${evidence.firstTextMs} ms。`}${evidence.nativeFinish === void 0 ? "未观察到原生结束。" : evidence.nativeFinish === "stop" ? "观察到原生正常结束。" : "观察到原生非正常结束。"}结果校验:${{
|
|
8426
8464
|
"not-validated": "未完成",
|
|
8427
8465
|
valid: "通过",
|
|
@@ -8437,7 +8475,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8437
8475
|
conclusion,
|
|
8438
8476
|
choice,
|
|
8439
8477
|
diagnostic,
|
|
8440
|
-
semantic: semantic === void 0 ? void 0 : `${semantic}${candidateDetail}${preparationDetail}`,
|
|
8478
|
+
semantic: semantic === void 0 ? void 0 : `${semantic}${candidateDetail}${preparationDetail}${projectionDetail}${classifierDetail}`,
|
|
8441
8479
|
assessment: `${zh ? "判断来源:" : "Assessment: "}${explanation.assessment.source === "semantic" ? zh ? "语义分类" : "semantic classification" : zh ? "本地规则" : "local rules"}${explanation.assessment.signals.length ? ` — ${explanation.assessment.signals.map((signal) => signals[signal]).join(zh ? "、" : ", ")}` : ""}`
|
|
8442
8480
|
};
|
|
8443
8481
|
}
|
|
@@ -8943,7 +8981,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8943
8981
|
return (0, react.createElement)("details", null, (0, react.createElement)("summary", null, zh ? "Auto 分配观察(当前 Session)" : "Auto allocation observations (this Session)"), (0, react.createElement)("p", null, zh ? "仅保留 Host 生命周期内最近最多 128 轮;重启、淘汰和缺失记录不代表零使用。这是选择观察,不是执行、质量或费用证明。" : "Up to 128 recent retained turns in this Host lifetime. Restart, eviction and missing records are not zero usage. These are selection observations, not execution, quality or billing."), failed ? (0, react.createElement)("div", { role: "alert" }, zh ? "读取分配观察失败。" : "Could not read allocation observations.", (0, react.createElement)("button", {
|
|
8944
8982
|
type: "button",
|
|
8945
8983
|
onClick: () => setAttempt((value) => value + 1)
|
|
8946
|
-
}, zh ? "重试" : "Retry")) : summary === void 0 ? (0, react.createElement)("p", { role: "status" }, zh ? "正在读取…" : "Reading…") : (0, react.createElement)("div", null, (0, react.createElement)("p", null, `${summary.policyVersion} · ${summary.retainedDecisions} ${zh ? "次保留分配" : "retained allocations"} · ${summary.noFitDecisions} ${zh ? "次无适配候选" : "no-fit decisions"}`), summary.observationStart === null || summary.observationEnd === null ? null : (0, react.createElement)("p", null, `${new Date(summary.observationStart).toLocaleString()} — ${new Date(summary.observationEnd).toLocaleString()}`), summary.status === "not-collected" ? (0, react.createElement)("p", null, zh ? "尚无保留样本。" : "No retained samples.") : null, summary.rowsTruncated ? (0, react.createElement)("p", { role: "status" }, zh ? "候选明细达到上限;导出不完整。" : "Candidate detail limit reached; export is incomplete.") : null, (0, react.createElement)("p", null, zh ? "导出包含模型 ID 与分配计数,不包含对话内容;不会自动上传。跨 Session 汇总和效果判断需另行审阅。" : "Export contains model IDs and allocation counts, not conversation content. Nothing is uploaded automatically. Cross-Session aggregation and effectiveness require a separate review."), (0, react.createElement)("label", { style: {
|
|
8984
|
+
}, zh ? "重试" : "Retry")) : summary === void 0 ? (0, react.createElement)("p", { role: "status" }, zh ? "正在读取…" : "Reading…") : (0, react.createElement)("div", null, (0, react.createElement)("p", null, `${summary.policyVersion} · ${summary.retainedDecisions} ${zh ? "次保留分配" : "retained allocations"} · ${summary.noFitDecisions} ${zh ? "次无适配候选" : "no-fit decisions"}`), summary.observationStart === null || summary.observationEnd === null ? null : (0, react.createElement)("p", null, `${new Date(summary.observationStart).toLocaleString()} — ${new Date(summary.observationEnd).toLocaleString()}`), summary.status === "not-collected" ? (0, react.createElement)("p", null, zh ? "尚无保留样本。" : "No retained samples.") : null, summary.rowsTruncated ? (0, react.createElement)("p", { role: "status" }, zh ? "候选明细达到上限;导出不完整。" : "Candidate detail limit reached; export is incomplete.") : null, (summary.omittedPolicyDecisions ?? 0) > 0 ? (0, react.createElement)("p", { role: "status" }, zh ? `另有 ${summary.omittedPolicyDecisions} 次不同策略版本的分配,未混入本汇总。` : `${summary.omittedPolicyDecisions} allocations from another policy version are excluded from this summary.`) : null, (0, react.createElement)("p", null, zh ? "导出包含模型 ID 与分配计数,不包含对话内容;不会自动上传。跨 Session 汇总和效果判断需另行审阅。" : "Export contains model IDs and allocation counts, not conversation content. Nothing is uploaded automatically. Cross-Session aggregation and effectiveness require a separate review."), (0, react.createElement)("label", { style: {
|
|
8947
8985
|
display: "grid",
|
|
8948
8986
|
gap: 6
|
|
8949
8987
|
} }, zh ? "只读本地观察 JSON" : "Read-only local observation JSON", (0, react.createElement)("textarea", {
|