dsh-github-copilot 0.4.0-alpha.126 → 0.4.0-alpha.128

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.126";
6991
+ var version = "0.4.0-alpha.128";
6992
6992
  //#endregion
6993
6993
  //#region lib/types/diagnostics-client.js
6994
6994
  let owner;
@@ -11137,6 +11137,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11137
11137
  borderRadius: "var(--dsw-radius-md, 8px)",
11138
11138
  background: "var(--dsw-alias-interactive-bg-hover, transparent)"
11139
11139
  };
11140
+ const composerNoticeQuietButtonStyle = {
11141
+ fontFamily: "inherit",
11142
+ fontSize: "inherit",
11143
+ fontWeight: "inherit",
11144
+ lineHeight: "inherit",
11145
+ color: "inherit",
11146
+ background: "transparent",
11147
+ border: 0,
11148
+ padding: "6px 10px",
11149
+ cursor: "pointer",
11150
+ maxWidth: "100%"
11151
+ };
11140
11152
  const composerNoticeParagraphStyle = {
11141
11153
  marginBlock: 8,
11142
11154
  maxWidth: "38rem"
@@ -11715,6 +11727,33 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11715
11727
  seq: count,
11716
11728
  route: routeSchema
11717
11729
  }).strict();
11730
+ const stepSchema = object({
11731
+ turn: count,
11732
+ step: count
11733
+ }).strict();
11734
+ const compactionSchema = object({
11735
+ id: string().min(1).max(256),
11736
+ startSeq: count,
11737
+ endSeq: count.nullable(),
11738
+ state: _enum([
11739
+ "running",
11740
+ "completed",
11741
+ "failed",
11742
+ "unknown"
11743
+ ]),
11744
+ checkpoint: boolean(),
11745
+ headerSeq: count.nullable(),
11746
+ requestRoute: routeSchema.nullable(),
11747
+ step: stepSchema.nullable(),
11748
+ request: _enum([
11749
+ "idle",
11750
+ "pending",
11751
+ "succeeded",
11752
+ "failed",
11753
+ "cancelled",
11754
+ "unknown"
11755
+ ])
11756
+ }).strict();
11718
11757
  const ContextEvidenceSchema = object({
11719
11758
  route: routeSchema.nullable(),
11720
11759
  sample: sampleSchema.nullable(),
@@ -11725,7 +11764,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11725
11764
  "compaction",
11726
11765
  "selection",
11727
11766
  "unknown"
11728
- ])
11767
+ ]),
11768
+ compaction: compactionSchema.nullable().optional(),
11769
+ activeStep: stepSchema.nullable().optional()
11729
11770
  }).strict();
11730
11771
  object({
11731
11772
  inputTokens: count,
@@ -11736,6 +11777,171 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11736
11777
  reasoningTokens: count.optional()
11737
11778
  });
11738
11779
  //#endregion
