dsh-github-copilot 0.4.0-alpha.115 → 0.4.0-alpha.116

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
@@ -5718,25 +5718,79 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5718
5718
  });
5719
5719
  });
5720
5720
  //#endregion
5721
- //#region lib/types/turn-selection.js
5722
- const ExplanationSchema = object({
5723
- assessment: object({
5724
- demand: _enum([
5725
- "simple",
5726
- "routine",
5727
- "complex",
5721
+ //#region lib/types/auto-task-assessment.js
5722
+ const TaskAssessmentSchema = object({
5723
+ demand: _enum([
5724
+ "simple",
5725
+ "routine",
5726
+ "complex",
5727
+ "unknown"
5728
+ ]),
5729
+ signals: array(_enum([
5730
+ "isolated-greeting",
5731
+ "bounded-transformation",
5732
+ "reasoning",
5733
+ "investigation",
5734
+ "continuation",
5735
+ "context-omitted",
5736
+ "insufficient-evidence"
5737
+ ])).max(7)
5738
+ }).strict();
5739
+ const GITHUB_COPILOT_PREVIEW_PROVIDER_ID = "github-copilot-preview";
5740
+ function autoModelPreference(model) {
5741
+ if (model === "auto") return "balance";
5742
+ if (model === "auto-efficiency") return "efficiency";
5743
+ if (model === "auto-intelligence") return "intelligence";
5744
+ }
5745
+ //#endregion
5746
+ //#region lib/types/auto-allocation.js
5747
+ const AUTO_ALLOCATION_POLICY = "high-cost-v1";
5748
+ const AutoAllocationSchema = object({
5749
+ policyVersion: literal(AUTO_ALLOCATION_POLICY),
5750
+ selectedModelId: string().min(1).max(512),
5751
+ candidates: array(object({
5752
+ modelId: string().min(1).max(512),
5753
+ highCost: boolean(),
5754
+ previous: boolean(),
5755
+ weight: number().positive().max(1.5),
5756
+ expectedShare: number().positive().max(1)
5757
+ }).strict()).min(1).max(512)
5758
+ }).strict().refine((value) => {
5759
+ const total = value.candidates.reduce((sum, row) => sum + row.weight, 0);
5760
+ return 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 ? 1.5 : 1) / 10 && Math.abs(row.expectedShare - row.weight / total) <= 1e-12);
5761
+ }, { message: "Invalid allocation policy evidence" });
5762
+ //#endregion
5763
+ //#region lib/types/auto-allocation-evidence.js
5764
+ const AutoAllocationSummarySchema = object({
5765
+ policyVersion: literal(AUTO_ALLOCATION_POLICY),
5766
+ scope: literal("viewed-session-host-lifetime"),
5767
+ status: _enum(["observed", "not-collected"]),
5768
+ retainedDecisions: number().int().nonnegative().max(128),
5769
+ noFitDecisions: number().int().nonnegative().max(128),
5770
+ rowsTruncated: boolean(),
5771
+ completeHistory: literal(false),
5772
+ observationStart: number().int().nonnegative().nullable(),
5773
+ observationEnd: number().int().nonnegative().nullable(),
5774
+ rows: array(object({
5775
+ modelId: string().min(1).max(512),
5776
+ category: _enum([
5777
+ "powerful",
5778
+ "versatile",
5779
+ "lightweight",
5728
5780
  "unknown"
5729
5781
  ]),
5730
- signals: array(_enum([
5731
- "isolated-greeting",
5732
- "bounded-transformation",
5733
- "reasoning",
5734
- "investigation",
5735
- "continuation",
5736
- "context-omitted",
5737
- "insufficient-evidence"
5738
- ])).max(7)
5739
- }).strict().extend({
5782
+ highCost: boolean(),
5783
+ previous: boolean(),
5784
+ weight: number().positive().max(1.5),
5785
+ opportunities: number().int().positive().max(128),
5786
+ expectedSelections: number().nonnegative().max(128),
5787
+ selections: number().int().nonnegative().max(128)
5788
+ }).strict()).max(512)
5789
+ }).strict();
5790
+ //#endregion
5791
+ //#region lib/types/turn-selection.js
5792
+ const ExplanationSchema = object({
5793
+ assessment: TaskAssessmentSchema.extend({
5740
5794
  source: _enum(["local", "semantic"]),
5741
5795
  diagnostic: _enum([
5742
5796
  "disabled",
@@ -5763,10 +5817,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5763
5817
  method: _enum([
5764
5818
  "continuity",
5765
5819
  "equal-distribution",
5820
+ "weighted-distribution",
5766
5821
  "only-candidate",
5767
5822
  "no-fit"
5768
5823
  ]),
5769
- fallback: boolean()
5824
+ fallback: boolean(),
5825
+ allocation: AutoAllocationSchema.optional()
5770
5826
  }).strict();
5771
5827
  const TurnSelectionSchema = discriminatedUnion("mode", [
5772
5828
  object({ mode: literal("unknown") }).strict(),
@@ -5811,45 +5867,63 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5811
5867
  //#region lib/types/turn-selection-remote.js
5812
5868
  const contribution$5 = {
5813
5869
  package: "dsh-github-copilot",
5814
- descriptors: [{
5815
- id: "dsh-github-copilot:githubCopilotTurnSelection.get",
5816
- namespace: "githubCopilotTurnSelection",
5817
- service: "githubCopilotTurnSelection",
5818
- method: "get",
5819
- invocation: { kind: "direct" },
5820
- parameters: [{
5821
- name: "agent",
5822
- wire: "agentId",
5823
- source: "lookup",
5824
- lookup: "agent",
5825
- codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", string().min(1).max(256))
5826
- }, {
5827
- name: "turn",
5828
- wire: "turn",
5829
- source: "json",
5830
- codec: strictRemoteCodec("dsh-github-copilot#TurnSelectionTurn", number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
5831
- }],
5832
- result: strictRemoteCodec("dsh-github-copilot#TurnSelection", TurnSelectionSchema)
5833
- }, {
5834
- id: "dsh-github-copilot:githubCopilotTurnSelection.requestedModels",
5835
- namespace: "githubCopilotTurnSelection",
5836
- service: "githubCopilotTurnSelection",
5837
- method: "requestedModels",
5838
- invocation: { kind: "direct" },
5839
- parameters: [{
5840
- name: "agent",
5841
- wire: "agentId",
5842
- source: "lookup",
5843
- lookup: "agent",
5844
- codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", string().min(1).max(256))
5845
- }, {
5846
- name: "turn",
5847
- wire: "turn",
5848
- source: "json",
5849
- codec: strictRemoteCodec("dsh-github-copilot#TurnSelectionTurn", number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
5850
- }],
5851
- result: strictRemoteCodec("dsh-github-copilot#RequestedModels", RequestedModelsSchema)
5852
- }]
5870
+ descriptors: [
5871
+ {
5872
+ id: "dsh-github-copilot:githubCopilotTurnSelection.get",
5873
+ namespace: "githubCopilotTurnSelection",
5874
+ service: "githubCopilotTurnSelection",
5875
+ method: "get",
5876
+ invocation: { kind: "direct" },
5877
+ parameters: [{
5878
+ name: "agent",
5879
+ wire: "agentId",
5880
+ source: "lookup",
5881
+ lookup: "agent",
5882
+ codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", string().min(1).max(256))
5883
+ }, {
5884
+ name: "turn",
5885
+ wire: "turn",
5886
+ source: "json",
5887
+ codec: strictRemoteCodec("dsh-github-copilot#TurnSelectionTurn", number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
5888
+ }],
5889
+ result: strictRemoteCodec("dsh-github-copilot#TurnSelection", TurnSelectionSchema)
5890
+ },
5891
+ {
5892
+ id: "dsh-github-copilot:githubCopilotTurnSelection.requestedModels",
5893
+ namespace: "githubCopilotTurnSelection",
5894
+ service: "githubCopilotTurnSelection",
5895
+ method: "requestedModels",
5896
+ invocation: { kind: "direct" },
5897
+ parameters: [{
5898
+ name: "agent",
5899
+ wire: "agentId",
5900
+ source: "lookup",
5901
+ lookup: "agent",
5902
+ codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", string().min(1).max(256))
5903
+ }, {
5904
+ name: "turn",
5905
+ wire: "turn",
5906
+ source: "json",
5907
+ codec: strictRemoteCodec("dsh-github-copilot#TurnSelectionTurn", number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
5908
+ }],
5909
+ result: strictRemoteCodec("dsh-github-copilot#RequestedModels", RequestedModelsSchema)
5910
+ },
5911
+ {
5912
+ id: "dsh-github-copilot:githubCopilotTurnSelection.allocationSummary",
5913
+ namespace: "githubCopilotTurnSelection",
5914
+ service: "githubCopilotTurnSelection",
5915
+ method: "allocationSummary",
5916
+ invocation: { kind: "direct" },
5917
+ parameters: [{
5918
+ name: "agent",
5919
+ wire: "agentId",
5920
+ source: "lookup",
5921
+ lookup: "agent",
5922
+ codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", string().min(1).max(256))
5923
+ }],
5924
+ result: strictRemoteCodec("dsh-github-copilot#AutoAllocationSummary", AutoAllocationSummarySchema)
5925
+ }
5926
+ ]
5853
5927
  };
5854
5928
  //#endregion
5855
5929
  //#region lib/types/replay-recovery-types.js
@@ -6192,6 +6266,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6192
6266
  excludedModelIds: array(string().min(1).max(512)).max(512),
6193
6267
  lockedModelIds: array(string().min(1).max(512)).max(512),
6194
6268
  unavailableExcludedModelIds: array(string().min(1).max(512)).max(512),
6269
+ highCostModelIds: array(string().min(1).max(512)).max(512).optional(),
6195
6270
  error: _enum([
6196
6271
  "COPILOT_MODEL_PREFERENCES_UNAVAILABLE",
6197
6272
  "COPILOT_MODEL_SETTINGS_UNAVAILABLE",
@@ -6324,6 +6399,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6324
6399
  }],
6325
6400
  result: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelPreferencesView", GitHubCopilotModelPreferencesViewSchema)
6326
6401
  },
6402
+ {
6403
+ id: "dsh-github-copilot:githubCopilot.setModelHighCost",
6404
+ service: "githubCopilotAuthorization",
6405
+ namespace: "githubCopilot",
6406
+ method: "setModelHighCost",
6407
+ invocation: direct,
6408
+ parameters: [{
6409
+ name: "modelId",
6410
+ wire: "modelId",
6411
+ source: "json",
6412
+ codec: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelId", string().min(1).max(512))
6413
+ }, {
6414
+ name: "highCost",
6415
+ wire: "highCost",
6416
+ source: "json",
6417
+ codec: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelHighCost", boolean())
6418
+ }],
6419
+ result: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelPreferencesView", GitHubCopilotModelPreferencesViewSchema)
6420
+ },
6327
6421
  {
6328
6422
  id: "dsh-github-copilot:githubCopilot.migrationStatus",
6329
6423
  service: "githubCopilotAuthorization",
@@ -6343,12 +6437,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6343
6437
  ...contribution$1.descriptors
6344
6438
  ]
6345
6439
  };
6346
- const GITHUB_COPILOT_PREVIEW_PROVIDER_ID = "github-copilot-preview";
6347
- function autoModelPreference(model) {
6348
- if (model === "auto") return "balance";
6349
- if (model === "auto-efficiency") return "efficiency";
6350
- if (model === "auto-intelligence") return "intelligence";
6351
- }
6352
6440
  //#endregion
6353
6441
  //#region lib/types/reasoning-presentation.js
6354
6442
  /** Plugin-owned, Step-scoped provenance; never a model route or durable message. */
@@ -6721,7 +6809,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6721
6809
  "insufficient-evidence": zh ? "本地规则尚不能确定任务需求" : "local rules cannot establish task demand"
6722
6810
  };
6723
6811
  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]}.`;
6724
- const choice = 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.";
6812
+ const allocation = explanation.allocation;
6813
+ const selected = allocation?.candidates.find((row) => row.modelId === allocation.selectedModelId);
6814
+ const choice = 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.";
6725
6815
  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 ? `语义判断未提供完整可用依据(${{
6726
6816
  unavailable: "没有可用分类模型",
6727
6817
  "invalid-result": "结果无效",
@@ -6760,7 +6850,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6760
6850
  if (account.state !== "recorded" || account.identity === void 0) return zh ? "身份暂不可用" : "identity unavailable";
6761
6851
  return `@${account.identity.login}`;
6762
6852
  }
6763
- function TurnSelectionCard({ selection, locale = "en", incomplete = false, readState = "ready", retry, account, accountFailed = false, retryAccount, models, modelsFailed = false, retryModels }) {
6853
+ function TurnSelectionCard({ selection, locale = "en", incomplete = false, readState = "ready", retry, account, accountFailed = false, retryAccount, models, modelsFailed = false, retryModels, allocationEvidence }) {
6764
6854
  const zh = locale.startsWith("zh");
6765
6855
  const id = (0, react.useId)();
6766
6856
  const [open, setOpen] = (0, react.useState)(false);
@@ -6924,7 +7014,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6924
7014
  borderTop: button.border,
6925
7015
  marginTop: 18,
6926
7016
  paddingTop: 12
6927
- } }, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, 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, explanation.semantic ? (0, react.createElement)("p", null, explanation.semantic) : null, (0, react.createElement)("p", null, zh ? "分类来自供应方;不保证实际速度、费用或任务质量。" : "Supplier categories do not guarantee actual speed, cost or task quality."))) : (0, react.createElement)("p", null, selection.mode === "manual" ? zh ? "本轮捕获了明确的手动选择;选择记录不是执行证明。" : "An explicit manual selection was captured for this turn; selection is not execution proof." : zh ? "本轮选择记录未保留;不使用当前设置反推历史。" : "Selection evidence was not retained; today’s settings cannot reconstruct it.")), !accountOpen && incomplete && models === void 0 ? (0, react.createElement)("p", null, zh ? "模型归属不完整:部分尝试或历史未记录模型。原生 Usage 保持不变。" : "Model attribution is incomplete: some attempts or history have no recorded model. Native Usage is unchanged.") : null, accountOpen ? null : (0, react.createElement)("p", null, zh ? "模型记录与计费归属不同。选择记录不是执行证明;原生 Usage、失败状态和重试保持不变。" : "Model evidence is not billing attribution. Selection is not execution proof; native Usage is unchanged, as are failures and retries."), (0, react.createElement)("button", {
7017
+ } }, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, 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, explanation.semantic ? (0, react.createElement)("p", null, explanation.semantic) : null, (0, react.createElement)("p", null, zh ? "分类来自供应方;不保证实际速度、费用或任务质量。" : "Supplier categories do not guarantee actual speed, cost or task quality."))) : (0, react.createElement)("p", null, selection.mode === "manual" ? zh ? "本轮捕获了明确的手动选择;选择记录不是执行证明。" : "An explicit manual selection was captured for this turn; selection is not execution proof." : zh ? "本轮选择记录未保留;不使用当前设置反推历史。" : "Selection evidence was not retained; today’s settings cannot reconstruct it.")), !accountOpen && incomplete && models === void 0 ? (0, react.createElement)("p", null, zh ? "模型归属不完整:部分尝试或历史未记录模型。原生 Usage 保持不变。" : "Model attribution is incomplete: some attempts or history have no recorded model. Native Usage is unchanged.") : null, !accountOpen ? allocationEvidence : null, accountOpen ? null : (0, react.createElement)("p", null, zh ? "模型记录与计费归属不同。选择记录不是执行证明;原生 Usage、失败状态和重试保持不变。" : "Model evidence is not billing attribution. Selection is not execution proof; native Usage is unchanged, as are failures and retries."), (0, react.createElement)("button", {
6928
7018
  ref: close,
6929
7019
  type: "button",
6930
7020
  style: button,
@@ -7231,6 +7321,48 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7231
7321
  }, zh ? "关闭" : "Close")) : null);
7232
7322
  }
7233
7323
  //#endregion
7324
+ //#region lib/types/auto-allocation-card.js
7325
+ function AutoAllocationCard({ read, locale }) {
7326
+ const zh = locale.startsWith("zh");
7327
+ const [summary, setSummary] = (0, react.useState)();
7328
+ const [failed, setFailed] = (0, react.useState)(false);
7329
+ const [attempt, setAttempt] = (0, react.useState)(0);
7330
+ (0, react.useEffect)(() => {
7331
+ let active = true;
7332
+ setFailed(false);
7333
+ setSummary(void 0);
7334
+ read().then((result) => {
7335
+ if (!active) return;
7336
+ const parsed = result.ok ? AutoAllocationSummarySchema.safeParse(result.value) : void 0;
7337
+ if (parsed?.success) setSummary(parsed.data);
7338
+ else setFailed(true);
7339
+ }, () => {
7340
+ if (active) setFailed(true);
7341
+ });
7342
+ return () => {
7343
+ active = false;
7344
+ };
7345
+ }, [read, attempt]);
7346
+ 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", {
7347
+ type: "button",
7348
+ onClick: () => setAttempt((value) => value + 1)
7349
+ }, 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: {
7350
+ display: "grid",
7351
+ gap: 6
7352
+ } }, zh ? "只读本地观察 JSON" : "Read-only local observation JSON", (0, react.createElement)("textarea", {
7353
+ readOnly: true,
7354
+ value: JSON.stringify(summary, null, 2),
7355
+ rows: 8,
7356
+ style: {
7357
+ width: "100%",
7358
+ boxSizing: "border-box",
7359
+ font: "inherit",
7360
+ color: "inherit",
7361
+ background: "var(--dsw-alias-bg-layer-1, Canvas)"
7362
+ }
7363
+ }))));
7364
+ }
7365
+ //#endregion
7234
7366
  //#region lib/types/auto-model-presentation.js
