dsh-github-copilot 0.4.0-alpha.127 → 0.4.0-alpha.129

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
@@ -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.127";
6991
+ var version = "0.4.0-alpha.129";
6992
6992
  //#endregion
6993
6993
  //#region lib/types/diagnostics-client.js
6994
6994
  let owner;
@@ -11727,6 +11727,37 @@ 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();
11734
+ const stepSchema = object({
11735
+ turn: count,
11736
+ step: count
11737
+ }).strict();
11738
+ const compactionSchema = object({
11739
+ id: string().min(1).max(256),
11740
+ startSeq: count,
11741
+ endSeq: count.nullable(),
11742
+ state: _enum([
11743
+ "running",
11744
+ "completed",
11745
+ "failed",
11746
+ "unknown"
11747
+ ]),
11748
+ checkpoint: boolean(),
11749
+ headerSeq: count.nullable(),
11750
+ requestRoute: routeSchema.nullable(),
11751
+ step: stepSchema.nullable(),
11752
+ request: _enum([
11753
+ "idle",
11754
+ "pending",
11755
+ "succeeded",
11756
+ "failed",
11757
+ "cancelled",
11758
+ "unknown"
11759
+ ])
11760
+ }).strict();
11730
11761
  const ContextEvidenceSchema = object({
11731
11762
  route: routeSchema.nullable(),
11732
11763
  sample: sampleSchema.nullable(),
@@ -11734,10 +11765,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11734
11765
  reason: _enum([
11735
11766
  "none",
11736
11767
  "failed-zero",
11768
+ "invalid-sample",
11737
11769
  "compaction",
11738
11770
  "selection",
11739
11771
  "unknown"
11740
- ])
11772
+ ]),
11773
+ incident: incidentSchema.nullable(),
11774
+ compaction: compactionSchema.nullable().optional(),
11775
+ activeStep: stepSchema.nullable().optional()
11741
11776
  }).strict();
11742
11777
  object({
11743
11778
  inputTokens: count,
@@ -11748,118 +11783,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11748
11783
  reasoningTokens: count.optional()
11749
11784
  });
11750
11785
  //#endregion
