cuelo 0.10.355 → 0.10.359
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +51 -51
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.js +1 -1
- package/.next/required-server-files.json +1 -1
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +3 -3
- package/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/agent/[id]/account/route.js +1 -1
- package/.next/server/app/api/agent/[id]/account/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/[id]/browser/events/route.js +1 -1
- package/.next/server/app/api/agent/[id]/browser/events/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/[id]/browser/input/route.js +1 -1
- package/.next/server/app/api/agent/[id]/browser/input/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/[id]/browser/route.js +1 -1
- package/.next/server/app/api/agent/[id]/browser/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/[id]/computer-takeover/route.js +1 -1
- package/.next/server/app/api/agent/[id]/computer-takeover/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/[id]/events/route.js +1 -1
- package/.next/server/app/api/agent/[id]/events/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/[id]/route.js +1 -1
- package/.next/server/app/api/agent/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/new/route.js +1 -1
- package/.next/server/app/api/agent/new/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/running/route.js +1 -1
- package/.next/server/app/api/agent/running/route.js.nft.json +1 -1
- package/.next/server/app/api/gpt6/handles/route.js +1 -1
- package/.next/server/app/api/gpt6/handles/route.js.nft.json +1 -1
- package/.next/server/app/api/gpt6/reply/route.js +1 -1
- package/.next/server/app/api/gpt6/reply/route.js.nft.json +1 -1
- package/.next/server/app/api/gpt6/token/route.js +1 -1
- package/.next/server/app/api/gpt6/token/route.js.nft.json +1 -1
- package/.next/server/app/api/gpt6/web6-session/route.js +1 -1
- package/.next/server/app/api/gpt6/web6-session/route.js.nft.json +1 -1
- package/.next/server/app/api/live/call/[callId]/route.js +1 -1
- package/.next/server/app/api/live/call/[callId]/route.js.nft.json +1 -1
- package/.next/server/app/api/live/draft-secret/route.js +1 -1
- package/.next/server/app/api/live/draft-secret/route.js.nft.json +1 -1
- package/.next/server/app/api/live/events/route.js +1 -1
- package/.next/server/app/api/live/events/route.js.nft.json +1 -1
- package/.next/server/app/api/live/interpret/assist/route.js +1 -1
- package/.next/server/app/api/live/interpret/assist/route.js.nft.json +1 -1
- package/.next/server/app/api/live/interpret/reading/route.js +1 -1
- package/.next/server/app/api/live/interpret/reading/route.js.nft.json +1 -1
- package/.next/server/app/api/live/interpret/route.js +1 -1
- package/.next/server/app/api/live/interpret/route.js.nft.json +1 -1
- package/.next/server/app/api/live/interpret/scan/route.js +1 -1
- package/.next/server/app/api/live/interpret/scan/route.js.nft.json +1 -1
- package/.next/server/app/api/live/interpret/text/route.js +1 -1
- package/.next/server/app/api/live/interpret/text/route.js.nft.json +1 -1
- package/.next/server/app/api/live/offer/route.js +1 -1
- package/.next/server/app/api/live/offer/route.js.nft.json +1 -1
- package/.next/server/app/api/live/speech/route.js +1 -1
- package/.next/server/app/api/live/speech/route.js.nft.json +1 -1
- package/.next/server/app/api/live/voices/route.js +1 -1
- package/.next/server/app/api/live/voices/route.js.nft.json +1 -1
- package/.next/server/app/api/project-trust/route.js +1 -1
- package/.next/server/app/api/project-trust/route.js.nft.json +1 -1
- package/.next/server/app/api/runs/[runId]/prelude/route.js +1 -1
- package/.next/server/app/api/runs/[runId]/prelude/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/auto-name/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/auto-name/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/context/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/state/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/route.js +1 -1
- package/.next/server/app/api/sessions/route.js.nft.json +1 -1
- package/.next/server/app/api/tool-image/route.js +1 -1
- package/.next/server/app/api/tool-image/route.js.nft.json +1 -1
- package/.next/server/app/api/update-maintenance/route.js +1 -1
- package/.next/server/app/api/update-maintenance/route.js.nft.json +1 -1
- package/.next/server/app/api/updates/apply/route.js +2 -2
- package/.next/server/app/api/updates/route.js +1 -1
- package/.next/server/app/api/upkeep/check/route.js +1 -1
- package/.next/server/app/api/upkeep/check/route.js.nft.json +1 -1
- package/.next/server/app/api/upkeep/morning/route.js +1 -1
- package/.next/server/app/api/upkeep/morning/route.js.nft.json +1 -1
- package/.next/server/app/api/upkeep/nightly/export/route.js +1 -1
- package/.next/server/app/api/upkeep/nightly/export/route.js.nft.json +1 -1
- package/.next/server/app/api/upkeep/nightly/result/route.js +1 -1
- package/.next/server/app/api/upkeep/nightly/result/route.js.nft.json +1 -1
- package/.next/server/app/api/upkeep/nightly/route.js +1 -1
- package/.next/server/app/api/upkeep/nightly/route.js.nft.json +1 -1
- package/.next/server/app/api/upkeep/route.js +1 -1
- package/.next/server/app/api/upkeep/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/route.js +1 -1
- package/.next/server/app/api/worktrees/route.js.nft.json +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +5 -5
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
- package/.next/server/app/index.segments/_full.segment.rsc +5 -5
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +3 -3
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/page.js +3 -3
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/recover/page_client-reference-manifest.js +1 -1
- package/.next/server/app/recover.html +1 -1
- package/.next/server/app/recover.rsc +3 -3
- package/.next/server/app/recover.segments/_full.segment.rsc +3 -3
- package/.next/server/app/recover.segments/_head.segment.rsc +1 -1
- package/.next/server/app/recover.segments/_index.segment.rsc +3 -3
- package/.next/server/app/recover.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/recover.segments/recover/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/recover.segments/recover.segment.rsc +1 -1
- package/.next/server/app-paths-manifest.json +51 -51
- package/.next/server/chunks/2908.js +1 -0
- package/.next/server/chunks/3267.js +1 -1
- package/.next/server/chunks/5228.js +5 -5
- package/.next/server/chunks/7106.js +1 -0
- package/.next/server/chunks/8041.js +2 -2
- package/.next/server/chunks/8685.js +16 -16
- package/.next/server/chunks/9467.js +6 -6
- package/.next/server/instrumentation.js +1 -1
- package/.next/server/instrumentation.js.nft.json +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/app/{layout-2e1f3361ad019c87.js → layout-ee5121c5bdcf8ed2.js} +1 -1
- package/.next/static/chunks/app/{page-a51b6d8b9800dc9b.js → page-850a3c23b950a55b.js} +3 -3
- package/.next/static/css/d8d2a25163838be6.css +1 -0
- package/.next/trace +118 -118
- package/.next/trace-build +1 -1
- package/Tools/CUELO_Setup/files/native-runtime-patch.js +1 -1
- package/Tools/OMP_Global_Config/agent/cuelo-plugins/goal-lane/index.ts +106 -61
- package/Tools/OMP_Global_Config/agent/cuelo-plugins/goal-lane/plugin.json +4 -0
- package/Tools/OMP_Global_Config/agent/cuelo-plugins/screen-fast-path/index.ts +28 -3
- package/Tools/OMP_Global_Config/agent/cuelo-plugins/screen-fast-path/plugin.json +3 -1
- package/Tools/OMP_Global_Config/agent/cuelo-plugins/todo-language/index.ts +49 -10
- package/Tools/OMP_Global_Config/agent/cuelo-plugins/todo-language/plugin.json +4 -0
- package/Tools/OMP_Global_Config/agent/extensions/edit-lessons.ts +35 -19
- package/Tools/OMP_Global_Config/agent/extensions/lib/finalize-checks.ts +139 -19
- package/Tools/OMP_Global_Config/agent/tools/git-finalizer/index.ts +68 -24
- package/bin/ci-local.mjs +1 -2
- package/package.json +1 -1
- package/.next/static/css/fe2e76f96aee275e.css +0 -1
- /package/.next/static/{D-td92MNj1e9bUxdQYele → Fv9DSUHJTmKsAWWcOTAUo}/_buildManifest.js +0 -0
- /package/.next/static/{D-td92MNj1e9bUxdQYele → Fv9DSUHJTmKsAWWcOTAUo}/_ssgManifest.js +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { execFile, spawn } from "node:child_process";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
|
-
import {
|
|
3
|
+
import type { BigIntStats } from "node:fs";
|
|
4
|
+
import { lstat, mkdir, mkdtemp, open, readdir, readFile, readlink, realpath, rm, stat, writeFile } from "node:fs/promises";
|
|
4
5
|
import { tmpdir } from "node:os";
|
|
5
|
-
import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
6
|
+
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
6
7
|
import type { CustomToolContext } from "@oh-my-pi/pi-coding-agent";
|
|
7
8
|
import { Process } from "@oh-my-pi/pi-natives";
|
|
8
9
|
import { getAgentDir } from "@oh-my-pi/pi-utils";
|
|
@@ -98,7 +99,7 @@ function matches(paths: readonly string[], file: string): boolean {
|
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
101
|
|
|
101
|
-
async function fileFingerprint(root: string, path: string, checkPaths: readonly string[]): Promise<{ value: string; opaque?: true }> {
|
|
102
|
+
async function fileFingerprint(root: string, path: string, checkPaths: readonly string[], untrackedInput: boolean): Promise<{ value: string; opaque?: true }> {
|
|
102
103
|
const absolute = join(root, path);
|
|
103
104
|
const info = await lstat(absolute).catch((error: NodeJS.ErrnoException) => {
|
|
104
105
|
if (error.code !== "ENOENT") throw error;
|
|
@@ -114,7 +115,7 @@ async function fileFingerprint(root: string, path: string, checkPaths: readonly
|
|
|
114
115
|
const within = real && relative(root, real);
|
|
115
116
|
if (within === undefined || isAbsolute(within) || within === ".." || within.startsWith(`..${sep}`)) {
|
|
116
117
|
// The link itself is known even when its target cannot be treated as a repository input.
|
|
117
|
-
return { value: `${real === undefined ? "dangling" : "external"}:${link}`, ...(link && !matches(checkPaths, path) ? {} : { opaque: true }) };
|
|
118
|
+
return { value: `${real === undefined ? "dangling" : "external"}:${link}`, ...(link && !untrackedInput && !matches(checkPaths, path) ? {} : { opaque: true }) };
|
|
118
119
|
}
|
|
119
120
|
if (!real) throw new Error("no resolved path");
|
|
120
121
|
const realInfo = await lstat(real, { bigint: true });
|
|
@@ -135,13 +136,116 @@ async function fileFingerprint(root: string, path: string, checkPaths: readonly
|
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
function runtimeFingerprints(cwd: string, env: NodeJS.ProcessEnv, signal?: AbortSignal) {
|
|
140
|
+
const pathKey = process.platform === "win32" ? Object.keys(env).sort().find((key) => key.toUpperCase() === "PATH") : "PATH";
|
|
141
|
+
const path = pathKey === undefined ? undefined : env[pathKey];
|
|
142
|
+
const host = realpath(process.execPath).catch(() => undefined);
|
|
143
|
+
const probes = new Map<string, Promise<string | undefined>>();
|
|
144
|
+
const probe = async (command: string) => {
|
|
145
|
+
try {
|
|
146
|
+
if (path === undefined) return undefined;
|
|
147
|
+
const executable = Bun.which(command, { PATH: path, cwd });
|
|
148
|
+
if (!executable) return undefined;
|
|
149
|
+
const resolved = await realpath(executable);
|
|
150
|
+
const identity = JSON.stringify([executable, resolved, statIdentity(await stat(resolved, { bigint: true }))]);
|
|
151
|
+
let version = probes.get(identity);
|
|
152
|
+
if (!version) {
|
|
153
|
+
const { promise, resolve } = Promise.withResolvers<string | undefined>();
|
|
154
|
+
execFile(executable, ["--version"], { cwd, env, signal, timeout: 2_000, killSignal: "SIGKILL", windowsHide: true, maxBuffer: 4_096 },
|
|
155
|
+
(error, stdout) => {
|
|
156
|
+
const text = stdout.trim();
|
|
157
|
+
resolve(!error && /^v?\d+\.\d+\.\d+(?:[-+][\w.+-]+)?$/.test(text) ? text : undefined);
|
|
158
|
+
});
|
|
159
|
+
version = promise;
|
|
160
|
+
probes.set(identity, version);
|
|
161
|
+
}
|
|
162
|
+
const text = await version;
|
|
163
|
+
return text === undefined ? undefined : [identity, text];
|
|
164
|
+
} catch {
|
|
165
|
+
// A failing or unresolvable probe must never turn into evidence for reuse.
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
return async (command: string) => {
|
|
170
|
+
const local = /^(bun|node)(\.exe)?$/i.test(basename(command)) && !/^(bun|node)$/.test(command);
|
|
171
|
+
const [executable, node, bun, direct] = await Promise.all([host, probe("node"), probe("bun"), local ? probe(command) : null]);
|
|
172
|
+
return executable && node && bun && direct !== undefined
|
|
173
|
+
? [executable, process.versions.node, process.versions.bun, node, bun, direct] : undefined;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function statIdentity(info: BigIntStats): string {
|
|
178
|
+
return [info.dev, info.ino, info.mode, info.size, info.ctimeNs, info.mtimeNs].join(":");
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const installEntries = { ".bin": true, ".bun": true, ".modules.yaml": true, ".package-lock.json": true,
|
|
182
|
+
".pnpm": true, ".yarn-integrity": true, ".yarn-state.yml": true };
|
|
183
|
+
|
|
184
|
+
async function installedDependencies(root: string, inputs: Iterable<string>, signal?: AbortSignal) {
|
|
185
|
+
const dirs = new Set<string>();
|
|
186
|
+
for (let dir = root;; dir = dirname(dir)) {
|
|
187
|
+
dirs.add(join(dir, "node_modules"));
|
|
188
|
+
if (dir === dirname(dir)) break;
|
|
189
|
+
}
|
|
190
|
+
for (const path of inputs) {
|
|
191
|
+
if (path.endsWith("/package.json") && !path.includes("\uFFFD")) dirs.add(join(root, dirname(path), "node_modules"));
|
|
192
|
+
}
|
|
193
|
+
const optional = (error: NodeJS.ErrnoException) => {
|
|
194
|
+
if (error.code !== "ENOENT") throw error;
|
|
195
|
+
return undefined;
|
|
196
|
+
};
|
|
197
|
+
const identity = async (path: string, info: BigIntStats) => {
|
|
198
|
+
const target = info.isSymbolicLink() ? await stat(path, { bigint: true }) : info;
|
|
199
|
+
return statIdentity(target);
|
|
200
|
+
};
|
|
201
|
+
try {
|
|
202
|
+
const hash = createHash("sha256");
|
|
203
|
+
for (const dir of [...dirs].sort()) {
|
|
204
|
+
signal?.throwIfAborted();
|
|
205
|
+
const info = await lstat(dir, { bigint: true }).catch(optional);
|
|
206
|
+
if (!info) continue;
|
|
207
|
+
// Include install metadata and hoisted package manifests, not package payloads
|
|
208
|
+
// or tool caches. Scope folders are the only extra level we enumerate.
|
|
209
|
+
const packages: string[] = [];
|
|
210
|
+
for (const entry of await readdir(dir, { withFileTypes: true })) {
|
|
211
|
+
if (entry.name.includes("\uFFFD")) return undefined;
|
|
212
|
+
if (Object.hasOwn(installEntries, entry.name)) packages.push(entry.name);
|
|
213
|
+
else if (entry.name.startsWith("@")) {
|
|
214
|
+
for (const name of await readdir(join(dir, entry.name))) {
|
|
215
|
+
if (name.includes("\uFFFD")) return undefined;
|
|
216
|
+
packages.push(`${entry.name}/${name}/package.json`);
|
|
217
|
+
}
|
|
218
|
+
} else if (!entry.name.startsWith(".") && (entry.isDirectory() || entry.isSymbolicLink())) {
|
|
219
|
+
packages.push(`${entry.name}/package.json`);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
hash.update(JSON.stringify([dir, await identity(dir, info)]));
|
|
223
|
+
packages.sort();
|
|
224
|
+
for (let index = 0; index < packages.length; index += 64) {
|
|
225
|
+
signal?.throwIfAborted();
|
|
226
|
+
const entries = packages.slice(index, index + 64);
|
|
227
|
+
const ids = await Promise.all(entries.map(async (name) => {
|
|
228
|
+
const path = join(dir, name);
|
|
229
|
+
const info = await lstat(path, { bigint: true }).catch(optional);
|
|
230
|
+
return info && identity(path, info);
|
|
231
|
+
}));
|
|
232
|
+
hash.update(JSON.stringify([entries, ids]));
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return hash.digest("hex");
|
|
236
|
+
} catch {
|
|
237
|
+
// Inaccessible or unsupported installed state cannot certify a cached pass.
|
|
238
|
+
return undefined;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
138
242
|
type ReadGit = (args: string[]) => ReturnType<Exec>;
|
|
139
|
-
type Snapshot = { hash: string; sourceHash: string;
|
|
243
|
+
type Snapshot = { hash: string; sourceHash: string; receiptHash?: string };
|
|
140
244
|
|
|
141
245
|
/** Hash raw working bytes rather than `git diff`, which can hide changes behind clean filters and index flags. */
|
|
142
246
|
async function fingerprint(
|
|
143
247
|
root: string, files: readonly string[], paths: readonly string[], git: ReadGit,
|
|
144
|
-
signal?: AbortSignal, publication = false,
|
|
248
|
+
signal?: AbortSignal, publication = false, collectReceipt = false,
|
|
145
249
|
): Promise<Snapshot | undefined> {
|
|
146
250
|
try {
|
|
147
251
|
const [head, tracked, committed, untracked] = await Promise.all([
|
|
@@ -163,20 +267,30 @@ async function fingerprint(
|
|
|
163
267
|
inputs.add(entry.slice(tab + 1));
|
|
164
268
|
}
|
|
165
269
|
const outputs = new Set<string>();
|
|
270
|
+
const extraInputs = new Set<string>();
|
|
166
271
|
for (const path of untracked.stdout.split("\0")) {
|
|
167
|
-
if (!path ||
|
|
168
|
-
|
|
169
|
-
|
|
272
|
+
if (!path || inputs.has(path)) continue;
|
|
273
|
+
if (matches(paths, path)) {
|
|
274
|
+
inputs.add(path);
|
|
275
|
+
if (publication) outputs.add(path);
|
|
276
|
+
} else if (collectReceipt) extraInputs.add(path);
|
|
170
277
|
}
|
|
278
|
+
const dependencyState = collectReceipt ? installedDependencies(root, [...inputs, ...extraInputs], signal) : undefined;
|
|
279
|
+
const extraHash = collectReceipt ? createHash("sha256") : undefined;
|
|
171
280
|
const hash = createHash("sha256").update(JSON.stringify([head.stdout.trim(), tracked.stdout, files]));
|
|
172
281
|
const sourceHash = outputs.size ? hash.copy() : undefined;
|
|
173
282
|
const update = (path: string, value: string | null) => {
|
|
174
283
|
const data = JSON.stringify([path, value]);
|
|
175
|
-
|
|
176
|
-
|
|
284
|
+
// Check selection paths are not a read boundary. This widens the receipt,
|
|
285
|
+
// not the publication source/output classification or transaction checks.
|
|
286
|
+
if (extraInputs.has(path)) extraHash?.update(data);
|
|
287
|
+
else {
|
|
288
|
+
hash.update(data);
|
|
289
|
+
if (!outputs.has(path)) sourceHash?.update(data);
|
|
290
|
+
}
|
|
177
291
|
};
|
|
178
292
|
const ordered: string[] = [];
|
|
179
|
-
for (const path of [...inputs].sort()) {
|
|
293
|
+
for (const path of [...inputs, ...extraInputs].sort()) {
|
|
180
294
|
// The text Git adapter cannot distinguish invalid UTF-8 from U+FFFD. Keep
|
|
181
295
|
// that part opaque instead of dropping the evidence from all other paths.
|
|
182
296
|
if (path.includes("\uFFFD")) {
|
|
@@ -187,7 +301,7 @@ async function fingerprint(
|
|
|
187
301
|
for (let index = 0; index < ordered.length; index += 32) {
|
|
188
302
|
signal?.throwIfAborted();
|
|
189
303
|
const batch = ordered.slice(index, index + 32);
|
|
190
|
-
const entries = await Promise.allSettled(batch.map((path) => fileFingerprint(root, path, paths)));
|
|
304
|
+
const entries = await Promise.allSettled(batch.map((path) => fileFingerprint(root, path, paths, extraInputs.has(path))));
|
|
191
305
|
for (let offset = 0; offset < batch.length; offset++) {
|
|
192
306
|
const entry = entries[offset];
|
|
193
307
|
if (entry.status === "rejected") {
|
|
@@ -200,7 +314,9 @@ async function fingerprint(
|
|
|
200
314
|
}
|
|
201
315
|
}
|
|
202
316
|
const digest = hash.digest("hex");
|
|
203
|
-
|
|
317
|
+
const dependencies = await dependencyState;
|
|
318
|
+
const receiptHash = complete && dependencies !== undefined ? extraHash?.update(digest).update(dependencies).digest("hex") : undefined;
|
|
319
|
+
return { hash: digest, sourceHash: sourceHash?.digest("hex") ?? digest, receiptHash };
|
|
204
320
|
} catch {
|
|
205
321
|
// Cache evidence is optional. Unknown, inaccessible or unsupported inputs require a fresh run.
|
|
206
322
|
return undefined;
|
|
@@ -444,18 +560,22 @@ async function runSelectedChecks(
|
|
|
444
560
|
env.BUN_INSTALL_CACHE_DIR = bunCache;
|
|
445
561
|
env.PWD = cwd;
|
|
446
562
|
}
|
|
563
|
+
const runtimeFingerprint = runtimeFingerprints(cwd, env, options.signal);
|
|
447
564
|
const results: CheckResult[] = [];
|
|
448
565
|
const verified: { check: Check; fingerprint: string }[] = [];
|
|
449
566
|
let ranAfterVerification = false;
|
|
450
567
|
let logDir: string | undefined;
|
|
451
568
|
for (const check of selected) {
|
|
452
569
|
options.signal?.throwIfAborted();
|
|
453
|
-
const prior = await
|
|
570
|
+
const [prior, runtime] = await Promise.all([
|
|
571
|
+
fingerprint(cwd, files, check.paths, git, options.signal, options.publicationCandidate, true),
|
|
572
|
+
runtimeFingerprint(check.command[0]),
|
|
573
|
+
]);
|
|
454
574
|
options.signal?.throwIfAborted();
|
|
455
575
|
const slot = createHash("sha256").update(JSON.stringify([root, check.name])).digest("hex");
|
|
456
576
|
const ledgerFile = join(ledgerDir, slot);
|
|
457
|
-
const key = prior?.
|
|
458
|
-
|
|
577
|
+
const key = prior?.receiptHash && runtime && !env.NODE_PATH ? createHash("sha256")
|
|
578
|
+
.update(JSON.stringify([4, envKey, runtime, check, !!options.publicationCandidate, candidateTree ?? null, prior.receiptHash])).digest("hex") : undefined;
|
|
459
579
|
if (key && await readFile(ledgerFile, "utf8").catch(() => undefined) === key) {
|
|
460
580
|
results.push({ name: check.name, seconds: 0, reused: true });
|
|
461
581
|
verified.push({ check, fingerprint: prior!.hash });
|
|
@@ -489,12 +609,12 @@ async function runSelectedChecks(
|
|
|
489
609
|
}
|
|
490
610
|
results.push({ name: check.name, seconds, reused: false });
|
|
491
611
|
ranAfterVerification = verified.length > 0;
|
|
492
|
-
const after = await fingerprint(cwd, files, check.paths, git, options.signal, options.publicationCandidate);
|
|
612
|
+
const after = await fingerprint(cwd, files, check.paths, git, options.signal, options.publicationCandidate, Boolean(key));
|
|
493
613
|
if (options.publicationCandidate && prior?.sourceHash !== after?.sourceHash) {
|
|
494
614
|
throw new Error(`${check.name}'s publication candidate inputs changed during the check. Call the publication tool again when the inputs are stable.`);
|
|
495
615
|
}
|
|
496
616
|
if (after) verified.push({ check, fingerprint: after.hash });
|
|
497
|
-
if (key && after?.
|
|
617
|
+
if (key && after?.receiptHash === prior?.receiptHash) {
|
|
498
618
|
try {
|
|
499
619
|
await mkdir(ledgerDir, { recursive: true, mode: 0o700 });
|
|
500
620
|
await writeFile(ledgerFile, key, { mode: 0o600 });
|
|
@@ -32,6 +32,8 @@ interface FinalizerResult {
|
|
|
32
32
|
repositoryFiles?: string[];
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
class FinalizerPathRefusal extends Error {}
|
|
36
|
+
|
|
35
37
|
const scriptPath = fileURLToPath(new URL("./finalizer.ps1", import.meta.url));
|
|
36
38
|
const syncCheckoutPath = fileURLToPath(new URL("./sync-checkout.ts", import.meta.url));
|
|
37
39
|
const helperPath = "Tools/CUELO_Setup/files/source-build-helper.js";
|
|
@@ -397,8 +399,8 @@ export const finalizeTool = (pi: ToolApi): CustomTool<any, any> => ({
|
|
|
397
399
|
label: "Git Finalize",
|
|
398
400
|
loadMode: "essential",
|
|
399
401
|
description:
|
|
400
|
-
"Main-only commit/push exact cwd-relative files in one repo
|
|
401
|
-
|
|
402
|
+
"Main-only commit/push. Before calling: give exact cwd-relative files in one repo (no globs/directories) and message; crossReviewHighRisk uses paths from files. Resolve cross_review for gated code and slop_check for gated visible files at current content. Include the matching source manifest where required; stale hashes are regenerated and committed when possible. Fix known .finalize-checks.json failures; matching checks run after review/slop before publication." +
|
|
403
|
+
" crossReviewWaiver: explicit user instruction OR standing exception when required review failed only on provider rate or usage limits (decision, reviewId, raw errors). slopGateWaiver and finalizeChecksWaiver: explicit user instruction only. outsideCwdReason: user's explicit instruction for files outside session cwd, except in its own linked worktree or for direct children of the cwd repo root. Result lists leftover files under the committed folder (advisory). Behind-only copies fast-forward/merge before gates; divergence/conflict stops. Never bypass locks/ancestry.",
|
|
402
404
|
parameters: pi.zod.object({
|
|
403
405
|
files: pi.zod.array(pi.zod.string()),
|
|
404
406
|
message: pi.zod.string(),
|
|
@@ -412,10 +414,66 @@ export const finalizeTool = (pi: ToolApi): CustomTool<any, any> => ({
|
|
|
412
414
|
async execute(_toolCallId, params, onUpdate, ctx, signal) {
|
|
413
415
|
let requested: string[] = params.files.map((value: string) => value.trim()).filter(Boolean);
|
|
414
416
|
const message = params.message.trim();
|
|
415
|
-
if (requested.length === 0)
|
|
417
|
+
if (requested.length === 0) {
|
|
418
|
+
throw new Error("git_finalize requires at least one exact file path." + (message ? "" : "\ngit_finalize requires a non-empty commit message."));
|
|
419
|
+
}
|
|
416
420
|
if (!message) throw new Error("git_finalize requires a non-empty commit message.");
|
|
417
421
|
|
|
418
422
|
const exec: Exec = (command, args, options) => pi.exec(command, args, { ...options, signal });
|
|
423
|
+
const prepareFinalizer = async (tempDir: string, files: string[], generatedManifest: boolean) => {
|
|
424
|
+
const requestPath = join(tempDir, "request.json");
|
|
425
|
+
const windows = await windowsDrivePaths(pi.cwd, files, [pi.cwd, scriptPath, requestPath], exec);
|
|
426
|
+
const shell = process.platform === "win32" || windows ? "powershell.exe" : "pwsh";
|
|
427
|
+
const args = ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", windows?.[1] ?? scriptPath, "-Request", windows?.[2] ?? requestPath];
|
|
428
|
+
const options = { cwd: pi.cwd, signal, timeout: 180_000 };
|
|
429
|
+
const outsideCwdReason = params.outsideCwdReason?.trim();
|
|
430
|
+
const request = { cwd: windows?.[0] ?? pi.cwd, files, message, outsideCwdReason, generatedFiles: generatedManifest ? [manifestPath] : undefined };
|
|
431
|
+
return {
|
|
432
|
+
requestPath, request, windows, shell, args, options,
|
|
433
|
+
async checkPaths() {
|
|
434
|
+
await writeFile(requestPath, JSON.stringify(request), "utf8");
|
|
435
|
+
const result = await pi.exec(shell, [...args, "-PreflightOnly"], options);
|
|
436
|
+
const parsed = parseResult(result.stdout);
|
|
437
|
+
if (result.code !== 0 || !parsed?.ok || !parsed.repositoryRoot || !parsed.repositoryFiles?.length) {
|
|
438
|
+
const detail = `git_finalize failed at ${parsed?.stage ?? "preflight"}: ${parsed?.error || result.stderr.trim() || result.stdout.trim() || `exit ${result.code}`}`;
|
|
439
|
+
if (parsed?.ok === false && parsed.stage === "repository") throw new FinalizerPathRefusal(detail);
|
|
440
|
+
throw new Error(detail);
|
|
441
|
+
}
|
|
442
|
+
const root = windows ? windowsPathToPosix(parsed.repositoryRoot) : parsed.repositoryRoot;
|
|
443
|
+
return { root, paths: parsed.repositoryFiles };
|
|
444
|
+
},
|
|
445
|
+
};
|
|
446
|
+
};
|
|
447
|
+
const preconditionError = async (error: unknown, stage?: "cross-review" | "slop-gate", generatedManifest = false) => {
|
|
448
|
+
const primary = (stage ? `git_finalize failed at ${stage}: ` : "") + (error instanceof Error ? error.message : String(error));
|
|
449
|
+
let pathNote = "";
|
|
450
|
+
let dir: string | undefined;
|
|
451
|
+
try {
|
|
452
|
+
// Diagnose paths only on rejection. This stops before fetch, staging, or project commands.
|
|
453
|
+
if (!signal?.aborted) {
|
|
454
|
+
dir = await mkdtemp(join(tmpdir(), "omp-git-finalize-"));
|
|
455
|
+
const prepared = await prepareFinalizer(dir, requested, generatedManifest);
|
|
456
|
+
await prepared.checkPaths();
|
|
457
|
+
}
|
|
458
|
+
} catch (pathError) {
|
|
459
|
+
const detail = pathError instanceof Error ? pathError.message : String(pathError);
|
|
460
|
+
pathNote = pathError instanceof FinalizerPathRefusal
|
|
461
|
+
? `\nExact file-list preflight: ${detail}\nCorrect the reported path or repository issue before retrying.`
|
|
462
|
+
: `\nCould not verify the exact file list: ${detail}\nResolve the preflight error before retrying.`;
|
|
463
|
+
} finally {
|
|
464
|
+
if (dir) {
|
|
465
|
+
await rm(dir, { recursive: true, force: true }).catch((cleanupError: Error) => {
|
|
466
|
+
pathNote += `\nCould not remove the temporary preflight request: ${cleanupError.message}`;
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
const next = [
|
|
471
|
+
!stage && "a current cross_review pass for gated code",
|
|
472
|
+
stage !== "slop-gate" && "a current slop_check pass for gated visible files",
|
|
473
|
+
"passing matching .finalize-checks.json checks (git_finalize runs them after preflight)",
|
|
474
|
+
].filter(Boolean).join("; ");
|
|
475
|
+
return new Error(`${primary}${pathNote}\nAfter fixing the above, this call also requires, where applicable: ${next}.`);
|
|
476
|
+
};
|
|
419
477
|
// 뒤처지기만 한 작업 사본은 원격 커밋을 먼저 받는다(사용자 결정 2026-11-05). 게이트가 받은 뒤의 내용(합친 파일 포함)을 보도록 맨 앞에서 한다.
|
|
420
478
|
let upstreamNote = "";
|
|
421
479
|
const repo = await resolveRepoTargets(pi.cwd, requested, exec).catch(() => undefined);
|
|
@@ -433,7 +491,8 @@ export const finalizeTool = (pi: ToolApi): CustomTool<any, any> => ({
|
|
|
433
491
|
if (reattached.note) upstreamNote = [reattached.note, upstreamNote].filter(Boolean).join(" ");
|
|
434
492
|
}
|
|
435
493
|
// 낡은 매니페스트는 여기서 다시 만들어 요청 파일에 더한다. 게이트 blob 수집(runGate)보다 앞이라 finalizer의 blob 대조와 어긋나지 않는다.
|
|
436
|
-
const regeneratedManifest = await checkSourceManifest(pi.cwd, requested, exec, Boolean(params.outsideCwdReason?.trim()))
|
|
494
|
+
const regeneratedManifest = await checkSourceManifest(pi.cwd, requested, exec, Boolean(params.outsideCwdReason?.trim()))
|
|
495
|
+
.catch(async (error: unknown) => { throw await preconditionError(error); });
|
|
437
496
|
if (regeneratedManifest && !requested.some((file) => resolve(pi.cwd, file) === resolve(pi.cwd, regeneratedManifest.file))) {
|
|
438
497
|
requested = [...requested, regeneratedManifest.file];
|
|
439
498
|
}
|
|
@@ -448,7 +507,7 @@ export const finalizeTool = (pi: ToolApi): CustomTool<any, any> => ({
|
|
|
448
507
|
})).gateBlobs;
|
|
449
508
|
} catch (error) {
|
|
450
509
|
// 게이트가 판정하지 못한 오류(git 실패 등)도 열어 두지 않는다: 확인하지 못한 채 커밋하지 않는다.
|
|
451
|
-
throw
|
|
510
|
+
throw await preconditionError(error, "cross-review", Boolean(regeneratedManifest));
|
|
452
511
|
}
|
|
453
512
|
// AI 슬롭 게이트: 보이는 산출물(문서·html·Office·pdf·보고 csv·UI 문구, .slop-gate.json이 더한 것)은 현재 내용의 slop_check 통과가 있어야 한다.
|
|
454
513
|
// 게이트가 맞춘 바이트의 blob을 gateBlobs에 합쳐, 게이트 뒤에 파일이 바뀌면 finalizer가 잠금 안에서 거절한다.
|
|
@@ -462,7 +521,7 @@ export const finalizeTool = (pi: ToolApi): CustomTool<any, any> => ({
|
|
|
462
521
|
// 원자료 csv로 보고 통과를 요구하지 않은 파일도 결과에 남긴다(조용히 빠지지 않게).
|
|
463
522
|
if (slop.rawData?.length) rawDataNote = `slop-gate가 원자료 csv로 보고 심사를 요구하지 않은 파일: ${slop.rawData.map((file) => `${file.path} (${file.reason})`).join("; ")}.`;
|
|
464
523
|
} catch (error) {
|
|
465
|
-
throw
|
|
524
|
+
throw await preconditionError(error, "slop-gate", Boolean(regeneratedManifest));
|
|
466
525
|
}
|
|
467
526
|
const memory = await exportMemories(pi.cwd, requested, exec);
|
|
468
527
|
const files = memory.file ? [...requested, memory.file] : requested;
|
|
@@ -478,28 +537,13 @@ export const finalizeTool = (pi: ToolApi): CustomTool<any, any> => ({
|
|
|
478
537
|
}
|
|
479
538
|
|
|
480
539
|
const tempDir = await mkdtemp(join(tmpdir(), "omp-git-finalize-"));
|
|
481
|
-
const requestPath = join(tempDir, "request.json");
|
|
482
540
|
try {
|
|
483
|
-
const
|
|
484
|
-
const
|
|
485
|
-
const args = ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", windows?.[1] ?? scriptPath, "-Request", windows?.[2] ?? requestPath];
|
|
486
|
-
const options = { cwd: pi.cwd, signal, timeout: 180_000 };
|
|
487
|
-
const outsideCwdReason = params.outsideCwdReason?.trim();
|
|
488
|
-
const request = { cwd: windows?.[0] ?? pi.cwd, files, message, outsideCwdReason, generatedFiles: regeneratedManifest ? [manifestPath] : undefined };
|
|
541
|
+
const prepared = await prepareFinalizer(tempDir, files, Boolean(regeneratedManifest));
|
|
542
|
+
const { requestPath, request, windows, shell, args, options } = prepared;
|
|
489
543
|
let finalizeChecks: FinalizeChecksResult | undefined;
|
|
490
544
|
const run = spawnExec(signal);
|
|
491
545
|
let pathPreflight: { root: string; paths: string[] } | undefined;
|
|
492
|
-
const verifyPaths = async () =>
|
|
493
|
-
if (pathPreflight) return pathPreflight;
|
|
494
|
-
await writeFile(requestPath, JSON.stringify(request), "utf8");
|
|
495
|
-
const result = await pi.exec(shell, [...args, "-PreflightOnly"], options);
|
|
496
|
-
const parsed = parseResult(result.stdout);
|
|
497
|
-
if (result.code !== 0 || !parsed?.ok || !parsed.repositoryRoot || !parsed.repositoryFiles?.length) {
|
|
498
|
-
throw new Error(`git_finalize failed at ${parsed?.stage ?? "preflight"}: ${parsed?.error || result.stderr.trim() || result.stdout.trim() || `exit ${result.code}`}`);
|
|
499
|
-
}
|
|
500
|
-
const root = windows ? windowsPathToPosix(parsed.repositoryRoot) : parsed.repositoryRoot;
|
|
501
|
-
return pathPreflight = { root, paths: parsed.repositoryFiles };
|
|
502
|
-
};
|
|
546
|
+
const verifyPaths = async () => pathPreflight ??= await prepared.checkPaths();
|
|
503
547
|
const portableFiles = files.map((file) => file.replaceAll("\\", "/"));
|
|
504
548
|
const targets = repo && !("failure" in repo) && files.length === repo.targets.length && portableFiles.every((file, index) => file === repo.targets[index].input)
|
|
505
549
|
? repo : await resolveRepoTargets(pi.cwd, portableFiles, run);
|
package/bin/ci-local.mjs
CHANGED
|
@@ -181,8 +181,7 @@ async function runExtensions(env, signal) {
|
|
|
181
181
|
"./agent/tools/git-finalizer", "./agent/tools/windows-control", "./agent/tools/artifact-search",
|
|
182
182
|
"./agent/tools/vm-build", "./agent/tools/ego-browser", "./agent/tools/deploy-verify",
|
|
183
183
|
"./agent/tools/windows-build", "./agent/cuelo-plugins/scratch-dependency-hint", "./skill-cost"], harness, env, signal);
|
|
184
|
-
await run([process.execPath, "--test", "agent/
|
|
185
|
-
"agent/skills/kill-ai-slop/scripts/scan.test.mjs"], harness, env, signal);
|
|
184
|
+
await run([process.execPath, "--test", "agent/skills/kill-ai-slop/scripts/scan.test.mjs"], harness, env, signal);
|
|
186
185
|
}
|
|
187
186
|
|
|
188
187
|
async function coreTest(file, log, env, signal) {
|
package/package.json
CHANGED