11780
+ //#region lib/types/compaction-continuation-ui.js
11781
+ const successLifetimeMs = 8e3;
11782
+ /** Presentation only, retained across incidental mounts by the Client slot registration. */
11783
+ var CompactionNoticePresentation = class {
11784
+ entries = /* @__PURE__ */ new Map();
11785
+ listeners = /* @__PURE__ */ new Set();
11786
+ version = 0;
11787
+ subscribe = (listener) => {
11788
+ this.listeners.add(listener);
11789
+ return () => {
11790
+ this.listeners.delete(listener);
11791
+ };
11792
+ };
11793
+ snapshot = () => this.version;
11794
+ key(sessionId, id, state) {
11795
+ return JSON.stringify([
11796
+ sessionId,
11797
+ id,
11798
+ state
11799
+ ]);
11800
+ }
11801
+ remember(key, entry) {
11802
+ this.entries.set(key, entry);
11803
+ while (this.entries.size > 128) this.entries.delete(this.entries.keys().next().value);
11804
+ }
11805
+ observe(sessionId, id, state) {
11806
+ const key = this.key(sessionId, id, state);
11807
+ if (state === "completed" && !this.entries.has(key)) this.remember(key, {
11808
+ dismissed: false,
11809
+ expiresAt: Date.now() + successLifetimeMs
11810
+ });
11811
+ }
11812
+ remaining(sessionId, id) {
11813
+ const expiresAt = this.entries.get(this.key(sessionId, id, "completed"))?.expiresAt;
11814
+ return expiresAt === void 0 ? void 0 : Math.max(0, expiresAt - Date.now());
11815
+ }
11816
+ visible(sessionId, id, state) {
11817
+ if (state === "running") return true;
11818
+ const entry = this.entries.get(this.key(sessionId, id, state));
11819
+ return !entry?.dismissed && (entry?.expiresAt === void 0 || entry.expiresAt > Date.now());
11820
+ }
11821
+ dismiss(sessionId, id, state) {
11822
+ if (state === "running") return;
11823
+ const key = this.key(sessionId, id, state);
11824
+ this.remember(key, {
11825
+ ...this.entries.get(key),
11826
+ dismissed: true
11827
+ });
11828
+ this.version++;
11829
+ for (const listener of this.listeners) listener();
11830
+ }
11831
+ dispose() {
11832
+ this.entries.clear();
11833
+ this.listeners.clear();
11834
+ }
11835
+ };
11836
+ function CompactionContinuationNotice({ sessionId, remote, lifecycle, locale = "en", renderEvidence, presentation: sharedPresentation }) {
11837
+ const [localPresentation] = (0, react.useState)(() => new CompactionNoticePresentation());
11838
+ const presentation = sharedPresentation ?? localPresentation;
11839
+ const version = (0, react.useSyncExternalStore)(presentation.subscribe, presentation.snapshot, presentation.snapshot);
11840
+ const [, refresh] = (0, react.useState)(0);
11841
+ const parsed = CompactionContinuationLifecycleSchema.safeParse(lifecycle);
11842
+ const id = parsed.success ? parsed.data.id : null;
11843
+ const running = parsed.success && parsed.data.running;
11844
+ const [result, setResult] = (0, react.useState)();
11845
+ const currentResult = result?.sessionId === sessionId && result.id === id && result.remote === remote && result.running === running ? result : void 0;
11846
+ const status = currentResult?.status;
11847
+ const error = currentResult?.error === true;
11848
+ const state = error ? "unavailable" : status?.state;
11849
+ (0, react.useEffect)(() => () => localPresentation.dispose(), [localPresentation]);
11850
+ (0, react.useEffect)(() => {
11851
+ let current = true;
11852
+ let timer;
11853
+ setResult(void 0);
11854
+ if (!id) return;
11855
+ const publish = (status, error) => {
11856
+ if (!current) return;
11857
+ if (status) presentation.observe(sessionId, id, status.state);
11858
+ setResult({
11859
+ sessionId,
11860
+ id,
11861
+ running,
11862
+ remote,
11863
+ status,
11864
+ error
11865
+ });
11866
+ };
11867
+ if (!remote) {
11868
+ publish(void 0, true);
11869
+ return;
11870
+ }
11871
+ const read = async () => {
11872
+ try {
11873
+ const result = await remote.get(sessionId);
11874
+ const view = result.ok ? SessionContinuationViewSchema.safeParse(result.value) : void 0;
11875
+ if (!current) return;
11876
+ if (!view?.success) publish(void 0, true);
11877
+ else publish(view.data.compaction?.id === id ? view.data.compaction : void 0, false);
11878
+ } catch {
11879
+ publish(void 0, true);
11880
+ } finally {
11881
+ if (current && running) timer = setTimeout(() => void read(), 1e3);
11882
+ }
11883
+ };
11884
+ read();
11885
+ return () => {
11886
+ current = false;
11887
+ if (timer) clearTimeout(timer);
11888
+ };
11889
+ }, [
11890
+ sessionId,
11891
+ remote,
11892
+ id,
11893
+ running,
11894
+ presentation
11895
+ ]);
11896
+ (0, react.useEffect)(() => {
11897
+ if (!id || state !== "completed" || running || !presentation.visible(sessionId, id, state)) return;
11898
+ const remaining = presentation.remaining(sessionId, id);
11899
+ if (remaining === void 0) return;
11900
+ const timer = setTimeout(() => refresh((value) => value + 1), remaining);
11901
+ return () => clearTimeout(timer);
11902
+ }, [
11903
+ sessionId,
11904
+ id,
11905
+ state,
11906
+ running,
11907
+ presentation,
11908
+ version
11909
+ ]);
11910
+ const zh = locale.startsWith("zh");
11911
+ if (!id || !state || !running && !presentation.visible(sessionId, id, state)) return renderEvidence?.(void 0, null, false) ?? null;
11912
+ const dismiss = () => {
11913
+ if (!running) presentation.dismiss(sessionId, id, state);
11914
+ };
11915
+ const close = !running && state !== "running" ? (0, react.createElement)("button", {
11916
+ type: "button",
11917
+ style: composerNoticeQuietButtonStyle,
11918
+ onClick: dismiss,
11919
+ "aria-label": zh ? "关闭压缩提示" : "Close compaction notice"
11920
+ }, zh ? "关闭" : "Close") : null;
11921
+ if (status?.state === "blocked") return (0, react.createElement)("section", {
11922
+ "data-copilot-composer-notice": "compaction-continuation",
11923
+ style: composerNoticeSurfaceStyle
11924
+ }, (0, react.createElement)("p", {
11925
+ role: "alert",
11926
+ style: composerNoticeParagraphStyle
11927
+ }, zh ? "旧推理回放被拒绝,压缩未提交。开启降级可让后续聊天与压缩使用可见历史。" : "Old reasoning replay was rejected; compaction did not commit. Enabling continuation lets subsequent chat and compaction use visible history."), (0, react.createElement)(SessionContinuationCard, {
11928
+ sessionId,
11929
+ remote,
11930
+ locale,
11931
+ recovery: true,
11932
+ running,
11933
+ onCancel: dismiss
11934
+ }), close);
11935
+ if (renderEvidence && !error) return renderEvidence(status, close, true);
11936
+ 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.";
11937
+ return (0, react.createElement)("section", {
11938
+ "data-copilot-composer-notice": "compaction-continuation",
11939
+ role: error || status?.state === "failed" ? "alert" : "status",
11940
+ "aria-live": "polite",
11941
+ style: composerNoticeSurfaceStyle
11942
+ }, (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, text), close, error ? renderEvidence?.(void 0, null, false) : null);
11943
+ }
11944
+ //#endregion
11739
11945
  //#region lib/types/context-evidence-ui.js