11751
- //#region lib/types/context-evidence-ui.js
11752
- const slot = "conversation.input.dock";
11753
- const noop$1 = () => {};
11754
- function record$1(value) {
11755
- return typeof value === "object" && value !== null && !Array.isArray(value);
11756
- }
11757
- function isSlots$1(value) {
11758
- return record$1(value) && typeof value.spec === "function" && typeof value.inject === "function" && typeof value.register === "function";
11759
- }
11760
- function isLocale$1(value) {
11761
- return record$1(value) && typeof value.getLocale === "function" && typeof value.subscribe === "function";
11762
- }
11763
- function isRuntime$1(value) {
11764
- return record$1(value) && typeof value.sessionId === "string" && value.sessionId !== "" && typeof value.useSession === "function" && typeof value.useProjection === "function";
11765
- }
11766
- const copy = {
11767
- en: {
11768
- title: "Context unknown · native 0% is not an empty-context reading",
11769
- explanation: "A failed Copilot attempt reported zero usage. The native 0% is not evidence of an empty context.",
11770
- sample: "Last valid input sample (including cache)",
11771
- historical: "Historical sample, not current occupancy. No percentage is inferred.",
11772
- revoked: "No applicable historical input sample is available. Model changes, compaction and incomplete history invalidate earlier samples.",
11773
- missing: "COPILOT_CONTEXT_PROJECTION_UNAVAILABLE: historical context evidence is unavailable.",
11774
- unknown: "Context sampling evidence is incomplete. No current occupancy can be inferred."
11775
- },
11776
- zh: {
11777
- title: "上下文未知 · 原生 0% 不代表上下文为空",
11778
- explanation: "失败的 Copilot 请求记录了零用量。原生 0% 不代表上下文为空。",
11779
- sample: "最后有效输入采样(含缓存)",
11780
- historical: "这是历史采样,不是当前占用;不会据此推算百分比。",
11781
- revoked: "没有仍适用的历史输入采样。模型切换、压缩或历史证据不完整会使旧采样失效。",
11782
- missing: "COPILOT_CONTEXT_PROJECTION_UNAVAILABLE:无法获取历史上下文证据。",
11783
- unknown: "上下文采样证据不完整,无法据此推断当前占用。"
11784
- }
11785
- };
11786
- function ContextEvidenceNotice({ evidence, locale = "en", applicable = true }) {
11787
- if (evidence !== void 0 && !evidence.invalid) return null;
11788
- const text = locale.startsWith("zh") ? copy.zh : copy.en;
11789
- const sample = applicable ? evidence?.sample : null;
11790
- return (0, react.createElement)("details", {
11791
- "data-copilot-composer-notice": "context",
11792
- style: composerNoticeStyle
11793
- }, (0, react.createElement)("summary", { style: {
11794
- cursor: "pointer",
11795
- fontFamily: "var(--dsw-font-family, inherit)",
11796
- fontSize: "var(--dsh-content-font-size-secondary, 13px)",
11797
- fontWeight: 400,
11798
- lineHeight: "calc(20px + var(--dsh-content-font-delta-secondary, 0px))",
11799
- color: "var(--dsw-alias-label-tertiary, GrayText)"
11800
- } }, text.title), (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, evidence === void 0 ? text.missing : evidence.reason === "unknown" ? text.unknown : text.explanation), sample ? (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, `${text.sample}: ${new Intl.NumberFormat(locale.startsWith("zh") ? "zh-CN" : "en-US").format(sample.tokens)} tokens`) : null, evidence === void 0 ? null : (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, sample ? text.historical : text.revoked));
11801
- }
11802
- function Surface$1({ runtime, locale, diagnostic }) {
11803
- const valid = runtime.useSession((value) => record$1(value) && value.sessionId === runtime.sessionId && value.removed === false && value.openState === "open");
11804
- const selection = runtime.useProjection("modelSelection");
11805
- const raw = runtime.useProjection(COPILOT_CONTEXT_EVIDENCE);
11806
- const language = (0, react.useSyncExternalStore)((listener) => locale?.subscribe(listener) ?? noop$1, () => locale?.getLocale().active ?? "en", () => "en");
11807
- const parsed = ContextEvidenceSchema.safeParse(raw);
11808
- (0, react.useEffect)(() => {
11809
- if (!parsed.success) diagnostic("COPILOT_CONTEXT_PROJECTION_UNAVAILABLE");
11810
- }, [parsed.success, diagnostic]);
11811
- if (!valid || !record$1(selection) || !record$1(selection.next)) return null;
11812
- const next = selection.next;
11813
- if (next.provider !== "github-copilot" && next.provider !== "github-copilot-preview") return null;
11814
- const evidence = parsed.success ? parsed.data : void 0;
11815
- const route = evidence?.route;
11816
- const applicable = route !== null && route !== void 0 && next.provider === route.provider && (next.model === route.model || typeof next.model === "string" && autoModelPreference(next.model) !== void 0);
11817
- return (0, react.createElement)(ContextEvidenceNotice, {
11818
- evidence,
11819
- locale: language,
11820
- applicable
11821
- });
11822
- }
11823
- /** Additive disclosure only: native input, context ring and billing remain untouched. */
11824
- function registerContextEvidenceUi(ctx) {
11825
- const diagnosed = /* @__PURE__ */ new Set();
11826
- const diagnostic = (code) => {
11827
- if (!diagnosed.has(code)) {
11828
- diagnosed.add(code);
11829
- ctx.logger.warn(`[github-copilot] ${code}`);
11830
- }
11831
- };
11832
- const slots = ctx.get("slots");
11833
- if (!isSlots$1(slots)) {
11834
- diagnostic("COPILOT_CONTEXT_SLOT_UNAVAILABLE");
11835
- return noop$1;
11836
- }
11837
- const candidate = ctx.get("locale");
11838
- const locale = isLocale$1(candidate) ? candidate : void 0;
11839
- return slots.inject(slot, () => {
11840
- const spec = slots.spec(slot);
11841
- if (spec?.kind !== "list" || spec.scope !== "session") {
11842
- diagnostic("COPILOT_CONTEXT_SLOT_UNAVAILABLE");
11843
- return noop$1;
11844
- }
11845
- return slots.register({
11846
- name: slot,
11847
- id: "github-copilot-context-evidence",
11848
- order: 25
11849
- }, (props) => {
11850
- if (!isRuntime$1(props)) {
11851
- diagnostic("COPILOT_CONTEXT_SESSION_RUNTIME_UNAVAILABLE");
11852
- return null;
11853
- }
11854
- return (0, react.createElement)(Surface$1, {
11855
- runtime: props,
11856
- locale,
11857
- diagnostic
11858
- });
11859
- });
11860
- });
11861
- }
11862
- //#endregion
11863
11786
  //#region lib/types/compaction-continuation-ui.js
