@evandu/super-pi 0.1.145 → 0.1.147
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/super-pi-task/core.ts +74 -2
- package/agents/super-pi-task/index.ts +7 -0
- package/dist/.super-pi-check-inputs.json +2 -2
- package/dist/client/.super-pi-client-sources.json +11 -11
- package/dist/client/assets/{CodeMirrorEditor-A9KvbIkm.js → CodeMirrorEditor-DQCjEnxG.js} +2 -2
- package/dist/client/assets/{dist-DM4Olwfx.js → dist-1Innu17E.js} +1 -1
- package/dist/client/assets/{dist-bIDce5j-.js → dist-1lynFOc5.js} +1 -1
- package/dist/client/assets/{dist-BlxwDnWr.js → dist-B1qLZVMK.js} +1 -1
- package/dist/client/assets/{dist-BTVbZigv.js → dist-B4pz_xdd.js} +1 -1
- package/dist/client/assets/{dist-UJ46aPS3.js → dist-B6KwDpeI.js} +1 -1
- package/dist/client/assets/{dist-CK2KFFtT.js → dist-BJVI1Unv.js} +1 -1
- package/dist/client/assets/{dist-CRnm1rnO.js → dist-BWvzD8Pe.js} +1 -1
- package/dist/client/assets/{dist-DSHM-PAs.js → dist-BayWssd0.js} +1 -1
- package/dist/client/assets/{dist-B9DE7sc5.js → dist-Bk_pkBVH.js} +1 -1
- package/dist/client/assets/{dist-D-o7iQ8c.js → dist-BpeClAv0.js} +1 -1
- package/dist/client/assets/{dist-CQFASxyb.js → dist-BsmJg5PX.js} +1 -1
- package/dist/client/assets/{dist-Ds5gfeAi.js → dist-Bx7s4rni.js} +1 -1
- package/dist/client/assets/{dist-UPJPMjWv.js → dist-CDBKM9tL.js} +1 -1
- package/dist/client/assets/{dist-CIgjifH-.js → dist-CGzXCzCG.js} +1 -1
- package/dist/client/assets/{dist-BAiV8I_O.js → dist-CRxCwn-Z.js} +1 -1
- package/dist/client/assets/{dist-Br-AuQUG.js → dist-CTDgUnBG.js} +1 -1
- package/dist/client/assets/{dist-4JbFTwg2.js → dist-D1VfMWmf.js} +1 -1
- package/dist/client/assets/{dist-BYOpvW02.js → dist-DTZLNEci.js} +1 -1
- package/dist/client/assets/{dist-CQV5kOCE.js → dist-DuUi29km.js} +1 -1
- package/dist/client/assets/{dist-CjszAoXk.js → dist-F3S0t1oM.js} +1 -1
- package/dist/client/assets/{dist-2boAf_pN.js → dist-QZ-FAVJV.js} +1 -1
- package/dist/client/assets/{dist-B1p4YF9C.js → dist-u0nBg0fZ.js} +1 -1
- package/dist/client/assets/index-BMpqviwU.css +1 -0
- package/dist/client/assets/index-Dzyp_7sf.js +102 -0
- package/dist/client/index.html +2 -2
- package/dist/server/active-memory.d.ts +17 -0
- package/dist/server/active-memory.js +39 -0
- package/dist/server/agents.d.ts +1 -1
- package/dist/server/agents.js +3 -1
- package/dist/server/application/conversation-service.d.ts +1 -1
- package/dist/server/application/conversation-service.js +12 -4
- package/dist/server/application/run-service.d.ts +32 -2
- package/dist/server/application/run-service.js +296 -40
- package/dist/server/application/scheduled-task-service.d.ts +14 -1
- package/dist/server/application/scheduled-task-service.js +27 -2
- package/dist/server/application/session-orchestrator-service.d.ts +114 -3
- package/dist/server/application/session-orchestrator-service.js +406 -35
- package/dist/server/application/session-watchdog.d.ts +159 -0
- package/dist/server/application/session-watchdog.js +244 -0
- package/dist/server/command-handler.js +1 -1
- package/dist/server/conversation-usage.d.ts +19 -0
- package/dist/server/conversation-usage.js +40 -0
- package/dist/server/file-diff.d.ts +3 -0
- package/dist/server/file-diff.js +4 -4
- package/dist/server/file-index.d.ts +4 -2
- package/dist/server/file-index.js +14 -9
- package/dist/server/file-name-index.d.ts +5 -2
- package/dist/server/file-name-index.js +22 -5
- package/dist/server/git.d.ts +3 -3
- package/dist/server/git.js +10 -9
- package/dist/server/http-server.js +256 -34
- package/dist/server/index.js +3 -0
- package/dist/server/knowledge-vectors.d.ts +15 -0
- package/dist/server/knowledge-vectors.js +118 -37
- package/dist/server/knowledge.d.ts +7 -8
- package/dist/server/knowledge.js +133 -55
- package/dist/server/length-continuation.d.ts +50 -0
- package/dist/server/length-continuation.js +55 -0
- package/dist/server/model-context-window.d.ts +46 -0
- package/dist/server/model-context-window.js +121 -0
- package/dist/server/pi-session-events.js +5 -1
- package/dist/server/pi-session-pool.d.ts +2 -0
- package/dist/server/pi-session-pool.js +16 -0
- package/dist/server/pi-session.d.ts +6 -0
- package/dist/server/pi-session.js +15 -1
- package/dist/server/runtime.d.ts +3 -0
- package/dist/server/runtime.js +23 -7
- package/dist/server/session-cwd.d.ts +17 -0
- package/dist/server/session-cwd.js +43 -0
- package/dist/server/session-ledger.d.ts +7 -0
- package/dist/server/session-tree-scope.d.ts +125 -0
- package/dist/server/session-tree-scope.js +337 -0
- package/dist/server/store.d.ts +35 -0
- package/dist/server/store.js +87 -2
- package/dist/server/task-tool.d.ts +2 -1
- package/dist/server/task-tool.js +4 -1
- package/dist/server/terminal.d.ts +1 -0
- package/dist/server/terminal.js +5 -3
- package/dist/server/turn-failure.d.ts +26 -0
- package/dist/server/turn-failure.js +67 -1
- package/dist/server/types.d.ts +33 -1
- package/dist/server/version.d.ts +25 -2
- package/dist/server/version.js +98 -26
- package/dist/server/ws-server.d.ts +1 -1
- package/dist/server/ws-server.js +7 -5
- package/package.json +36 -3
- package/dist/client/assets/index-BGsP8pt_.js +0 -100
- package/dist/client/assets/index-CiIc734l.css +0 -1
|
@@ -32,7 +32,9 @@
|
|
|
32
32
|
* replaces.
|
|
33
33
|
*/
|
|
34
34
|
import { readdir } from "node:fs/promises";
|
|
35
|
+
import { isAbsolute, relative, resolve, sep } from "node:path";
|
|
35
36
|
import { createRootGuard, toRelative } from "./files.js";
|
|
37
|
+
import { sessionScopeKey } from "./session-cwd.js";
|
|
36
38
|
/**
|
|
37
39
|
* THE INDEX FOR ONE WORKSPACE, created on demand and then kept.
|
|
38
40
|
*
|
|
@@ -40,15 +42,28 @@ import { createRootGuard, toRelative } from "./files.js";
|
|
|
40
42
|
* the agent's writes - go through this one function, so there is exactly one index per workspace and
|
|
41
43
|
* the two never drift into answering from different maps.
|
|
42
44
|
*/
|
|
43
|
-
export function ensureNameIndex(indexes, workspaceId, root) {
|
|
44
|
-
|
|
45
|
+
export function ensureNameIndex(indexes, workspaceId, root, cwd = "") {
|
|
46
|
+
const key = sessionScopeKey(workspaceId, cwd);
|
|
47
|
+
let index = indexes.get(key);
|
|
45
48
|
if (!index) {
|
|
46
|
-
index = new FileNameIndex(workspaceId);
|
|
47
|
-
indexes.set(
|
|
49
|
+
index = new FileNameIndex(workspaceId, cwd);
|
|
50
|
+
indexes.set(key, index);
|
|
48
51
|
}
|
|
49
52
|
index.start(root);
|
|
50
53
|
return index;
|
|
51
54
|
}
|
|
55
|
+
/** Keeps every root/subdirectory index for a workspace in step with one observed write. */
|
|
56
|
+
export function recordWorkspacePath(indexes, workspaceId, workspaceRoot, path) {
|
|
57
|
+
const absolute = resolve(workspaceRoot, path);
|
|
58
|
+
for (const index of indexes.values()) {
|
|
59
|
+
if (index.workspaceId !== workspaceId)
|
|
60
|
+
continue;
|
|
61
|
+
const scoped = relative(resolve(workspaceRoot, index.cwd), absolute);
|
|
62
|
+
if (!scoped || scoped === ".." || scoped.startsWith(`..${sep}`) || isAbsolute(scoped))
|
|
63
|
+
continue;
|
|
64
|
+
index.upsert(scoped.split(sep).join("/"));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
52
67
|
const MAX_DIRECTORIES = 20000;
|
|
53
68
|
const MAX_FILES = 200000;
|
|
54
69
|
/**
|
|
@@ -92,6 +107,7 @@ function hitPosition(entry, needle) {
|
|
|
92
107
|
*/
|
|
93
108
|
export class FileNameIndex {
|
|
94
109
|
workspaceId;
|
|
110
|
+
cwd;
|
|
95
111
|
entries = new Map();
|
|
96
112
|
root = "";
|
|
97
113
|
building = false;
|
|
@@ -99,8 +115,9 @@ export class FileNameIndex {
|
|
|
99
115
|
scanned = 0;
|
|
100
116
|
stopped = false;
|
|
101
117
|
incomplete = false;
|
|
102
|
-
constructor(workspaceId) {
|
|
118
|
+
constructor(workspaceId, cwd = "") {
|
|
103
119
|
this.workspaceId = workspaceId;
|
|
120
|
+
this.cwd = cwd;
|
|
104
121
|
}
|
|
105
122
|
/**
|
|
106
123
|
* Whether the first pass has FINISHED.
|
package/dist/server/git.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ export type GitFile = {
|
|
|
13
13
|
name: string;
|
|
14
14
|
xy: string;
|
|
15
15
|
};
|
|
16
|
-
export declare function gitStatus(root: string): Promise<GitWorkspace>;
|
|
17
|
-
export declare function gitLog(root: string, limit: number): Promise<{
|
|
16
|
+
export declare function gitStatus(root: string, cwd?: string): Promise<GitWorkspace>;
|
|
17
|
+
export declare function gitLog(root: string, limit: number, cwd?: string): Promise<{
|
|
18
18
|
commits: {
|
|
19
19
|
hash: string;
|
|
20
20
|
short: string;
|
|
@@ -138,4 +138,4 @@ export type GitBlameOptions = {
|
|
|
138
138
|
export declare function gitBlame(root: string, path: string, options?: GitBlameOptions): Promise<GitBlameResponse>;
|
|
139
139
|
/** Whether the directory is a git repository at all. The review view asks before it offers a git baseline. */
|
|
140
140
|
export declare function isGitRepository(root: string): Promise<boolean>;
|
|
141
|
-
export declare function gitMutate(root: string, op: string, path?: string, message?: string): Promise<GitWorkspace>;
|
|
141
|
+
export declare function gitMutate(root: string, op: string, path?: string, message?: string, cwd?: string): Promise<GitWorkspace>;
|
package/dist/server/git.js
CHANGED
|
@@ -5,8 +5,9 @@ import { existsSync } from "node:fs";
|
|
|
5
5
|
import { readFile, stat } from "node:fs/promises";
|
|
6
6
|
const exec = promisify(execFile);
|
|
7
7
|
async function git(cwd, args, options) { return exec("git", ["-c", "core.quotepath=false", ...args], { cwd, windowsHide: true, maxBuffer: options?.maxBuffer ?? 8 * 1024 * 1024 }); }
|
|
8
|
-
function files(raw) { const staged = [], unstaged = [], untracked = []; for (const line of raw.split("\0").filter(Boolean)) {
|
|
9
|
-
const xy = line.slice(0, 2),
|
|
8
|
+
function files(raw, cwd = "") { const staged = [], unstaged = [], untracked = []; for (const line of raw.split("\0").filter(Boolean)) {
|
|
9
|
+
const xy = line.slice(0, 2), repoPath = line.slice(3).split("\0")[0].replaceAll("\\", "/");
|
|
10
|
+
const path = cwd && repoPath.startsWith(`${cwd}/`) ? repoPath.slice(cwd.length + 1) : repoPath;
|
|
10
11
|
const item = { path, name: basename(path), xy };
|
|
11
12
|
if (xy === "??")
|
|
12
13
|
untracked.push(item);
|
|
@@ -17,14 +18,14 @@ function files(raw) { const staged = [], unstaged = [], untracked = []; for (con
|
|
|
17
18
|
unstaged.push(item);
|
|
18
19
|
}
|
|
19
20
|
} return { staged, unstaged, untracked }; }
|
|
20
|
-
export async function gitStatus(root) { try {
|
|
21
|
+
export async function gitStatus(root, cwd = "") { try {
|
|
21
22
|
await git(root, ["rev-parse", "--git-dir"]);
|
|
22
23
|
}
|
|
23
24
|
catch {
|
|
24
25
|
throw Object.assign(new Error("此工作区不是 Git 仓库"), { code: "not_a_repo" });
|
|
25
|
-
} const status = await git(root, ["status", "--porcelain=v1", "-z"]); const branch = await git(root, ["symbolic-ref", "--short", "-q", "HEAD"]).then(r => r.stdout.trim() || null).catch(() => null); const unborn = !(await git(root, ["rev-parse", "--verify", "HEAD"]).then(() => true).catch(() => false)); const ahead = await git(root, ["rev-list", "--left-right", "--count", "HEAD...@{upstream}"]).then(r => { const [a, b] = r.stdout.trim().split(/\s+/).map(Number); return Number.isFinite(a) ? a : null; }).catch(() => null); const behind = await git(root, ["rev-list", "--left-right", "--count", "HEAD...@{upstream}"]).then(r => { const [a, b] = r.stdout.trim().split(/\s+/).map(Number); return Number.isFinite(b) ? b : null; }).catch(() => null); return { branch, detached: !branch, unborn, ahead, behind, ...files(status.stdout) }; }
|
|
26
|
-
export async function gitLog(root, limit) { const hasHead = await git(root, ["rev-parse", "--verify", "HEAD"]).then(() => true).catch(() => false); if (!hasHead)
|
|
27
|
-
return { commits: [], truncated: false }; const out = await git(root, ["log", `-${Math.min(Math.max(limit, 1), 50)}`, "--format=%H%x00%h%x00%s%x00%an%x00%aI%x00"]); const parts = out.stdout.split("\0").filter(Boolean); const commits = []; for (let i = 0; i + 4 < parts.length; i += 5)
|
|
26
|
+
} const status = await git(root, ["status", "--porcelain=v1", "-z", ...(cwd ? ["--", cwd] : [])]); const branch = await git(root, ["symbolic-ref", "--short", "-q", "HEAD"]).then(r => r.stdout.trim() || null).catch(() => null); const unborn = !(await git(root, ["rev-parse", "--verify", "HEAD"]).then(() => true).catch(() => false)); const ahead = await git(root, ["rev-list", "--left-right", "--count", "HEAD...@{upstream}"]).then(r => { const [a, b] = r.stdout.trim().split(/\s+/).map(Number); return Number.isFinite(a) ? a : null; }).catch(() => null); const behind = await git(root, ["rev-list", "--left-right", "--count", "HEAD...@{upstream}"]).then(r => { const [a, b] = r.stdout.trim().split(/\s+/).map(Number); return Number.isFinite(b) ? b : null; }).catch(() => null); return { branch, detached: !branch, unborn, ahead, behind, ...files(status.stdout, cwd) }; }
|
|
27
|
+
export async function gitLog(root, limit, cwd = "") { const hasHead = await git(root, ["rev-parse", "--verify", "HEAD"]).then(() => true).catch(() => false); if (!hasHead)
|
|
28
|
+
return { commits: [], truncated: false }; const out = await git(root, ["log", `-${Math.min(Math.max(limit, 1), 50)}`, "--format=%H%x00%h%x00%s%x00%an%x00%aI%x00", ...(cwd ? ["--", cwd] : [])]); const parts = out.stdout.split("\0").filter(Boolean); const commits = []; for (let i = 0; i + 4 < parts.length; i += 5)
|
|
28
29
|
commits.push({ hash: parts[i], short: parts[i + 1], subject: parts[i + 2], author: parts[i + 3], date: new Date(parts[i + 4]).toISOString() }); return { commits, truncated: commits.length >= limit }; }
|
|
29
30
|
export async function gitDiff(root, path, staged) { const safe = resolve(root, path); if (!safe.startsWith(resolve(root) + sep) || !existsSync(safe))
|
|
30
31
|
throw Object.assign(new Error("文件路径无效"), { code: "path" }); const check = await git(root, ["ls-files", "--error-unmatch", "--", path]).then(() => true).catch(() => false); if (!check)
|
|
@@ -341,7 +342,7 @@ function safePath(root, path) {
|
|
|
341
342
|
throw Object.assign(new Error("文件路径无效"), { code: "path" });
|
|
342
343
|
return path;
|
|
343
344
|
}
|
|
344
|
-
export async function gitMutate(root, op, path, message) {
|
|
345
|
+
export async function gitMutate(root, op, path, message, cwd = "") {
|
|
345
346
|
if (op === "stage" || op === "unstage" || op === "discard") {
|
|
346
347
|
if (!path)
|
|
347
348
|
throw Object.assign(new Error("缺少文件路径"), { code: "path" });
|
|
@@ -356,7 +357,7 @@ export async function gitMutate(root, op, path, message) {
|
|
|
356
357
|
else if (op === "commit") {
|
|
357
358
|
if (!message?.trim())
|
|
358
359
|
throw Object.assign(new Error("提交消息不能为空"), { code: "bad_message" });
|
|
359
|
-
await git(root, ["commit", "-m", message.trim()]);
|
|
360
|
+
await git(root, ["commit", "-m", message.trim(), ...(cwd ? ["--", cwd] : [])]);
|
|
360
361
|
}
|
|
361
362
|
else if (op === "pull")
|
|
362
363
|
await git(root, ["pull", "--ff-only"]);
|
|
@@ -364,5 +365,5 @@ export async function gitMutate(root, op, path, message) {
|
|
|
364
365
|
await git(root, ["push"]);
|
|
365
366
|
else
|
|
366
367
|
throw Object.assign(new Error("未知 Git 操作"), { code: "bad_op" });
|
|
367
|
-
return gitStatus(root);
|
|
368
|
+
return gitStatus(root, cwd);
|
|
368
369
|
}
|