11740
11946
  const slot = "conversation.input.dock";
11741
11947
  const noop$1 = () => {};
@@ -11759,7 +11965,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11759
11965
  historical: "Historical sample, not current occupancy. No percentage is inferred.",
11760
11966
  revoked: "No applicable historical input sample is available. Model changes, compaction and incomplete history invalidate earlier samples.",
11761
11967
  missing: "COPILOT_CONTEXT_PROJECTION_UNAVAILABLE: historical context evidence is unavailable.",
11762
- unknown: "Context sampling evidence is incomplete. No current occupancy can be inferred."
11968
+ unknown: "Context sampling evidence is incomplete. No current occupancy can be inferred.",
11969
+ completed: "Compaction completed · context occupancy awaiting confirmation",
11970
+ completedSucceeded: "Compaction completed · subsequent request succeeded · context occupancy awaiting confirmation",
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
+ running: "Compacting with visible history; hidden reasoning context may be lost.",
11978
+ failed: "Visible-history compaction failed; no recovery summary commit is confirmed. Check the native failure.",
11979
+ cancelled: "Visible-history compaction cancelled; no recovery summary commit is confirmed.",
11980
+ nativeRunning: "Compacting context · context occupancy awaiting confirmation",
11981
+ nativeFailed: "Compaction did not complete · check the native result",
11982
+ nativeUnknown: "Compaction commit could not be confirmed · check the native result",
11983
+ omitted: "Hidden reasoning context was omitted from the summary. Visible messages and tool relations were preserved.",
11984
+ pending: "No subsequent normal request has completed yet.",
11985
+ succeeded: "Subsequent request succeeded.",
11986
+ requestFailed: "The latest subsequent request failed; compaction success does not confirm Session recovery.",
11987
+ requestCancelled: "The latest subsequent request was cancelled.",
11988
+ requestRunning: "Subsequent request in progress; success is not yet confirmed.",
11989
+ requestUnknown: "Subsequent request outcome is unconfirmed.",
11990
+ sampled: "An applicable post-compaction input sample is recorded. It is historical evidence, not current occupancy.",
11991
+ unsampled: "No applicable valid post-compaction input sample is confirmed. Request success alone does not establish occupancy.",
11992
+ zero: "Native 0% does not prove an empty context. No replacement percentage is estimated."
11763
11993
  },