11864
11787
  const successLifetimeMs = 8e3;
11865
11788
  /** Presentation only, retained across incidental mounts by the Client slot registration. */
@@ -11916,7 +11839,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11916
11839
  this.listeners.clear();
11917
11840
  }
11918
11841
  };
11919
- function CompactionContinuationNotice({ sessionId, remote, lifecycle, locale = "en", presentation: sharedPresentation }) {
11842
+ function CompactionContinuationNotice({ sessionId, remote, lifecycle, locale = "en", renderEvidence, presentation: sharedPresentation }) {
11920
11843
  const [localPresentation] = (0, react.useState)(() => new CompactionNoticePresentation());
11921
11844
  const presentation = sharedPresentation ?? localPresentation;
11922
11845
  const version = (0, react.useSyncExternalStore)(presentation.subscribe, presentation.snapshot, presentation.snapshot);
@@ -11991,7 +11914,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11991
11914
  version
11992
11915
  ]);
11993
11916
  const zh = locale.startsWith("zh");
11994
- if (!id || !state || !running && !presentation.visible(sessionId, id, state)) return null;
11917
+ if (!id || !state || !running && !presentation.visible(sessionId, id, state)) return renderEvidence?.(void 0, null, false) ?? null;
11995
11918
  const dismiss = () => {
11996
11919
  if (!running) presentation.dismiss(sessionId, id, state);
11997
11920
  };
@@ -12015,13 +11938,271 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12015
11938
  running,
12016
11939
  onCancel: dismiss
12017
11940
  }), close);
11941
+ if (renderEvidence && !error) return renderEvidence(status, close, true);
12018
11942
  const text = error ? zh ? "无法确认压缩降级状态;请查看原生压缩结果。" : "Compaction recovery status is unavailable; check the native compaction result." : status?.state === "running" ? zh ? "正在使用可见历史降级压缩,隐藏推理上下文可能丢失。" : "Compacting with visible history; hidden reasoning context may be lost." : status?.state === "completed" ? zh ? "可见历史压缩已提交;隐藏推理上下文未带入摘要。" : "Visible-history compaction committed; hidden reasoning context was omitted from the summary." : status?.state === "cancelled" ? zh ? "可见历史压缩已取消;未确认提交恢复摘要。" : "Visible-history compaction cancelled; no recovery summary commit is confirmed." : zh ? "可见历史压缩失败;Session 尚未恢复。请查看原生失败原因。" : "Visible-history compaction failed; the Session is not recovered. Check the native failure.";
