dsh-github-copilot 0.4.0-alpha.80 → 0.4.0-alpha.82
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 +14 -0
- package/CHANGELOG.md +13 -0
- package/README.md +13 -8
- package/README.zh.md +13 -8
- package/deployment-baseline.json +34 -2
- package/docs/auto-task-routing.md +114 -0
- package/docs/automatic-model-routing.md +28 -21
- package/docs/copilot-usage.md +18 -0
- package/lib/client.js +370 -42
- package/lib/client.js.map +1 -1
- package/lib/index.js +446 -150
- package/lib/remote.js +53 -1
- package/lib/types/account-model-catalog.d.ts +3 -0
- package/lib/types/auto-model-host.d.ts +4 -0
- package/lib/types/auto-model-routing.d.ts +15 -3
- package/lib/types/auto-selection-explanation.d.ts +8 -0
- package/lib/types/auto-task-assessment.d.ts +45 -0
- package/lib/types/auto-task-classifier.d.ts +7 -0
- package/lib/types/config.d.ts +2 -0
- package/lib/types/preview-route.d.ts +1 -1
- package/lib/types/remote.d.ts +1 -1
- package/lib/types/turn-selection.d.ts +52 -0
- package/lib/types/turn-usage-evidence.d.ts +47 -0
- package/lib/types/turn-usage-notice.d.ts +7 -0
- package/package.json +2 -1
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
|
|
@@ -5919,14 +5968,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5919
5968
|
const CHAT_NODE_SLOT = "conversation.chat.node";
|
|
5920
5969
|
const ASSISTANT_KEY = "assistant-step";
|
|
5921
5970
|
const noop$3 = () => {};
|
|
5922
|
-
function record$
|
|
5971
|
+
function record$6(value) {
|
|
5923
5972
|
return typeof value === "object" && value !== null;
|
|
5924
5973
|
}
|
|
5925
5974
|
function sequence$1(value) {
|
|
5926
5975
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
5927
5976
|
}
|
|
5928
5977
|
function eventLocation(event) {
|
|
5929
|
-
if (!record$
|
|
5978
|
+
if (!record$6(event) || !record$6(event.data)) return void 0;
|
|
5930
5979
|
const { turn, step } = event.data;
|
|
5931
5980
|
return sequence$1(turn) && sequence$1(step) ? {
|
|
5932
5981
|
turn,
|
|
@@ -5934,9 +5983,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5934
5983
|
} : void 0;
|
|
5935
5984
|
}
|
|
5936
5985
|
function messageOrigin(event) {
|
|
5937
|
-
if (!record$
|
|
5986
|
+
if (!record$6(event) || event.type !== "assistant/message" || event.surfaceOp !== "append" || !sequence$1(event.seq) || !record$6(event.data) || !record$6(event.data.message)) return void 0;
|
|
5938
5987
|
const source = event.data.message.source;
|
|
5939
|
-
if (!record$
|
|
5988
|
+
if (!record$6(source) || typeof source.provider !== "string" || source.provider.trim() === "" || typeof source.model !== "string" || source.model.trim() === "") return void 0;
|
|
5940
5989
|
return {
|
|
5941
5990
|
seq: event.seq,
|
|
5942
5991
|
provider: source.provider,
|
|
@@ -5947,7 +5996,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5947
5996
|
const assistantOriginDefinition = {
|
|
5948
5997
|
kind: ASSISTANT_ORIGIN_KEY,
|
|
5949
5998
|
match(event) {
|
|
5950
|
-
if (!record$
|
|
5999
|
+
if (!record$6(event)) return null;
|
|
5951
6000
|
const location = eventLocation(event);
|
|
5952
6001
|
if (location === void 0) return null;
|
|
5953
6002
|
if (event.type === "step/start") return {
|
|
@@ -5962,14 +6011,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5962
6011
|
},
|
|
5963
6012
|
start(_context, match) {
|
|
5964
6013
|
const location = eventLocation(match.event);
|
|
5965
|
-
if (location === void 0 || !record$
|
|
6014
|
+
if (location === void 0 || !record$6(match.event) || match.event.type !== "step/start") throw new Error("COPILOT_REASONING_ORIGIN_START: expected step/start");
|
|
5966
6015
|
return {
|
|
5967
6016
|
...location,
|
|
5968
6017
|
origin: void 0
|
|
5969
6018
|
};
|
|
5970
6019
|
},
|
|
5971
6020
|
update(context, match) {
|
|
5972
|
-
if (!record$
|
|
6021
|
+
if (!record$6(match.event) || match.event.type !== "assistant/message" || match.event.surfaceOp !== "append") return context.state;
|
|
5973
6022
|
return {
|
|
5974
6023
|
...context.state,
|
|
5975
6024
|
origin: messageOrigin(match.event)
|
|
@@ -5980,7 +6029,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5980
6029
|
let state = context.state;
|
|
5981
6030
|
if (state === void 0) for (const match of context.matches) {
|
|
5982
6031
|
const event = match.event;
|
|
5983
|
-
if (!record$
|
|
6032
|
+
if (!record$6(event) || event.type !== "assistant/message" || event.surfaceOp !== "append") continue;
|
|
5984
6033
|
const location = eventLocation(event);
|
|
5985
6034
|
if (location !== void 0) state = {
|
|
5986
6035
|
...location,
|
|
@@ -6001,12 +6050,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6001
6050
|
};
|
|
6002
6051
|
/** Shallow UI-only projection. Unchanged input retains its exact props identity. */
|
|
6003
6052
|
function projectReasoningPresentation(props, origin) {
|
|
6004
|
-
if (!record$
|
|
6053
|
+
if (!record$6(props) || !record$6(props.node) || props.node.kind !== ASSISTANT_KEY || !record$6(props.node.data) || !record$6(origin)) return props;
|
|
6005
6054
|
const node = props.node;
|
|
6006
6055
|
const data = node.data;
|
|
6007
|
-
if (data.status !== "settled" || !record$
|
|
6056
|
+
if (data.status !== "settled" || !record$6(data.finalNode) || !sequence$1(data.finalNode.seq) || origin.seq !== data.finalNode.seq) return props;
|
|
6008
6057
|
if (!(origin.provider === "github-copilot" || origin.provider === "github-copilot-preview") || typeof origin.model !== "string" || origin.model.trim() === "" || !Array.isArray(data.blocks)) return props;
|
|
6009
|
-
const blocks = data.blocks.filter((block) => !(record$
|
|
6058
|
+
const blocks = data.blocks.filter((block) => !(record$6(block) && block.kind === "reasoning" && typeof block.text === "string" && block.text.trim() === ""));
|
|
6010
6059
|
if (blocks.length === data.blocks.length) return props;
|
|
6011
6060
|
return {
|
|
6012
6061
|
...props,
|
|
@@ -6025,12 +6074,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6025
6074
|
};
|
|
6026
6075
|
function originSource(props) {
|
|
6027
6076
|
const node = props.node;
|
|
6028
|
-
if (!record$
|
|
6077
|
+
if (!record$6(node) || !record$6(node.location) || node.location.kind !== "step" || !record$6(node.location.step) || !record$6(node.location.step.data)) return missingOriginSource;
|
|
6029
6078
|
const store = node.location.step.data;
|
|
6030
6079
|
if (typeof store.source !== "function") return missingOriginSource;
|
|
6031
6080
|
try {
|
|
6032
6081
|
const source = store.source(ASSISTANT_ORIGIN_KEY);
|
|
6033
|
-
if (!record$
|
|
6082
|
+
if (!record$6(source) || typeof source.getSnapshot !== "function" || typeof source.subscribe !== "function") return missingOriginSource;
|
|
6034
6083
|
return source;
|
|
6035
6084
|
} catch {
|
|
6036
6085
|
return missingOriginSource;
|
|
@@ -6044,7 +6093,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6044
6093
|
*/
|
|
6045
6094
|
function supportedNative(entry) {
|
|
6046
6095
|
const component = entry.component;
|
|
6047
|
-
return (entry.options.priority ?? 0) === 0 && entry.locale === "chat" && entry.options.id === void 0 && entry.options.order === void 0 && entry.options.label === void 0 && entry.inject === void 0 && entry.store === void 0 && entry.children === void 0 && entry.select === void 0 && record$
|
|
6096
|
+
return (entry.options.priority ?? 0) === 0 && entry.locale === "chat" && entry.options.id === void 0 && entry.options.order === void 0 && entry.options.label === void 0 && entry.inject === void 0 && entry.store === void 0 && entry.children === void 0 && entry.select === void 0 && record$6(component) && component.$$typeof === Symbol.for("react.memo") && typeof component.type === "function" && component.type.name === "AssistantNodeView";
|
|
6048
6097
|
}
|
|
6049
6098
|
/**
|
|
6050
6099
|
* Optional Client enhancement. The caller owns the returned disposer in its
|
|
@@ -6054,13 +6103,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6054
6103
|
const { diagnostic } = capabilities;
|
|
6055
6104
|
const slotsCandidate = capabilities.slots;
|
|
6056
6105
|
const conversation = capabilities.uiConversation;
|
|
6057
|
-
if (!record$
|
|
6106
|
+
if (!record$6(slotsCandidate) || ![
|
|
6058
6107
|
"entries",
|
|
6059
6108
|
"spec",
|
|
6060
6109
|
"subscribe",
|
|
6061
6110
|
"inject",
|
|
6062
6111
|
"register"
|
|
6063
|
-
].every((key) => typeof slotsCandidate[key] === "function") || !record$
|
|
6112
|
+
].every((key) => typeof slotsCandidate[key] === "function") || !record$6(conversation) || !record$6(conversation.events) || typeof conversation.events.register !== "function") {
|
|
6064
6113
|
diagnostic("COPILOT_REASONING_PRESENTATION_UNAVAILABLE");
|
|
6065
6114
|
return noop$3;
|
|
6066
6115
|
}
|
|
@@ -6165,14 +6214,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6165
6214
|
//#endregion
|
|
6166
6215
|
//#region lib/types/turn-model-provenance.js
|
|
6167
6216
|
const TURN_MODEL_PROVENANCE_KEY = "github-copilot-turn-model-provenance";
|
|
6168
|
-
function record$
|
|
6217
|
+
function record$5(value) {
|
|
6169
6218
|
return typeof value === "object" && value !== null;
|
|
6170
6219
|
}
|
|
6171
6220
|
function isTurnModelProvenance(value) {
|
|
6172
|
-
return record$
|
|
6221
|
+
return record$5(value) && typeof value.ended === "boolean" && typeof value.incomplete === "boolean" && Array.isArray(value.routes) && value.routes.every((route) => record$5(route) && typeof route.provider === "string" && route.provider.trim() !== "" && typeof route.model === "string" && route.model.trim() !== "");
|
|
6173
6222
|
}
|
|
6174
|
-
function coordinates(event) {
|
|
6175
|
-
if (!record$
|
|
6223
|
+
function coordinates$1(event) {
|
|
6224
|
+
if (!record$5(event) || typeof event.type !== "string" || !record$5(event.data) || !Number.isSafeInteger(event.data.turn) || typeof event.data.turn !== "number" || event.data.turn < 0 || ![
|
|
6176
6225
|
"turn/start",
|
|
6177
6226
|
"turn/end",
|
|
6178
6227
|
"step/start",
|
|
@@ -6188,8 +6237,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6188
6237
|
data: event.data
|
|
6189
6238
|
};
|
|
6190
6239
|
}
|
|
6191
|
-
function fold(state, event) {
|
|
6192
|
-
const parsed = coordinates(event);
|
|
6240
|
+
function fold$1(state, event) {
|
|
6241
|
+
const parsed = coordinates$1(event);
|
|
6193
6242
|
if (parsed === void 0 || state !== void 0 && state.turn !== parsed.turn) return state;
|
|
6194
6243
|
const hasStart = state?.hasStart === true || parsed.type === "turn/start";
|
|
6195
6244
|
const routes = state?.value.routes ?? [];
|
|
@@ -6205,8 +6254,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6205
6254
|
let missing = false;
|
|
6206
6255
|
let route;
|
|
6207
6256
|
if (parsed.type === "assistant/message") {
|
|
6208
|
-
const source = record$
|
|
6209
|
-
if (record$
|
|
6257
|
+
const source = record$5(parsed.data.message) ? parsed.data.message.source : void 0;
|
|
6258
|
+
if (record$5(source) && typeof source.provider === "string" && source.provider.trim() !== "" && typeof source.model === "string" && source.model.trim() !== "") route = {
|
|
6210
6259
|
provider: source.provider,
|
|
6211
6260
|
model: source.model
|
|
6212
6261
|
};
|
|
@@ -6227,23 +6276,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6227
6276
|
const turnModelProvenanceDefinition = {
|
|
6228
6277
|
kind: TURN_MODEL_PROVENANCE_KEY,
|
|
6229
6278
|
match(event) {
|
|
6230
|
-
const parsed = coordinates(event);
|
|
6279
|
+
const parsed = coordinates$1(event);
|
|
6231
6280
|
return parsed ? {
|
|
6232
6281
|
id: String(parsed.turn),
|
|
6233
6282
|
role: parsed.type === "turn/start" ? "start" : "update"
|
|
6234
6283
|
} : null;
|
|
6235
6284
|
},
|
|
6236
6285
|
start(_context, match) {
|
|
6237
|
-
const state = fold(void 0, match.event);
|
|
6286
|
+
const state = fold$1(void 0, match.event);
|
|
6238
6287
|
if (!state) throw new Error("COPILOT_MODEL_PROVENANCE_START");
|
|
6239
6288
|
return state;
|
|
6240
6289
|
},
|
|
6241
6290
|
update(context, match) {
|
|
6242
|
-
return fold(context.state, match.event) ?? context.state;
|
|
6291
|
+
return fold$1(context.state, match.event) ?? context.state;
|
|
6243
6292
|
},
|
|
6244
6293
|
buildLocationData(context, scope, previous) {
|
|
6245
6294
|
if (scope !== "turn") return null;
|
|
6246
|
-
const state = context.state ?? context.matches.reduce((state, match) => fold(state, match.event), void 0);
|
|
6295
|
+
const state = context.state ?? context.matches.reduce((state, match) => fold$1(state, match.event), void 0);
|
|
6247
6296
|
if (!state) return null;
|
|
6248
6297
|
const value = {
|
|
6249
6298
|
...state.value,
|
|
@@ -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
|
|
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 ? "
|
|
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,232 @@ 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 ? "
|
|
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", {
|
|
6474
|
+
ref: close,
|
|
6475
|
+
type: "button",
|
|
6476
|
+
style: button,
|
|
6477
|
+
onClick: () => {
|
|
6478
|
+
setOpen(false);
|
|
6479
|
+
trigger.current?.focus();
|
|
6480
|
+
}
|
|
6481
|
+
}, zh ? "关闭" : "Close")) : null);
|
|
6482
|
+
}
|
|
6483
|
+
//#endregion
|
|
6484
|
+
//#region lib/types/turn-usage-evidence.js
|
|
6485
|
+
const TURN_USAGE_EVIDENCE_KEY = "github-copilot-turn-usage-evidence";
|
|
6486
|
+
function record$4(value) {
|
|
6487
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6488
|
+
}
|
|
6489
|
+
function count$1(value) {
|
|
6490
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
6491
|
+
}
|
|
6492
|
+
function isTurnUsageEvidence(value) {
|
|
6493
|
+
return record$4(value) && typeof value.ended === "boolean" && typeof value.hasStart === "boolean" && count$1(value.localPreDispatchBlocks) && count$1(value.unreportedAttempts);
|
|
6494
|
+
}
|
|
6495
|
+
function coordinates(event) {
|
|
6496
|
+
if (!record$4(event) || typeof event.type !== "string" || !record$4(event.data) || !count$1(event.data.turn) || ![
|
|
6497
|
+
"turn/start",
|
|
6498
|
+
"turn/end",
|
|
6499
|
+
"assistant/message",
|
|
6500
|
+
"assistant/attempt"
|
|
6501
|
+
].includes(event.type)) return void 0;
|
|
6502
|
+
if (event.type === "assistant/message" && event.surfaceOp !== "append") return void 0;
|
|
6503
|
+
return {
|
|
6504
|
+
turn: event.data.turn,
|
|
6505
|
+
type: event.type,
|
|
6506
|
+
data: event.data
|
|
6507
|
+
};
|
|
6508
|
+
}
|
|
6509
|
+
function unreported(type, data) {
|
|
6510
|
+
if (type === "assistant/message" && data.usage !== void 0) return false;
|
|
6511
|
+
return !Array.isArray(data.stream) || !data.stream.some((entry) => record$4(entry) && entry.type === "chunk" && record$4(entry.chunk) && entry.chunk.type === "usage" && entry.chunk.usage !== void 0);
|
|
6512
|
+
}
|
|
6513
|
+
/** Recognize only our recorded finish-only diagnostic; never infer dispatch from a generic error. */
|
|
6514
|
+
function localBlock(data) {
|
|
6515
|
+
if (!Array.isArray(data.stream) || data.stream.length !== 1) return false;
|
|
6516
|
+
const entry = data.stream[0];
|
|
6517
|
+
if (!record$4(entry) || entry.type !== "chunk" || !record$4(entry.chunk) || entry.chunk.type !== "finish" || !record$4(entry.chunk.reason) || entry.chunk.reason.kind !== "error" || !record$4(entry.chunk.reason.failure)) return false;
|
|
6518
|
+
const failure = entry.chunk.reason.failure;
|
|
6519
|
+
if (failure.code !== "CONTEXT_WINDOW_EXCEEDED" || typeof failure.message !== "string" || failure.message.length > 256) return false;
|
|
6520
|
+
const match = /^Copilot local estimated input budget exceeded \((\d+) estimated tokens > (\d+) budget tokens\); requesting stock compaction before provider dispatch\.$/.exec(failure.message);
|
|
6521
|
+
if (!match) return false;
|
|
6522
|
+
const estimate = Number(match[1]), budget = Number(match[2]);
|
|
6523
|
+
return count$1(estimate) && count$1(budget) && budget > 0 && estimate > budget;
|
|
6524
|
+
}
|
|
6525
|
+
function fold(state, event) {
|
|
6526
|
+
const parsed = coordinates(event);
|
|
6527
|
+
if (!parsed || state !== void 0 && state.turn !== parsed.turn) return state;
|
|
6528
|
+
const value = state?.value ?? {
|
|
6529
|
+
ended: false,
|
|
6530
|
+
hasStart: false,
|
|
6531
|
+
localPreDispatchBlocks: 0,
|
|
6532
|
+
unreportedAttempts: 0
|
|
6533
|
+
};
|
|
6534
|
+
const missing = (parsed.type === "assistant/message" || parsed.type === "assistant/attempt") && unreported(parsed.type, parsed.data);
|
|
6535
|
+
const local = missing && parsed.type === "assistant/attempt" && localBlock(parsed.data);
|
|
6536
|
+
return {
|
|
6537
|
+
turn: parsed.turn,
|
|
6538
|
+
value: {
|
|
6539
|
+
ended: value.ended || parsed.type === "turn/end",
|
|
6540
|
+
hasStart: value.hasStart || parsed.type === "turn/start",
|
|
6541
|
+
localPreDispatchBlocks: Math.min(Number.MAX_SAFE_INTEGER, value.localPreDispatchBlocks + (local ? 1 : 0)),
|
|
6542
|
+
unreportedAttempts: Math.min(Number.MAX_SAFE_INTEGER, value.unreportedAttempts + (missing && !local ? 1 : 0))
|
|
6543
|
+
}
|
|
6544
|
+
};
|
|
6545
|
+
}
|
|
6546
|
+
/** Native completed-tail evidence gates the notice; native totals are never replaced. */
|
|
6547
|
+
function turnUsageDiagnostic(turn, tail, evidence, copilot) {
|
|
6548
|
+
if (!count$1(turn) || !record$4(tail) || tail.turn !== turn || !count$1(tail.seq) || tail.tokenUsage !== void 0) return void 0;
|
|
6549
|
+
const parsed = isTurnUsageEvidence(evidence) && evidence.ended ? evidence : void 0;
|
|
6550
|
+
if (!copilot && (parsed?.localPreDispatchBlocks ?? 0) === 0) return void 0;
|
|
6551
|
+
return {
|
|
6552
|
+
localPreDispatchBlocks: parsed?.localPreDispatchBlocks ?? 0,
|
|
6553
|
+
unreportedAttempts: parsed?.unreportedAttempts ?? 0,
|
|
6554
|
+
incompleteHistory: parsed?.hasStart !== true
|
|
6555
|
+
};
|
|
6556
|
+
}
|
|
6557
|
+
/** Diagnostic event counts only, not a competing usage total or billing projection. */
|
|
6558
|
+
const turnUsageEvidenceDefinition = {
|
|
6559
|
+
kind: TURN_USAGE_EVIDENCE_KEY,
|
|
6560
|
+
match(event) {
|
|
6561
|
+
const parsed = coordinates(event);
|
|
6562
|
+
return parsed ? {
|
|
6563
|
+
id: String(parsed.turn),
|
|
6564
|
+
role: parsed.type === "turn/start" ? "start" : "update"
|
|
6565
|
+
} : null;
|
|
6566
|
+
},
|
|
6567
|
+
start(_context, match) {
|
|
6568
|
+
const state = fold(void 0, match.event);
|
|
6569
|
+
if (!state) throw new Error("COPILOT_TURN_USAGE_EVIDENCE_START");
|
|
6570
|
+
return state;
|
|
6571
|
+
},
|
|
6572
|
+
update(context, match) {
|
|
6573
|
+
return fold(context.state, match.event) ?? context.state;
|
|
6574
|
+
},
|
|
6575
|
+
buildLocationData(context, scope, previous) {
|
|
6576
|
+
if (scope !== "turn") return null;
|
|
6577
|
+
const state = context.state ?? context.matches.reduce((state, match) => fold(state, match.event), void 0);
|
|
6578
|
+
if (!state) return null;
|
|
6579
|
+
const value = state.value;
|
|
6580
|
+
if (previous?.turn === state.turn && previous.value.ended === value.ended && previous.value.hasStart === value.hasStart && previous.value.localPreDispatchBlocks === value.localPreDispatchBlocks && previous.value.unreportedAttempts === value.unreportedAttempts) return previous;
|
|
6581
|
+
return {
|
|
6582
|
+
kind: "turn",
|
|
6583
|
+
turn: state.turn,
|
|
6584
|
+
key: TURN_USAGE_EVIDENCE_KEY,
|
|
6585
|
+
value
|
|
6586
|
+
};
|
|
6587
|
+
}
|
|
6588
|
+
};
|
|
6589
|
+
//#endregion
|
|
6590
|
+
//#region lib/types/turn-usage-notice.js
|
|
6591
|
+
function TurnUsageNotice({ diagnostic, locale = "en" }) {
|
|
6592
|
+
const zh = locale.startsWith("zh");
|
|
6593
|
+
const id = (0, react.useId)();
|
|
6594
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
6595
|
+
const [position, setPosition] = (0, react.useState)({
|
|
6596
|
+
left: 12,
|
|
6597
|
+
top: 12
|
|
6598
|
+
});
|
|
6599
|
+
const trigger = (0, react.useRef)(null);
|
|
6600
|
+
const panel = (0, react.useRef)(null);
|
|
6601
|
+
const close = (0, react.useRef)(null);
|
|
6602
|
+
const label = zh ? "本轮 Usage 不可用" : "Turn Usage unavailable";
|
|
6603
|
+
(0, react.useLayoutEffect)(() => {
|
|
6604
|
+
if (!open) return;
|
|
6605
|
+
panel.current?.showPopover?.();
|
|
6606
|
+
const place = () => {
|
|
6607
|
+
const a = trigger.current?.getBoundingClientRect(), b = panel.current?.getBoundingClientRect();
|
|
6608
|
+
if (a && b) setPosition({
|
|
6609
|
+
left: Math.max(12, Math.min(a.left, innerWidth - b.width - 12)),
|
|
6610
|
+
top: Math.max(12, Math.min(a.top - b.height - 8, innerHeight - b.height - 12))
|
|
6611
|
+
});
|
|
6612
|
+
};
|
|
6613
|
+
place();
|
|
6614
|
+
close.current?.focus();
|
|
6615
|
+
window.addEventListener("resize", place);
|
|
6616
|
+
window.addEventListener("scroll", place, true);
|
|
6617
|
+
return () => {
|
|
6618
|
+
window.removeEventListener("resize", place);
|
|
6619
|
+
window.removeEventListener("scroll", place, true);
|
|
6620
|
+
};
|
|
6621
|
+
}, [open]);
|
|
6622
|
+
(0, react.useEffect)(() => {
|
|
6623
|
+
if (!open) return;
|
|
6624
|
+
const outside = (event) => {
|
|
6625
|
+
if (event.target instanceof Node && !panel.current?.contains(event.target) && !trigger.current?.contains(event.target)) setOpen(false);
|
|
6626
|
+
};
|
|
6627
|
+
const key = (event) => {
|
|
6628
|
+
if (event.key === "Escape") {
|
|
6629
|
+
event.preventDefault();
|
|
6630
|
+
setOpen(false);
|
|
6631
|
+
trigger.current?.focus();
|
|
6632
|
+
}
|
|
6633
|
+
};
|
|
6634
|
+
document.addEventListener("pointerdown", outside);
|
|
6635
|
+
document.addEventListener("focusin", outside);
|
|
6636
|
+
document.addEventListener("keydown", key);
|
|
6637
|
+
return () => {
|
|
6638
|
+
document.removeEventListener("pointerdown", outside);
|
|
6639
|
+
document.removeEventListener("focusin", outside);
|
|
6640
|
+
document.removeEventListener("keydown", key);
|
|
6641
|
+
};
|
|
6642
|
+
}, [open]);
|
|
6643
|
+
const button = {
|
|
6644
|
+
font: "inherit",
|
|
6645
|
+
color: "inherit",
|
|
6646
|
+
background: "transparent",
|
|
6647
|
+
border: "1px solid var(--dsw-alias-border-main, GrayText)",
|
|
6648
|
+
borderRadius: 6,
|
|
6649
|
+
cursor: "pointer"
|
|
6650
|
+
};
|
|
6651
|
+
return (0, react.createElement)("span", { style: {
|
|
6652
|
+
order: 2,
|
|
6653
|
+
display: "inline-flex",
|
|
6654
|
+
minWidth: 0,
|
|
6655
|
+
maxWidth: "100%",
|
|
6656
|
+
fontSize: "var(--dsh-content-font-size-secondary, 13px)",
|
|
6657
|
+
color: "var(--dsw-alias-label-tertiary, GrayText)"
|
|
6658
|
+
} }, (0, react.createElement)("button", {
|
|
6659
|
+
ref: trigger,
|
|
6660
|
+
type: "button",
|
|
6661
|
+
style: {
|
|
6662
|
+
...button,
|
|
6663
|
+
minWidth: 0,
|
|
6664
|
+
overflow: "hidden",
|
|
6665
|
+
textOverflow: "ellipsis",
|
|
6666
|
+
whiteSpace: "nowrap"
|
|
6667
|
+
},
|
|
6668
|
+
title: label,
|
|
6669
|
+
"aria-expanded": open,
|
|
6670
|
+
"aria-controls": open ? id : void 0,
|
|
6671
|
+
"aria-haspopup": "dialog",
|
|
6672
|
+
onClick: () => setOpen((value) => !value)
|
|
6673
|
+
}, label), open ? (0, react.createElement)("div", {
|
|
6674
|
+
ref: panel,
|
|
6675
|
+
id,
|
|
6676
|
+
popover: "manual",
|
|
6677
|
+
role: "dialog",
|
|
6678
|
+
"aria-label": label,
|
|
6679
|
+
style: {
|
|
6680
|
+
position: "fixed",
|
|
6681
|
+
inset: "auto",
|
|
6682
|
+
...position,
|
|
6683
|
+
margin: 0,
|
|
6684
|
+
zIndex: 1e3,
|
|
6685
|
+
width: 340,
|
|
6686
|
+
maxWidth: "calc(100vw - 24px)",
|
|
6687
|
+
maxHeight: `calc(100dvh - ${position.top + 12}px)`,
|
|
6688
|
+
boxSizing: "border-box",
|
|
6689
|
+
overflowY: "auto",
|
|
6690
|
+
overflowWrap: "anywhere",
|
|
6691
|
+
padding: 16,
|
|
6692
|
+
borderRadius: 12,
|
|
6693
|
+
border: button.border,
|
|
6694
|
+
background: "var(--dsw-alias-bg-layer-2, Canvas)",
|
|
6695
|
+
color: "var(--dsw-alias-label-primary, CanvasText)",
|
|
6696
|
+
lineHeight: 1.6
|
|
6697
|
+
}
|
|
6698
|
+
}, (0, react.createElement)("strong", null, label), (0, react.createElement)("p", null, zh ? "原生统计无法证明本轮所有尝试的完整总量。部分步骤有用量,不代表整轮总量已知。" : "Native accounting cannot prove a complete total for every attempt in this turn. Reported usage on some steps is not a complete turn total."), diagnostic.localPreDispatchBlocks > 0 ? (0, react.createElement)("p", null, zh ? `记录中有 ${diagnostic.localPreDispatchBlocks} 次插件发出前的本地输入预算拦截,未记录供应商用量。后续压缩恢复不会补齐这些尝试的用量。` : `The history records ${diagnostic.localPreDispatchBlocks} local input-budget ${diagnostic.localPreDispatchBlocks === 1 ? "block" : "blocks"} before provider dispatch, with no reported provider usage. Subsequent compaction recovery does not fill in those attempts' usage.`) : null, diagnostic.unreportedAttempts > 0 ? (0, react.createElement)("p", null, zh ? `另有 ${diagnostic.unreportedAttempts} 次完成或失败记录未带用量样本;不能据此判断请求是否发出或计费。` : `${diagnostic.unreportedAttempts} other ${diagnostic.unreportedAttempts === 1 ? "settlement has" : "settlements have"} no reported usage sample; this does not establish whether a request was sent or billed.`) : null, diagnostic.incompleteHistory ? (0, react.createElement)("p", null, zh ? "本页未保留完整轮次证据;以上记录可能不完整。" : "Complete turn evidence is not retained on this page; these records may be incomplete.") : null, diagnostic.localPreDispatchBlocks === 0 && diagnostic.unreportedAttempts === 0 ? (0, react.createElement)("p", null, zh ? "现有证据无法确定原因;缺失的生命周期或无效用量也会使原生统计不可用。" : "The available evidence does not identify a cause; missing lifecycle boundaries or invalid usage can also make native accounting unavailable.") : null, (0, react.createElement)("p", null, zh ? "这是只读说明,不是零用量、部分合计或当前上下文占用。原生 Usage、用量记录与压缩恢复均保持不变。" : "This read-only explanation is not zero usage, a partial total or current context occupancy. Native Usage, usage records and compaction recovery remain unchanged."), (0, react.createElement)("button", {
|
|
6386
6699
|
ref: close,
|
|
6387
6700
|
type: "button",
|
|
6388
6701
|
style: button,
|
|
@@ -6468,14 +6781,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6468
6781
|
getSnapshot: () => void 0,
|
|
6469
6782
|
subscribe: () => noop$2
|
|
6470
6783
|
};
|
|
6471
|
-
function sourceOf(props, key, diagnostic) {
|
|
6784
|
+
function sourceOf(props, key, diagnostic, failure = "COPILOT_TURN_SELECTION_PROJECTION_FAILED") {
|
|
6472
6785
|
const turn = props.turn;
|
|
6473
6786
|
if (!record$3(turn) || !record$3(turn.data) || typeof turn.data.source !== "function") return missingSource;
|
|
6474
6787
|
try {
|
|
6475
6788
|
const source = turn.data.source(key);
|
|
6476
6789
|
return record$3(source) && typeof source.getSnapshot === "function" && typeof source.subscribe === "function" ? source : missingSource;
|
|
6477
6790
|
} catch {
|
|
6478
|
-
diagnostic(
|
|
6791
|
+
diagnostic(failure);
|
|
6479
6792
|
return missingSource;
|
|
6480
6793
|
}
|
|
6481
6794
|
}
|
|
@@ -6544,6 +6857,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6544
6857
|
const value = react.useSyncExternalStore(source.subscribe, source.getSnapshot, source.getSnapshot);
|
|
6545
6858
|
const provenanceSource = sourceOf(props, TURN_MODEL_PROVENANCE_KEY, props.diagnostic);
|
|
6546
6859
|
const provenance = react.useSyncExternalStore(provenanceSource.subscribe, provenanceSource.getSnapshot, provenanceSource.getSnapshot);
|
|
6860
|
+
const usageSource = sourceOf(props, TURN_USAGE_EVIDENCE_KEY, props.diagnostic, "COPILOT_TURN_USAGE_PROJECTION_FAILED");
|
|
6861
|
+
const usageEvidence = react.useSyncExternalStore(usageSource.subscribe, usageSource.getSnapshot, usageSource.getSnapshot);
|
|
6547
6862
|
const parsed = attribution({
|
|
6548
6863
|
type: "github-copilot/auto-model-decision",
|
|
6549
6864
|
data: {
|
|
@@ -6557,7 +6872,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6557
6872
|
if (evidence?.ended !== true && !nativeCompleted) return null;
|
|
6558
6873
|
if (evidence === void 0) props.diagnostic("COPILOT_TURN_SELECTION_PROVENANCE_UNAVAILABLE");
|
|
6559
6874
|
const nativeRoutes = nativeCompleted && record$3(native?.tokenUsage) && Array.isArray(native.tokenUsage.routes) ? native.tokenUsage.routes : [];
|
|
6560
|
-
|
|
6875
|
+
const copilot = (evidence?.routes ?? nativeRoutes).some((route) => record$3(route) && (route.provider === "github-copilot-preview" || route.provider === "github-copilot") && typeof route.model === "string" && route.model.trim() !== "");
|
|
6876
|
+
const usageDiagnostic = turn === void 0 ? void 0 : turnUsageDiagnostic(turn, native, usageEvidence, copilot);
|
|
6877
|
+
if (!copilot && parsed === void 0 && live.mode === "unknown" && usageDiagnostic === void 0) return null;
|
|
6878
|
+
if (usageDiagnostic !== void 0 && !isTurnUsageEvidence(usageEvidence)) props.diagnostic("COPILOT_TURN_USAGE_EVIDENCE_UNAVAILABLE");
|
|
6561
6879
|
const selection = live.mode !== "unknown" ? live : parsed?.preference ? {
|
|
6562
6880
|
mode: "auto",
|
|
6563
6881
|
preference: parsed.preference,
|
|
@@ -6565,13 +6883,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6565
6883
|
candidateCount: parsed.candidateCount,
|
|
6566
6884
|
fittingCandidateCount: parsed.fittingCandidateCount
|
|
6567
6885
|
} : { mode: "unknown" };
|
|
6568
|
-
return react.createElement(TurnSelectionCard, {
|
|
6886
|
+
return react.createElement(react.Fragment, null, react.createElement(TurnSelectionCard, {
|
|
6569
6887
|
selection,
|
|
6570
6888
|
locale: language,
|
|
6571
6889
|
incomplete: evidence?.incomplete ?? true,
|
|
6572
6890
|
readState: selection.mode === "unknown" ? readState : "ready",
|
|
6573
6891
|
retry: props.remote === void 0 ? void 0 : () => setReadAttempt((value) => value + 1)
|
|
6574
|
-
})
|
|
6892
|
+
}), usageDiagnostic === void 0 ? null : react.createElement(TurnUsageNotice, {
|
|
6893
|
+
diagnostic: usageDiagnostic,
|
|
6894
|
+
locale: language
|
|
6895
|
+
}));
|
|
6575
6896
|
}
|
|
6576
6897
|
function installAutoModelProjections(capabilities) {
|
|
6577
6898
|
if (!record$3(capabilities.uiConversation) || !record$3(capabilities.uiConversation.events) || typeof capabilities.uiConversation.events.register !== "function") {
|
|
@@ -6581,6 +6902,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6581
6902
|
const events = capabilities.uiConversation.events;
|
|
6582
6903
|
let removeDefinition = noop$2;
|
|
6583
6904
|
let removeProvenance = noop$2;
|
|
6905
|
+
let removeUsage = noop$2;
|
|
6584
6906
|
try {
|
|
6585
6907
|
removeDefinition = events.register(autoModelAttributionDefinition);
|
|
6586
6908
|
removeProvenance = events.register(turnModelProvenanceDefinition);
|
|
@@ -6590,7 +6912,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6590
6912
|
capabilities.diagnostic("COPILOT_AUTO_PROJECTIONS_FAILED");
|
|
6591
6913
|
return noop$2;
|
|
6592
6914
|
}
|
|
6915
|
+
try {
|
|
6916
|
+
removeUsage = events.register(turnUsageEvidenceDefinition);
|
|
6917
|
+
} catch {
|
|
6918
|
+
capabilities.diagnostic("COPILOT_TURN_USAGE_PROJECTION_FAILED");
|
|
6919
|
+
}
|
|
6593
6920
|
return () => {
|
|
6921
|
+
removeUsage();
|
|
6594
6922
|
removeProvenance();
|
|
6595
6923
|
removeDefinition();
|
|
6596
6924
|
};
|