11764
11994
  zh: {
11765
11995
  title: "上下文未知 · 原生 0% 不代表上下文为空",
@@ -11768,15 +11998,48 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11768
11998
  historical: "这是历史采样,不是当前占用;不会据此推算百分比。",
11769
11999
  revoked: "没有仍适用的历史输入采样。模型切换、压缩或历史证据不完整会使旧采样失效。",
11770
12000
  missing: "COPILOT_CONTEXT_PROJECTION_UNAVAILABLE:无法获取历史上下文证据。",
11771
- unknown: "上下文采样证据不完整,无法据此推断当前占用。"
12001
+ unknown: "上下文采样证据不完整,无法据此推断当前占用。",
12002
+ completed: "压缩已完成 · 当前上下文占用待确认",
12003
+ completedSucceeded: "压缩已完成 · 后续请求已成功 · 上下文占用待确认",
12004
+ completedFailed: "压缩已完成 · 后续请求失败 · 上下文占用待确认",
12005
+ completedCancelled: "压缩已完成 · 后续请求已取消 · 上下文占用待确认",
12006
+ contextPending: "当前上下文占用待确认",
12007
+ contextSucceeded: "后续请求已成功 · 上下文占用待确认",
12008
+ contextFailed: "后续请求失败 · 上下文占用未知",
12009
+ contextCancelled: "后续请求已取消 · 上下文占用未知",
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
+ unsampled: "尚未确认仍适用的有效压缩后输入采样;请求成功不能单独证明占用。",
12025
+ zero: "原生 0% 不代表上下文为空;不会用另一个估算百分比替代。"
11772
12026
  }
11773
12027
  };
11774
- function ContextEvidenceNotice({ evidence, locale = "en", applicable = true }) {
11775
- if (evidence !== void 0 && !evidence.invalid) return null;
12028
+ function ContextEvidenceNotice({ evidence, locale = "en", applicable = true, compactionStatus, showCompactionResult = true, controls }) {
11776
12029
  const text = locale.startsWith("zh") ? copy.zh : copy.en;
12030
+ const native = evidence?.compaction;
12031
+ const status = showCompactionResult ? compactionStatus ?? (native ? {
12032
+ id: native.id,
12033
+ state: native.state
12034
+ } : void 0) : void 0;
11777
12035
  const sample = applicable ? evidence?.sample : null;
11778
- return (0, react.createElement)("details", {
11779
- "data-copilot-composer-notice": "context",
12036
+ const completed = status?.state === "completed";
12037
+ const following = applicable && native?.state === "completed" && (status === void 0 || native.id === status.id) ? native : void 0;
12038
+ 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 && evidence !== void 0 && !evidence.invalid && (!following || sampled)) return null;
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 : following ? following.request === "succeeded" ? text.contextSucceeded : following.request === "failed" ? text.contextFailed : following.request === "cancelled" ? text.contextCancelled : text.contextPending : text.title;
12041
+ const disclosure = (0, react.createElement)("details", {
12042
+ "data-copilot-composer-notice": controls === void 0 ? "context" : void 0,
11780
12043
  style: composerNoticeStyle
11781
12044
  }, (0, react.createElement)("summary", { style: {
11782
12045
  cursor: "pointer",
@@ -11785,12 +12048,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11785
12048
  fontWeight: 400,
11786
12049
  lineHeight: "calc(20px + var(--dsh-content-font-delta-secondary, 0px))",
11787
12050
  color: "var(--dsw-alias-label-tertiary, GrayText)"
11788
- } }, 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));
12051
+ } }, title), completed || following ? (0, react.createElement)("p", {
12052
+ role: "status",
12053
+ "aria-live": "polite",
12054
+ 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 || following ? (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, sampled ? text.sampled : text.unsampled) : null, compactionStatus && completed ? (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, text.omitted) : null, status || following ? (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, text.zero) : null, evidence === void 0 || evidence.reason === "unknown" || evidence.reason === "failed-zero" ? (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, evidence === void 0 ? text.missing : evidence.reason === "unknown" ? text.unknown : text.explanation) : 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, evidence === void 0 ? null : (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, sample && sample.tokens > 0 ? text.historical : text.revoked));
12056
+ return controls === void 0 ? disclosure : (0, react.createElement)("section", {
12057
+ "data-copilot-composer-notice": "context",
12058
+ style: composerNoticeStyle
12059
+ }, disclosure, controls);
11789
12060
  }
