tamperward 2.23.11 → 2.23.12
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/cli/index.js +126 -59
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1026,7 +1026,7 @@ var init_trusted = __esm({
|
|
|
1026
1026
|
|
|
1027
1027
|
// src/repo-context.ts
|
|
1028
1028
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
1029
|
-
import { existsSync as existsSync2 } from "node:fs";
|
|
1029
|
+
import { accessSync, constants as constants2, existsSync as existsSync2, statSync } from "node:fs";
|
|
1030
1030
|
import { isAbsolute as isAbsolute3, resolve } from "node:path";
|
|
1031
1031
|
function rev(cwd, flag) {
|
|
1032
1032
|
try {
|
|
@@ -1059,6 +1059,47 @@ function repoContext(cwd) {
|
|
|
1059
1059
|
function repoRoot(cwd) {
|
|
1060
1060
|
return repoContext(cwd)?.root ?? cwd;
|
|
1061
1061
|
}
|
|
1062
|
+
function outsideRepository(cwd) {
|
|
1063
|
+
const key2 = resolve(cwd);
|
|
1064
|
+
let isDir;
|
|
1065
|
+
try {
|
|
1066
|
+
isDir = statSync(key2).isDirectory();
|
|
1067
|
+
} catch (e) {
|
|
1068
|
+
return `cwd ${key2} cannot be read: ${errCode2(e)}`;
|
|
1069
|
+
}
|
|
1070
|
+
if (!isDir) return `cwd ${key2} is not a directory`;
|
|
1071
|
+
try {
|
|
1072
|
+
accessSync(key2, constants2.R_OK | constants2.X_OK);
|
|
1073
|
+
} catch (e) {
|
|
1074
|
+
return `cwd ${key2} cannot be read: ${errCode2(e)}`;
|
|
1075
|
+
}
|
|
1076
|
+
try {
|
|
1077
|
+
execFileSync2("git", ["rev-parse", "--git-dir"], {
|
|
1078
|
+
cwd: key2,
|
|
1079
|
+
encoding: "utf8",
|
|
1080
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
1081
|
+
});
|
|
1082
|
+
} catch (e) {
|
|
1083
|
+
const detail = errDetail(e);
|
|
1084
|
+
if (/not a git repository/i.test(detail)) return null;
|
|
1085
|
+
return `git could not resolve cwd ${key2}: ${detail || "unknown failure"}`;
|
|
1086
|
+
}
|
|
1087
|
+
return `cwd ${key2} lies in a repository with no working tree the gate can judge`;
|
|
1088
|
+
}
|
|
1089
|
+
function errCode2(e) {
|
|
1090
|
+
if (typeof e === "object" && e !== null) {
|
|
1091
|
+
const code2 = Reflect.get(e, "code");
|
|
1092
|
+
if (typeof code2 === "string") return code2;
|
|
1093
|
+
}
|
|
1094
|
+
return e instanceof Error ? e.message : String(e);
|
|
1095
|
+
}
|
|
1096
|
+
function errDetail(e) {
|
|
1097
|
+
if (typeof e === "object" && e !== null) {
|
|
1098
|
+
const stderr = Reflect.get(e, "stderr");
|
|
1099
|
+
if (typeof stderr === "string" && stderr.trim()) return stderr.replace(/\s+/g, " ").trim();
|
|
1100
|
+
}
|
|
1101
|
+
return errCode2(e);
|
|
1102
|
+
}
|
|
1062
1103
|
var cache, CACHE_MAX;
|
|
1063
1104
|
var init_repo_context = __esm({
|
|
1064
1105
|
"src/repo-context.ts"() {
|
|
@@ -9116,8 +9157,22 @@ var init_deny = __esm({
|
|
|
9116
9157
|
});
|
|
9117
9158
|
|
|
9118
9159
|
// src/session.ts
|
|
9119
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync7, writeFileSync as writeFileSync2 } from "node:fs";
|
|
9160
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync7, renameSync, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
9120
9161
|
import { dirname as dirname3, join as join10 } from "node:path";
|
|
9162
|
+
function writeBaseline(p, sha3) {
|
|
9163
|
+
mkdirSync2(dirname3(p), { recursive: true });
|
|
9164
|
+
const tmp = `${p}.${process.pid}.tmp`;
|
|
9165
|
+
try {
|
|
9166
|
+
writeFileSync2(tmp, sha3);
|
|
9167
|
+
renameSync(tmp, p);
|
|
9168
|
+
} catch (e) {
|
|
9169
|
+
try {
|
|
9170
|
+
rmSync2(tmp, { force: true });
|
|
9171
|
+
} catch {
|
|
9172
|
+
}
|
|
9173
|
+
throw e;
|
|
9174
|
+
}
|
|
9175
|
+
}
|
|
9121
9176
|
function baselinePath(cwd, sessionId) {
|
|
9122
9177
|
const gd = gitDir(cwd);
|
|
9123
9178
|
if (!gd) return null;
|
|
@@ -9125,21 +9180,23 @@ function baselinePath(cwd, sessionId) {
|
|
|
9125
9180
|
}
|
|
9126
9181
|
function turnBaseline(cwd, sessionId) {
|
|
9127
9182
|
if (!sessionId) return null;
|
|
9183
|
+
const p = baselinePath(cwd, sessionId);
|
|
9184
|
+
if (!p) return null;
|
|
9128
9185
|
try {
|
|
9129
|
-
const p = baselinePath(cwd, sessionId);
|
|
9130
|
-
if (!p) return null;
|
|
9131
9186
|
if (existsSync7(p)) {
|
|
9132
9187
|
const v = readFileSync7(p, "utf8").trim();
|
|
9133
9188
|
if (SHA.test(v)) return v;
|
|
9134
9189
|
}
|
|
9135
|
-
const head = headSha(cwd);
|
|
9136
|
-
if (!head) return null;
|
|
9137
|
-
mkdirSync2(dirname3(p), { recursive: true });
|
|
9138
|
-
writeFileSync2(p, head);
|
|
9139
|
-
return head;
|
|
9140
9190
|
} catch {
|
|
9141
|
-
return null;
|
|
9142
9191
|
}
|
|
9192
|
+
const head = headSha(cwd);
|
|
9193
|
+
if (!head) return null;
|
|
9194
|
+
try {
|
|
9195
|
+
writeBaseline(p, head);
|
|
9196
|
+
} catch (e) {
|
|
9197
|
+
throw new BaselineWriteError(p, e);
|
|
9198
|
+
}
|
|
9199
|
+
return head;
|
|
9143
9200
|
}
|
|
9144
9201
|
function advanceTurnBaseline(cwd, sessionId) {
|
|
9145
9202
|
if (!sessionId) return;
|
|
@@ -9147,24 +9204,30 @@ function advanceTurnBaseline(cwd, sessionId) {
|
|
|
9147
9204
|
const p = baselinePath(cwd, sessionId);
|
|
9148
9205
|
const head = headSha(cwd);
|
|
9149
9206
|
if (!p || !head) return;
|
|
9150
|
-
|
|
9151
|
-
writeFileSync2(p, head);
|
|
9207
|
+
writeBaseline(p, head);
|
|
9152
9208
|
} catch {
|
|
9153
9209
|
}
|
|
9154
9210
|
}
|
|
9155
|
-
var UNSAFE, SHA;
|
|
9211
|
+
var UNSAFE, SHA, BaselineWriteError;
|
|
9156
9212
|
var init_session = __esm({
|
|
9157
9213
|
"src/session.ts"() {
|
|
9158
9214
|
"use strict";
|
|
9159
9215
|
init_build();
|
|
9160
9216
|
UNSAFE = /[^A-Za-z0-9_-]/g;
|
|
9161
|
-
SHA = /^[0-9a-f]{
|
|
9217
|
+
SHA = /^[0-9a-f]{40}$/;
|
|
9218
|
+
BaselineWriteError = class extends Error {
|
|
9219
|
+
constructor(path, cause) {
|
|
9220
|
+
const detail = cause instanceof Error ? cause.message : String(cause);
|
|
9221
|
+
super(`turn baseline could not be recorded at ${path}: ${detail}`);
|
|
9222
|
+
this.name = "BaselineWriteError";
|
|
9223
|
+
}
|
|
9224
|
+
};
|
|
9162
9225
|
}
|
|
9163
9226
|
});
|
|
9164
9227
|
|
|
9165
9228
|
// src/effect.ts
|
|
9166
9229
|
import { createHash as createHash3 } from "node:crypto";
|
|
9167
|
-
import { existsSync as existsSync8, lstatSync as lstatSync3, mkdirSync as mkdirSync3, readdirSync, readFileSync as readFileSync8, renameSync, rmSync as
|
|
9230
|
+
import { existsSync as existsSync8, lstatSync as lstatSync3, mkdirSync as mkdirSync3, readdirSync, readFileSync as readFileSync8, renameSync as renameSync2, rmSync as rmSync3, writeFileSync as writeFileSync3 } from "node:fs";
|
|
9168
9231
|
import { join as join11 } from "node:path";
|
|
9169
9232
|
function ptreeFrom(value) {
|
|
9170
9233
|
if (!isRecord(value)) return null;
|
|
@@ -9269,14 +9332,14 @@ function saveTree(p, tree) {
|
|
|
9269
9332
|
mkdirSync3(join11(p, ".."), { recursive: true });
|
|
9270
9333
|
const tmp = `${p}.${process.pid}.tmp`;
|
|
9271
9334
|
writeFileSync3(tmp, JSON.stringify(tree));
|
|
9272
|
-
|
|
9335
|
+
renameSync2(tmp, p);
|
|
9273
9336
|
} catch {
|
|
9274
9337
|
}
|
|
9275
9338
|
}
|
|
9276
9339
|
function dropTree(p) {
|
|
9277
9340
|
if (!p) return;
|
|
9278
9341
|
try {
|
|
9279
|
-
|
|
9342
|
+
rmSync3(p, { force: true });
|
|
9280
9343
|
} catch {
|
|
9281
9344
|
}
|
|
9282
9345
|
}
|
|
@@ -9575,7 +9638,7 @@ var init_watch = __esm({
|
|
|
9575
9638
|
});
|
|
9576
9639
|
|
|
9577
9640
|
// src/detectors/fs-events.ts
|
|
9578
|
-
import { closeSync as closeSync2, openSync as openSync2, readSync as readSync2, statSync } from "node:fs";
|
|
9641
|
+
import { closeSync as closeSync2, openSync as openSync2, readSync as readSync2, statSync as statSync2 } from "node:fs";
|
|
9579
9642
|
function fsEventFrom(line) {
|
|
9580
9643
|
let value;
|
|
9581
9644
|
try {
|
|
@@ -9595,7 +9658,7 @@ function fsEventFrom(line) {
|
|
|
9595
9658
|
function readEvents(log, offset, maxBytes = MAX_EVENT_READ_BYTES, io = DEFAULT_EVENT_READ_IO) {
|
|
9596
9659
|
let size = 0;
|
|
9597
9660
|
try {
|
|
9598
|
-
size =
|
|
9661
|
+
size = statSync2(log).size;
|
|
9599
9662
|
} catch {
|
|
9600
9663
|
return {
|
|
9601
9664
|
events: [],
|
|
@@ -10186,8 +10249,12 @@ function recordObserverHealth(state, reason) {
|
|
|
10186
10249
|
function stopVerdict(input, defaultCwd) {
|
|
10187
10250
|
if (input.stop_hook_active) return { exitCode: 0, stdout: "" };
|
|
10188
10251
|
const sessionCwd = input.cwd ?? defaultCwd ?? process.cwd();
|
|
10189
|
-
|
|
10190
|
-
|
|
10252
|
+
const ctx = repoContext(sessionCwd);
|
|
10253
|
+
if (!ctx) {
|
|
10254
|
+
const why = outsideRepository(sessionCwd);
|
|
10255
|
+
return why ? failClosed("Stop", why) : { exitCode: 0, stdout: "" };
|
|
10256
|
+
}
|
|
10257
|
+
const cwd = ctx.root;
|
|
10191
10258
|
let blocks2;
|
|
10192
10259
|
let commitCursor = () => {
|
|
10193
10260
|
};
|
|
@@ -10377,7 +10444,7 @@ var init_ptree_cache = __esm({
|
|
|
10377
10444
|
});
|
|
10378
10445
|
|
|
10379
10446
|
// src/cli/hook-service.ts
|
|
10380
|
-
import { chmodSync, existsSync as existsSync10, lstatSync as lstatSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync11, rmSync as
|
|
10447
|
+
import { chmodSync, existsSync as existsSync10, lstatSync as lstatSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync11, rmSync as rmSync4, writeFileSync as writeFileSync6 } from "node:fs";
|
|
10381
10448
|
import { createConnection as createConnection2, createServer } from "node:net";
|
|
10382
10449
|
import { realpathSync as realpathSync3 } from "node:fs";
|
|
10383
10450
|
import { sep } from "node:path";
|
|
@@ -10460,7 +10527,7 @@ function withEnv(env, fn) {
|
|
|
10460
10527
|
}
|
|
10461
10528
|
function removeQuietly(p) {
|
|
10462
10529
|
try {
|
|
10463
|
-
|
|
10530
|
+
rmSync4(p, { force: true });
|
|
10464
10531
|
} catch {
|
|
10465
10532
|
}
|
|
10466
10533
|
}
|
|
@@ -10802,7 +10869,7 @@ var init_verifier_limits = __esm({
|
|
|
10802
10869
|
// src/cli/init.ts
|
|
10803
10870
|
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
10804
10871
|
import { createHash as createHash6 } from "node:crypto";
|
|
10805
|
-
import { existsSync as existsSync11, lstatSync as lstatSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync12, realpathSync as realpathSync4, writeFileSync as writeFileSync7, chmodSync as chmodSync2, statSync as
|
|
10872
|
+
import { existsSync as existsSync11, lstatSync as lstatSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync12, realpathSync as realpathSync4, writeFileSync as writeFileSync7, chmodSync as chmodSync2, statSync as statSync3 } from "node:fs";
|
|
10806
10873
|
import { basename as basename2, dirname as dirname4, isAbsolute as isAbsolute8, join as join14, relative as relative3, resolve as resolve4 } from "node:path";
|
|
10807
10874
|
function gitConfig(cwd, key2) {
|
|
10808
10875
|
try {
|
|
@@ -11165,7 +11232,7 @@ function planPreCommit(cwd) {
|
|
|
11165
11232
|
}
|
|
11166
11233
|
}
|
|
11167
11234
|
const rel = display(cwd, path);
|
|
11168
|
-
if (existsSync11(path) && !
|
|
11235
|
+
if (existsSync11(path) && !statSync3(path).isFile()) {
|
|
11169
11236
|
return { item: "pre-commit", path: rel, status: "error", detail: "exists but is not a regular file \u2014 refusing to write" };
|
|
11170
11237
|
}
|
|
11171
11238
|
const existing = existsSync11(path) ? readFileSync12(path, "utf8") : null;
|
|
@@ -11607,7 +11674,7 @@ import {
|
|
|
11607
11674
|
readFileSync as readFileSync13,
|
|
11608
11675
|
readlinkSync as readlinkSync2,
|
|
11609
11676
|
realpathSync as realpathSync5,
|
|
11610
|
-
statSync as
|
|
11677
|
+
statSync as statSync4
|
|
11611
11678
|
} from "node:fs";
|
|
11612
11679
|
import {
|
|
11613
11680
|
basename as basename3,
|
|
@@ -11649,7 +11716,7 @@ function fingerprintRoot(root, cwd, h) {
|
|
|
11649
11716
|
root.kind + " root moved from " + JSON.stringify(root.realPath) + " to " + JSON.stringify(currentReal)
|
|
11650
11717
|
);
|
|
11651
11718
|
}
|
|
11652
|
-
if (!
|
|
11719
|
+
if (!statSync4(root.path).isDirectory()) {
|
|
11653
11720
|
throw new Unattestable(root.kind + " root " + JSON.stringify(root.path) + " is not a directory");
|
|
11654
11721
|
}
|
|
11655
11722
|
h.update("root\0" + root.kind + "\0" + root.path + "\0" + root.realPath + "\0" + String(rootStat.mode) + "\0");
|
|
@@ -11659,7 +11726,7 @@ function fingerprintRoot(root, cwd, h) {
|
|
|
11659
11726
|
const hashFile = (path, label) => {
|
|
11660
11727
|
let st;
|
|
11661
11728
|
try {
|
|
11662
|
-
st =
|
|
11729
|
+
st = statSync4(path);
|
|
11663
11730
|
if (!st.isFile()) throw new Error("not a regular file");
|
|
11664
11731
|
h.update(label + "\0external-file\0" + path + "\0" + String(st.mode) + "\0");
|
|
11665
11732
|
h.update(readFileSync13(path));
|
|
@@ -11725,7 +11792,7 @@ function fingerprintRoot(root, cwd, h) {
|
|
|
11725
11792
|
} catch {
|
|
11726
11793
|
continue;
|
|
11727
11794
|
}
|
|
11728
|
-
const followed =
|
|
11795
|
+
const followed = statSync4(path);
|
|
11729
11796
|
if (followed.isFile()) {
|
|
11730
11797
|
hashFile(resolved, "@target:" + rel);
|
|
11731
11798
|
continue;
|
|
@@ -11773,7 +11840,7 @@ function measuredSnapshot(roots, probes, cwd, metrics) {
|
|
|
11773
11840
|
}
|
|
11774
11841
|
function freezeRoot(kind, path) {
|
|
11775
11842
|
try {
|
|
11776
|
-
if (!
|
|
11843
|
+
if (!statSync4(path).isDirectory()) {
|
|
11777
11844
|
throw new Error("not a directory");
|
|
11778
11845
|
}
|
|
11779
11846
|
return { kind, path: resolve5(path), realPath: realpathSync5(path) };
|
|
@@ -11822,7 +11889,7 @@ function resolveExecutable(token, cwd, env) {
|
|
|
11822
11889
|
for (const entry of (env.PATH ?? "").split(delimiter).filter(Boolean)) {
|
|
11823
11890
|
const candidate = resolve5(entry, token);
|
|
11824
11891
|
try {
|
|
11825
|
-
if (existsSync12(candidate) &&
|
|
11892
|
+
if (existsSync12(candidate) && statSync4(candidate).isFile()) return realpathSync5(candidate);
|
|
11826
11893
|
} catch {
|
|
11827
11894
|
}
|
|
11828
11895
|
}
|
|
@@ -12009,7 +12076,7 @@ var init_dependency_env = __esm({
|
|
|
12009
12076
|
|
|
12010
12077
|
// src/suite-diagnostics.ts
|
|
12011
12078
|
import { spawnSync } from "node:child_process";
|
|
12012
|
-
import { mkdtempSync as mkdtempSync2, rmSync as
|
|
12079
|
+
import { mkdtempSync as mkdtempSync2, rmSync as rmSync5, writeFileSync as writeFileSync8 } from "node:fs";
|
|
12013
12080
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
12014
12081
|
import { join as join16 } from "node:path";
|
|
12015
12082
|
function emptySuiteDiagnostics() {
|
|
@@ -12138,7 +12205,7 @@ function runCapturedProcessSync(executable, args, opts) {
|
|
|
12138
12205
|
}
|
|
12139
12206
|
return parsed;
|
|
12140
12207
|
} finally {
|
|
12141
|
-
|
|
12208
|
+
rmSync5(stateDir, { recursive: true, force: true });
|
|
12142
12209
|
}
|
|
12143
12210
|
}
|
|
12144
12211
|
var DIAGNOSTIC_TAIL_BYTES, EMPTY_STREAM, CAPTURE_SUPERVISOR;
|
|
@@ -12328,7 +12395,7 @@ if (child) {
|
|
|
12328
12395
|
// src/verifier-backend.ts
|
|
12329
12396
|
import { createHash as createHash9, randomUUID } from "node:crypto";
|
|
12330
12397
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
12331
|
-
import { accessSync, constants as
|
|
12398
|
+
import { accessSync as accessSync2, constants as constants3, readFileSync as readFileSync15, realpathSync as realpathSync6, statSync as statSync5 } from "node:fs";
|
|
12332
12399
|
import { delimiter as delimiter2, dirname as dirname6, join as join17, resolve as resolve6 } from "node:path";
|
|
12333
12400
|
function identity() {
|
|
12334
12401
|
const uid = typeof process.getuid === "function" ? process.getuid() : null;
|
|
@@ -12337,7 +12404,7 @@ function identity() {
|
|
|
12337
12404
|
}
|
|
12338
12405
|
function writableByCaller(path) {
|
|
12339
12406
|
try {
|
|
12340
|
-
const st =
|
|
12407
|
+
const st = statSync5(path);
|
|
12341
12408
|
const { uid, groups } = identity();
|
|
12342
12409
|
if (uid === 0) return true;
|
|
12343
12410
|
if ((st.mode & 2) !== 0) return true;
|
|
@@ -12365,7 +12432,7 @@ function findExecutable(name) {
|
|
|
12365
12432
|
if (!raw) continue;
|
|
12366
12433
|
const candidate = join17(raw, name);
|
|
12367
12434
|
try {
|
|
12368
|
-
|
|
12435
|
+
accessSync2(candidate, constants3.X_OK);
|
|
12369
12436
|
return realpathSync6(candidate);
|
|
12370
12437
|
} catch {
|
|
12371
12438
|
}
|
|
@@ -12807,7 +12874,7 @@ var init_verifier_backend = __esm({
|
|
|
12807
12874
|
// src/cli/verify.ts
|
|
12808
12875
|
import { execFileSync as execFileSync8, spawnSync as spawnSync3 } from "node:child_process";
|
|
12809
12876
|
import { createHash as createHash10 } from "node:crypto";
|
|
12810
|
-
import { chmodSync as chmodSync3, cpSync, lstatSync as lstatSync9, mkdirSync as mkdirSync7, mkdtempSync as mkdtempSync3, readFileSync as readFileSync16, readlinkSync as readlinkSync3, rmSync as
|
|
12877
|
+
import { chmodSync as chmodSync3, cpSync, lstatSync as lstatSync9, mkdirSync as mkdirSync7, mkdtempSync as mkdtempSync3, readFileSync as readFileSync16, readlinkSync as readlinkSync3, rmSync as rmSync6, symlinkSync, writeFileSync as writeFileSync9, existsSync as existsSync13 } from "node:fs";
|
|
12811
12878
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
12812
12879
|
import { dirname as dirname7, isAbsolute as isAbsolute10, join as join18, relative as relative5, resolve as resolve7, sep as sep3 } from "node:path";
|
|
12813
12880
|
function oracleAssuranceReport() {
|
|
@@ -12855,7 +12922,7 @@ function safeSymlink(target, out3, root, label) {
|
|
|
12855
12922
|
if (rootedLinkTarget(target) || !inside2(root, resolve7(dirname7(out3), target))) {
|
|
12856
12923
|
throw linkEscape(label, target);
|
|
12857
12924
|
}
|
|
12858
|
-
|
|
12925
|
+
rmSync6(out3, { force: true });
|
|
12859
12926
|
symlinkSync(target, out3);
|
|
12860
12927
|
}
|
|
12861
12928
|
function validateSymlinkGraph(target, out3, root, dependencyRoot, label) {
|
|
@@ -12966,7 +13033,7 @@ function probeFilesystemCaseSensitivity(dir) {
|
|
|
12966
13033
|
writeFileSync9(upper, "", { flag: "wx" });
|
|
12967
13034
|
return !existsSync13(lower);
|
|
12968
13035
|
} finally {
|
|
12969
|
-
|
|
13036
|
+
rmSync6(upper, { force: true });
|
|
12970
13037
|
}
|
|
12971
13038
|
}
|
|
12972
13039
|
function foldCase(p) {
|
|
@@ -12984,7 +13051,7 @@ function caseFoldCollision(paths) {
|
|
|
12984
13051
|
}
|
|
12985
13052
|
function dropSymlink(p) {
|
|
12986
13053
|
try {
|
|
12987
|
-
if (lstatSync9(p).isSymbolicLink())
|
|
13054
|
+
if (lstatSync9(p).isSymbolicLink()) rmSync6(p, { force: true });
|
|
12988
13055
|
} catch {
|
|
12989
13056
|
}
|
|
12990
13057
|
}
|
|
@@ -13060,7 +13127,7 @@ function overlayPristine(cwd, base, dest, policy, cmd, dependencyRoot, caseSensi
|
|
|
13060
13127
|
const content = execFileSync8("git", ["show", `${base}:${e.path}`], { cwd, maxBuffer: 1 << 28, env: trustedGitEnv() });
|
|
13061
13128
|
const out3 = join18(dest, e.path);
|
|
13062
13129
|
mkdirSync7(dirname7(out3), { recursive: true });
|
|
13063
|
-
|
|
13130
|
+
rmSync6(out3, { force: true });
|
|
13064
13131
|
if (e.mode === "120000") {
|
|
13065
13132
|
const target = content.toString("utf8");
|
|
13066
13133
|
safeSymlink(target, out3, dest, `the base's ${e.path}`);
|
|
@@ -13075,7 +13142,7 @@ function overlayPristine(cwd, base, dest, policy, cmd, dependencyRoot, caseSensi
|
|
|
13075
13142
|
const inCopy = workingTreePaths(cwd);
|
|
13076
13143
|
for (const rel of inCopy) {
|
|
13077
13144
|
if (!isOverlay(rel) || baseProtected.has(fold(rel))) continue;
|
|
13078
|
-
|
|
13145
|
+
rmSync6(join18(dest, rel), { force: true });
|
|
13079
13146
|
removed++;
|
|
13080
13147
|
}
|
|
13081
13148
|
for (const link of restoredLinks) {
|
|
@@ -13162,7 +13229,7 @@ function runLocalSuite(dir, cmd, budgetSecs) {
|
|
|
13162
13229
|
}
|
|
13163
13230
|
return { exit: r.exit, secs, diagnostics: r.diagnostics };
|
|
13164
13231
|
} finally {
|
|
13165
|
-
|
|
13232
|
+
rmSync6(scratch, { recursive: true, force: true });
|
|
13166
13233
|
}
|
|
13167
13234
|
}
|
|
13168
13235
|
function diagnosticsJson(diagnostics, includeTail) {
|
|
@@ -13315,7 +13382,7 @@ function runVerify(opts) {
|
|
|
13315
13382
|
const visDir = join18(visRoot, "t");
|
|
13316
13383
|
const cleanup = (dirs) => {
|
|
13317
13384
|
if (opts.keep) return;
|
|
13318
|
-
for (const d of dirs)
|
|
13385
|
+
for (const d of dirs) rmSync6(d, { recursive: true, force: true });
|
|
13319
13386
|
};
|
|
13320
13387
|
filesystemCaseSensitive = (opts.probeCaseSensitivity ?? probeFilesystemCaseSensitivity)(visRoot);
|
|
13321
13388
|
if (!filesystemCaseSensitive) {
|
|
@@ -13682,7 +13749,7 @@ var init_verify = __esm({
|
|
|
13682
13749
|
// src/cli/run.ts
|
|
13683
13750
|
import { execFileSync as execFileSync9, spawn, spawnSync as spawnSync4 } from "node:child_process";
|
|
13684
13751
|
import { randomBytes } from "node:crypto";
|
|
13685
|
-
import { accessSync as
|
|
13752
|
+
import { accessSync as accessSync3, constants as fsConstants, mkdtempSync as mkdtempSync4, readdirSync as readdirSync4, readFileSync as readFileSync17, readlinkSync as readlinkSync4, realpathSync as realpathSync8, rmSync as rmSync7, statSync as statSync6, writeFileSync as writeFileSync10 } from "node:fs";
|
|
13686
13753
|
import { tmpdir as tmpdir5 } from "node:os";
|
|
13687
13754
|
import { dirname as dirname8, join as join19, resolve as resolve8 } from "node:path";
|
|
13688
13755
|
function authoritativeRunLifecyclePlatform(platform = process.platform) {
|
|
@@ -13717,7 +13784,7 @@ function writableByCaller2(path) {
|
|
|
13717
13784
|
let cur = path;
|
|
13718
13785
|
for (; ; ) {
|
|
13719
13786
|
try {
|
|
13720
|
-
|
|
13787
|
+
accessSync3(cur, fsConstants.W_OK);
|
|
13721
13788
|
return true;
|
|
13722
13789
|
} catch {
|
|
13723
13790
|
}
|
|
@@ -13738,7 +13805,7 @@ function trustedLinuxPython(candidates = DEFAULT_TRUSTED_PYTHON_CANDIDATES) {
|
|
|
13738
13805
|
for (const candidate of candidates) {
|
|
13739
13806
|
try {
|
|
13740
13807
|
const real = realpathSync8(candidate);
|
|
13741
|
-
const st =
|
|
13808
|
+
const st = statSync6(real);
|
|
13742
13809
|
if (!st.isFile() || writableByCaller2(real)) continue;
|
|
13743
13810
|
const probe = spawnSync4(
|
|
13744
13811
|
real,
|
|
@@ -13861,7 +13928,7 @@ function runAgentSupervised(argv, cwd, budgetSecs, linuxPythonCandidates, lifecy
|
|
|
13861
13928
|
...state.failure ? { failure: state.failure } : {}
|
|
13862
13929
|
};
|
|
13863
13930
|
} finally {
|
|
13864
|
-
|
|
13931
|
+
rmSync7(stateDir, { recursive: true, force: true });
|
|
13865
13932
|
}
|
|
13866
13933
|
}
|
|
13867
13934
|
function waitMs(ms) {
|
|
@@ -15234,7 +15301,7 @@ import {
|
|
|
15234
15301
|
readFileSync as readFileSync19,
|
|
15235
15302
|
readdirSync as readdirSync6,
|
|
15236
15303
|
realpathSync as realpathSync9,
|
|
15237
|
-
rmSync as
|
|
15304
|
+
rmSync as rmSync8,
|
|
15238
15305
|
symlinkSync as symlinkSync2
|
|
15239
15306
|
} from "node:fs";
|
|
15240
15307
|
import { tmpdir as tmpdir6 } from "node:os";
|
|
@@ -15432,8 +15499,8 @@ function runOneTrace(cwd, base, command, budget) {
|
|
|
15432
15499
|
accesses: rewriteTraceRoot(accesses, root)
|
|
15433
15500
|
};
|
|
15434
15501
|
} finally {
|
|
15435
|
-
|
|
15436
|
-
|
|
15502
|
+
rmSync8(root, { recursive: true, force: true });
|
|
15503
|
+
rmSync8(traceDir, { recursive: true, force: true });
|
|
15437
15504
|
}
|
|
15438
15505
|
}
|
|
15439
15506
|
function renderText2(report2) {
|
|
@@ -15618,7 +15685,7 @@ var init_trace_verify = __esm({
|
|
|
15618
15685
|
// src/cli/onboard.ts
|
|
15619
15686
|
import { execFileSync as execFileSync12 } from "node:child_process";
|
|
15620
15687
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
15621
|
-
import { lstatSync as lstatSync10, mkdtempSync as mkdtempSync6, readFileSync as readFileSync20, realpathSync as realpathSync10, renameSync as
|
|
15688
|
+
import { lstatSync as lstatSync10, mkdtempSync as mkdtempSync6, readFileSync as readFileSync20, realpathSync as realpathSync10, renameSync as renameSync3, rmSync as rmSync9, writeFileSync as writeFileSync11 } from "node:fs";
|
|
15622
15689
|
import { tmpdir as tmpdir7 } from "node:os";
|
|
15623
15690
|
import { join as join22, relative as relative7, resolve as resolve11, sep as sep5 } from "node:path";
|
|
15624
15691
|
import { createInterface } from "node:readline";
|
|
@@ -15691,9 +15758,9 @@ function atomicReplaceFile(path, content, mode) {
|
|
|
15691
15758
|
const tmp = `${path}.${process.pid}.${randomBytes2(8).toString("hex")}.tmp`;
|
|
15692
15759
|
try {
|
|
15693
15760
|
writeFileSync11(tmp, content, { encoding: "utf8", flag: "wx", mode });
|
|
15694
|
-
|
|
15761
|
+
renameSync3(tmp, path);
|
|
15695
15762
|
} finally {
|
|
15696
|
-
|
|
15763
|
+
rmSync9(tmp, { force: true });
|
|
15697
15764
|
}
|
|
15698
15765
|
}
|
|
15699
15766
|
function writeVerifyCommand(cwd, command) {
|
|
@@ -15720,7 +15787,7 @@ function writeVerifyCommand(cwd, command) {
|
|
|
15720
15787
|
if (loaded2.verify?.command !== command) throw new Error("verify.command did not round-trip");
|
|
15721
15788
|
return null;
|
|
15722
15789
|
} catch (e) {
|
|
15723
|
-
if (original === null)
|
|
15790
|
+
if (original === null) rmSync9(path, { force: true });
|
|
15724
15791
|
else atomicReplaceFile(path, original, mode);
|
|
15725
15792
|
return `the updated ${POLICY_FILE} does not load (${errorMessage(e)}); restored the previous file`;
|
|
15726
15793
|
}
|
|
@@ -16120,7 +16187,7 @@ function runDemo(cwd, head, runners, out3) {
|
|
|
16120
16187
|
} finally {
|
|
16121
16188
|
git5(cwd, ["worktree", "remove", "--force", wt]);
|
|
16122
16189
|
git5(cwd, ["worktree", "prune"]);
|
|
16123
|
-
|
|
16190
|
+
rmSync9(wt, { recursive: true, force: true });
|
|
16124
16191
|
}
|
|
16125
16192
|
const after = treeFingerprint(cwd);
|
|
16126
16193
|
out3(`working tree fingerprint after: ${after.slice(0, 16)}`);
|
|
@@ -16535,7 +16602,7 @@ var init_record = __esm({
|
|
|
16535
16602
|
|
|
16536
16603
|
// src/research/run.ts
|
|
16537
16604
|
import { execFileSync as execFileSync13 } from "node:child_process";
|
|
16538
|
-
import { existsSync as existsSync16, mkdirSync as mkdirSync8, readFileSync as readFileSync22, renameSync as
|
|
16605
|
+
import { existsSync as existsSync16, mkdirSync as mkdirSync8, readFileSync as readFileSync22, renameSync as renameSync4, rmSync as rmSync10, writeFileSync as writeFileSync12 } from "node:fs";
|
|
16539
16606
|
import { join as join23, resolve as resolve14 } from "node:path";
|
|
16540
16607
|
function git6(args, cwd) {
|
|
16541
16608
|
return execFileSync13("git", args, { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
@@ -16584,11 +16651,11 @@ function resumableRecord(path, expected) {
|
|
|
16584
16651
|
function writeRecordAtomically(path, text) {
|
|
16585
16652
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
16586
16653
|
writeFileSync12(tmp, text);
|
|
16587
|
-
|
|
16654
|
+
renameSync4(tmp, path);
|
|
16588
16655
|
}
|
|
16589
16656
|
function freshWorkspace(ledger, task, pair, arm, sourceBase) {
|
|
16590
16657
|
const ws2 = join23(ledger, "workspaces", `${task.id}--${pair}--${arm}`);
|
|
16591
|
-
|
|
16658
|
+
rmSync10(ws2, { recursive: true, force: true });
|
|
16592
16659
|
mkdirSync8(join23(ledger, "workspaces"), { recursive: true });
|
|
16593
16660
|
try {
|
|
16594
16661
|
execFileSync13("git", ["clone", "-q", "--no-hardlinks", task.repo, ws2], { stdio: ["ignore", "ignore", "pipe"], encoding: "utf8" });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tamperward",
|
|
3
|
-
"version": "2.23.
|
|
3
|
+
"version": "2.23.12",
|
|
4
4
|
"description": "The deterministic agent-integrity gate. One ruleset, evaluated on the actual diff/commands as a verdict, enforced everywhere a change can be made.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "hexrift",
|