dsh-github-copilot 0.4.0-alpha.94 → 0.4.0-alpha.96
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 +1 -1
- package/CHANGELOG.md +12 -0
- package/README.md +9 -7
- package/README.zh.md +9 -7
- package/deployment-baseline.json +7 -3
- package/docs/copilot-usage.md +113 -107
- package/docs/model-compatibility-acceptance.md +26 -7
- package/lib/client.js +168 -58
- package/lib/client.js.map +1 -1
- package/lib/index.js +48 -8
- package/lib/remote.js +61 -32
- package/lib/types/replay-recovery-host.d.ts +2 -1
- package/lib/types/replay-recovery-remote.d.ts +2 -1
- package/lib/types/replay-recovery-types.d.ts +10 -0
- package/lib/types/replay-recovery-ui.d.ts +9 -2
- package/lib/types/replay-recovery.d.ts +4 -2
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -5781,11 +5781,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5781
5781
|
};
|
|
5782
5782
|
//#endregion
|
|
5783
5783
|
//#region lib/types/replay-recovery-types.js
|
|
5784
|
+
const ReplayRecoveryDurationSchema = _enum(["next-turn", "session"]);
|
|
5784
5785
|
const ReplayRecoveryViewSchema = discriminatedUnion("state", [object({ state: literal("unavailable") }).strict(), object({
|
|
5785
5786
|
state: _enum(["available", "enabled"]),
|
|
5786
5787
|
revision: string().uuid(),
|
|
5787
5788
|
itemCount: number().int().positive().max(512),
|
|
5788
|
-
model: string().min(1).max(256)
|
|
5789
|
+
model: string().min(1).max(256),
|
|
5790
|
+
duration: ReplayRecoveryDurationSchema.optional(),
|
|
5791
|
+
expiresAt: number().int().nonnegative().optional()
|
|
5789
5792
|
}).strict()]);
|
|
5790
5793
|
//#endregion
|
|
5791
5794
|
//#region lib/types/replay-recovery-remote.js
|
|
@@ -5798,37 +5801,63 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5798
5801
|
};
|
|
5799
5802
|
const contribution$1 = {
|
|
5800
5803
|
package: "dsh-github-copilot",
|
|
5801
|
-
descriptors: [
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5804
|
+
descriptors: [
|
|
5805
|
+
{
|
|
5806
|
+
id: "dsh-github-copilot:githubCopilotReplayRecovery.get",
|
|
5807
|
+
namespace: "githubCopilotReplayRecovery",
|
|
5808
|
+
service: "githubCopilotReplayRecovery",
|
|
5809
|
+
method: "get",
|
|
5810
|
+
invocation: { kind: "direct" },
|
|
5811
|
+
parameters: [agent],
|
|
5812
|
+
result: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryView", ReplayRecoveryViewSchema)
|
|
5813
|
+
},
|
|
5814
|
+
{
|
|
5815
|
+
id: "dsh-github-copilot:githubCopilotReplayRecovery.authorize",
|
|
5816
|
+
namespace: "githubCopilotReplayRecovery",
|
|
5817
|
+
service: "githubCopilotReplayRecovery",
|
|
5818
|
+
method: "authorize",
|
|
5819
|
+
invocation: { kind: "direct" },
|
|
5820
|
+
parameters: [
|
|
5821
|
+
agent,
|
|
5822
|
+
{
|
|
5823
|
+
name: "revision",
|
|
5824
|
+
wire: "revision",
|
|
5825
|
+
source: "json",
|
|
5826
|
+
codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryRevision", string().uuid())
|
|
5827
|
+
},
|
|
5828
|
+
{
|
|
5829
|
+
name: "duration",
|
|
5830
|
+
wire: "duration",
|
|
5831
|
+
source: "json",
|
|
5832
|
+
codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryDuration", ReplayRecoveryDurationSchema)
|
|
5833
|
+
}
|
|
5834
|
+
],
|
|
5835
|
+
result: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryView", ReplayRecoveryViewSchema)
|
|
5836
|
+
},
|
|
5837
|
+
{
|
|
5838
|
+
id: "dsh-github-copilot:githubCopilotReplayRecovery.setEnabled",
|
|
5839
|
+
namespace: "githubCopilotReplayRecovery",
|
|
5840
|
+
service: "githubCopilotReplayRecovery",
|
|
5841
|
+
method: "setEnabled",
|
|
5842
|
+
invocation: { kind: "direct" },
|
|
5843
|
+
parameters: [
|
|
5844
|
+
agent,
|
|
5845
|
+
{
|
|
5846
|
+
name: "revision",
|
|
5847
|
+
wire: "revision",
|
|
5848
|
+
source: "json",
|
|
5849
|
+
codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryRevision", string().uuid())
|
|
5850
|
+
},
|
|
5851
|
+
{
|
|
5852
|
+
name: "enabled",
|
|
5853
|
+
wire: "enabled",
|
|
5854
|
+
source: "json",
|
|
5855
|
+
codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryEnabled", boolean())
|
|
5856
|
+
}
|
|
5857
|
+
],
|
|
5858
|
+
result: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryView", ReplayRecoveryViewSchema)
|
|
5859
|
+
}
|
|
5860
|
+
]
|
|
5832
5861
|
};
|
|
5833
5862
|
//#endregion
|
|
5834
5863
|
//#region lib/types/remote.js
|
|
@@ -8770,13 +8799,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8770
8799
|
function record(value) {
|
|
8771
8800
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
8772
8801
|
}
|
|
8773
|
-
function ReplayRecoveryCard({ sessionId, remote, locale = "en" }) {
|
|
8802
|
+
function ReplayRecoveryCard({ sessionId, remote, locale = "en", running = false, refreshKey = "" }) {
|
|
8774
8803
|
const zh = locale.startsWith("zh");
|
|
8804
|
+
const durationName = (0, react.useId)();
|
|
8775
8805
|
const [view, setView] = (0, react.useState)();
|
|
8776
8806
|
const [busy, setBusy] = (0, react.useState)(false);
|
|
8777
8807
|
const [error, setError] = (0, react.useState)(false);
|
|
8778
8808
|
const [confirm, setConfirm] = (0, react.useState)(false);
|
|
8809
|
+
const [duration, setDuration] = (0, react.useState)("next-turn");
|
|
8810
|
+
const [dismissed, setDismissed] = (0, react.useState)();
|
|
8811
|
+
const [hadEvidence, setHadEvidence] = (0, react.useState)(false);
|
|
8812
|
+
const latest = (0, react.useRef)(view);
|
|
8813
|
+
const active = (0, react.useRef)(running);
|
|
8814
|
+
latest.current = view;
|
|
8815
|
+
active.current = running;
|
|
8779
8816
|
const pending = (0, react.useRef)(false);
|
|
8817
|
+
const refreshPending = (0, react.useRef)(false);
|
|
8780
8818
|
const mounted = (0, react.useRef)(true);
|
|
8781
8819
|
(0, react.useEffect)(() => {
|
|
8782
8820
|
mounted.current = true;
|
|
@@ -8784,18 +8822,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8784
8822
|
mounted.current = false;
|
|
8785
8823
|
};
|
|
8786
8824
|
}, []);
|
|
8787
|
-
const perform = async (
|
|
8788
|
-
if (pending.current)
|
|
8825
|
+
const perform = (0, react.useCallback)(async (authorization) => {
|
|
8826
|
+
if (pending.current) {
|
|
8827
|
+
if (authorization === void 0) refreshPending.current = true;
|
|
8828
|
+
return;
|
|
8829
|
+
}
|
|
8830
|
+
if (active.current) return;
|
|
8789
8831
|
pending.current = true;
|
|
8790
8832
|
setBusy(true);
|
|
8791
8833
|
setError(false);
|
|
8792
8834
|
setConfirm(false);
|
|
8793
8835
|
try {
|
|
8794
|
-
const
|
|
8836
|
+
const current = latest.current;
|
|
8837
|
+
const result = authorization === void 0 ? await remote.get(sessionId) : current && current.state !== "unavailable" ? authorization === false ? await remote.setEnabled(sessionId, current.revision, false) : await remote.authorize(sessionId, current.revision, authorization) : void 0;
|
|
8795
8838
|
const parsed = result?.ok ? ReplayRecoveryViewSchema.safeParse(result.value) : void 0;
|
|
8796
8839
|
if (!mounted.current) return;
|
|
8797
|
-
if (parsed?.success)
|
|
8798
|
-
|
|
8840
|
+
if (parsed?.success) {
|
|
8841
|
+
setView(parsed.data);
|
|
8842
|
+
if (parsed.data.state !== "unavailable") setHadEvidence(true);
|
|
8843
|
+
} else {
|
|
8799
8844
|
setView(void 0);
|
|
8800
8845
|
setError(true);
|
|
8801
8846
|
}
|
|
@@ -8806,9 +8851,29 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8806
8851
|
}
|
|
8807
8852
|
} finally {
|
|
8808
8853
|
pending.current = false;
|
|
8809
|
-
if (mounted.current)
|
|
8854
|
+
if (mounted.current) {
|
|
8855
|
+
setBusy(false);
|
|
8856
|
+
if (refreshPending.current) {
|
|
8857
|
+
refreshPending.current = false;
|
|
8858
|
+
perform();
|
|
8859
|
+
}
|
|
8860
|
+
}
|
|
8810
8861
|
}
|
|
8811
|
-
};
|
|
8862
|
+
}, [remote, sessionId]);
|
|
8863
|
+
(0, react.useEffect)(() => {
|
|
8864
|
+
setConfirm(false);
|
|
8865
|
+
if (!running) perform();
|
|
8866
|
+
}, [
|
|
8867
|
+
running,
|
|
8868
|
+
refreshKey,
|
|
8869
|
+
perform
|
|
8870
|
+
]);
|
|
8871
|
+
const expiresAt = view && view.state !== "unavailable" ? view.expiresAt : void 0;
|
|
8872
|
+
(0, react.useEffect)(() => {
|
|
8873
|
+
if (expiresAt === void 0) return;
|
|
8874
|
+
const timer = setTimeout(() => void perform(), Math.max(0, expiresAt - Date.now()));
|
|
8875
|
+
return () => clearTimeout(timer);
|
|
8876
|
+
}, [expiresAt, perform]);
|
|
8812
8877
|
const button = {
|
|
8813
8878
|
font: "inherit",
|
|
8814
8879
|
color: "inherit",
|
|
@@ -8817,38 +8882,79 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8817
8882
|
borderRadius: 6,
|
|
8818
8883
|
padding: "6px 10px"
|
|
8819
8884
|
};
|
|
8820
|
-
|
|
8885
|
+
const disabled = busy || running;
|
|
8886
|
+
const evidence = view && view.state !== "unavailable" ? view : void 0;
|
|
8887
|
+
if (!error && !evidence && !hadEvidence) return null;
|
|
8888
|
+
if (!error && evidence?.state === "available" && dismissed === evidence.revision) return (0, react.createElement)("button", {
|
|
8889
|
+
type: "button",
|
|
8890
|
+
style: button,
|
|
8891
|
+
disabled,
|
|
8892
|
+
onClick: () => setDismissed(void 0)
|
|
8893
|
+
}, zh ? "回放恢复 · 查看" : "Replay recovery · Review");
|
|
8894
|
+
return (0, react.createElement)("section", {
|
|
8895
|
+
"aria-label": zh ? "回放恢复" : "Replay recovery",
|
|
8896
|
+
"aria-busy": busy,
|
|
8821
8897
|
style: {
|
|
8822
8898
|
maxWidth: "min(100%, 38rem)",
|
|
8823
|
-
overflowWrap: "anywhere"
|
|
8824
|
-
|
|
8825
|
-
onToggle: (event) => {
|
|
8826
|
-
if (event.currentTarget.open && view === void 0 && !busy && !error) perform();
|
|
8899
|
+
overflowWrap: "anywhere",
|
|
8900
|
+
paddingBlock: 8
|
|
8827
8901
|
}
|
|
8828
|
-
}, (0, react.createElement)("
|
|
8902
|
+
}, (0, react.createElement)("strong", { role: "status" }, evidence?.state === "enabled" ? zh ? "回放恢复已授权" : "Replay recovery authorized" : evidence ? zh ? "旧推理回放被拒绝" : "Old reasoning replay was rejected" : zh ? "回放恢复" : "Replay recovery"), error ? (0, react.createElement)("p", { role: "alert" }, zh ? "无法读取或更改恢复状态。请等当前轮结束后重新读取;旧确认可能已过期。" : "Recovery could not be read or changed. Wait for the active turn to end and read again; the prior confirmation may have expired.") : null, view?.state === "unavailable" ? (0, react.createElement)("p", null, zh ? "授权或失败证据已失效。恢复未启用;没有当前可用的失败证据。" : "Authorization or failure evidence expired. Recovery is off; no current failure evidence is available.") : null, evidence ? (0, react.createElement)("div", null, (0, react.createElement)("p", null, zh ? `${evidence.model}:${evidence.itemCount} 条已识别的旧加密推理项。` : `${evidence.model}: ${evidence.itemCount} identified old encrypted reasoning items.`), evidence.state === "enabled" ? (0, react.createElement)("p", null, evidence.duration === "next-turn" ? zh ? "仅下一轮使用恢复,覆盖该轮的全部步骤与原生重试,轮结束即关闭。" : "Authorized for the next matching turn only, including all its steps and native retries; turns off when that turn ends." : zh ? "本会话继续使用恢复,直到关闭或验证状态失效。" : "Authorized for this session until disabled or validation expires.", " ", zh ? "尚未发送消息。请使用原生发送或重试按钮继续。" : "No message has been sent. Use the native Send or Retry control to continue.") : (0, react.createElement)("p", null, zh ? "恢复未启用。确认损失后才能跳过这些旧项;不会自动重试。" : "Recovery is off. Review the loss before skipping these old items; nothing is retried automatically."), confirm ? (0, react.createElement)("div", null, (0, react.createElement)("p", null, zh ? "恢复会跳过已识别的旧项,包括对应隐藏推理状态及项内摘要。磁盘历史、界面可见消息及工具调用保持不变;新推理照常保留。关闭不能撤销已生成的回答。" : "Recovery skips the identified old items, including their hidden reasoning state and item summaries. Stored history, displayed messages and tool calls stay unchanged; new reasoning is retained. Disabling cannot undo generated answers."), (0, react.createElement)("fieldset", {
|
|
8903
|
+
disabled,
|
|
8904
|
+
style: {
|
|
8905
|
+
border: 0,
|
|
8906
|
+
padding: 0,
|
|
8907
|
+
marginBlock: 12
|
|
8908
|
+
}
|
|
8909
|
+
}, (0, react.createElement)("legend", null, zh ? "授权范围" : "Authorization duration"), ...["next-turn", "session"].map((value) => (0, react.createElement)("label", {
|
|
8910
|
+
key: value,
|
|
8911
|
+
style: {
|
|
8912
|
+
display: "block",
|
|
8913
|
+
paddingBlock: 6
|
|
8914
|
+
}
|
|
8915
|
+
}, (0, react.createElement)("input", {
|
|
8916
|
+
type: "radio",
|
|
8917
|
+
name: durationName,
|
|
8918
|
+
value,
|
|
8919
|
+
checked: duration === value,
|
|
8920
|
+
onChange: () => setDuration(value)
|
|
8921
|
+
}), " ", value === "next-turn" ? zh ? "仅下一轮使用恢复" : "Next matching turn only" : zh ? "在本会话内继续使用" : "Continue in this session"))), (0, react.createElement)("p", null, zh ? "两种授权都只适用于相同模型及验证状态,最长不超过失败证据产生后一小时;Host 重启后失效。不会处理 408、额度或上下文超限。" : "Both options require the same model and validation state, expire within one hour of the failure, and are lost on Host restart. Not a remedy for 408, quota or context limits."), (0, react.createElement)("div", { style: {
|
|
8922
|
+
display: "flex",
|
|
8923
|
+
flexWrap: "wrap",
|
|
8924
|
+
gap: 8
|
|
8925
|
+
} }, (0, react.createElement)("button", {
|
|
8829
8926
|
type: "button",
|
|
8830
8927
|
style: button,
|
|
8831
|
-
disabled
|
|
8832
|
-
onClick: () => void perform(
|
|
8833
|
-
}, zh ? "
|
|
8928
|
+
disabled,
|
|
8929
|
+
onClick: () => void perform(duration)
|
|
8930
|
+
}, zh ? "接受损失并授权" : "Accept loss and authorize"), (0, react.createElement)("button", {
|
|
8834
8931
|
type: "button",
|
|
8835
8932
|
style: button,
|
|
8836
|
-
disabled
|
|
8933
|
+
disabled,
|
|
8837
8934
|
onClick: () => setConfirm(false)
|
|
8838
|
-
}, zh ? "取消" : "Cancel")) : (0, react.createElement)("
|
|
8935
|
+
}, zh ? "取消" : "Cancel"))) : (0, react.createElement)("div", { style: {
|
|
8936
|
+
display: "flex",
|
|
8937
|
+
flexWrap: "wrap",
|
|
8938
|
+
gap: 8
|
|
8939
|
+
} }, (0, react.createElement)("button", {
|
|
8839
8940
|
type: "button",
|
|
8840
8941
|
style: button,
|
|
8841
|
-
disabled
|
|
8842
|
-
onClick: () =>
|
|
8843
|
-
},
|
|
8942
|
+
disabled,
|
|
8943
|
+
onClick: () => evidence.state === "enabled" ? void perform(false) : (setDuration("next-turn"), setConfirm(true))
|
|
8944
|
+
}, evidence.state === "enabled" ? zh ? "关闭恢复" : "Disable recovery" : zh ? "查看恢复选项" : "Review recovery options"), evidence.state === "available" ? (0, react.createElement)("button", {
|
|
8945
|
+
type: "button",
|
|
8946
|
+
style: button,
|
|
8947
|
+
disabled,
|
|
8948
|
+
onClick: () => setDismissed(evidence.revision)
|
|
8949
|
+
}, zh ? "暂不处理" : "Not now") : null)) : null, running ? (0, react.createElement)("p", { role: "status" }, zh ? "当前轮进行中,结束后自动更新。" : "Turn in progress; status updates when it ends.") : null, (0, react.createElement)("button", {
|
|
8844
8950
|
type: "button",
|
|
8845
8951
|
style: {
|
|
8846
8952
|
...button,
|
|
8847
8953
|
marginBlock: 8
|
|
8848
8954
|
},
|
|
8849
|
-
disabled
|
|
8955
|
+
disabled,
|
|
8850
8956
|
onClick: () => void perform()
|
|
8851
|
-
}, zh ? "重新读取状态" : "Read status again"));
|
|
8957
|
+
}, busy ? zh ? "正在读取…" : "Reading…" : zh ? "重新读取状态" : "Read status again"));
|
|
8852
8958
|
}
|
|
8853
8959
|
function isSlots(value) {
|
|
8854
8960
|
return record(value) && typeof value.spec === "function" && typeof value.inject === "function" && typeof value.register === "function";
|
|
@@ -8862,13 +8968,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8862
8968
|
function Surface({ runtime, remote, locale }) {
|
|
8863
8969
|
const valid = runtime.useSession((value) => record(value) && value.sessionId === runtime.sessionId && value.removed === false && value.openState === "open");
|
|
8864
8970
|
const selected = runtime.useProjection("modelSelection");
|
|
8971
|
+
const running = runtime.useSession((value) => !record(value) || value.running !== false);
|
|
8972
|
+
const lastError = runtime.useSession((value) => record(value) && typeof value.lastAgentError === "string" ? value.lastAgentError : "");
|
|
8865
8973
|
const language = (0, react.useSyncExternalStore)((listener) => locale?.subscribe(listener) ?? noop, () => locale?.getLocale().active ?? "en", () => "en");
|
|
8866
8974
|
if (!valid || !record(selected) || !record(selected.next) || selected.next.provider !== "github-copilot-preview") return null;
|
|
8867
8975
|
return (0, react.createElement)(ReplayRecoveryCard, {
|
|
8868
|
-
key: runtime.sessionId,
|
|
8976
|
+
key: JSON.stringify([runtime.sessionId, selected.next.model]),
|
|
8869
8977
|
sessionId: runtime.sessionId,
|
|
8870
8978
|
remote,
|
|
8871
|
-
locale: language
|
|
8979
|
+
locale: language,
|
|
8980
|
+
running,
|
|
8981
|
+
refreshKey: lastError
|
|
8872
8982
|
});
|
|
8873
8983
|
}
|
|
8874
8984
|
function registerReplayRecoveryUi(ctx) {
|