dsh-github-copilot 0.4.0-alpha.79 → 0.4.0-alpha.81

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/client.js CHANGED
@@ -5646,6 +5646,54 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5646
5646
  };
5647
5647
  //#endregion
5648
5648
  //#region lib/types/turn-selection.js
5649
+ const ExplanationSchema = object({
5650
+ assessment: object({
5651
+ demand: _enum([
5652
+ "simple",
5653
+ "routine",
5654
+ "complex",
5655
+ "unknown"
5656
+ ]),
5657
+ signals: array(_enum([
5658
+ "isolated-greeting",
5659
+ "bounded-transformation",
5660
+ "reasoning",
5661
+ "investigation",
5662
+ "continuation",
5663
+ "context-omitted",
5664
+ "insufficient-evidence"
5665
+ ])).max(7)
5666
+ }).strict().extend({
5667
+ source: _enum(["local", "semantic"]),
5668
+ diagnostic: _enum([
5669
+ "disabled",
5670
+ "unavailable",
5671
+ "invalid-result",
5672
+ "timeout",
5673
+ "failed",
5674
+ "context-omitted"
5675
+ ]).optional()
5676
+ }).strict(),
5677
+ targetCategory: _enum([
5678
+ "powerful",
5679
+ "versatile",
5680
+ "lightweight"
5681
+ ]),
5682
+ selectedCategory: _enum([
5683
+ "powerful",
5684
+ "versatile",
5685
+ "lightweight",
5686
+ "unknown"
5687
+ ]),
5688
+ categoryCandidateCount: number().int().min(0).max(512),
5689
+ method: _enum([
5690
+ "continuity",
5691
+ "equal-distribution",
5692
+ "only-candidate",
5693
+ "no-fit"
5694
+ ]),
5695
+ fallback: boolean()
5696
+ }).strict();
5649
5697
  const TurnSelectionSchema = discriminatedUnion("mode", [
5650
5698
  object({ mode: literal("unknown") }).strict(),
5651
5699
  object({ mode: literal("manual") }).strict(),
@@ -5663,7 +5711,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5663
5711
  "image-capability"
5664
5712
  ]),
5665
5713
  candidateCount: number().int().positive(),
5666
- fittingCandidateCount: number().int().nonnegative().optional()
5714
+ fittingCandidateCount: number().int().nonnegative().optional(),
5715
+ explanation: ExplanationSchema.optional()
5667
5716
  }).strict()
5668
5717
  ]);
5669
5718
  //#endregion
@@ -6259,6 +6308,50 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6259
6308
  }
6260
6309
  };
6261
6310
  //#endregion
