@evandu/super-pi 0.1.291 → 0.1.293
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/dist/client/.super-pi-client-sources.json +9 -9
- package/dist/client/assets/{CodeMirrorEditor-O7UpftQ-.css → CodeMirrorEditor-7EW-C8kx.css} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-BItIClMY.js → CodeMirrorEditor-CRYNvn14.js} +1 -1
- package/dist/client/assets/GitDiffEditor-WONJq3t4.js +29 -0
- package/dist/client/assets/index-B2HH9caF.css +1 -0
- package/dist/client/assets/{index-Cwt3-oUx.js → index-MxsSEfDh.js} +28 -28
- package/dist/client/index.html +2 -2
- package/dist/server/git.js +16 -3
- package/dist/server/managed-servers.js +19 -1
- package/package.json +1 -1
- package/dist/client/assets/GitDiffEditor-CgWWgUsi.js +0 -29
- package/dist/client/assets/index-C3aSjjM8.css +0 -1
package/dist/client/index.html
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
<link rel="alternate icon" href="/favicon.ico" />
|
|
9
9
|
<link rel="apple-touch-icon" href="/favicon.svg" />
|
|
10
10
|
<title>Super Pi</title>
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-MxsSEfDh.js"></script>
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
|
|
13
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
13
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B2HH9caF.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<div id="root"></div>
|
package/dist/server/git.js
CHANGED
|
@@ -86,9 +86,9 @@ function parseGitCommits(raw) {
|
|
|
86
86
|
}
|
|
87
87
|
const COMMIT_HASH = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/i;
|
|
88
88
|
export async function gitGraph(root, limit, offset, snapshot, after, knownSnapshot = "") {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
return readGitGraph(root, limit, offset, snapshot, after, knownSnapshot, 1);
|
|
90
|
+
}
|
|
91
|
+
async function graphSnapshot(repo) {
|
|
92
92
|
const [refs, checkout] = await Promise.all([
|
|
93
93
|
git(repo, ["for-each-ref", "--format=%(refname)%00%(objectname)%00%(*objectname)%00%(symref)"], { maxBuffer: 32 * 1024 * 1024, timeout: 12_000 }),
|
|
94
94
|
gitWorktrees(repo),
|
|
@@ -96,6 +96,13 @@ export async function gitGraph(root, limit, offset, snapshot, after, knownSnapsh
|
|
|
96
96
|
const worktrees = checkout.worktrees.filter(entry => !entry.missing && COMMIT_HASH.test(entry.head) && !/^0+$/.test(entry.head));
|
|
97
97
|
const heads = worktrees.map(({ id, branch, head, current, name }) => ({ id, branch, head, current, name }));
|
|
98
98
|
const version = createHash("sha256").update(refs.stdout).update(JSON.stringify(heads)).digest("hex");
|
|
99
|
+
return { refs, worktrees, version };
|
|
100
|
+
}
|
|
101
|
+
async function readGitGraph(root, limit, offset, snapshot, after, knownSnapshot, retries) {
|
|
102
|
+
const size = pageNumber(limit, 50, 1, 100);
|
|
103
|
+
const start = pageNumber(offset, 0, 0, 2_147_483_647);
|
|
104
|
+
const repo = await worktreeRoot(root);
|
|
105
|
+
const { refs, worktrees, version } = await graphSnapshot(repo);
|
|
99
106
|
const changed = () => gitFailure("提交图已变化,请刷新后继续查看。", "graph_changed");
|
|
100
107
|
if (start && snapshot !== version)
|
|
101
108
|
throw changed();
|
|
@@ -134,6 +141,12 @@ export async function gitGraph(root, limit, offset, snapshot, after, knownSnapsh
|
|
|
134
141
|
const format = "--format=%H%x00%h%x00%P%x00%s%x00%an%x00%aI";
|
|
135
142
|
const { stdout } = await git(repo, ["-c", "log.showSignature=false", "log", "--all", "--topo-order", "--no-notes", "--no-decorate",
|
|
136
143
|
"--no-patch", "--encoding=UTF-8", "-z", `--skip=${start - overlap}`, `-${size + 1 + overlap}`, format, ...detached, "--"], { timeout: 12_000 });
|
|
144
|
+
// Git refs may change between separate commands; never cache a mixed snapshot.
|
|
145
|
+
if ((await graphSnapshot(repo)).version !== version) {
|
|
146
|
+
if (!start && retries > 0)
|
|
147
|
+
return readGitGraph(root, limit, offset, snapshot, after, knownSnapshot, retries - 1);
|
|
148
|
+
throw changed();
|
|
149
|
+
}
|
|
137
150
|
const parts = stdout.split("\0");
|
|
138
151
|
const commits = [];
|
|
139
152
|
for (let index = 0; index + 5 < parts.length; index += 6) {
|
|
@@ -753,8 +753,26 @@ export class ManagedServers {
|
|
|
753
753
|
throw new Error("未能重新确认所选旧实例及数据目录,未创建新实例或删除任何数据。");
|
|
754
754
|
if (entry.compatibility && entry.profile.service === "online")
|
|
755
755
|
throw new Error("当前连接是正在运行的原有服务,请使用独立连接接管旧托管实例,避免中断未知启动方式。");
|
|
756
|
-
if (entry.installation && entry.installation.root !== selected.root)
|
|
756
|
+
if (entry.installation && entry.installation.root !== selected.root) {
|
|
757
|
+
await this.health(id);
|
|
758
|
+
if (entry.profile.service === "online") {
|
|
759
|
+
const state = await this.serviceJson(entry, "/api/conversations");
|
|
760
|
+
if ((state.conversations ?? []).some((conversation) => ["running", "waiting", "awaiting_background"].includes(conversation.status)))
|
|
761
|
+
throw new Error("远端仍有进行中的任务,请完成后再重新接管");
|
|
762
|
+
}
|
|
757
763
|
await stopRemote(client, entry.installation);
|
|
764
|
+
}
|
|
765
|
+
const previousRelay = this.relays.get(id);
|
|
766
|
+
this.relays.delete(id);
|
|
767
|
+
previousRelay?.terminate();
|
|
768
|
+
this.closeServiceTunnel(id);
|
|
769
|
+
entry.profile.service = "unknown";
|
|
770
|
+
entry.profile.modelChannel = "offline";
|
|
771
|
+
delete entry.profile.transport;
|
|
772
|
+
delete entry.profile.modelTransport;
|
|
773
|
+
delete entry.profile.serviceError;
|
|
774
|
+
delete entry.profile.modelError;
|
|
775
|
+
entry.modelHash = undefined;
|
|
758
776
|
entry.recoveryRoot = selected.root;
|
|
759
777
|
entry.installation = selected.installation;
|
|
760
778
|
entry.instanceId = selected.id;
|