dsh-github-copilot 0.4.0-alpha.128 → 0.4.0-alpha.130
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 +21 -2
- package/CHANGELOG.md +12 -0
- package/README.md +16 -13
- package/README.zh.md +13 -12
- package/deployment-baseline.json +5 -2
- package/docs/copilot-usage.md +4 -4
- package/docs/plugin-diagnostics.md +64 -0
- package/lib/client.js +97 -42
- package/lib/client.js.map +1 -1
- package/lib/diagnostics-analysis-io.js +78 -0
- package/lib/diagnostics-analysis.js +425 -0
- package/lib/diagnostics-types-FVf6zjob.js +182 -0
- package/lib/index.js +68 -38
- package/lib/manual-compaction-recovery.js +2 -1
- package/lib/request-budget-DLY_aRq0.js +87 -0
- package/lib/types/context-evidence-ui.d.ts +14 -1
- package/lib/types/context-evidence.d.ts +29 -1
- package/lib/types/diagnostics-analysis-io.d.ts +23 -0
- package/lib/types/diagnostics-analysis.d.ts +295 -0
- package/package.json +3 -1
- package/scripts/analyze-diagnostics.mjs +91 -0
- package/lib/request-budget-Cui2hCi1.js +0 -268
package/lib/client.js
CHANGED
|
@@ -6988,7 +6988,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6988
6988
|
};
|
|
6989
6989
|
//#endregion
|
|
6990
6990
|
//#region package.json
|
|
6991
|
-
var version = "0.4.0-alpha.
|
|
6991
|
+
var version = "0.4.0-alpha.130";
|
|
6992
6992
|
//#endregion
|
|
6993
6993
|
//#region lib/types/diagnostics-client.js
|
|
6994
6994
|
let owner;
|
|
@@ -11727,6 +11727,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11727
11727
|
seq: count,
|
|
11728
11728
|
route: routeSchema
|
|
11729
11729
|
}).strict();
|
|
11730
|
+
const incidentSchema = object({
|
|
11731
|
+
kind: _enum(["failed-zero", "invalid-sample"]),
|
|
11732
|
+
seq: count
|
|
11733
|
+
}).strict();
|
|
11730
11734
|
const stepSchema = object({
|
|
11731
11735
|
turn: count,
|
|
11732
11736
|
step: count
|
|
@@ -11761,10 +11765,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11761
11765
|
reason: _enum([
|
|
11762
11766
|
"none",
|
|
11763
11767
|
"failed-zero",
|
|
11768
|
+
"invalid-sample",
|
|
11764
11769
|
"compaction",
|
|
11765
11770
|
"selection",
|
|
11766
11771
|
"unknown"
|
|
11767
11772
|
]),
|
|
11773
|
+
incident: incidentSchema.nullable(),
|
|
11768
11774
|
compaction: compactionSchema.nullable().optional(),
|
|
11769
11775
|
activeStep: stepSchema.nullable().optional()
|
|
11770
11776
|
}).strict();
|
|
@@ -11945,6 +11951,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11945
11951
|
//#region lib/types/context-evidence-ui.js
|
|
11946
11952
|
const slot = "conversation.input.dock";
|
|
11947
11953
|
const noop$1 = () => {};
|
|
11954
|
+
const subscribeNoop = () => noop$1;
|
|
11955
|
+
const zeroSnapshot = () => 0;
|
|
11948
11956
|
function record$1(value) {
|
|
11949
11957
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11950
11958
|
}
|
|
@@ -11959,25 +11967,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11959
11967
|
}
|
|
11960
11968
|
const copy = {
|
|
11961
11969
|
en: {
|
|
11962
|
-
|
|
11963
|
-
|
|
11970
|
+
failedZeroTitle: "Context sample unreliable · failed attempt reported zero usage",
|
|
11971
|
+
invalidSampleTitle: "Context sample invalid · current occupancy is unknown",
|
|
11972
|
+
failedZero: "A failed Copilot attempt recorded a zero usage sample. It is not reliable context-occupancy evidence.",
|
|
11973
|
+
invalidSample: "The latest context usage sample was malformed or conflicted with the active route.",
|
|
11964
11974
|
sample: "Last valid input sample (including cache)",
|
|
11965
11975
|
historical: "Historical sample, not current occupancy. No percentage is inferred.",
|
|
11966
11976
|
revoked: "No applicable historical input sample is available. Model changes, compaction and incomplete history invalidate earlier samples.",
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
completedFailed: "Compaction completed · subsequent request failed · context occupancy awaiting confirmation",
|
|
11972
|
-
completedCancelled: "Compaction completed · subsequent request cancelled · context occupancy awaiting confirmation",
|
|
11973
|
-
contextPending: "Context occupancy awaiting confirmation",
|
|
11974
|
-
contextSucceeded: "Subsequent request succeeded · context occupancy awaiting confirmation",
|
|
11975
|
-
contextFailed: "Subsequent request failed · context occupancy unknown",
|
|
11976
|
-
contextCancelled: "Subsequent request cancelled · context occupancy unknown",
|
|
11977
|
+
completed: "Compaction completed",
|
|
11978
|
+
completedSucceeded: "Compaction completed · subsequent request succeeded",
|
|
11979
|
+
completedFailed: "Compaction completed · subsequent request failed",
|
|
11980
|
+
completedCancelled: "Compaction completed · subsequent request cancelled",
|
|
11977
11981
|
running: "Compacting with visible history; hidden reasoning context may be lost.",
|
|
11978
11982
|
failed: "Visible-history compaction failed; no recovery summary commit is confirmed. Check the native failure.",
|
|
11979
11983
|
cancelled: "Visible-history compaction cancelled; no recovery summary commit is confirmed.",
|
|
11980
|
-
nativeRunning: "Compacting context
|
|
11984
|
+
nativeRunning: "Compacting context",
|
|
11981
11985
|
nativeFailed: "Compaction did not complete · check the native result",
|
|
11982
11986
|
nativeUnknown: "Compaction commit could not be confirmed · check the native result",
|
|
11983
11987
|
omitted: "Hidden reasoning context was omitted from the summary. Visible messages and tool relations were preserved.",
|
|
@@ -11988,29 +11992,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11988
11992
|
requestRunning: "Subsequent request in progress; success is not yet confirmed.",
|
|
11989
11993
|
requestUnknown: "Subsequent request outcome is unconfirmed.",
|
|
11990
11994
|
sampled: "An applicable post-compaction input sample is recorded. It is historical evidence, not current occupancy.",
|
|
11991
|
-
|
|
11992
|
-
|
|
11995
|
+
dismiss: "Dismiss",
|
|
11996
|
+
dismissLabel: "Dismiss context sample warning"
|
|
11993
11997
|
},
|
|
11994
11998
|
zh: {
|
|
11995
|
-
|
|
11996
|
-
|
|
11999
|
+
failedZeroTitle: "上下文采样不可靠 · 失败请求记录了零用量",
|
|
12000
|
+
invalidSampleTitle: "上下文采样无效 · 当前占用未知",
|
|
12001
|
+
failedZero: "失败的 Copilot 请求记录了零用量采样,不能将其作为可靠的上下文占用证据。",
|
|
12002
|
+
invalidSample: "最近的上下文用量采样格式无效,或与当前路由冲突。",
|
|
11997
12003
|
sample: "最后有效输入采样(含缓存)",
|
|
11998
12004
|
historical: "这是历史采样,不是当前占用;不会据此推算百分比。",
|
|
11999
12005
|
revoked: "没有仍适用的历史输入采样。模型切换、压缩或历史证据不完整会使旧采样失效。",
|
|
12000
|
-
|
|
12001
|
-
|
|
12002
|
-
|
|
12003
|
-
|
|
12004
|
-
completedFailed: "压缩已完成 · 后续请求失败 · 上下文占用待确认",
|
|
12005
|
-
completedCancelled: "压缩已完成 · 后续请求已取消 · 上下文占用待确认",
|
|
12006
|
-
contextPending: "当前上下文占用待确认",
|
|
12007
|
-
contextSucceeded: "后续请求已成功 · 上下文占用待确认",
|
|
12008
|
-
contextFailed: "后续请求失败 · 上下文占用未知",
|
|
12009
|
-
contextCancelled: "后续请求已取消 · 上下文占用未知",
|
|
12006
|
+
completed: "压缩已完成",
|
|
12007
|
+
completedSucceeded: "压缩已完成 · 后续请求已成功",
|
|
12008
|
+
completedFailed: "压缩已完成 · 后续请求失败",
|
|
12009
|
+
completedCancelled: "压缩已完成 · 后续请求已取消",
|
|
12010
12010
|
running: "正在使用可见历史降级压缩,隐藏推理上下文可能丢失。",
|
|
12011
12011
|
failed: "可见历史压缩失败;未确认提交恢复摘要。请查看原生失败原因。",
|
|
12012
12012
|
cancelled: "可见历史压缩已取消;未确认提交恢复摘要。",
|
|
12013
|
-
nativeRunning: "正在压缩上下文
|
|
12013
|
+
nativeRunning: "正在压缩上下文",
|
|
12014
12014
|
nativeFailed: "压缩未完成 · 请查看原生结果",
|
|
12015
12015
|
nativeUnknown: "无法确认压缩摘要已提交 · 请查看原生结果",
|
|
12016
12016
|
omitted: "隐藏推理上下文未带入摘要;可见消息与工具调用关系保留。",
|
|
@@ -12021,11 +12021,44 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12021
12021
|
requestRunning: "后续请求进行中;尚未确认成功。",
|
|
12022
12022
|
requestUnknown: "后续请求结果尚未确认。",
|
|
12023
12023
|
sampled: "已记录仍适用的压缩后输入采样;这是历史证据,不是当前占用。",
|
|
12024
|
-
|
|
12025
|
-
|
|
12024
|
+
dismiss: "关闭",
|
|
12025
|
+
dismissLabel: "关闭上下文采样警告"
|
|
12026
12026
|
}
|
|
12027
12027
|
};
|
|
12028
|
-
|
|
12028
|
+
var ContextIncidentPresentation = class {
|
|
12029
|
+
dismissed = /* @__PURE__ */ new Map();
|
|
12030
|
+
listeners = /* @__PURE__ */ new Set();
|
|
12031
|
+
version = 0;
|
|
12032
|
+
subscribe = (listener) => {
|
|
12033
|
+
this.listeners.add(listener);
|
|
12034
|
+
return () => {
|
|
12035
|
+
this.listeners.delete(listener);
|
|
12036
|
+
};
|
|
12037
|
+
};
|
|
12038
|
+
snapshot = () => this.version;
|
|
12039
|
+
key(sessionId, incident) {
|
|
12040
|
+
return JSON.stringify([
|
|
12041
|
+
sessionId,
|
|
12042
|
+
incident.kind,
|
|
12043
|
+
incident.seq
|
|
12044
|
+
]);
|
|
12045
|
+
}
|
|
12046
|
+
visible(sessionId, incident) {
|
|
12047
|
+
return !this.dismissed.has(this.key(sessionId, incident));
|
|
12048
|
+
}
|
|
12049
|
+
dismiss(sessionId, incident) {
|
|
12050
|
+
this.dismissed.set(this.key(sessionId, incident), true);
|
|
12051
|
+
while (this.dismissed.size > 128) this.dismissed.delete(this.dismissed.keys().next().value);
|
|
12052
|
+
this.version++;
|
|
12053
|
+
for (const listener of this.listeners) listener();
|
|
12054
|
+
}
|
|
12055
|
+
dispose() {
|
|
12056
|
+
this.dismissed.clear();
|
|
12057
|
+
this.listeners.clear();
|
|
12058
|
+
}
|
|
12059
|
+
};
|
|
12060
|
+
function ContextEvidenceNotice({ evidence, locale = "en", applicable = true, compactionStatus, showCompactionResult = true, controls, sessionId, presentation }) {
|
|
12061
|
+
(0, react.useSyncExternalStore)(presentation?.subscribe ?? subscribeNoop, presentation?.snapshot ?? zeroSnapshot, presentation?.snapshot ?? zeroSnapshot);
|
|
12029
12062
|
const text = locale.startsWith("zh") ? copy.zh : copy.en;
|
|
12030
12063
|
const native = evidence?.compaction;
|
|
12031
12064
|
const status = showCompactionResult ? compactionStatus ?? (native ? {
|
|
@@ -12033,11 +12066,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12033
12066
|
state: native.state
|
|
12034
12067
|
} : void 0) : void 0;
|
|
12035
12068
|
const sample = applicable ? evidence?.sample : null;
|
|
12069
|
+
const incident = applicable ? evidence?.incident : null;
|
|
12070
|
+
const incidentVisible = incident !== null && incident !== void 0 && (sessionId === void 0 || presentation === void 0 || presentation.visible(sessionId, incident));
|
|
12036
12071
|
const completed = status?.state === "completed";
|
|
12037
12072
|
const following = applicable && native?.state === "completed" && (status === void 0 || native.id === status.id) ? native : void 0;
|
|
12038
12073
|
const sampled = following?.endSeq !== null && following?.endSeq !== void 0 && sample !== null && sample !== void 0 && sample.tokens > 0 && sample.seq > following.endSeq && !evidence?.invalid;
|
|
12039
|
-
if (!status &&
|
|
12040
|
-
const title = status ? completed ? following?.request === "succeeded" ? text.completedSucceeded : following?.request === "failed" ? text.completedFailed : following?.request === "cancelled" ? text.completedCancelled : text.completed : status.state === "running" ? compactionStatus ? text.running : text.nativeRunning : status.state === "cancelled" ? text.cancelled : status.state === "failed" ? compactionStatus ? text.failed : text.nativeFailed : text.nativeUnknown :
|
|
12074
|
+
if (!status && !incidentVisible) return null;
|
|
12075
|
+
const title = status ? completed ? following?.request === "succeeded" ? text.completedSucceeded : following?.request === "failed" ? text.completedFailed : following?.request === "cancelled" ? text.completedCancelled : text.completed : status.state === "running" ? compactionStatus ? text.running : text.nativeRunning : status.state === "cancelled" ? text.cancelled : status.state === "failed" ? compactionStatus ? text.failed : text.nativeFailed : text.nativeUnknown : incident?.kind === "invalid-sample" ? text.invalidSampleTitle : text.failedZeroTitle;
|
|
12076
|
+
const dismiss = incidentVisible && sessionId !== void 0 && presentation !== void 0 ? (0, react.createElement)("button", {
|
|
12077
|
+
type: "button",
|
|
12078
|
+
style: composerNoticeQuietButtonStyle,
|
|
12079
|
+
"aria-label": text.dismissLabel,
|
|
12080
|
+
onClick: () => presentation.dismiss(sessionId, incident)
|
|
12081
|
+
}, text.dismiss) : null;
|
|
12041
12082
|
const disclosure = (0, react.createElement)("details", {
|
|
12042
12083
|
"data-copilot-composer-notice": controls === void 0 ? "context" : void 0,
|
|
12043
12084
|
style: composerNoticeStyle
|
|
@@ -12052,13 +12093,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12052
12093
|
role: "status",
|
|
12053
12094
|
"aria-live": "polite",
|
|
12054
12095
|
style: composerNoticeParagraphStyle
|
|
12055
|
-
}, following?.request === "succeeded" ? text.succeeded : following?.request === "failed" ? text.requestFailed : following?.request === "cancelled" ? text.requestCancelled : following?.request === "pending" ? text.requestRunning : following?.request === "idle" ? text.pending : text.requestUnknown) : null, completed
|
|
12056
|
-
|
|
12096
|
+
}, following?.request === "succeeded" ? text.succeeded : following?.request === "failed" ? text.requestFailed : following?.request === "cancelled" ? text.requestCancelled : following?.request === "pending" ? text.requestRunning : following?.request === "idle" ? text.pending : text.requestUnknown) : null, completed && sampled ? (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, text.sampled) : null, compactionStatus && completed ? (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, text.omitted) : null, incidentVisible ? (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, incident?.kind === "invalid-sample" ? text.invalidSample : text.failedZero) : null, sample && sample.tokens > 0 ? (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, `${text.sample}: ${new Intl.NumberFormat(locale.startsWith("zh") ? "zh-CN" : "en-US").format(sample.tokens)} tokens`) : null, incidentVisible ? (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, sample && sample.tokens > 0 ? text.historical : text.revoked) : null);
|
|
12097
|
+
const actions = controls === void 0 ? dismiss : controls;
|
|
12098
|
+
return actions === null || actions === void 0 ? disclosure : (0, react.createElement)("section", {
|
|
12057
12099
|
"data-copilot-composer-notice": "context",
|
|
12058
12100
|
style: composerNoticeStyle
|
|
12059
|
-
}, disclosure, controls);
|
|
12101
|
+
}, disclosure, actions, controls === void 0 ? null : dismiss);
|
|
12060
12102
|
}
|
|
12061
|
-
function Surface$1({ runtime, locale, diagnostic, continuation, presentation }) {
|
|
12103
|
+
function Surface$1({ runtime, locale, diagnostic, continuation, presentation, incidentPresentation }) {
|
|
12062
12104
|
const valid = runtime.useSession((value) => record$1(value) && value.sessionId === runtime.sessionId && value.removed === false && value.openState === "open");
|
|
12063
12105
|
const selection = runtime.useProjection("modelSelection");
|
|
12064
12106
|
const raw = runtime.useProjection(COPILOT_CONTEXT_EVIDENCE);
|
|
@@ -12068,6 +12110,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12068
12110
|
(0, react.useEffect)(() => {
|
|
12069
12111
|
if (!parsed.success) diagnostic("COPILOT_CONTEXT_PROJECTION_UNAVAILABLE");
|
|
12070
12112
|
}, [parsed.success, diagnostic]);
|
|
12113
|
+
(0, react.useEffect)(() => {
|
|
12114
|
+
if (parsed.success && parsed.data.reason === "unknown") diagnostic("COPILOT_CONTEXT_EVIDENCE_INCOMPLETE");
|
|
12115
|
+
}, [
|
|
12116
|
+
parsed.success,
|
|
12117
|
+
parsed.success ? parsed.data.reason : void 0,
|
|
12118
|
+
diagnostic
|
|
12119
|
+
]);
|
|
12071
12120
|
if (!valid || !record$1(selection) || !record$1(selection.next)) return null;
|
|
12072
12121
|
const next = selection.next;
|
|
12073
12122
|
if (next.provider !== "github-copilot" && next.provider !== "github-copilot-preview") return null;
|
|
@@ -12079,8 +12128,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12079
12128
|
...evidence,
|
|
12080
12129
|
compaction: null,
|
|
12081
12130
|
sample: null,
|
|
12082
|
-
invalid:
|
|
12083
|
-
reason: "compaction"
|
|
12131
|
+
invalid: false,
|
|
12132
|
+
reason: "compaction",
|
|
12133
|
+
incident: null
|
|
12084
12134
|
} : evidence;
|
|
12085
12135
|
const renderEvidence = (compactionStatus, controls, transient = true) => (0, react.createElement)(ContextEvidenceNotice, {
|
|
12086
12136
|
evidence: shown,
|
|
@@ -12088,7 +12138,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12088
12138
|
applicable,
|
|
12089
12139
|
compactionStatus,
|
|
12090
12140
|
controls,
|
|
12091
|
-
showCompactionResult: transient
|
|
12141
|
+
showCompactionResult: transient,
|
|
12142
|
+
sessionId: runtime.sessionId,
|
|
12143
|
+
presentation: incidentPresentation
|
|
12092
12144
|
});
|
|
12093
12145
|
return next.provider === "github-copilot-preview" && compact.success && compact.data.id !== null ? (0, react.createElement)(CompactionContinuationNotice, {
|
|
12094
12146
|
key: runtime.sessionId,
|
|
@@ -12118,6 +12170,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12118
12170
|
const locale = isLocale$1(candidate) ? candidate : void 0;
|
|
12119
12171
|
let faces;
|
|
12120
12172
|
const presentation = new CompactionNoticePresentation();
|
|
12173
|
+
const incidentPresentation = new ContextIncidentPresentation();
|
|
12121
12174
|
const remove = slots.inject(slot, () => {
|
|
12122
12175
|
const spec = slots.spec(slot);
|
|
12123
12176
|
if (spec?.kind !== "list" || spec.scope !== "session") {
|
|
@@ -12140,13 +12193,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12140
12193
|
locale,
|
|
12141
12194
|
diagnostic,
|
|
12142
12195
|
continuation,
|
|
12143
|
-
presentation
|
|
12196
|
+
presentation,
|
|
12197
|
+
incidentPresentation
|
|
12144
12198
|
});
|
|
12145
12199
|
});
|
|
12146
12200
|
});
|
|
12147
12201
|
return () => {
|
|
12148
12202
|
remove();
|
|
12149
12203
|
presentation.dispose();
|
|
12204
|
+
incidentPresentation.dispose();
|
|
12150
12205
|
};
|
|
12151
12206
|
}
|
|
12152
12207
|
//#endregion
|