tamperward 2.37.0 → 2.37.1
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 +173 -112
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -12201,7 +12201,7 @@ var init_fs_events = __esm({
|
|
|
12201
12201
|
|
|
12202
12202
|
// src/cli/audit.ts
|
|
12203
12203
|
import { createHash as createHash6, randomBytes } from "node:crypto";
|
|
12204
|
-
import { appendFileSync as appendFileSync4, existsSync as existsSync9, mkdirSync as mkdirSync5,
|
|
12204
|
+
import { appendFileSync as appendFileSync4, closeSync as closeSync3, existsSync as existsSync9, mkdirSync as mkdirSync5, openSync as openSync3, readSync as readSync3 } from "node:fs";
|
|
12205
12205
|
import { dirname as dirname4, isAbsolute as isAbsolute8, join as join13, resolve as resolve4 } from "node:path";
|
|
12206
12206
|
function sessionHash(sessionId) {
|
|
12207
12207
|
if (!sessionId) return void 0;
|
|
@@ -12311,19 +12311,56 @@ function parseAuditEvent(value, line = 0) {
|
|
|
12311
12311
|
...typeof value.session === "string" ? { session: value.session } : {}
|
|
12312
12312
|
};
|
|
12313
12313
|
}
|
|
12314
|
-
function
|
|
12315
|
-
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
|
|
12319
|
-
|
|
12320
|
-
|
|
12321
|
-
|
|
12322
|
-
|
|
12314
|
+
function parseAuditLine(line, lineNumber) {
|
|
12315
|
+
let value;
|
|
12316
|
+
try {
|
|
12317
|
+
value = JSON.parse(line);
|
|
12318
|
+
} catch {
|
|
12319
|
+
throw new Error(`audit line ${lineNumber} is not valid JSON`);
|
|
12320
|
+
}
|
|
12321
|
+
return parseAuditEvent(value, lineNumber);
|
|
12322
|
+
}
|
|
12323
|
+
function forEachAuditLine(file, onLine, maxLineBytes = MAX_AUDIT_LINE_BYTES) {
|
|
12324
|
+
const fd = openSync3(file, "r");
|
|
12325
|
+
try {
|
|
12326
|
+
const chunk = Buffer.allocUnsafe(64 * 1024);
|
|
12327
|
+
let pending = [];
|
|
12328
|
+
let pendingBytes = 0;
|
|
12329
|
+
let lineNumber = 0;
|
|
12330
|
+
const emit3 = (parts) => {
|
|
12331
|
+
lineNumber++;
|
|
12332
|
+
let line = parts.length === 1 ? parts[0].toString("utf8") : Buffer.concat(parts).toString("utf8");
|
|
12333
|
+
if (line.endsWith("\r")) line = line.slice(0, -1);
|
|
12334
|
+
if (line.trim()) onLine(line, lineNumber);
|
|
12335
|
+
};
|
|
12336
|
+
for (; ; ) {
|
|
12337
|
+
const read = readSync3(fd, chunk, 0, chunk.length, null);
|
|
12338
|
+
if (read === 0) break;
|
|
12339
|
+
let start = 0;
|
|
12340
|
+
for (let i = 0; i < read; i++) {
|
|
12341
|
+
if (chunk[i] !== 10) continue;
|
|
12342
|
+
const part = chunk.subarray(start, i);
|
|
12343
|
+
if (pendingBytes + part.length > maxLineBytes) {
|
|
12344
|
+
throw new Error(`audit line ${lineNumber + 1} exceeds ${maxLineBytes} bytes (not an audit-v1 event)`);
|
|
12345
|
+
}
|
|
12346
|
+
emit3(pending.length ? [...pending, part] : [part]);
|
|
12347
|
+
pending = [];
|
|
12348
|
+
pendingBytes = 0;
|
|
12349
|
+
start = i + 1;
|
|
12350
|
+
}
|
|
12351
|
+
if (start < read) {
|
|
12352
|
+
const rest = Buffer.from(chunk.subarray(start, read));
|
|
12353
|
+
pendingBytes += rest.length;
|
|
12354
|
+
if (pendingBytes > maxLineBytes) {
|
|
12355
|
+
throw new Error(`audit line ${lineNumber + 1} exceeds ${maxLineBytes} bytes (not an audit-v1 event)`);
|
|
12356
|
+
}
|
|
12357
|
+
pending.push(rest);
|
|
12358
|
+
}
|
|
12323
12359
|
}
|
|
12324
|
-
|
|
12325
|
-
}
|
|
12326
|
-
|
|
12360
|
+
if (pending.length) emit3(pending);
|
|
12361
|
+
} finally {
|
|
12362
|
+
closeSync3(fd);
|
|
12363
|
+
}
|
|
12327
12364
|
}
|
|
12328
12365
|
function parseSince(value, nowMs = Date.now()) {
|
|
12329
12366
|
const relative13 = /^(\d+)(m|h|d)$/.exec(value);
|
|
@@ -12339,37 +12376,58 @@ function parseSince(value, nowMs = Date.now()) {
|
|
|
12339
12376
|
}
|
|
12340
12377
|
return parsed;
|
|
12341
12378
|
}
|
|
12342
|
-
function
|
|
12343
|
-
|
|
12344
|
-
|
|
12345
|
-
|
|
12379
|
+
function createAuditAggregator() {
|
|
12380
|
+
let events = 0;
|
|
12381
|
+
let blocked = 0;
|
|
12382
|
+
let warnings = 0;
|
|
12346
12383
|
const rules = /* @__PURE__ */ new Map();
|
|
12347
12384
|
const surfaces = /* @__PURE__ */ new Map();
|
|
12348
12385
|
const sessions = /* @__PURE__ */ new Set();
|
|
12349
|
-
|
|
12350
|
-
const bucket = rules.get(event.rule) ?? { events: 0, blocked: 0, warnings: 0 };
|
|
12351
|
-
bucket.events++;
|
|
12352
|
-
if (event.severity === "block") bucket.blocked++;
|
|
12353
|
-
else bucket.warnings++;
|
|
12354
|
-
rules.set(event.rule, bucket);
|
|
12355
|
-
surfaces.set(event.surface, (surfaces.get(event.surface) ?? 0) + 1);
|
|
12356
|
-
if (event.session) sessions.add(event.session);
|
|
12357
|
-
}
|
|
12358
|
-
const by_rule = [...rules.entries()].map(([rule, counts]) => ({ rule, ...counts })).sort((a, b) => b.events - a.events || a.rule.localeCompare(b.rule));
|
|
12359
|
-
const by_surface = [...surfaces.entries()].map(([surface, count]) => ({ surface, events: count })).sort((a, b) => b.events - a.events || a.surface.localeCompare(b.surface));
|
|
12386
|
+
const bounds = { first: null, last: null };
|
|
12360
12387
|
return {
|
|
12361
|
-
|
|
12362
|
-
|
|
12363
|
-
|
|
12364
|
-
|
|
12365
|
-
|
|
12366
|
-
|
|
12367
|
-
|
|
12368
|
-
|
|
12369
|
-
|
|
12370
|
-
|
|
12388
|
+
add(event) {
|
|
12389
|
+
events++;
|
|
12390
|
+
if (event.severity === "block") blocked++;
|
|
12391
|
+
else warnings++;
|
|
12392
|
+
const bucket = rules.get(event.rule) ?? { events: 0, blocked: 0, warnings: 0 };
|
|
12393
|
+
bucket.events++;
|
|
12394
|
+
if (event.severity === "block") bucket.blocked++;
|
|
12395
|
+
else bucket.warnings++;
|
|
12396
|
+
rules.set(event.rule, bucket);
|
|
12397
|
+
surfaces.set(event.surface, (surfaces.get(event.surface) ?? 0) + 1);
|
|
12398
|
+
if (event.session) sessions.add(event.session);
|
|
12399
|
+
const ms = Date.parse(event.timestamp);
|
|
12400
|
+
const { first, last } = bounds;
|
|
12401
|
+
if (first === null || ms < first.ms || ms === first.ms && event.id.localeCompare(first.id) < 0) {
|
|
12402
|
+
bounds.first = { ms, id: event.id, timestamp: event.timestamp };
|
|
12403
|
+
}
|
|
12404
|
+
if (last === null || ms > last.ms || ms === last.ms && event.id.localeCompare(last.id) > 0) {
|
|
12405
|
+
bounds.last = { ms, id: event.id, timestamp: event.timestamp };
|
|
12406
|
+
}
|
|
12407
|
+
},
|
|
12408
|
+
finish() {
|
|
12409
|
+
const by_rule = [...rules.entries()].map(([rule, counts]) => ({ rule, ...counts })).sort((a, b) => b.events - a.events || a.rule.localeCompare(b.rule));
|
|
12410
|
+
const by_surface = [...surfaces.entries()].map(([surface, count]) => ({ surface, events: count })).sort((a, b) => b.events - a.events || a.surface.localeCompare(b.surface));
|
|
12411
|
+
return {
|
|
12412
|
+
schema_version: AUDIT_SCHEMA_VERSION,
|
|
12413
|
+
events,
|
|
12414
|
+
blocked,
|
|
12415
|
+
warnings,
|
|
12416
|
+
sessions: sessions.size,
|
|
12417
|
+
first_event: bounds.first === null ? null : bounds.first.timestamp,
|
|
12418
|
+
last_event: bounds.last === null ? null : bounds.last.timestamp,
|
|
12419
|
+
by_rule,
|
|
12420
|
+
by_surface,
|
|
12421
|
+
interpretation: "finding-is-not-proof-of-intent"
|
|
12422
|
+
};
|
|
12423
|
+
}
|
|
12371
12424
|
};
|
|
12372
12425
|
}
|
|
12426
|
+
function summarizeAudit(events) {
|
|
12427
|
+
const aggregator = createAuditAggregator();
|
|
12428
|
+
for (const event of events) aggregator.add(event);
|
|
12429
|
+
return aggregator.finish();
|
|
12430
|
+
}
|
|
12373
12431
|
function renderAuditStats(summary) {
|
|
12374
12432
|
const out3 = [
|
|
12375
12433
|
"TamperWard audit stats",
|
|
@@ -12408,21 +12466,24 @@ function runStats(opts = {}) {
|
|
|
12408
12466
|
process.stdout.write(opts.json ? JSON.stringify(empty2) + "\n" : renderAuditStats(empty2));
|
|
12409
12467
|
return 0;
|
|
12410
12468
|
}
|
|
12411
|
-
|
|
12412
|
-
|
|
12413
|
-
|
|
12414
|
-
|
|
12415
|
-
|
|
12469
|
+
const aggregator = createAuditAggregator();
|
|
12470
|
+
forEachAuditLine(file, (line, lineNumber) => {
|
|
12471
|
+
const event = parseAuditLine(line, lineNumber);
|
|
12472
|
+
if (cutoff !== null && Date.parse(event.timestamp) < cutoff) return;
|
|
12473
|
+
aggregator.add(event);
|
|
12474
|
+
});
|
|
12475
|
+
const summary = aggregator.finish();
|
|
12416
12476
|
process.stdout.write(opts.json ? JSON.stringify(summary) + "\n" : renderAuditStats(summary));
|
|
12417
12477
|
return 0;
|
|
12418
12478
|
}
|
|
12419
|
-
var AUDIT_SCHEMA_VERSION, AUDIT_LOG_ENV, ALLOWED_KEYS;
|
|
12479
|
+
var AUDIT_SCHEMA_VERSION, AUDIT_LOG_ENV, MAX_AUDIT_LINE_BYTES, ALLOWED_KEYS;
|
|
12420
12480
|
var init_audit = __esm({
|
|
12421
12481
|
"src/cli/audit.ts"() {
|
|
12422
12482
|
"use strict";
|
|
12423
12483
|
init_repo_context();
|
|
12424
12484
|
AUDIT_SCHEMA_VERSION = 1;
|
|
12425
12485
|
AUDIT_LOG_ENV = "TAMPERWARD_AUDIT_LOG";
|
|
12486
|
+
MAX_AUDIT_LINE_BYTES = 16 * 1024;
|
|
12426
12487
|
ALLOWED_KEYS = /* @__PURE__ */ new Set([
|
|
12427
12488
|
"schema_version",
|
|
12428
12489
|
"id",
|
|
@@ -12438,14 +12499,14 @@ var init_audit = __esm({
|
|
|
12438
12499
|
});
|
|
12439
12500
|
|
|
12440
12501
|
// src/cli/hook.ts
|
|
12441
|
-
import { readFileSync as
|
|
12502
|
+
import { readFileSync as readFileSync10, appendFileSync as appendFileSync5, writeFileSync as writeFileSync5, existsSync as existsSync10 } from "node:fs";
|
|
12442
12503
|
import { createHash as createHash7 } from "node:crypto";
|
|
12443
12504
|
function setSnapshotCache(cache3) {
|
|
12444
12505
|
snapshotCache = cache3;
|
|
12445
12506
|
}
|
|
12446
12507
|
function readStdin() {
|
|
12447
12508
|
try {
|
|
12448
|
-
return
|
|
12509
|
+
return readFileSync10(0, "utf8");
|
|
12449
12510
|
} catch (e) {
|
|
12450
12511
|
throw new HookInputError(`cannot read the hook payload on stdin: ${e instanceof Error ? e.message : String(e)}`);
|
|
12451
12512
|
}
|
|
@@ -12738,7 +12799,7 @@ function turnTransientBlocks(cwd, sessionId, policy, changes) {
|
|
|
12738
12799
|
if (!existsSync10(log)) return none;
|
|
12739
12800
|
let offset = 0;
|
|
12740
12801
|
if (cp && existsSync10(cp)) {
|
|
12741
|
-
const n2 = Number(
|
|
12802
|
+
const n2 = Number(readFileSync10(cp, "utf8"));
|
|
12742
12803
|
offset = Number.isFinite(n2) ? n2 : 0;
|
|
12743
12804
|
}
|
|
12744
12805
|
const drained = drainEvents(log, offset);
|
|
@@ -13012,13 +13073,13 @@ var init_ptree_cache = __esm({
|
|
|
13012
13073
|
});
|
|
13013
13074
|
|
|
13014
13075
|
// src/cli/hook-service.ts
|
|
13015
|
-
import { chmodSync, existsSync as existsSync11, lstatSync as lstatSync6, mkdirSync as mkdirSync6, readFileSync as
|
|
13076
|
+
import { chmodSync, existsSync as existsSync11, lstatSync as lstatSync6, mkdirSync as mkdirSync6, readFileSync as readFileSync11, rmSync as rmSync4, writeFileSync as writeFileSync6 } from "node:fs";
|
|
13016
13077
|
import { createConnection as createConnection2, createServer } from "node:net";
|
|
13017
13078
|
import { realpathSync as realpathSync4 } from "node:fs";
|
|
13018
13079
|
import { sep } from "node:path";
|
|
13019
13080
|
function readServiceState(paths) {
|
|
13020
13081
|
try {
|
|
13021
|
-
const v = JSON.parse(
|
|
13082
|
+
const v = JSON.parse(readFileSync11(paths.state, "utf8"));
|
|
13022
13083
|
if (!isRecord(v)) return null;
|
|
13023
13084
|
const { pid, version, root, started_at } = v;
|
|
13024
13085
|
if (typeof pid !== "number" || typeof version !== "string" || typeof root !== "string" || typeof started_at !== "string") return null;
|
|
@@ -13579,7 +13640,7 @@ var init_safe_write = __esm({
|
|
|
13579
13640
|
// src/cli/init.ts
|
|
13580
13641
|
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
13581
13642
|
import { createHash as createHash8 } from "node:crypto";
|
|
13582
|
-
import { existsSync as existsSync12, mkdirSync as mkdirSync7, readFileSync as
|
|
13643
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync7, readFileSync as readFileSync12, realpathSync as realpathSync5 } from "node:fs";
|
|
13583
13644
|
import { basename as basename3, dirname as dirname5, isAbsolute as isAbsolute9, join as join15, relative as relative4, resolve as resolve6 } from "node:path";
|
|
13584
13645
|
function gitConfig(cwd, key2) {
|
|
13585
13646
|
try {
|
|
@@ -13673,34 +13734,34 @@ function verifierCandidates(cwd) {
|
|
|
13673
13734
|
if (!candidates.includes(command)) candidates.push(command);
|
|
13674
13735
|
};
|
|
13675
13736
|
try {
|
|
13676
|
-
const pkg = JSON.parse(
|
|
13737
|
+
const pkg = JSON.parse(readFileSync12(join15(cwd, "package.json"), "utf8"));
|
|
13677
13738
|
const test = isRecord(pkg) && isRecord(pkg.scripts) ? pkg.scripts.test : void 0;
|
|
13678
13739
|
if (typeof test === "string" && test.trim() !== "" && !/error:\s*no test specified/i.test(test)) add("npm test");
|
|
13679
13740
|
} catch {
|
|
13680
13741
|
}
|
|
13681
13742
|
try {
|
|
13682
|
-
const pyproject =
|
|
13743
|
+
const pyproject = readFileSync12(join15(cwd, "pyproject.toml"), "utf8");
|
|
13683
13744
|
if (/^\s*\[tool\.pytest(?:\.ini_options)?\]\s*$/m.test(pyproject)) add("pytest");
|
|
13684
13745
|
} catch {
|
|
13685
13746
|
}
|
|
13686
13747
|
if (existsSync12(join15(cwd, "pytest.ini"))) add("pytest");
|
|
13687
13748
|
try {
|
|
13688
|
-
const setupCfg =
|
|
13749
|
+
const setupCfg = readFileSync12(join15(cwd, "setup.cfg"), "utf8");
|
|
13689
13750
|
if (/^\s*\[tool:pytest\]\s*$/m.test(setupCfg)) add("pytest");
|
|
13690
13751
|
} catch {
|
|
13691
13752
|
}
|
|
13692
13753
|
try {
|
|
13693
|
-
const tox =
|
|
13754
|
+
const tox = readFileSync12(join15(cwd, "tox.ini"), "utf8");
|
|
13694
13755
|
if (/^\s*\[tox\]\s*$/m.test(tox)) add("tox");
|
|
13695
13756
|
} catch {
|
|
13696
13757
|
}
|
|
13697
13758
|
try {
|
|
13698
|
-
const cargo =
|
|
13759
|
+
const cargo = readFileSync12(join15(cwd, "Cargo.toml"), "utf8");
|
|
13699
13760
|
if (/^\s*\[(?:package|workspace)\]\s*(?:#.*)?$/m.test(cargo)) add("cargo test");
|
|
13700
13761
|
} catch {
|
|
13701
13762
|
}
|
|
13702
13763
|
try {
|
|
13703
|
-
const goMod =
|
|
13764
|
+
const goMod = readFileSync12(join15(cwd, "go.mod"), "utf8");
|
|
13704
13765
|
if (/^\s*module\s+\S+\s*(?:\/\/.*)?$/m.test(goMod)) add("go test ./...");
|
|
13705
13766
|
} catch {
|
|
13706
13767
|
}
|
|
@@ -13772,7 +13833,7 @@ function planGitignore(cwd) {
|
|
|
13772
13833
|
}
|
|
13773
13834
|
const refused = refuseNonRegular(path);
|
|
13774
13835
|
if (refused) return { item: "gitignore", path: rel, status: "error", detail: refused };
|
|
13775
|
-
if (kind === "file") existing =
|
|
13836
|
+
if (kind === "file") existing = readFileSync12(path, "utf8");
|
|
13776
13837
|
try {
|
|
13777
13838
|
const tracked = execFileSync6("git", ["ls-files", "--cached", "--", "node_modules"], {
|
|
13778
13839
|
cwd,
|
|
@@ -13830,7 +13891,7 @@ function planClaudeHooks(cwd) {
|
|
|
13830
13891
|
if (existsSync12(path)) {
|
|
13831
13892
|
let parsed;
|
|
13832
13893
|
try {
|
|
13833
|
-
parsed = JSON.parse(
|
|
13894
|
+
parsed = JSON.parse(readFileSync12(path, "utf8"));
|
|
13834
13895
|
} catch {
|
|
13835
13896
|
return {
|
|
13836
13897
|
item: "agent",
|
|
@@ -13972,7 +14033,7 @@ function planPreCommit(cwd) {
|
|
|
13972
14033
|
const rel = display(cwd, path);
|
|
13973
14034
|
const refused = refuseNonRegular(path);
|
|
13974
14035
|
if (refused) return { item: "pre-commit", path: rel, status: "error", detail: refused };
|
|
13975
|
-
const existing = existsSync12(path) ?
|
|
14036
|
+
const existing = existsSync12(path) ? readFileSync12(path, "utf8") : null;
|
|
13976
14037
|
const hookMode = () => existingMode(path, 493) | 73;
|
|
13977
14038
|
if (existing === null) {
|
|
13978
14039
|
return {
|
|
@@ -14063,7 +14124,7 @@ function planCodeowners(cwd) {
|
|
|
14063
14124
|
const path = join15(cwd, existingRel ?? rel);
|
|
14064
14125
|
const refused = refuseNonRegular(path);
|
|
14065
14126
|
if (refused) return { item: "codeowners", path: existingRel ?? rel, status: "error", detail: refused };
|
|
14066
|
-
const existing = existingRel ?
|
|
14127
|
+
const existing = existingRel ? readFileSync12(path, "utf8") : null;
|
|
14067
14128
|
const missing = CODEOWNERS_PATHS.filter((p) => existing === null || !coveredBy(existing, p));
|
|
14068
14129
|
if (existingRel !== void 0 && missing.length === 0) {
|
|
14069
14130
|
return { item: "codeowners", path: existingRel, status: "ok", detail: "gate paths already have code owners" };
|
|
@@ -14114,7 +14175,7 @@ function planWorkflow(cwd, force) {
|
|
|
14114
14175
|
}
|
|
14115
14176
|
let src;
|
|
14116
14177
|
try {
|
|
14117
|
-
src =
|
|
14178
|
+
src = readFileSync12(path, "utf8");
|
|
14118
14179
|
} catch {
|
|
14119
14180
|
return { item: "ci", path: rel, status: "error", detail: "exists but cannot be read \u2014 refusing to overwrite" };
|
|
14120
14181
|
}
|
|
@@ -14414,7 +14475,7 @@ import {
|
|
|
14414
14475
|
existsSync as existsSync13,
|
|
14415
14476
|
lstatSync as lstatSync8,
|
|
14416
14477
|
readdirSync as readdirSync3,
|
|
14417
|
-
readFileSync as
|
|
14478
|
+
readFileSync as readFileSync13,
|
|
14418
14479
|
readlinkSync as readlinkSync2,
|
|
14419
14480
|
realpathSync as realpathSync6,
|
|
14420
14481
|
statSync as statSync3
|
|
@@ -14472,7 +14533,7 @@ function fingerprintRoot(root, cwd, h) {
|
|
|
14472
14533
|
st = statSync3(path);
|
|
14473
14534
|
if (!st.isFile()) throw new Error("not a regular file");
|
|
14474
14535
|
h.update(label + "\0external-file\0" + path + "\0" + String(st.mode) + "\0");
|
|
14475
|
-
h.update(
|
|
14536
|
+
h.update(readFileSync13(path));
|
|
14476
14537
|
h.update("\0");
|
|
14477
14538
|
} catch (e) {
|
|
14478
14539
|
throw new Unattestable(
|
|
@@ -14506,7 +14567,7 @@ function fingerprintRoot(root, cwd, h) {
|
|
|
14506
14567
|
h.update(rel + "\0" + ident.kind + "\0" + String(ident.mode) + "\0");
|
|
14507
14568
|
if (ident.kind === "file") {
|
|
14508
14569
|
try {
|
|
14509
|
-
h.update(
|
|
14570
|
+
h.update(readFileSync13(path));
|
|
14510
14571
|
h.update("\0");
|
|
14511
14572
|
} catch (e) {
|
|
14512
14573
|
throw new Unattestable(
|
|
@@ -14677,7 +14738,7 @@ function venvProblem(root) {
|
|
|
14677
14738
|
const cfg = join16(root, "pyvenv.cfg");
|
|
14678
14739
|
if (!existsSync13(cfg)) return "VIRTUAL_ENV " + JSON.stringify(root) + " has no pyvenv.cfg";
|
|
14679
14740
|
try {
|
|
14680
|
-
const body =
|
|
14741
|
+
const body = readFileSync13(cfg, "utf8");
|
|
14681
14742
|
if (/^\s*include-system-site-packages\s*=\s*true\s*$/im.test(body)) {
|
|
14682
14743
|
return "Python environment " + JSON.stringify(root) + " enables system site-packages; those external package roots are not bounded";
|
|
14683
14744
|
}
|
|
@@ -15193,7 +15254,7 @@ if (child) {
|
|
|
15193
15254
|
// src/verifier-backend.ts
|
|
15194
15255
|
import { createHash as createHash11, randomUUID } from "node:crypto";
|
|
15195
15256
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
15196
|
-
import { accessSync as accessSync2, constants as constants3, readFileSync as
|
|
15257
|
+
import { accessSync as accessSync2, constants as constants3, readFileSync as readFileSync14, realpathSync as realpathSync7, statSync as statSync4 } from "node:fs";
|
|
15197
15258
|
import { delimiter as delimiter2, dirname as dirname7, join as join18, resolve as resolve8 } from "node:path";
|
|
15198
15259
|
function identity() {
|
|
15199
15260
|
const uid = typeof process.getuid === "function" ? process.getuid() : null;
|
|
@@ -15238,7 +15299,7 @@ function findExecutable(name) {
|
|
|
15238
15299
|
return null;
|
|
15239
15300
|
}
|
|
15240
15301
|
function fileSha256(path) {
|
|
15241
|
-
return createHash11("sha256").update(
|
|
15302
|
+
return createHash11("sha256").update(readFileSync14(path)).digest("hex");
|
|
15242
15303
|
}
|
|
15243
15304
|
function engineClientEnv() {
|
|
15244
15305
|
return {
|
|
@@ -15672,7 +15733,7 @@ var init_verifier_backend = __esm({
|
|
|
15672
15733
|
// src/verification-state.ts
|
|
15673
15734
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
15674
15735
|
import { createHash as createHash12 } from "node:crypto";
|
|
15675
|
-
import { mkdirSync as mkdirSync8, readFileSync as
|
|
15736
|
+
import { mkdirSync as mkdirSync8, readFileSync as readFileSync15, rmSync as rmSync7, writeFileSync as writeFileSync9 } from "node:fs";
|
|
15676
15737
|
import { dirname as dirname8, join as join19 } from "node:path";
|
|
15677
15738
|
function git2(args, cwd) {
|
|
15678
15739
|
return execFileSync8("git", args, {
|
|
@@ -15721,7 +15782,7 @@ function interventionWiring(cwd) {
|
|
|
15721
15782
|
return sources.map(([source, path]) => {
|
|
15722
15783
|
let parsed;
|
|
15723
15784
|
try {
|
|
15724
|
-
parsed = JSON.parse(
|
|
15785
|
+
parsed = JSON.parse(readFileSync15(path, "utf8"));
|
|
15725
15786
|
} catch {
|
|
15726
15787
|
return { source, present: false };
|
|
15727
15788
|
}
|
|
@@ -15874,7 +15935,7 @@ function readVerificationRecord(cwd) {
|
|
|
15874
15935
|
if (!path) return null;
|
|
15875
15936
|
let raw;
|
|
15876
15937
|
try {
|
|
15877
|
-
raw =
|
|
15938
|
+
raw = readFileSync15(path, "utf8");
|
|
15878
15939
|
} catch {
|
|
15879
15940
|
return null;
|
|
15880
15941
|
}
|
|
@@ -15923,7 +15984,7 @@ function readVerifyingMarker(cwd) {
|
|
|
15923
15984
|
if (!path) return null;
|
|
15924
15985
|
let parsed;
|
|
15925
15986
|
try {
|
|
15926
|
-
parsed = JSON.parse(
|
|
15987
|
+
parsed = JSON.parse(readFileSync15(path, "utf8"));
|
|
15927
15988
|
} catch {
|
|
15928
15989
|
return null;
|
|
15929
15990
|
}
|
|
@@ -16035,7 +16096,7 @@ var init_verification_state = __esm({
|
|
|
16035
16096
|
// src/cli/verify.ts
|
|
16036
16097
|
import { execFileSync as execFileSync9, spawnSync as spawnSync3 } from "node:child_process";
|
|
16037
16098
|
import { createHash as createHash13 } from "node:crypto";
|
|
16038
|
-
import { chmodSync as chmodSync2, cpSync, lstatSync as lstatSync9, mkdirSync as mkdirSync9, mkdtempSync as mkdtempSync3, readFileSync as
|
|
16099
|
+
import { chmodSync as chmodSync2, cpSync, lstatSync as lstatSync9, mkdirSync as mkdirSync9, mkdtempSync as mkdtempSync3, readFileSync as readFileSync16, readlinkSync as readlinkSync3, rmSync as rmSync8, symlinkSync, writeFileSync as writeFileSync10, existsSync as existsSync14 } from "node:fs";
|
|
16039
16100
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
16040
16101
|
import { dirname as dirname9, isAbsolute as isAbsolute11, join as join20, relative as relative6, resolve as resolve9, sep as sep4 } from "node:path";
|
|
16041
16102
|
function oracleAssuranceReport() {
|
|
@@ -16295,7 +16356,7 @@ function overlayDigest(dest, paths) {
|
|
|
16295
16356
|
try {
|
|
16296
16357
|
const st = lstatSync9(p);
|
|
16297
16358
|
h.update(String(st.mode));
|
|
16298
|
-
h.update(st.isSymbolicLink() ? readlinkSync3(p) :
|
|
16359
|
+
h.update(st.isSymbolicLink() ? readlinkSync3(p) : readFileSync16(p));
|
|
16299
16360
|
} catch {
|
|
16300
16361
|
h.update("<gone>");
|
|
16301
16362
|
}
|
|
@@ -17092,7 +17153,7 @@ var init_verify = __esm({
|
|
|
17092
17153
|
// src/cli/run.ts
|
|
17093
17154
|
import { execFileSync as execFileSync10, spawn, spawnSync as spawnSync4 } from "node:child_process";
|
|
17094
17155
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
17095
|
-
import { accessSync as accessSync3, constants as fsConstants, mkdtempSync as mkdtempSync4, readdirSync as readdirSync4, readFileSync as
|
|
17156
|
+
import { accessSync as accessSync3, constants as fsConstants, mkdtempSync as mkdtempSync4, readdirSync as readdirSync4, readFileSync as readFileSync17, readlinkSync as readlinkSync4, realpathSync as realpathSync8, rmSync as rmSync9, statSync as statSync5, writeFileSync as writeFileSync11 } from "node:fs";
|
|
17096
17157
|
import { tmpdir as tmpdir5 } from "node:os";
|
|
17097
17158
|
import { dirname as dirname10, join as join21, resolve as resolve10 } from "node:path";
|
|
17098
17159
|
function authoritativeRunLifecyclePlatform(platform = process.platform) {
|
|
@@ -17246,7 +17307,7 @@ function runAgentSupervised(argv, cwd, budgetSecs, linuxPythonCandidates, lifecy
|
|
|
17246
17307
|
}
|
|
17247
17308
|
let state = {};
|
|
17248
17309
|
try {
|
|
17249
|
-
state = JSON.parse(
|
|
17310
|
+
state = JSON.parse(readFileSync17(resultFile, "utf8"));
|
|
17250
17311
|
} catch {
|
|
17251
17312
|
return {
|
|
17252
17313
|
exit: 1,
|
|
@@ -17290,7 +17351,7 @@ function observerExited(pid) {
|
|
|
17290
17351
|
if (!pidAlive4(pid)) return true;
|
|
17291
17352
|
if (process.platform !== "linux") return false;
|
|
17292
17353
|
try {
|
|
17293
|
-
const stat =
|
|
17354
|
+
const stat = readFileSync17(`/proc/${pid}/stat`, "utf8");
|
|
17294
17355
|
const state = stat.slice(stat.lastIndexOf(")") + 2).split(" ")[0];
|
|
17295
17356
|
return state === "Z" || state === "X";
|
|
17296
17357
|
} catch (e) {
|
|
@@ -17412,7 +17473,7 @@ function git4(args, cwd) {
|
|
|
17412
17473
|
}
|
|
17413
17474
|
function nowTicks() {
|
|
17414
17475
|
try {
|
|
17415
|
-
return Math.floor(parseFloat(
|
|
17476
|
+
return Math.floor(parseFloat(readFileSync17("/proc/uptime", "utf8").split(" ")[0]) * 100);
|
|
17416
17477
|
} catch {
|
|
17417
17478
|
return Number.POSITIVE_INFINITY;
|
|
17418
17479
|
}
|
|
@@ -17435,7 +17496,7 @@ function survivorsHoldingTree(cwd, spawnedAfterTicks) {
|
|
|
17435
17496
|
const n2 = Number(pid);
|
|
17436
17497
|
if (n2 === process.pid) continue;
|
|
17437
17498
|
try {
|
|
17438
|
-
const stat =
|
|
17499
|
+
const stat = readFileSync17(`/proc/${pid}/stat`, "utf8");
|
|
17439
17500
|
const startTicks = Number(stat.slice(stat.lastIndexOf(")") + 2).split(" ")[19]);
|
|
17440
17501
|
if (!Number.isFinite(startTicks) || startTicks < spawnedAfterTicks) continue;
|
|
17441
17502
|
} catch {
|
|
@@ -18008,7 +18069,7 @@ raise SystemExit(0)
|
|
|
18008
18069
|
|
|
18009
18070
|
// src/cli/doctor.ts
|
|
18010
18071
|
import { execFileSync as execFileSync11 } from "node:child_process";
|
|
18011
|
-
import { existsSync as existsSync15, readFileSync as
|
|
18072
|
+
import { existsSync as existsSync15, readFileSync as readFileSync18, readdirSync as readdirSync5 } from "node:fs";
|
|
18012
18073
|
import { join as join22, resolve as resolve11 } from "node:path";
|
|
18013
18074
|
function lifecyclePlatformCheck(platform = process.platform, linuxPython = platform === "linux" ? trustedLinuxPython() : null) {
|
|
18014
18075
|
if (platform === "linux") {
|
|
@@ -18067,7 +18128,7 @@ function pinsInFile(path) {
|
|
|
18067
18128
|
if (!existsSync15(path)) return [];
|
|
18068
18129
|
let src = "";
|
|
18069
18130
|
try {
|
|
18070
|
-
src =
|
|
18131
|
+
src = readFileSync18(path, "utf8");
|
|
18071
18132
|
} catch {
|
|
18072
18133
|
return [];
|
|
18073
18134
|
}
|
|
@@ -18094,7 +18155,7 @@ function workflowPermissionCheck(cwd, workflowRels = [".github/workflows/tamperw
|
|
|
18094
18155
|
}
|
|
18095
18156
|
let doc;
|
|
18096
18157
|
try {
|
|
18097
|
-
doc = yaml.parse(
|
|
18158
|
+
doc = yaml.parse(readFileSync18(path, "utf8"));
|
|
18098
18159
|
} catch (e) {
|
|
18099
18160
|
broken.push(`${rel} is not valid YAML (${e instanceof Error ? e.message : String(e)})`);
|
|
18100
18161
|
continue;
|
|
@@ -18518,7 +18579,7 @@ function diagnose(opts = {}) {
|
|
|
18518
18579
|
}
|
|
18519
18580
|
let doc;
|
|
18520
18581
|
try {
|
|
18521
|
-
doc = yaml.parse(
|
|
18582
|
+
doc = yaml.parse(readFileSync18(workflowPath, "utf8"));
|
|
18522
18583
|
} catch (e) {
|
|
18523
18584
|
return fail(
|
|
18524
18585
|
"ci-verifier",
|
|
@@ -18831,7 +18892,7 @@ import { execFileSync as execFileSync12, spawnSync as spawnSync5 } from "node:ch
|
|
|
18831
18892
|
import {
|
|
18832
18893
|
existsSync as existsSync16,
|
|
18833
18894
|
mkdtempSync as mkdtempSync5,
|
|
18834
|
-
readFileSync as
|
|
18895
|
+
readFileSync as readFileSync19,
|
|
18835
18896
|
readdirSync as readdirSync6,
|
|
18836
18897
|
realpathSync as realpathSync9,
|
|
18837
18898
|
rmSync as rmSync10,
|
|
@@ -19145,7 +19206,7 @@ function straceOnce(root, command, budget) {
|
|
|
19145
19206
|
}
|
|
19146
19207
|
);
|
|
19147
19208
|
const logs = traced.error ? [] : traceFiles(prefix);
|
|
19148
|
-
const accesses = logs.flatMap((path) => parseStraceFileAccess(
|
|
19209
|
+
const accesses = logs.flatMap((path) => parseStraceFileAccess(readFileSync19(path, "utf8"), TRACE_ROOT));
|
|
19149
19210
|
const raw = {
|
|
19150
19211
|
spawnError: traced.error ? traced.error.message : null,
|
|
19151
19212
|
status: traced.status,
|
|
@@ -19377,7 +19438,7 @@ var init_trace_verify = __esm({
|
|
|
19377
19438
|
});
|
|
19378
19439
|
|
|
19379
19440
|
// src/runtimes.ts
|
|
19380
|
-
import { existsSync as existsSync17, readFileSync as
|
|
19441
|
+
import { existsSync as existsSync17, readFileSync as readFileSync20 } from "node:fs";
|
|
19381
19442
|
import { join as join24 } from "node:path";
|
|
19382
19443
|
function isRecord5(x) {
|
|
19383
19444
|
return typeof x === "object" && x !== null && !Array.isArray(x);
|
|
@@ -19408,7 +19469,7 @@ function claudeSettingsBeyondTamperward(cwd) {
|
|
|
19408
19469
|
let raw;
|
|
19409
19470
|
try {
|
|
19410
19471
|
if (!existsSync17(path)) return false;
|
|
19411
|
-
raw =
|
|
19472
|
+
raw = readFileSync20(path, "utf8");
|
|
19412
19473
|
} catch {
|
|
19413
19474
|
return false;
|
|
19414
19475
|
}
|
|
@@ -19515,7 +19576,7 @@ var init_runtimes = __esm({
|
|
|
19515
19576
|
|
|
19516
19577
|
// src/cli/onboard.ts
|
|
19517
19578
|
import { execFileSync as execFileSync13 } from "node:child_process";
|
|
19518
|
-
import { lstatSync as lstatSync10, mkdtempSync as mkdtempSync6, readFileSync as
|
|
19579
|
+
import { lstatSync as lstatSync10, mkdtempSync as mkdtempSync6, readFileSync as readFileSync21, realpathSync as realpathSync10, rmSync as rmSync11 } from "node:fs";
|
|
19519
19580
|
import { tmpdir as tmpdir7 } from "node:os";
|
|
19520
19581
|
import { join as join25, relative as relative8, resolve as resolve13, sep as sep6 } from "node:path";
|
|
19521
19582
|
import { createInterface } from "node:readline";
|
|
@@ -19588,7 +19649,7 @@ function writeVerifyCommand(cwd, command) {
|
|
|
19588
19649
|
return `${POLICY_FILE} is not a regular file; refusing to follow or replace a symlink or special file`;
|
|
19589
19650
|
}
|
|
19590
19651
|
const mode = existingMode(path, 420);
|
|
19591
|
-
const original = kind === "file" ?
|
|
19652
|
+
const original = kind === "file" ? readFileSync21(path, "utf8") : null;
|
|
19592
19653
|
let next;
|
|
19593
19654
|
try {
|
|
19594
19655
|
const doc = parseDocument(original && original.trim() ? original : "version: 1\n");
|
|
@@ -20200,7 +20261,7 @@ var init_capture = __esm({
|
|
|
20200
20261
|
|
|
20201
20262
|
// src/research/manifest.ts
|
|
20202
20263
|
import { createHash as createHash14 } from "node:crypto";
|
|
20203
|
-
import { readFileSync as
|
|
20264
|
+
import { readFileSync as readFileSync22 } from "node:fs";
|
|
20204
20265
|
import { dirname as dirname11, resolve as resolve15 } from "node:path";
|
|
20205
20266
|
function taskFrom(raw, index, manifestDir) {
|
|
20206
20267
|
const where = `task #${index + 1}`;
|
|
@@ -20234,7 +20295,7 @@ function readManifest(path) {
|
|
|
20234
20295
|
const abs = resolve15(path);
|
|
20235
20296
|
let bytes;
|
|
20236
20297
|
try {
|
|
20237
|
-
bytes =
|
|
20298
|
+
bytes = readFileSync22(abs);
|
|
20238
20299
|
} catch (e) {
|
|
20239
20300
|
throw new ResearchError(`cannot read task manifest ${abs}: ${e instanceof Error ? e.message : String(e)}`);
|
|
20240
20301
|
}
|
|
@@ -20532,7 +20593,7 @@ var init_record = __esm({
|
|
|
20532
20593
|
// src/research/run.ts
|
|
20533
20594
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
20534
20595
|
import { execFileSync as execFileSync14 } from "node:child_process";
|
|
20535
|
-
import { closeSync as
|
|
20596
|
+
import { closeSync as closeSync4, existsSync as existsSync18, linkSync, mkdirSync as mkdirSync10, openSync as openSync4, readFileSync as readFileSync23, renameSync as renameSync4, rmSync as rmSync12, unlinkSync, writeFileSync as writeFileSync12, writeSync } from "node:fs";
|
|
20536
20597
|
import { hostname } from "node:os";
|
|
20537
20598
|
import { join as join26, resolve as resolve16 } from "node:path";
|
|
20538
20599
|
function git7(args, cwd) {
|
|
@@ -20546,7 +20607,7 @@ function researchLockPath(ledger) {
|
|
|
20546
20607
|
}
|
|
20547
20608
|
function readLockOwner(path) {
|
|
20548
20609
|
try {
|
|
20549
|
-
const parsed = JSON.parse(
|
|
20610
|
+
const parsed = JSON.parse(readFileSync23(path, "utf8"));
|
|
20550
20611
|
if (!isRecord(parsed) || typeof parsed.pid !== "number" || !Number.isInteger(parsed.pid) || parsed.pid <= 0) return null;
|
|
20551
20612
|
if (typeof parsed.host !== "string" || typeof parsed.started_at !== "string" || typeof parsed.token !== "string") return null;
|
|
20552
20613
|
return { pid: parsed.pid, host: parsed.host, started_at: parsed.started_at, token: parsed.token };
|
|
@@ -20612,12 +20673,12 @@ function acquireResearchLock(ledger, breakStaleLock = false) {
|
|
|
20612
20673
|
const text = JSON.stringify(owner) + "\n";
|
|
20613
20674
|
let fd = -1;
|
|
20614
20675
|
try {
|
|
20615
|
-
fd =
|
|
20676
|
+
fd = openSync4(path, "wx", 384);
|
|
20616
20677
|
writeSync(fd, text);
|
|
20617
|
-
|
|
20678
|
+
closeSync4(fd);
|
|
20618
20679
|
fd = -1;
|
|
20619
20680
|
} catch (e) {
|
|
20620
|
-
if (fd !== -1)
|
|
20681
|
+
if (fd !== -1) closeSync4(fd);
|
|
20621
20682
|
if (e.code === "EEXIST") {
|
|
20622
20683
|
throw new ResearchError(
|
|
20623
20684
|
`research output ${ledger} is already locked by ${lockHolder(path)}; refusing concurrent writers. Verify the owner is not running, then remove ${path} deliberately or rerun with --break-lock`
|
|
@@ -20631,7 +20692,7 @@ function acquireResearchLock(ledger, breakStaleLock = false) {
|
|
|
20631
20692
|
if (released) return;
|
|
20632
20693
|
released = true;
|
|
20633
20694
|
try {
|
|
20634
|
-
if (
|
|
20695
|
+
if (readFileSync23(path, "utf8") === text) unlinkSync(path);
|
|
20635
20696
|
} catch {
|
|
20636
20697
|
}
|
|
20637
20698
|
}
|
|
@@ -20640,7 +20701,7 @@ function acquireResearchLock(ledger, breakStaleLock = false) {
|
|
|
20640
20701
|
function resumableRecord(path, expected) {
|
|
20641
20702
|
let raw;
|
|
20642
20703
|
try {
|
|
20643
|
-
raw = JSON.parse(
|
|
20704
|
+
raw = JSON.parse(readFileSync23(path, "utf8"));
|
|
20644
20705
|
} catch (e) {
|
|
20645
20706
|
throw new ResearchError(`ledger record ${path} is malformed (${errorMessage(e).split("\n")[0]}); remove it to regenerate the pair, or use a new --out`);
|
|
20646
20707
|
}
|
|
@@ -21062,7 +21123,7 @@ var init_run2 = __esm({
|
|
|
21062
21123
|
});
|
|
21063
21124
|
|
|
21064
21125
|
// src/research/summarize.ts
|
|
21065
|
-
import { readdirSync as readdirSync7, readFileSync as
|
|
21126
|
+
import { readdirSync as readdirSync7, readFileSync as readFileSync24 } from "node:fs";
|
|
21066
21127
|
import { join as join27, resolve as resolve17 } from "node:path";
|
|
21067
21128
|
function readLedger2(dir) {
|
|
21068
21129
|
const pairsDir = join27(resolve17(dir), "pairs");
|
|
@@ -21077,7 +21138,7 @@ function readLedger2(dir) {
|
|
|
21077
21138
|
const path = join27(pairsDir, n2);
|
|
21078
21139
|
let raw;
|
|
21079
21140
|
try {
|
|
21080
|
-
raw = JSON.parse(
|
|
21141
|
+
raw = JSON.parse(readFileSync24(path, "utf8"));
|
|
21081
21142
|
} catch (e) {
|
|
21082
21143
|
throw new ResearchError(`ledger record ${path} is not valid JSON: ${errorMessage(e)}`);
|
|
21083
21144
|
}
|
|
@@ -21209,7 +21270,7 @@ var init_summarize = __esm({
|
|
|
21209
21270
|
|
|
21210
21271
|
// src/research/init.ts
|
|
21211
21272
|
import { createHash as createHash15 } from "node:crypto";
|
|
21212
|
-
import { existsSync as existsSync19, mkdirSync as mkdirSync11, readFileSync as
|
|
21273
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync11, readFileSync as readFileSync25, writeFileSync as writeFileSync13 } from "node:fs";
|
|
21213
21274
|
import { basename as basename5, dirname as dirname12, resolve as resolve18 } from "node:path";
|
|
21214
21275
|
function idFrom(repo) {
|
|
21215
21276
|
const clean = repo.replace(/[\\/]$/, "").split(/[\\/]/).pop() || "task";
|
|
@@ -21261,7 +21322,7 @@ function runResearchInit(opts) {
|
|
|
21261
21322
|
}
|
|
21262
21323
|
}
|
|
21263
21324
|
function requireHash(path) {
|
|
21264
|
-
return createHash15("sha256").update(
|
|
21325
|
+
return createHash15("sha256").update(readFileSync25(path)).digest("hex");
|
|
21265
21326
|
}
|
|
21266
21327
|
var init_init2 = __esm({
|
|
21267
21328
|
"src/research/init.ts"() {
|
|
@@ -21328,7 +21389,7 @@ var init_report2 = __esm({
|
|
|
21328
21389
|
// src/research/bundle.ts
|
|
21329
21390
|
import { createHash as createHash16 } from "node:crypto";
|
|
21330
21391
|
import { gzipSync, gunzipSync } from "node:zlib";
|
|
21331
|
-
import { existsSync as existsSync20, mkdirSync as mkdirSync12, readdirSync as readdirSync8, readFileSync as
|
|
21392
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync12, readdirSync as readdirSync8, readFileSync as readFileSync26, statSync as statSync6, writeFileSync as writeFileSync14 } from "node:fs";
|
|
21332
21393
|
import { dirname as dirname13, join as join28, resolve as resolve19 } from "node:path";
|
|
21333
21394
|
function octal(value, width) {
|
|
21334
21395
|
return value.toString(8).padStart(width - 1, "0") + "\0";
|
|
@@ -21382,7 +21443,7 @@ function walkLedger(ledger) {
|
|
|
21382
21443
|
for (const name of names) {
|
|
21383
21444
|
const path = join28(pairs, name);
|
|
21384
21445
|
if (!statSync6(path).isFile()) continue;
|
|
21385
|
-
entries.push({ name: `ledger/pairs/${name}`, bytes:
|
|
21446
|
+
entries.push({ name: `ledger/pairs/${name}`, bytes: readFileSync26(path) });
|
|
21386
21447
|
}
|
|
21387
21448
|
return entries;
|
|
21388
21449
|
}
|
|
@@ -21392,7 +21453,7 @@ function jsonBytes(value) {
|
|
|
21392
21453
|
function validateResearchBundle(path) {
|
|
21393
21454
|
let files;
|
|
21394
21455
|
try {
|
|
21395
|
-
files = parseTar(gunzipSync(
|
|
21456
|
+
files = parseTar(gunzipSync(readFileSync26(resolve19(path))));
|
|
21396
21457
|
} catch (e) {
|
|
21397
21458
|
throw new ResearchError(`cannot read research bundle ${path}: ${e instanceof Error ? e.message : String(e)}`);
|
|
21398
21459
|
}
|
|
@@ -21446,7 +21507,7 @@ function createResearchBundle(opts) {
|
|
|
21446
21507
|
const summary = summarizeLedger(ledger);
|
|
21447
21508
|
const entries = walkLedger(ledger);
|
|
21448
21509
|
if (opts.manifest) {
|
|
21449
|
-
const manifest =
|
|
21510
|
+
const manifest = readFileSync26(resolve19(opts.manifest));
|
|
21450
21511
|
const sha3 = createHash16("sha256").update(manifest).digest("hex");
|
|
21451
21512
|
if (sha3 !== summary.manifest_sha256) throw new ResearchError(`manifest sha256 ${sha3} does not match ledger ${summary.manifest_sha256}`);
|
|
21452
21513
|
entries.push({ name: "manifest.json", bytes: manifest });
|
|
@@ -22474,7 +22535,7 @@ var init_adapter4 = __esm({
|
|
|
22474
22535
|
|
|
22475
22536
|
// src/adapters/copilot-sdk/changes.ts
|
|
22476
22537
|
import { execFileSync as execFileSync15 } from "node:child_process";
|
|
22477
|
-
import { mkdtempSync as mkdtempSync7, writeFileSync as writeFileSync15, readFileSync as
|
|
22538
|
+
import { mkdtempSync as mkdtempSync7, writeFileSync as writeFileSync15, readFileSync as readFileSync27, rmSync as rmSync13, existsSync as existsSync21, realpathSync as realpathSync11 } from "node:fs";
|
|
22478
22539
|
import { tmpdir as tmpdir8 } from "node:os";
|
|
22479
22540
|
import { basename as basename6, dirname as dirname14, isAbsolute as isAbsolute17, relative as relative12, resolve as resolve22, join as join29 } from "node:path";
|
|
22480
22541
|
function asStr4(v) {
|
|
@@ -22568,7 +22629,7 @@ function reconstructAfterViaGit(rawDiff, display2, before, isCreate) {
|
|
|
22568
22629
|
if (statPath !== TARGET) throw new Error(`write diff reconstructs a different file (${statPath}) than the bound target`);
|
|
22569
22630
|
git8(["--check"]);
|
|
22570
22631
|
git8([]);
|
|
22571
|
-
return op === "delete" ? null :
|
|
22632
|
+
return op === "delete" ? null : readFileSync27(targetPath, "utf8");
|
|
22572
22633
|
} catch (e) {
|
|
22573
22634
|
throw new Error(`could not reconstruct the write to ${display2} from its diff via git apply: ${e instanceof Error ? e.message : String(e)}`);
|
|
22574
22635
|
} finally {
|
|
@@ -23312,7 +23373,7 @@ var init_runtime_qualification = __esm({
|
|
|
23312
23373
|
|
|
23313
23374
|
// src/cli/runtime.ts
|
|
23314
23375
|
import { execFileSync as execFileSync16 } from "node:child_process";
|
|
23315
|
-
import { existsSync as existsSync22, mkdirSync as mkdirSync13, readFileSync as
|
|
23376
|
+
import { existsSync as existsSync22, mkdirSync as mkdirSync13, readFileSync as readFileSync28, writeFileSync as writeFileSync16 } from "node:fs";
|
|
23316
23377
|
import { join as join30, dirname as dirname15 } from "node:path";
|
|
23317
23378
|
function storePath(cwd) {
|
|
23318
23379
|
const dir = gitDir(cwd);
|
|
@@ -23322,7 +23383,7 @@ function readStore(cwd) {
|
|
|
23322
23383
|
const path = storePath(cwd);
|
|
23323
23384
|
if (!path || !existsSync22(path)) return null;
|
|
23324
23385
|
try {
|
|
23325
|
-
const parsed = JSON.parse(
|
|
23386
|
+
const parsed = JSON.parse(readFileSync28(path, "utf8"));
|
|
23326
23387
|
if (parsed && typeof parsed === "object" && parsed.records && typeof parsed.records === "object") return parsed;
|
|
23327
23388
|
} catch {
|
|
23328
23389
|
return null;
|
|
@@ -23484,7 +23545,7 @@ function resolveHookConfigHash(canonicalId, cwd) {
|
|
|
23484
23545
|
const file = files[canonicalId];
|
|
23485
23546
|
if (!file || !existsSync22(file)) return null;
|
|
23486
23547
|
try {
|
|
23487
|
-
const raw =
|
|
23548
|
+
const raw = readFileSync28(file, "utf8");
|
|
23488
23549
|
let hooks = raw;
|
|
23489
23550
|
try {
|
|
23490
23551
|
const parsed = JSON.parse(raw);
|
|
@@ -24490,7 +24551,7 @@ var init_main = __esm({
|
|
|
24490
24551
|
// src/cli/index.ts
|
|
24491
24552
|
init_hook_client();
|
|
24492
24553
|
init_exit();
|
|
24493
|
-
import { readFileSync as
|
|
24554
|
+
import { readFileSync as readFileSync29 } from "node:fs";
|
|
24494
24555
|
function loadMain() {
|
|
24495
24556
|
return Promise.resolve().then(() => (init_main(), main_exports));
|
|
24496
24557
|
}
|
|
@@ -24503,7 +24564,7 @@ async function launch(argv) {
|
|
|
24503
24564
|
if (kind && hookServiceEnabled()) {
|
|
24504
24565
|
let raw = null;
|
|
24505
24566
|
try {
|
|
24506
|
-
raw =
|
|
24567
|
+
raw = readFileSync29(0, "utf8");
|
|
24507
24568
|
} catch {
|
|
24508
24569
|
raw = null;
|
|
24509
24570
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tamperward",
|
|
3
|
-
"version": "2.37.
|
|
3
|
+
"version": "2.37.1",
|
|
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",
|