6311
+ //#region lib/types/auto-selection-explanation.js
6312
+ function selectionExplanation(explanation, locale) {
6313
+ const zh = locale.startsWith("zh");
6314
+ const category = {
6315
+ powerful: "Powerful",
6316
+ versatile: "Versatile",
6317
+ lightweight: "Lightweight",
6318
+ unknown: zh ? "分类未知" : "unclassified"
6319
+ };
6320
+ const demand = {
6321
+ simple: zh ? "明确简单" : "demonstrably simple",
6322
+ routine: zh ? "常规、边界明确" : "routine and bounded",
6323
+ complex: zh ? "复杂" : "complex",
6324
+ unknown: zh ? "需求不确定" : "uncertain"
6325
+ };
6326
+ const signals = {
6327
+ "isolated-greeting": zh ? "独立问候" : "isolated greeting",
6328
+ "bounded-transformation": zh ? "有边界的内容转换" : "bounded transformation",
6329
+ reasoning: zh ? "推理任务" : "reasoning task",
6330
+ investigation: zh ? "调查或调试" : "investigation or debugging",
6331
+ continuation: zh ? "继续已有工作" : "continuation of existing work",
6332
+ "context-omitted": zh ? "判断上下文不完整" : "incomplete assessment context",
6333
+ "insufficient-evidence": zh ? "缺少足够判断依据" : "insufficient evidence"
6334
+ };
6335
+ return {
6336
+ 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]}.` : zh ? `本轮判断为${demand[explanation.assessment.demand]};按当前偏好选择 ${category[explanation.selectedCategory]} 类模型。` : `This task was assessed as ${demand[explanation.assessment.demand]}; the preference policy selected ${category[explanation.selectedCategory]}.`,
6337
+ choice: explanation.method === "continuity" ? zh ? "上一轮模型仍满足本轮分类和输入要求,因此保持它。" : "Kept the previous model because it still meets this turn’s category and input requirements." : 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.",
6338
+ diagnostic: explanation.assessment.diagnostic === void 0 ? void 0 : explanation.assessment.diagnostic === "disabled" ? zh ? "语义判断实验未开启,本轮使用保守本地规则。" : "Semantic assessment is disabled; this turn used conservative local rules." : zh ? `语义判断未提供完整可用依据(${{
6339
+ unavailable: "没有可用分类模型",
6340
+ "invalid-result": "结果无效",
6341
+ timeout: "超时",
6342
+ failed: "请求失败",
6343
+ "context-omitted": "上下文不完整"
6344
+ }[explanation.assessment.diagnostic]});未将失败当作简单任务。` : `Semantic assessment did not provide complete usable evidence (${{
6345
+ unavailable: "no classifier available",
6346
+ "invalid-result": "invalid result",
6347
+ timeout: "timeout",
6348
+ failed: "request failed",
6349
+ "context-omitted": "incomplete context"
6350
+ }[explanation.assessment.diagnostic]}); failure was not treated as simplicity.`,
6351
+ 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 ? "、" : ", ")}` : ""}`
6352
+ };
6353
+ }
6354
+ //#endregion
6262
6355
  //#region lib/types/turn-selection-card.js
6263
6356
  function TurnSelectionCard({ selection, locale = "en", incomplete = false, readState = "ready", retry }) {
6264
6357
  const zh = locale.startsWith("zh");
@@ -6312,12 +6405,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6312
6405
  };
6313
6406
  }, [open]);
6314
6407
  const label = selection.mode === "auto" ? `Auto (${selection.preference})` : selection.mode === "manual" ? zh ? "手动" : "Manual" : zh ? "选择方式未知" : "Selection unknown";
6315
- const reason = selection.mode !== "auto" ? "" : {
6316
- "short-text-turn": zh ? "短文本轮次" : "Short text turn",
6317
- "standard-turn": zh ? "常规轮次" : "Standard turn",
6318
- "large-structured-turn": zh ? "较大结构化轮次" : "Large structured turn",
6319
- "image-capability": zh ? "需要图片能力" : "Image capability required"
6320
- }[selection.reason];
6408
+ const explanation = selection.mode === "auto" && selection.explanation !== void 0 ? selectionExplanation(selection.explanation, locale) : void 0;
6321
6409
  const button = {
6322
6410
  font: "inherit",
6323
6411
  color: "inherit",
@@ -6352,7 +6440,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6352
6440
  height: 24,
6353
6441
  flexShrink: 0
6354
6442
  },
6355
- "aria-label": zh ? "本轮选择记录" : "Turn selection evidence",
6443
+ "aria-label": zh ? "为什么本轮选择这个模型" : "Why this model was selected",
6356
6444
  "aria-expanded": open,
6357
6445
  "aria-controls": open ? id : void 0,
6358
6446
  "aria-haspopup": "dialog",
@@ -6382,7 +6470,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6382
6470
  color: "var(--dsw-alias-label-primary, CanvasText)",
6383
6471
  lineHeight: 1.6
6384
6472
  }
6385
- }, (0, react.createElement)("strong", null, zh ? "本轮选择记录" : "Turn selection evidence"), selection.mode === "auto" ? (0, react.createElement)("p", null, `${reason}. `, zh ? `容量偏好:${selection.preference}。` : `Capacity preference: ${selection.preference}. `, zh ? `从 ${selection.candidateCount} 个合格模型中选择。` : `Selected from ${selection.candidateCount} eligible models.`, selection.fittingCandidateCount === void 0 ? "" : zh ? `其中 ${selection.fittingCandidateCount} 个可容纳估算输入。` : ` ${selection.fittingCandidateCount} fit the estimated input.`) : null, incomplete ? (0, react.createElement)("p", null, zh ? "模型归属不完整:部分尝试或历史未记录模型。原生 Usage 保持不变。" : "Model attribution is incomplete: some attempts or history have no recorded model. Native Usage is unchanged.") : null, (0, react.createElement)("p", null, zh ? "此记录说明选择方式,不证明执行;实际模型以原生 Usage 为准。" : "Selection evidence is not execution proof; see native Usage for recorded models."), (0, react.createElement)("button", {
6473
+ }, (0, react.createElement)("strong", null, zh ? "为什么本轮选择这个模型" : "Why this model was selected"), selection.mode === "auto" ? explanation === void 0 ? (0, react.createElement)("p", null, zh ? "本轮未保留详细选模原因;不使用当前设置反推历史。" : "Detailed selection reasons were not retained for this turn; today’s settings cannot reconstruct them.") : (0, react.createElement)("div", null, (0, react.createElement)("p", null, explanation.conclusion), (0, react.createElement)("p", null, explanation.choice), (0, react.createElement)("details", null, (0, react.createElement)("summary", null, zh ? "查看判断依据" : "Assessment details"), (0, react.createElement)("p", null, explanation.assessment), (0, react.createElement)("p", null, zh ? `${selection.candidateCount} 个合格候选;${selection.fittingCandidateCount ?? "未知"} 个可容纳估算输入。` : `${selection.candidateCount} eligible candidates; ${selection.fittingCandidateCount ?? "unknown"} fit the estimated input.`), explanation.diagnostic ? (0, react.createElement)("p", null, explanation.diagnostic) : null, (0, react.createElement)("p", null, zh ? "分类来自供应方;不保证实际速度、费用或任务质量。" : "Supplier categories do not guarantee actual speed, cost or task quality."))) : null, incomplete ? (0, react.createElement)("p", null, zh ? "模型归属不完整:部分尝试或历史未记录模型。原生 Usage 保持不变。" : "Model attribution is incomplete: some attempts or history have no recorded model. Native Usage is unchanged.") : null, (0, react.createElement)("p", null, zh ? "此记录说明选择方式,不证明执行;实际模型以原生 Usage 为准。" : "Selection evidence is not execution proof; see native Usage for recorded models."), (0, react.createElement)("button", {
6386
6474
  ref: close,
6387
6475
  type: "button",
6388
6476
  style: button,