11790
- function Surface$1({ runtime, locale, diagnostic }) {
12061
+ function Surface$1({ runtime, locale, diagnostic, continuation, presentation }) {
11791
12062
  const valid = runtime.useSession((value) => record$1(value) && value.sessionId === runtime.sessionId && value.removed === false && value.openState === "open");
11792
12063
  const selection = runtime.useProjection("modelSelection");
11793
12064
  const raw = runtime.useProjection(COPILOT_CONTEXT_EVIDENCE);
12065
+ const lifecycle = runtime.useProjection(COMPACTION_CONTINUATION);
11794
12066
  const language = (0, react.useSyncExternalStore)((listener) => locale?.subscribe(listener) ?? noop$1, () => locale?.getLocale().active ?? "en", () => "en");
11795
12067
  const parsed = ContextEvidenceSchema.safeParse(raw);
11796
12068
  (0, react.useEffect)(() => {
@@ -11802,11 +12074,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11802
12074
  const evidence = parsed.success ? parsed.data : void 0;
11803
12075
  const route = evidence?.route;
11804
12076
  const applicable = route !== null && route !== void 0 && next.provider === route.provider && (next.model === route.model || typeof next.model === "string" && autoModelPreference(next.model) !== void 0);
11805
- return (0, react.createElement)(ContextEvidenceNotice, {
11806
- evidence,
12077
+ const compact = CompactionContinuationLifecycleSchema.safeParse(lifecycle);
12078
+ const shown = next.provider === "github-copilot-preview" && compact.success && compact.data.id !== null && evidence?.compaction && evidence.compaction.id !== compact.data.id ? {
12079
+ ...evidence,
12080
+ compaction: null,
12081
+ sample: null,
12082
+ invalid: true,
12083
+ reason: "compaction"
12084
+ } : evidence;
12085
+ const renderEvidence = (compactionStatus, controls, transient = true) => (0, react.createElement)(ContextEvidenceNotice, {
12086
+ evidence: shown,
11807
12087
  locale: language,
11808
- applicable
12088
+ applicable,
12089
+ compactionStatus,
12090
+ controls,
12091
+ showCompactionResult: transient
11809
12092
  });
12093
+ return next.provider === "github-copilot-preview" && compact.success && compact.data.id !== null ? (0, react.createElement)(CompactionContinuationNotice, {
12094
+ key: runtime.sessionId,
12095
+ sessionId: runtime.sessionId,
12096
+ remote: continuation,
12097
+ lifecycle,
12098
+ locale: language,
12099
+ renderEvidence,
12100
+ presentation
12101
+ }) : renderEvidence();
11810
12102
  }
11811
12103
  /** Additive disclosure only: native input, context ring and billing remain untouched. */
11812
12104
  function registerContextEvidenceUi(ctx) {
@@ -11824,12 +12116,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11824
12116
  }
11825
12117
  const candidate = ctx.get("locale");
11826
12118
  const locale = isLocale$1(candidate) ? candidate : void 0;
11827
- return slots.inject(slot, () => {
12119
+ let faces;
12120
+ const presentation = new CompactionNoticePresentation();
12121
+ const remove = slots.inject(slot, () => {
11828
12122
  const spec = slots.spec(slot);
11829
12123
  if (spec?.kind !== "list" || spec.scope !== "session") {
11830
12124
  diagnostic("COPILOT_CONTEXT_SLOT_UNAVAILABLE");
11831
12125
  return noop$1;
11832
12126
  }
12127
+ faces ??= { continuation: ctx.remote.githubCopilotSessionContinuation };
12128
+ const { continuation } = faces;
11833
12129
  return slots.register({
11834
12130
  name: slot,
11835
12131
  id: "github-copilot-context-evidence",
@@ -11842,80 +12138,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11842
12138
  return (0, react.createElement)(Surface$1, {
11843
12139
  runtime: props,
11844
12140
  locale,
11845
- diagnostic
12141
+ diagnostic,
12142
+ continuation,
12143
+ presentation
11846
12144
  });
11847
12145
  });
11848
12146
  });
11849
- }
11850
- //#endregion
11851
- //#region lib/types/compaction-continuation-ui.js
11852
- function CompactionContinuationNotice({ sessionId, remote, lifecycle, locale = "en" }) {
11853
- const parsed = CompactionContinuationLifecycleSchema.safeParse(lifecycle);
11854
- const id = parsed.success ? parsed.data.id : null;
11855
- const running = parsed.success && parsed.data.running;
11856
- const [status, setStatus] = (0, react.useState)();
11857
- const [error, setError] = (0, react.useState)(false);
11858
- const [dismissed, setDismissed] = (0, react.useState)();
11859
- (0, react.useEffect)(() => {
11860
- let current = true;
11861
- let timer;
11862
- setStatus(void 0);
11863
- setError(false);
11864
- if (!id || !remote) return;
11865
- const read = async () => {
11866
- try {
11867
- const result = await remote.get(sessionId);
11868
- const view = result.ok ? SessionContinuationViewSchema.safeParse(result.value) : void 0;
11869
- if (!current) return;
11870
- if (!view?.success) {
11871
- setError(true);
11872
- setStatus(void 0);
11873
- } else {
11874
- setError(false);
11875
- setStatus(view.data.compaction?.id === id ? view.data.compaction : void 0);
11876
- }
11877
- } catch {
11878
- if (current) {
11879
- setError(true);
11880
- setStatus(void 0);
11881
- }
11882
- } finally {
11883
- if (current && running) timer = setTimeout(() => void read(), 1e3);
11884
- }
11885
- };
11886
- read();
11887
- return () => {
11888
- current = false;
11889
- if (timer) clearTimeout(timer);
11890
- };
11891
- }, [
11892
- sessionId,
11893
- remote,
11894
- id,
11895
- running
11896
- ]);
11897
- const zh = locale.startsWith("zh");
11898
- if (!status && !error) return null;
11899
- if (status?.state === "blocked") return dismissed === status.id ? null : (0, react.createElement)("section", {
11900
- "data-copilot-composer-notice": "compaction-continuation",
11901
- style: composerNoticeSurfaceStyle
11902
- }, (0, react.createElement)("p", {
11903
- role: "alert",
11904
- style: composerNoticeParagraphStyle
11905
- }, zh ? "旧推理回放被拒绝,压缩未提交。开启降级可让后续聊天与压缩使用可见历史。" : "Old reasoning replay was rejected; compaction did not commit. Enabling continuation lets subsequent chat and compaction use visible history."), (0, react.createElement)(SessionContinuationCard, {
11906
- sessionId,
11907
- remote,
11908
- locale,
11909
- recovery: true,
11910
- onCancel: () => setDismissed(status.id)
11911
- }));
11912
- 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.";
11913
- return (0, react.createElement)("section", {
11914
- "data-copilot-composer-notice": "compaction-continuation",
11915
- role: error || status?.state === "failed" ? "alert" : "status",
11916
- "aria-live": "polite",
11917
- style: composerNoticeSurfaceStyle
11918
- }, (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, text));
12147
+ return () => {
12148
+ remove();
12149
+ presentation.dispose();
12150
+ };
11919
12151
  }
11920
12152
  //#endregion
11921
12153
  //#region lib/types/replay-recovery-ui.js
@@ -12053,17 +12285,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12053
12285
  function Surface({ runtime, remote, continuation, locale }) {
12054
12286
  const valid = runtime.useSession((value) => record(value) && value.sessionId === runtime.sessionId && value.removed === false && value.openState === "open");
12055
12287
  const selected = runtime.useProjection("modelSelection");
12056
- const compaction = runtime.useProjection(COMPACTION_CONTINUATION);
12057
12288
  const running = runtime.useSession((value) => !record(value) || value.running !== false);
12058
12289
  const lastError = runtime.useSession((value) => record(value) && typeof value.lastAgentError === "string" ? value.lastAgentError : "");
12059
12290
  const language = (0, react.useSyncExternalStore)((listener) => locale?.subscribe(listener) ?? noop, () => locale?.getLocale().active ?? "en", () => "en");
12060
12291
  if (!valid || !record(selected) || !record(selected.next) || selected.next.provider !== "github-copilot-preview") return null;
12061
- return (0, react.createElement)("div", null, (0, react.createElement)(CompactionContinuationNotice, {
12062
- sessionId: runtime.sessionId,
12063
- remote: continuation,
12064
- lifecycle: compaction,
12065
- locale: language
12066
- }), (0, react.createElement)(ReplayRecoveryCard, {
12292
+ return (0, react.createElement)("div", null, (0, react.createElement)(ReplayRecoveryCard, {
12067
12293
  key: JSON.stringify([runtime.sessionId, selected.next.model]),
12068
12294
  sessionId: runtime.sessionId,
12069
12295
  remote,
@@ -13595,7 +13821,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
13595
13821
  "remote.githubCopilotSessionContinuation",
13596
13822
  "slots"
13597
13823
  ], registerCopilotUsageUi);
13598
- const contextUi = ctx.inject(["slots"], registerContextEvidenceUi);
13824
+ const contextUi = ctx.inject(["remote.githubCopilotSessionContinuation", "slots"], registerContextEvidenceUi);
13599
13825
  const recoveryUi = ctx.inject([
13600
13826
  "remote.githubCopilotReplayRecovery",
13601
13827
  "remote.githubCopilotSessionContinuation",