12019
11943
  return (0, react.createElement)("section", {
12020
11944
  "data-copilot-composer-notice": "compaction-continuation",
12021
11945
  role: error || status?.state === "failed" ? "alert" : "status",
12022
11946
  "aria-live": "polite",
12023
11947
  style: composerNoticeSurfaceStyle
12024
- }, (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, text), close);
11948
+ }, (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, text), close, error ? renderEvidence?.(void 0, null, false) : null);
11949
+ }
11950
+ //#endregion
11951
+ //#region lib/types/context-evidence-ui.js
11952
+ const slot = "conversation.input.dock";
11953
+ const noop$1 = () => {};
11954
+ const subscribeNoop = () => noop$1;
11955
+ const zeroSnapshot = () => 0;
11956
+ function record$1(value) {
11957
+ return typeof value === "object" && value !== null && !Array.isArray(value);
11958
+ }
11959
+ function isSlots$1(value) {
11960
+ return record$1(value) && typeof value.spec === "function" && typeof value.inject === "function" && typeof value.register === "function";
11961
+ }
11962
+ function isLocale$1(value) {
11963
+ return record$1(value) && typeof value.getLocale === "function" && typeof value.subscribe === "function";
11964
+ }
11965
+ function isRuntime$1(value) {
11966
+ return record$1(value) && typeof value.sessionId === "string" && value.sessionId !== "" && typeof value.useSession === "function" && typeof value.useProjection === "function";
11967
+ }
11968
+ const copy = {
11969
+ en: {
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.",
11974
+ sample: "Last valid input sample (including cache)",
11975
+ historical: "Historical sample, not current occupancy. No percentage is inferred.",
11976
+ revoked: "No applicable historical input sample is available. Model changes, compaction and incomplete history invalidate earlier samples.",
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",
11981
+ running: "Compacting with visible history; hidden reasoning context may be lost.",
11982
+ failed: "Visible-history compaction failed; no recovery summary commit is confirmed. Check the native failure.",
11983
+ cancelled: "Visible-history compaction cancelled; no recovery summary commit is confirmed.",
11984
+ nativeRunning: "Compacting context",
11985
+ nativeFailed: "Compaction did not complete · check the native result",
11986
+ nativeUnknown: "Compaction commit could not be confirmed · check the native result",
11987
+ omitted: "Hidden reasoning context was omitted from the summary. Visible messages and tool relations were preserved.",
11988
+ pending: "No subsequent normal request has completed yet.",
11989
+ succeeded: "Subsequent request succeeded.",
11990
+ requestFailed: "The latest subsequent request failed; compaction success does not confirm Session recovery.",
11991
+ requestCancelled: "The latest subsequent request was cancelled.",
11992
+ requestRunning: "Subsequent request in progress; success is not yet confirmed.",
11993
+ requestUnknown: "Subsequent request outcome is unconfirmed.",
11994
+ sampled: "An applicable post-compaction input sample is recorded. It is historical evidence, not current occupancy.",
11995
+ dismiss: "Dismiss",
11996
+ dismissLabel: "Dismiss context sample warning"
11997
+ },
11998
+ zh: {
11999
+ failedZeroTitle: "上下文采样不可靠 · 失败请求记录了零用量",
12000
+ invalidSampleTitle: "上下文采样无效 · 当前占用未知",
12001
+ failedZero: "失败的 Copilot 请求记录了零用量采样,不能将其作为可靠的上下文占用证据。",
12002
+ invalidSample: "最近的上下文用量采样格式无效,或与当前路由冲突。",
12003
+ sample: "最后有效输入采样(含缓存)",
12004
+ historical: "这是历史采样,不是当前占用;不会据此推算百分比。",
12005
+ revoked: "没有仍适用的历史输入采样。模型切换、压缩或历史证据不完整会使旧采样失效。",
12006
+ completed: "压缩已完成",
12007
+ completedSucceeded: "压缩已完成 · 后续请求已成功",
12008
+ completedFailed: "压缩已完成 · 后续请求失败",
12009
+ completedCancelled: "压缩已完成 · 后续请求已取消",
12010
+ running: "正在使用可见历史降级压缩,隐藏推理上下文可能丢失。",
12011
+ failed: "可见历史压缩失败;未确认提交恢复摘要。请查看原生失败原因。",
12012
+ cancelled: "可见历史压缩已取消;未确认提交恢复摘要。",
12013
+ nativeRunning: "正在压缩上下文",
12014
+ nativeFailed: "压缩未完成 · 请查看原生结果",
12015
+ nativeUnknown: "无法确认压缩摘要已提交 · 请查看原生结果",
12016
+ omitted: "隐藏推理上下文未带入摘要;可见消息与工具调用关系保留。",
12017
+ pending: "压缩后尚无已完成的普通请求。",
12018
+ succeeded: "后续请求已成功。",
12019
+ requestFailed: "最近一次后续请求失败;压缩成功不代表 Session 已恢复。",
12020
+ requestCancelled: "最近一次后续请求已取消。",
12021
+ requestRunning: "后续请求进行中;尚未确认成功。",
12022
+ requestUnknown: "后续请求结果尚未确认。",
12023
+ sampled: "已记录仍适用的压缩后输入采样;这是历史证据,不是当前占用。",
12024
+ dismiss: "关闭",
12025
+ dismissLabel: "关闭上下文采样警告"
12026
+ }
12027
+ };
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);
12062
+ const text = locale.startsWith("zh") ? copy.zh : copy.en;
12063
+ const native = evidence?.compaction;
12064
+ const status = showCompactionResult ? compactionStatus ?? (native ? {
12065
+ id: native.id,
12066
+ state: native.state
12067
+ } : void 0) : void 0;
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));
12071
+ const completed = status?.state === "completed";
12072
+ const following = applicable && native?.state === "completed" && (status === void 0 || native.id === status.id) ? native : void 0;
12073
+ const sampled = following?.endSeq !== null && following?.endSeq !== void 0 && sample !== null && sample !== void 0 && sample.tokens > 0 && sample.seq > following.endSeq && !evidence?.invalid;
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;
12082
+ const disclosure = (0, react.createElement)("details", {
12083
+ "data-copilot-composer-notice": controls === void 0 ? "context" : void 0,
12084
+ style: composerNoticeStyle
12085
+ }, (0, react.createElement)("summary", { style: {
12086
+ cursor: "pointer",
12087
+ fontFamily: "var(--dsw-font-family, inherit)",
12088
+ fontSize: "var(--dsh-content-font-size-secondary, 13px)",
12089
+ fontWeight: 400,
12090
+ lineHeight: "calc(20px + var(--dsh-content-font-delta-secondary, 0px))",
12091
+ color: "var(--dsw-alias-label-tertiary, GrayText)"
12092
+ } }, title), completed || following ? (0, react.createElement)("p", {
12093
+ role: "status",
12094
+ "aria-live": "polite",
12095
+ style: composerNoticeParagraphStyle
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", {
12099
+ "data-copilot-composer-notice": "context",
12100
+ style: composerNoticeStyle
12101
+ }, disclosure, actions, controls === void 0 ? null : dismiss);
12102
+ }
12103
+ function Surface$1({ runtime, locale, diagnostic, continuation, presentation, incidentPresentation }) {
12104
+ const valid = runtime.useSession((value) => record$1(value) && value.sessionId === runtime.sessionId && value.removed === false && value.openState === "open");
12105
+ const selection = runtime.useProjection("modelSelection");
12106
+ const raw = runtime.useProjection(COPILOT_CONTEXT_EVIDENCE);
12107
+ const lifecycle = runtime.useProjection(COMPACTION_CONTINUATION);
12108
+ const language = (0, react.useSyncExternalStore)((listener) => locale?.subscribe(listener) ?? noop$1, () => locale?.getLocale().active ?? "en", () => "en");
12109
+ const parsed = ContextEvidenceSchema.safeParse(raw);
12110
+ (0, react.useEffect)(() => {
12111
+ if (!parsed.success) diagnostic("COPILOT_CONTEXT_PROJECTION_UNAVAILABLE");
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
+ ]);
12120
+ if (!valid || !record$1(selection) || !record$1(selection.next)) return null;
12121
+ const next = selection.next;
12122
+ if (next.provider !== "github-copilot" && next.provider !== "github-copilot-preview") return null;
12123
+ const evidence = parsed.success ? parsed.data : void 0;
12124
+ const route = evidence?.route;
12125
+ const applicable = route !== null && route !== void 0 && next.provider === route.provider && (next.model === route.model || typeof next.model === "string" && autoModelPreference(next.model) !== void 0);
12126
+ const compact = CompactionContinuationLifecycleSchema.safeParse(lifecycle);
12127
+ const shown = next.provider === "github-copilot-preview" && compact.success && compact.data.id !== null && evidence?.compaction && evidence.compaction.id !== compact.data.id ? {
12128
+ ...evidence,
12129
+ compaction: null,
12130
+ sample: null,
12131
+ invalid: false,
12132
+ reason: "compaction",
12133
+ incident: null
12134
+ } : evidence;
12135
+ const renderEvidence = (compactionStatus, controls, transient = true) => (0, react.createElement)(ContextEvidenceNotice, {
12136
+ evidence: shown,
12137
+ locale: language,
12138
+ applicable,
12139
+ compactionStatus,
12140
+ controls,
12141
+ showCompactionResult: transient,
12142
+ sessionId: runtime.sessionId,
12143
+ presentation: incidentPresentation
12144
+ });
12145
+ return next.provider === "github-copilot-preview" && compact.success && compact.data.id !== null ? (0, react.createElement)(CompactionContinuationNotice, {
12146
+ key: runtime.sessionId,
12147
+ sessionId: runtime.sessionId,
12148
+ remote: continuation,
12149
+ lifecycle,
12150
+ locale: language,
12151
+ renderEvidence,
12152
+ presentation
12153
+ }) : renderEvidence();
12154
+ }
12155
+ /** Additive disclosure only: native input, context ring and billing remain untouched. */
12156
+ function registerContextEvidenceUi(ctx) {
12157
+ const diagnosed = /* @__PURE__ */ new Set();
12158
+ const diagnostic = (code) => {
12159
+ if (!diagnosed.has(code)) {
12160
+ diagnosed.add(code);
12161
+ ctx.logger.warn(`[github-copilot] ${code}`);
12162
+ }
12163
+ };
12164
+ const slots = ctx.get("slots");
12165
+ if (!isSlots$1(slots)) {
12166
+ diagnostic("COPILOT_CONTEXT_SLOT_UNAVAILABLE");
12167
+ return noop$1;
12168
+ }
12169
+ const candidate = ctx.get("locale");
12170
+ const locale = isLocale$1(candidate) ? candidate : void 0;
12171
+ let faces;
12172
+ const presentation = new CompactionNoticePresentation();
12173
+ const incidentPresentation = new ContextIncidentPresentation();
12174
+ const remove = slots.inject(slot, () => {
12175
+ const spec = slots.spec(slot);
12176
+ if (spec?.kind !== "list" || spec.scope !== "session") {
12177
+ diagnostic("COPILOT_CONTEXT_SLOT_UNAVAILABLE");
12178
+ return noop$1;
12179
+ }
12180
+ faces ??= { continuation: ctx.remote.githubCopilotSessionContinuation };
12181
+ const { continuation } = faces;
12182
+ return slots.register({
12183
+ name: slot,
12184
+ id: "github-copilot-context-evidence",
12185
+ order: 25
12186
+ }, (props) => {
12187
+ if (!isRuntime$1(props)) {
12188
+ diagnostic("COPILOT_CONTEXT_SESSION_RUNTIME_UNAVAILABLE");
12189
+ return null;
12190
+ }
12191
+ return (0, react.createElement)(Surface$1, {
12192
+ runtime: props,
12193
+ locale,
12194
+ diagnostic,
12195
+ continuation,
12196
+ presentation,
12197
+ incidentPresentation
12198
+ });
12199
+ });
12200
+ });
12201
+ return () => {
12202
+ remove();
12203
+ presentation.dispose();
12204
+ incidentPresentation.dispose();
12205
+ };
12025
12206
  }