7235
7367
  const AUTO_MODEL_ATTRIBUTION_KEY = "github-copilot-auto-model-attribution";
7236
7368
  const SLOT = "conversation.chat.assistant-actions";
@@ -7353,6 +7485,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7353
7485
  const [account, setAccount] = react.useState();
7354
7486
  const [accountFailed, setAccountFailed] = react.useState(false);
7355
7487
  const [accountAttempt, setAccountAttempt] = react.useState(0);
7488
+ const readAllocation = react.useMemo(() => sessionId === void 0 || props.remote?.allocationSummary === void 0 ? void 0 : () => props.remote.allocationSummary(sessionId), [sessionId, props.remote]);
7356
7489
  react.useEffect(() => {
7357
7490
  setLive({ mode: "unknown" });
7358
7491
  if (turn === void 0 || sessionId === void 0 || props.remote === void 0) {
@@ -7512,6 +7645,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7512
7645
  account,
7513
7646
  accountFailed,
7514
7647
  retryAccount: () => setAccountAttempt((value) => value + 1),
7648
+ allocationEvidence: readAllocation === void 0 ? void 0 : react.createElement(AutoAllocationCard, {
7649
+ read: readAllocation,
7650
+ locale: language
7651
+ }),
7515
7652
  retry: props.remote === void 0 ? void 0 : () => setReadAttempt((value) => value + 1)
7516
7653
  }), usageDiagnostic === void 0 ? null : react.createElement(TurnUsageNotice, {
7517
7654
  diagnostic: usageDiagnostic,
@@ -7568,9 +7705,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7568
7705
  const face = record$4(capabilities.remote) ? capabilities.remote.githubCopilotTurnSelection : void 0;
7569
7706
  const getSelection = record$4(face) ? face.get : void 0;
7570
7707
  const getRequested = record$4(face) ? face.requestedModels : void 0;
7708
+ const getAllocation = record$4(face) ? face.allocationSummary : void 0;
7571
7709
  const remote = typeof getSelection === "function" ? {
7572
7710
  get: (agentId, turn) => getSelection(agentId, turn),
7573
- ...typeof getRequested === "function" ? { requestedModels: (agentId, turn) => getRequested(agentId, turn) } : {}
7711
+ ...typeof getRequested === "function" ? { requestedModels: (agentId, turn) => getRequested(agentId, turn) } : {},
7712
+ ...typeof getAllocation === "function" ? { allocationSummary: (agentId) => getAllocation(agentId) } : {}
7574
7713
  } : void 0;
7575
7714
  const accountFace = record$4(capabilities.remote) ? capabilities.remote.githubCopilotSessionAccount : void 0;
7576
7715
  const readAccount = record$4(accountFace) ? accountFace.turn : void 0;
@@ -10992,8 +11131,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10992
11131
  };
10993
11132
  function preferenceMessage(code) {
10994
11133
  switch (code) {
10995
- case "COPILOT_MODEL_SETTINGS_UNAVAILABLE": return "Cannot read model exclusion settings. Models are read-only. Retry to read settings again.";
10996
- case "COPILOT_MODEL_SETTINGS_INVALID": return "Model exclusion settings are invalid. No settings were changed. Review the settings before retrying.";
11134
+ case "COPILOT_MODEL_SETTINGS_UNAVAILABLE": return "Cannot read model preference settings. Models are read-only. Retry to read settings again.";
11135
+ case "COPILOT_MODEL_SETTINGS_INVALID": return "Model preference settings are invalid. No settings were changed. Review the settings before retrying.";
10997
11136
  case "COPILOT_MODEL_SELECTION_UNAVAILABLE": return "Cannot confirm the models selected by sessions or the default. Changes are disabled to protect those selections. Retry to check again.";
10998
11137
  case "COPILOT_MODEL_EXCLUSION_SELECTED": return "This model is selected by a session or the default. Select another fixed model there before excluding it.";
10999
11138
  case "COPILOT_MODEL_EXCLUSION_CONFLICT": return "Settings changed elsewhere. Review the current list before trying again.";
@@ -11035,13 +11174,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11035
11174
  const availabilityKnown = models?.state === "ready";
11036
11175
  const settingsKnown = preferences !== void 0 && preferences.revision !== void 0;
11037
11176
  const excluded = new Set(preferences?.excludedModelIds ?? []);
11177
+ const highCost = new Set(preferences?.highCostModelIds ?? []);
11178
+ const highCostKnown = settingsKnown && preferences?.highCostModelIds !== void 0;
11038
11179
  const diagnostic = error ?? preferences?.error ?? (preferences === void 0 ? "COPILOT_MODEL_PREFERENCES_UNAVAILABLE" : void 0);
11039
11180
  const writable = preferences?.writable === true && settingsKnown;
11040
11181
  const rows = [...available.map((model) => ({
11041
11182
  id: model.id,
11042
11183
  name: model.name,
11043
11184
  available: true
11044
- })), ...Array.from(/* @__PURE__ */ new Set([...preferences?.excludedModelIds ?? [], ...preferences?.unavailableExcludedModelIds ?? []])).filter((id) => !available.some((model) => model.id === id)).map((id) => ({
11185
+ })), ...Array.from(/* @__PURE__ */ new Set([
11186
+ ...preferences?.excludedModelIds ?? [],
11187
+ ...preferences?.unavailableExcludedModelIds ?? [],
11188
+ ...preferences?.highCostModelIds ?? []
11189
+ ])).filter((id) => !available.some((model) => model.id === id)).map((id) => ({
11045
11190
  id,
11046
11191
  name: id,
11047
11192
  available: false
@@ -11050,7 +11195,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11050
11195
  const filtered = rows.filter((model) => (filter === "all" || filter === "enabled" && settingsKnown && !excluded.has(model.id) || filter === "excluded" && settingsKnown && excluded.has(model.id) || filter === "available" && availabilityKnown && model.available || filter === "unavailable" && availabilityKnown && !model.available) && (needle.length === 0 || model.id.toLocaleLowerCase().includes(needle) || model.name.toLocaleLowerCase().includes(needle)));
11051
11196
  const visibleCount = available.filter((model) => !excluded.has(model.id)).length;
11052
11197
  const unavailableCount = rows.filter((model) => !model.available).length;
11053
- const update = async (modelId, restore = false) => {
11198
+ const update = async (modelId, restore = false, marking) => {
11054
11199
  const scope = request.current;
11055
11200
  if (scope.pending || modelId !== void 0 && !writable) return;
11056
11201
  scope.pending = true;
@@ -11061,7 +11206,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11061
11206
  setErrorModel(modelId);
11062
11207
  try {
11063
11208
  if (modelId !== void 0) {
11064
- const result = await props.remote.setModelExcluded(modelId, !restore);
11209
+ const result = marking === void 0 ? await props.remote.setModelExcluded(modelId, !restore) : await props.remote.setModelHighCost(modelId, marking);
11065
11210
  if (!current()) return;
11066
11211
  if (!result.ok) {
11067
11212
  setError("COPILOT_MODEL_EXCLUSION_SAVE_FAILED");
@@ -11108,7 +11253,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11108
11253
  return (0, react.createElement)("details", { "data-dsh-github-copilot-model-preferences": true }, (0, react.createElement)("summary", null, settingsKnown ? `Model preferences · ${visibleCount} enabled · ${excluded.size} excluded` : "Model preferences · Read-only"), (0, react.createElement)("p", { style: {
11109
11254
  fontSize: "14px",
11110
11255
  marginBlock: "12px"
11111
- } }, "Exclusions are shared across GitHub Copilot accounts; availability below reflects the current account. Newly discovered models are enabled by default. Unavailable saved exclusions are retained and apply again if that model returns. Excluded models disappear from the managed picker and cannot start a new turn, including Auto. An admitted turn keeps its model. Fixed selections are not changed; select another model before the next turn. Restoring a model does not select it."), availabilityKnown ? null : (0, react.createElement)("p", { role: "status" }, "Current account availability unconfirmed. Shown models reflect the last metadata snapshot and saved exclusions, not a current availability check."), diagnostic === void 0 ? null : (0, react.createElement)("div", {
11256
+ } }, "Exclusions are shared across GitHub Copilot accounts; availability below reflects the current account. Newly discovered models are enabled by default. Unavailable saved exclusions are retained and apply again if that model returns. Excluded models disappear from the managed picker and cannot start a new turn, including Auto. An admitted turn keeps its model. Fixed selections are not changed; select another model before the next turn. Restoring a model does not select it."), (0, react.createElement)("p", { style: {
11257
+ fontSize: "14px",
11258
+ marginBlock: "12px"
11259
+ } }, "High cost is your preference, not a price or quality rating. Auto gives marked models a smaller, nonzero allocation weight within their fitting category, including Fast models. Continuity is a small bonus, not a lock. Markings are shared across accounts, save immediately and affect new Auto turns only; fixed selections and admitted turns are unchanged."), highCostKnown ? null : (0, react.createElement)("p", { role: "status" }, "High-cost preferences are unknown. Retry to read settings; marking is disabled."), availabilityKnown ? null : (0, react.createElement)("p", { role: "status" }, "Current account availability unconfirmed. Shown models reflect the last metadata snapshot and saved preferences, not a current availability check."), diagnostic === void 0 ? null : (0, react.createElement)("div", {
11112
11260
  role: "alert",
11113
11261
  "data-dsh-github-copilot-model-preferences-error": true,
11114
11262
  style: {
@@ -11180,6 +11328,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11180
11328
  key: model.id,
11181
11329
  style: {
11182
11330
  display: "flex",
11331
+ flexWrap: "wrap",
11183
11332
  gap: "12px",
11184
11333
  alignItems: "center",
11185
11334
  paddingBlock: "12px",
@@ -11190,13 +11339,27 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11190
11339
  minWidth: 0,
11191
11340
  overflowWrap: "anywhere",
11192
11341
  fontSize: "14px"
11193
- } }, (0, react.createElement)("strong", null, model.name), (0, react.createElement)("br"), (0, react.createElement)("code", null, model.id), (0, react.createElement)("span", null, ` · ${!availabilityKnown ? "Current account availability unconfirmed" : model.available ? "Available on current account" : "Currently unavailable on current account; saved exclusion retained"}`), (0, react.createElement)("span", null, ` · ${!settingsKnown ? "Exclusion status unknown" : isExcluded ? "Excluded" : "Enabled"}`), errorModel === model.id && error !== void 0 ? (0, react.createElement)("span", {
11342
+ } }, (0, react.createElement)("strong", null, model.name), (0, react.createElement)("br"), (0, react.createElement)("code", null, model.id), (0, react.createElement)("span", null, ` · ${!availabilityKnown ? "Current account availability unconfirmed" : model.available ? "Available on current account" : "Currently unavailable on current account; saved preferences retained"}`), (0, react.createElement)("span", null, ` · ${!settingsKnown ? "Exclusion status unknown" : isExcluded ? "Excluded" : "Enabled"}`), errorModel === model.id && error !== void 0 ? (0, react.createElement)("span", {
11194
11343
  role: "status",
11195
11344
  style: {
11196
11345
  display: "block",
11197
11346
  marginTop: "6px"
11198
11347
  }
11199
- }, preferenceMessage(error)) : null), (0, react.createElement)("button", {
11348
+ }, preferenceMessage(error)) : null), (0, react.createElement)("label", { style: {
11349
+ display: "inline-flex",
11350
+ alignItems: "center",
11351
+ gap: "6px",
11352
+ fontSize: "14px",
11353
+ minHeight: "36px"
11354
+ } }, (0, react.createElement)("input", {
11355
+ type: "checkbox",
11356
+ checked: highCost.has(model.id),
11357
+ disabled: disabled || !highCostKnown,
11358
+ "aria-label": `High cost ${model.name}`,
11359
+ "data-dsh-github-copilot-high-cost": true,
11360
+ "data-high-cost-model-id": model.id,
11361
+ onChange: (event) => update(model.id, false, event.currentTarget.checked)
11362
+ }), "High cost"), (0, react.createElement)("button", {
11200
11363
  type: "button",
11201
11364
  style: {
11202
11365
  ...controlStyle,
@@ -11315,6 +11478,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11315
11478
  "lockedModelIds",
11316
11479
  "unavailableExcludedModelIds"
11317
11480
  ]) next[key] = viewStrings(fields[key]);
11481
+ if (fields.highCostModelIds !== void 0) next.highCostModelIds = viewStrings(fields.highCostModelIds);
11318
11482
  owned.modelPreferences = next;
11319
11483
  }
11320
11484
  const parsed = GitHubCopilotAuthorizationViewSchema.safeParse(owned);