12026
12207
  //#endregion
12027
12208
  //#region lib/types/replay-recovery-ui.js
@@ -12156,21 +12337,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12156
12337
  function isRuntime(value) {
12157
12338
  return record(value) && typeof value.sessionId === "string" && value.sessionId !== "" && typeof value.useSession === "function" && typeof value.useProjection === "function";
12158
12339
  }
12159
- function Surface({ runtime, remote, continuation, locale, presentation }) {
12340
+ function Surface({ runtime, remote, continuation, locale }) {
12160
12341
  const valid = runtime.useSession((value) => record(value) && value.sessionId === runtime.sessionId && value.removed === false && value.openState === "open");
12161
12342
  const selected = runtime.useProjection("modelSelection");
12162
- const compaction = runtime.useProjection(COMPACTION_CONTINUATION);
12163
12343
  const running = runtime.useSession((value) => !record(value) || value.running !== false);
12164
12344
  const lastError = runtime.useSession((value) => record(value) && typeof value.lastAgentError === "string" ? value.lastAgentError : "");
12165
12345
  const language = (0, react.useSyncExternalStore)((listener) => locale?.subscribe(listener) ?? noop, () => locale?.getLocale().active ?? "en", () => "en");
12166
12346
  if (!valid || !record(selected) || !record(selected.next) || selected.next.provider !== "github-copilot-preview") return null;
12167
- return (0, react.createElement)("div", null, (0, react.createElement)(CompactionContinuationNotice, {
12168
- sessionId: runtime.sessionId,
12169
- remote: continuation,
12170
- lifecycle: compaction,
12171
- locale: language,
12172
- presentation
12173
- }), (0, react.createElement)(ReplayRecoveryCard, {
12347
+ return (0, react.createElement)("div", null, (0, react.createElement)(ReplayRecoveryCard, {
12174
12348
  key: JSON.stringify([runtime.sessionId, selected.next.model]),
12175
12349
  sessionId: runtime.sessionId,
12176
12350
  remote,
@@ -12187,12 +12361,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12187
12361
  return noop;
12188
12362
  }
12189
12363
  const slots = candidate;
12190
- const presentation = new CompactionNoticePresentation();
12191
12364
  let faces;
12192
12365
  const language = ctx.get("locale");
12193
12366
  const locale = isLocale(language) ? language : void 0;
12194
12367
  const name = "conversation.input.dock";
12195
- const remove = slots.inject(name, () => {
12368
+ return slots.inject(name, () => {
12196
12369
  const spec = slots.spec(name);
12197
12370
  if (spec?.kind !== "list" || spec.scope !== "session") {
12198
12371
  ctx.logger.warn("COPILOT_REPLAY_RECOVERY_SLOT_UNAVAILABLE");
@@ -12216,15 +12389,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12216
12389
  runtime: props,
12217
12390
  remote,
12218
12391
  continuation,
12219
- locale,
12220
- presentation
12392
+ locale
12221
12393
  });
12222
12394
  });
12223
12395
  });
12224
- return () => {
12225
- remove();
12226
- presentation.dispose();
12227
- };
12228
12396
  }
12229
12397
  //#endregion
12230
12398
  //#region lib/types/model-preferences-card.js
@@ -13708,7 +13876,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
13708
13876
  "remote.githubCopilotSessionContinuation",
13709
13877
  "slots"
13710
13878
  ], registerCopilotUsageUi);
13711
- const contextUi = ctx.inject(["slots"], registerContextEvidenceUi);
13879
+ const contextUi = ctx.inject(["remote.githubCopilotSessionContinuation", "slots"], registerContextEvidenceUi);
13712
13880
  const recoveryUi = ctx.inject([
13713
13881
  "remote.githubCopilotReplayRecovery",
13714
13882
  "remote.githubCopilotSessionContinuation",