failproofai 1.0.13-beta.2 → 1.0.13-beta.3
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/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +2 -2
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +3 -3
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
- package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +8 -8
- package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/_0tovk6q0miud6._.js +1 -1
- package/.next/standalone/.next/server/chunks/_0trp3ycqv17cl._.js +1 -1
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4vkpxxu7._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_hooks_0_em82s16zfym._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__19nvo1qfswchs._.js → [root-of-the-server]__070rqh7scntiu._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__08ch3staq3ejw._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0bigvy9xmv2ka._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h86bl2qf0k_o._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0pia5h3p8re4c._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1-ey9fgesfbc0._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__15usvs-ms-0hf._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__16gb3_92zvk5x._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1avi2kypusyb_._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1r7drlqli-ado._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0eoura3_9gjb-._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0pedwblqdoh58._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1djqs9i27e4kg._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_1nvqg4si0splb._.js → _1tcvpgd7hugnx._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo5_vm5f.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9snixb5fd-._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47q0xq5w._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x33jqb6._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpcz0uxur._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h47jmhhd._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_html-to-image_es_index_1gk40bvx2bftt.js → node_modules_html-to-image_es_index_1p-is71j0j7fb.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/package_json_[json]_cjs_013tntikdft59._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/preview-props.json +3 -3
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +23 -23
- package/.next/standalone/.next/static/chunks/{3lgxb73wehfv2.js → 095l2av-xsus2.js} +1 -1
- package/.next/standalone/.next/static/chunks/{44rukkkzacqkl.js → 0h7mkux811w5b.js} +2 -2
- package/.next/standalone/.next/static/chunks/{2q-6h4rclnu98.js → 19l5hbzn475am.js} +1 -1
- package/.next/standalone/.next/static/chunks/{1l9lji2he-mbw.js → 1s__s2o5zcfcy.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2f9-xdgd1o3r5.js → 1uxq_gbvdti30.js} +1 -1
- package/.next/standalone/.next/static/chunks/{1mkf3bas1g5ka.js → 2sthn8c56n9m_.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2xox4fr0q-ftn.js → 3eonfpk9jyceg.js} +1 -1
- package/.next/standalone/.next/static/chunks/{061bksch79zq2.js → 3m9g1l6-yh0s3.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2x-77r0k0xm3b.js → 3uaguc-tbu_ik.js} +1 -1
- package/.next/standalone/.next/static/chunks/{22gs9785ug-vp.js → 3zwff_ax3hust.js} +1 -1
- package/.next/standalone/hermes-plugin/plugin.yaml +1 -1
- package/.next/standalone/package.json +9 -9
- package/.next/standalone/server.js +1 -1
- package/dist/cli.mjs +224 -371
- package/dist/worker.mjs +5 -4
- package/hermes-plugin/plugin.yaml +1 -1
- package/package.json +9 -9
- package/src/hooks/daemon-service.ts +3 -168
- package/src/hooks/types.ts +20 -17
- package/src/hooks/uninstall-cli.ts +0 -3
- /package/.next/standalone/.next/static/{TdOlUedz_AHC-0Ops67a_ → fHR90vZ5ls7d-K8cH9hxe}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{TdOlUedz_AHC-0Ops67a_ → fHR90vZ5ls7d-K8cH9hxe}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{TdOlUedz_AHC-0Ops67a_ → fHR90vZ5ls7d-K8cH9hxe}/_ssgManifest.js +0 -0
package/dist/cli.mjs
CHANGED
|
@@ -29,7 +29,7 @@ var __esm = (fn, res, err) => () => {
|
|
|
29
29
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
30
30
|
|
|
31
31
|
// package.json
|
|
32
|
-
var version2 = "1.0.13-beta.
|
|
32
|
+
var version2 = "1.0.13-beta.3", package_default;
|
|
33
33
|
var init_package = __esm(() => {
|
|
34
34
|
package_default = {
|
|
35
35
|
name: "failproofai",
|
|
@@ -159,16 +159,16 @@ var init_package = __esm(() => {
|
|
|
159
159
|
browserslist: "4.28.8"
|
|
160
160
|
},
|
|
161
161
|
optionalDependencies: {
|
|
162
|
-
"@failproofai/failproofaid-linux-x64": "1.0.13-beta.
|
|
163
|
-
"@failproofai/failproofaid-linux-arm64": "1.0.13-beta.
|
|
164
|
-
"@failproofai/failproofaid-darwin-x64": "1.0.13-beta.
|
|
165
|
-
"@failproofai/failproofaid-darwin-arm64": "1.0.13-beta.
|
|
162
|
+
"@failproofai/failproofaid-linux-x64": "1.0.13-beta.3",
|
|
163
|
+
"@failproofai/failproofaid-linux-arm64": "1.0.13-beta.3",
|
|
164
|
+
"@failproofai/failproofaid-darwin-x64": "1.0.13-beta.3",
|
|
165
|
+
"@failproofai/failproofaid-darwin-arm64": "1.0.13-beta.3"
|
|
166
166
|
},
|
|
167
167
|
failproofaidBinaries: {
|
|
168
|
-
"linux-x64": "
|
|
169
|
-
"linux-arm64": "
|
|
170
|
-
"darwin-x64": "
|
|
171
|
-
"darwin-arm64": "
|
|
168
|
+
"linux-x64": "86f8b544b95d33b3464c916dff72e1a1436340d98c480dc8f83d1696dda1e5fe",
|
|
169
|
+
"linux-arm64": "d09376e5608e1379c247087386473f4ff1fcaa264022e570cc00f2cbb66b09fb",
|
|
170
|
+
"darwin-x64": "95f485247270fef7f4676e383ec586e339451c87dcd0480e1a12d721a62bec4b",
|
|
171
|
+
"darwin-arm64": "f8c0d43dba6d78facb00a0a265c188238e50223aedab2c17b3e66c202edacf5d"
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
174
|
});
|
|
@@ -1550,6 +1550,7 @@ var init_types = __esm(() => {
|
|
|
1550
1550
|
ANTIGRAVITY_TOOL_MAP = {
|
|
1551
1551
|
run_command: "Bash",
|
|
1552
1552
|
write_to_file: "Write",
|
|
1553
|
+
write_file: "Write",
|
|
1553
1554
|
read_file: "Read",
|
|
1554
1555
|
view_file: "Read",
|
|
1555
1556
|
edit_file: "Edit",
|
|
@@ -1562,9 +1563,9 @@ var init_types = __esm(() => {
|
|
|
1562
1563
|
};
|
|
1563
1564
|
ANTIGRAVITY_TOOL_INPUT_MAP = {
|
|
1564
1565
|
Bash: { CommandLine: "command", Cwd: "cwd" },
|
|
1565
|
-
Write: { TargetFile: "file_path", CodeContent: "content" },
|
|
1566
|
-
Edit: { TargetFile: "file_path" },
|
|
1567
|
-
Read: { TargetFile: "file_path", AbsolutePath: "file_path", File: "file_path" }
|
|
1566
|
+
Write: { Path: "file_path", Content: "content", TargetFile: "file_path", CodeContent: "content" },
|
|
1567
|
+
Edit: { Path: "file_path", Target: "old_string", Replacement: "new_string", TargetFile: "file_path" },
|
|
1568
|
+
Read: { Path: "file_path", TargetFile: "file_path", AbsolutePath: "file_path", File: "file_path" }
|
|
1568
1569
|
};
|
|
1569
1570
|
GOOSE_HOOK_SCOPES = ["user", "project"];
|
|
1570
1571
|
GOOSE_HOOK_EVENT_TYPES = [
|
|
@@ -13494,14 +13495,12 @@ import {
|
|
|
13494
13495
|
mkdirSync as mkdirSync7,
|
|
13495
13496
|
mkdtempSync,
|
|
13496
13497
|
readFileSync as readFileSync7,
|
|
13497
|
-
readdirSync as readdirSync2,
|
|
13498
|
-
statSync as statSync10,
|
|
13499
13498
|
writeFileSync as writeFileSync5,
|
|
13500
13499
|
unlinkSync,
|
|
13501
13500
|
rmSync as rmSync5
|
|
13502
13501
|
} from "node:fs";
|
|
13503
13502
|
import { homedir as homedir5, tmpdir, userInfo } from "node:os";
|
|
13504
|
-
import {
|
|
13503
|
+
import { resolve as resolve8 } from "node:path";
|
|
13505
13504
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
13506
13505
|
function setDaemonConfigured(value, installedVersion) {
|
|
13507
13506
|
try {
|
|
@@ -13613,63 +13612,6 @@ function systemdUnitDir() {
|
|
|
13613
13612
|
function systemdUnitPath(user = serviceUser()) {
|
|
13614
13613
|
return resolve8(systemdUnitDir(), systemdUnitName(user));
|
|
13615
13614
|
}
|
|
13616
|
-
function systemBinaryRoot(user = serviceUser()) {
|
|
13617
|
-
return resolve8(process.env.FAILPROOFAI_SYSTEM_BIN_DIR || "/opt/failproofai", user);
|
|
13618
|
-
}
|
|
13619
|
-
function systemBinaryDir() {
|
|
13620
|
-
return resolve8(systemBinaryRoot(), "bin");
|
|
13621
|
-
}
|
|
13622
|
-
function daemonSystemBinaryDir() {
|
|
13623
|
-
return process.platform === "linux" ? systemBinaryRoot() : null;
|
|
13624
|
-
}
|
|
13625
|
-
function systemBinaryTarget(binaryPath) {
|
|
13626
|
-
if (process.platform !== "linux" || process.env.FAILPROOFAI_DAEMON_BINARY)
|
|
13627
|
-
return null;
|
|
13628
|
-
try {
|
|
13629
|
-
if (!statSync10(binaryPath).isFile())
|
|
13630
|
-
return null;
|
|
13631
|
-
} catch {
|
|
13632
|
-
return null;
|
|
13633
|
-
}
|
|
13634
|
-
return resolve8(systemBinaryDir(), `failproofaid-${version2}`);
|
|
13635
|
-
}
|
|
13636
|
-
function selinuxEnabled() {
|
|
13637
|
-
return existsSync11("/sys/fs/selinux/enforce");
|
|
13638
|
-
}
|
|
13639
|
-
function stageSystemBinary(binaryPath) {
|
|
13640
|
-
const target = systemBinaryTarget(binaryPath);
|
|
13641
|
-
if (!target)
|
|
13642
|
-
return binaryPath;
|
|
13643
|
-
const dir = systemBinaryDir();
|
|
13644
|
-
const staging = `${target}.${process.pid}.tmp`;
|
|
13645
|
-
runPrivileged("install", ["-d", "-m", "0755", dir]);
|
|
13646
|
-
try {
|
|
13647
|
-
runPrivileged("install", ["-m", "0755", binaryPath, staging]);
|
|
13648
|
-
runPrivileged("mv", ["-f", staging, target]);
|
|
13649
|
-
} catch (err) {
|
|
13650
|
-
try {
|
|
13651
|
-
runPrivileged("rm", ["-f", staging]);
|
|
13652
|
-
} catch {}
|
|
13653
|
-
throw err;
|
|
13654
|
-
}
|
|
13655
|
-
if (selinuxEnabled()) {
|
|
13656
|
-
const root = systemBinaryRoot();
|
|
13657
|
-
try {
|
|
13658
|
-
runPrivileged("restorecon", ["-R", root]);
|
|
13659
|
-
} catch (err) {
|
|
13660
|
-
hookLogWarn(`restorecon on ${root} failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
13661
|
-
}
|
|
13662
|
-
}
|
|
13663
|
-
return target;
|
|
13664
|
-
}
|
|
13665
|
-
function pruneSystemBinaries(current) {
|
|
13666
|
-
try {
|
|
13667
|
-
const dir = systemBinaryDir();
|
|
13668
|
-
const stale = readdirSync2(dir).filter((f) => f.startsWith("failproofaid-")).map((f) => resolve8(dir, f)).filter((p) => p !== current).map((p) => ({ p, mtime: statSync10(p).mtimeMs })).sort((a, b) => b.mtime - a.mtime).slice(1);
|
|
13669
|
-
for (const { p } of stale)
|
|
13670
|
-
runPrivileged("rm", ["-f", p]);
|
|
13671
|
-
} catch {}
|
|
13672
|
-
}
|
|
13673
13615
|
function legacySystemdUserUnitPath() {
|
|
13674
13616
|
return resolve8(homedir5(), ".config", "systemd", "user", "failproofaid.service");
|
|
13675
13617
|
}
|
|
@@ -13850,17 +13792,9 @@ ${envBlock} <key>StandardOutPath</key>
|
|
|
13850
13792
|
}
|
|
13851
13793
|
function daemonInstallCommands(binaryPath, workerCmd, cliCmd) {
|
|
13852
13794
|
if (process.platform === "linux") {
|
|
13853
|
-
const target = systemBinaryTarget(binaryPath);
|
|
13854
|
-
const dir = systemBinaryDir();
|
|
13855
|
-
const stage = target ? [
|
|
13856
|
-
`sudo install -d -m 0755 ${dir}`,
|
|
13857
|
-
`sudo install -m 0755 ${binaryPath} ${target}`,
|
|
13858
|
-
`{ sudo restorecon -R ${systemBinaryRoot()} 2>/dev/null || true; }`
|
|
13859
|
-
] : [];
|
|
13860
13795
|
return [
|
|
13861
|
-
...stage,
|
|
13862
13796
|
`sudo tee ${systemdUnitPath()} <<'EOF'
|
|
13863
|
-
${systemdUnitContents(
|
|
13797
|
+
${systemdUnitContents(binaryPath, workerCmd, cliCmd)}EOF`,
|
|
13864
13798
|
"sudo systemctl daemon-reload",
|
|
13865
13799
|
`sudo systemctl enable ${systemdUnitName()}`,
|
|
13866
13800
|
`sudo systemctl restart ${systemdUnitName()}`
|
|
@@ -13888,11 +13822,9 @@ async function installDaemonService() {
|
|
|
13888
13822
|
};
|
|
13889
13823
|
}
|
|
13890
13824
|
removeLegacyUserService();
|
|
13891
|
-
let execPath = binaryPath;
|
|
13892
13825
|
try {
|
|
13893
13826
|
if (process.platform === "linux") {
|
|
13894
|
-
|
|
13895
|
-
writePrivilegedFile(systemdUnitPath(), systemdUnitContents(execPath, workerCmd, cliCmd));
|
|
13827
|
+
writePrivilegedFile(systemdUnitPath(), systemdUnitContents(binaryPath, workerCmd, cliCmd));
|
|
13896
13828
|
runPrivileged("systemctl", ["daemon-reload"]);
|
|
13897
13829
|
runPrivileged("systemctl", ["enable", systemdUnitName()]);
|
|
13898
13830
|
restartSystemdUnit();
|
|
@@ -13916,8 +13848,6 @@ async function installDaemonService() {
|
|
|
13916
13848
|
hookLogWarn(`daemon service install failed: ${reason}`);
|
|
13917
13849
|
return { installed: false, reason };
|
|
13918
13850
|
}
|
|
13919
|
-
if (execPath !== binaryPath)
|
|
13920
|
-
pruneSystemBinaries(execPath);
|
|
13921
13851
|
return { installed: true };
|
|
13922
13852
|
}
|
|
13923
13853
|
async function probeDaemon() {
|
|
@@ -14150,13 +14080,6 @@ async function uninstallDaemonService() {
|
|
|
14150
14080
|
try {
|
|
14151
14081
|
runPrivileged("systemctl", ["daemon-reload"]);
|
|
14152
14082
|
} catch {}
|
|
14153
|
-
const binRoot = systemBinaryRoot();
|
|
14154
|
-
if (existsSync11(binRoot)) {
|
|
14155
|
-
runPrivileged("rm", ["-rf", binRoot]);
|
|
14156
|
-
try {
|
|
14157
|
-
runPrivileged("rmdir", [dirname7(binRoot)]);
|
|
14158
|
-
} catch {}
|
|
14159
|
-
}
|
|
14160
14083
|
} else {
|
|
14161
14084
|
const plistPath = launchdPlistPath();
|
|
14162
14085
|
if (!existsSync11(plistPath))
|
|
@@ -14239,9 +14162,9 @@ var init_daemon_service = __esm(() => {
|
|
|
14239
14162
|
// src/hooks/codex-system-hooks.ts
|
|
14240
14163
|
import { execSync as execSync3 } from "node:child_process";
|
|
14241
14164
|
import { createHash as createHash4 } from "node:crypto";
|
|
14242
|
-
import { accessSync, chmodSync as chmodSync5, constants as fsConstants3, existsSync as existsSync12, readFileSync as readFileSync8, rmSync as rmSync6, statSync as
|
|
14165
|
+
import { accessSync, chmodSync as chmodSync5, constants as fsConstants3, existsSync as existsSync12, readFileSync as readFileSync8, rmSync as rmSync6, statSync as statSync10 } from "node:fs";
|
|
14243
14166
|
import { homedir as homedir6 } from "node:os";
|
|
14244
|
-
import { dirname as
|
|
14167
|
+
import { dirname as dirname7, resolve as resolve9 } from "node:path";
|
|
14245
14168
|
function codexSystemConfigPath() {
|
|
14246
14169
|
const override = process.env.FAILPROOFAI_CODEX_SYSTEM_CONFIG;
|
|
14247
14170
|
if (override !== undefined)
|
|
@@ -14363,9 +14286,9 @@ function resolvedPath(deps) {
|
|
|
14363
14286
|
return deps.path !== undefined ? deps.path : codexSystemConfigPath();
|
|
14364
14287
|
}
|
|
14365
14288
|
function writableDirectly(path) {
|
|
14366
|
-
let dir =
|
|
14289
|
+
let dir = dirname7(path);
|
|
14367
14290
|
while (!existsSync12(dir)) {
|
|
14368
|
-
const parent =
|
|
14291
|
+
const parent = dirname7(dir);
|
|
14369
14292
|
if (parent === dir)
|
|
14370
14293
|
return false;
|
|
14371
14294
|
dir = parent;
|
|
@@ -14381,7 +14304,7 @@ function writableDirectly(path) {
|
|
|
14381
14304
|
}
|
|
14382
14305
|
function fileMode(path) {
|
|
14383
14306
|
try {
|
|
14384
|
-
return (
|
|
14307
|
+
return (statSync10(path).mode & 511).toString(8).padStart(4, "0");
|
|
14385
14308
|
} catch {
|
|
14386
14309
|
return "0644";
|
|
14387
14310
|
}
|
|
@@ -14392,7 +14315,7 @@ function writeSystemFile(path, contents, mode, direct) {
|
|
|
14392
14315
|
chmodSync5(path, parseInt(mode, 8));
|
|
14393
14316
|
return;
|
|
14394
14317
|
}
|
|
14395
|
-
runPrivileged("install", ["-d", "-m", "0755",
|
|
14318
|
+
runPrivileged("install", ["-d", "-m", "0755", dirname7(path)]);
|
|
14396
14319
|
writePrivilegedFile(path, contents, mode);
|
|
14397
14320
|
}
|
|
14398
14321
|
function removeSystemFile(path, direct) {
|
|
@@ -14758,19 +14681,19 @@ var init_codex_system_hooks = __esm(() => {
|
|
|
14758
14681
|
});
|
|
14759
14682
|
|
|
14760
14683
|
// lib/hermes-profiles.ts
|
|
14761
|
-
import { existsSync as existsSync13, readdirSync as
|
|
14684
|
+
import { existsSync as existsSync13, readdirSync as readdirSync2 } from "node:fs";
|
|
14762
14685
|
import { homedir as homedir7 } from "node:os";
|
|
14763
|
-
import { basename as basename2, dirname as
|
|
14686
|
+
import { basename as basename2, dirname as dirname8, join as join4, resolve as resolve10 } from "node:path";
|
|
14764
14687
|
function hermesRoot() {
|
|
14765
14688
|
const env = (process.env.HERMES_HOME || "").trim();
|
|
14766
14689
|
if (env) {
|
|
14767
14690
|
let home = resolve10(env);
|
|
14768
|
-
const parent =
|
|
14691
|
+
const parent = dirname8(home);
|
|
14769
14692
|
if (basename2(parent) === PROFILES_DIR)
|
|
14770
|
-
home =
|
|
14693
|
+
home = dirname8(parent);
|
|
14771
14694
|
const base = basename2(home);
|
|
14772
14695
|
if (base === STANDARD_HOME || base.startsWith(SIBLING_HOME_PREFIX)) {
|
|
14773
|
-
return join4(
|
|
14696
|
+
return join4(dirname8(home), STANDARD_HOME);
|
|
14774
14697
|
}
|
|
14775
14698
|
return home;
|
|
14776
14699
|
}
|
|
@@ -14793,7 +14716,7 @@ function listHermesProfiles() {
|
|
|
14793
14716
|
const seen = new Set([HERMES_DEFAULT_PROFILE]);
|
|
14794
14717
|
let names = [];
|
|
14795
14718
|
try {
|
|
14796
|
-
names =
|
|
14719
|
+
names = readdirSync2(join4(root, PROFILES_DIR), { withFileTypes: true }).filter((e) => (e.isDirectory() || e.isSymbolicLink()) && !e.name.startsWith(".")).map((e) => e.name).sort();
|
|
14797
14720
|
} catch {}
|
|
14798
14721
|
for (const name of names) {
|
|
14799
14722
|
if (seen.has(name))
|
|
@@ -14804,9 +14727,9 @@ function listHermesProfiles() {
|
|
|
14804
14727
|
if (basename2(root) !== STANDARD_HOME)
|
|
14805
14728
|
return out;
|
|
14806
14729
|
let siblings = [];
|
|
14807
|
-
const parent =
|
|
14730
|
+
const parent = dirname8(root);
|
|
14808
14731
|
try {
|
|
14809
|
-
siblings =
|
|
14732
|
+
siblings = readdirSync2(parent, { withFileTypes: true }).filter((entry) => (entry.isDirectory() || entry.isSymbolicLink()) && entry.name.startsWith(SIBLING_HOME_PREFIX) && entry.name.length > SIBLING_HOME_PREFIX.length && existsSync13(join4(parent, entry.name, "config.yaml"))).map((entry) => ({
|
|
14810
14733
|
name: entry.name.slice(SIBLING_HOME_PREFIX.length),
|
|
14811
14734
|
home: join4(parent, entry.name)
|
|
14812
14735
|
})).sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -14847,9 +14770,9 @@ var PROFILES_DIR = "profiles", STANDARD_HOME = ".hermes", SIBLING_HOME_PREFIX =
|
|
|
14847
14770
|
var init_hermes_profiles = () => {};
|
|
14848
14771
|
|
|
14849
14772
|
// lib/openclaw-profiles.ts
|
|
14850
|
-
import { existsSync as existsSync14, readdirSync as
|
|
14773
|
+
import { existsSync as existsSync14, readdirSync as readdirSync3 } from "node:fs";
|
|
14851
14774
|
import { homedir as homedir8 } from "node:os";
|
|
14852
|
-
import { basename as basename3, dirname as
|
|
14775
|
+
import { basename as basename3, dirname as dirname9, join as join5, resolve as resolve11 } from "node:path";
|
|
14853
14776
|
function openclawProfileHome() {
|
|
14854
14777
|
const stateDir = (process.env.OPENCLAW_STATE_DIR ?? "").trim();
|
|
14855
14778
|
if (stateDir)
|
|
@@ -14859,7 +14782,7 @@ function openclawProfileHome() {
|
|
|
14859
14782
|
return resolve11(openclawHome);
|
|
14860
14783
|
const configPath = (process.env.OPENCLAW_CONFIG_PATH || "").trim();
|
|
14861
14784
|
if (configPath)
|
|
14862
|
-
return
|
|
14785
|
+
return dirname9(resolve11(configPath));
|
|
14863
14786
|
return join5(homedir8(), ".openclaw");
|
|
14864
14787
|
}
|
|
14865
14788
|
function listOpenClawProfiles() {
|
|
@@ -14868,14 +14791,14 @@ function listOpenClawProfiles() {
|
|
|
14868
14791
|
if (activeBase !== ".openclaw" && !activeBase.startsWith(".openclaw-")) {
|
|
14869
14792
|
return [{ name: OPENCLAW_DEFAULT_PROFILE, home: activeHome }];
|
|
14870
14793
|
}
|
|
14871
|
-
const parent =
|
|
14794
|
+
const parent = dirname9(activeHome);
|
|
14872
14795
|
const defaultHome = join5(parent, ".openclaw");
|
|
14873
14796
|
const out = [
|
|
14874
14797
|
{ name: OPENCLAW_DEFAULT_PROFILE, home: defaultHome }
|
|
14875
14798
|
];
|
|
14876
14799
|
let entries;
|
|
14877
14800
|
try {
|
|
14878
|
-
entries =
|
|
14801
|
+
entries = readdirSync3(parent, { withFileTypes: true });
|
|
14879
14802
|
} catch {
|
|
14880
14803
|
return out;
|
|
14881
14804
|
}
|
|
@@ -14905,7 +14828,7 @@ import {
|
|
|
14905
14828
|
symlinkSync,
|
|
14906
14829
|
unlinkSync as unlinkSync2
|
|
14907
14830
|
} from "node:fs";
|
|
14908
|
-
import { resolve as resolve12, dirname as
|
|
14831
|
+
import { resolve as resolve12, dirname as dirname10, basename as basename4 } from "node:path";
|
|
14909
14832
|
import { fileURLToPath } from "node:url";
|
|
14910
14833
|
import { homedir as homedir9 } from "node:os";
|
|
14911
14834
|
function readJsonFile(path) {
|
|
@@ -15015,7 +14938,7 @@ function isMarkedCopilotHook(hook) {
|
|
|
15015
14938
|
return false;
|
|
15016
14939
|
}
|
|
15017
14940
|
function opencodePluginFilePath(settingsPath) {
|
|
15018
|
-
return resolve12(
|
|
14941
|
+
return resolve12(dirname10(settingsPath), "plugins", "failproofai.mjs");
|
|
15019
14942
|
}
|
|
15020
14943
|
function buildOpenCodePluginShim(binaryPath, scope) {
|
|
15021
14944
|
const useNpx = scope === "project";
|
|
@@ -15255,7 +15178,7 @@ function getHermesPluginSourcePath() {
|
|
|
15255
15178
|
const fromEnv = process.env.FAILPROOFAI_PACKAGE_ROOT;
|
|
15256
15179
|
if (fromEnv)
|
|
15257
15180
|
return resolve12(fromEnv, HERMES_PLUGIN_SOURCE_DIR);
|
|
15258
|
-
return findHermesPluginSourcePath(
|
|
15181
|
+
return findHermesPluginSourcePath(dirname10(fileURLToPath(import.meta.url)));
|
|
15259
15182
|
}
|
|
15260
15183
|
function findHermesPluginSourcePath(startDir) {
|
|
15261
15184
|
let dir = resolve12(startDir);
|
|
@@ -15263,7 +15186,7 @@ function findHermesPluginSourcePath(startDir) {
|
|
|
15263
15186
|
const candidate = resolve12(dir, HERMES_PLUGIN_SOURCE_DIR);
|
|
15264
15187
|
if (existsSync15(resolve12(candidate, "plugin.yaml")))
|
|
15265
15188
|
return candidate;
|
|
15266
|
-
const parent =
|
|
15189
|
+
const parent = dirname10(dir);
|
|
15267
15190
|
if (parent === dir)
|
|
15268
15191
|
break;
|
|
15269
15192
|
dir = parent;
|
|
@@ -15271,7 +15194,7 @@ function findHermesPluginSourcePath(startDir) {
|
|
|
15271
15194
|
return resolve12(startDir, "..", "..", HERMES_PLUGIN_SOURCE_DIR);
|
|
15272
15195
|
}
|
|
15273
15196
|
function hermesPluginPathForSettings(settingsPath) {
|
|
15274
|
-
return resolve12(
|
|
15197
|
+
return resolve12(dirname10(settingsPath), "plugins", HERMES_PLUGIN_ID);
|
|
15275
15198
|
}
|
|
15276
15199
|
function pathPresent(path) {
|
|
15277
15200
|
try {
|
|
@@ -15285,7 +15208,7 @@ function hasAllHermesPluginFiles(dir) {
|
|
|
15285
15208
|
return HERMES_PLUGIN_FILES.every((file) => existsSync15(resolve12(dir, file)));
|
|
15286
15209
|
}
|
|
15287
15210
|
function hermesLinkRecordPath(pluginPath) {
|
|
15288
|
-
return resolve12(
|
|
15211
|
+
return resolve12(dirname10(pluginPath), HERMES_LINK_RECORD);
|
|
15289
15212
|
}
|
|
15290
15213
|
function readHermesLinkRecord(pluginPath) {
|
|
15291
15214
|
try {
|
|
@@ -15308,10 +15231,10 @@ function isOwnedHermesPluginLink(pluginPath, target) {
|
|
|
15308
15231
|
return true;
|
|
15309
15232
|
if (samePath(target, getHermesPluginSourcePath()))
|
|
15310
15233
|
return true;
|
|
15311
|
-
const pkgRoot =
|
|
15234
|
+
const pkgRoot = dirname10(resolve12(target));
|
|
15312
15235
|
if (basename4(resolve12(target)) !== HERMES_PLUGIN_SOURCE_DIR)
|
|
15313
15236
|
return false;
|
|
15314
|
-
if (basename4(pkgRoot) !== "failproofai" || basename4(
|
|
15237
|
+
if (basename4(pkgRoot) !== "failproofai" || basename4(dirname10(pkgRoot)) !== "node_modules")
|
|
15315
15238
|
return false;
|
|
15316
15239
|
try {
|
|
15317
15240
|
const pkg = JSON.parse(readFileSync9(resolve12(pkgRoot, "package.json"), "utf8"));
|
|
@@ -15343,7 +15266,7 @@ function hermesPluginState(settingsPath) {
|
|
|
15343
15266
|
if (isLink) {
|
|
15344
15267
|
let target;
|
|
15345
15268
|
try {
|
|
15346
|
-
target = resolve12(
|
|
15269
|
+
target = resolve12(dirname10(pluginPath), readlinkSync2(pluginPath));
|
|
15347
15270
|
} catch {
|
|
15348
15271
|
return { kind: "foreign" };
|
|
15349
15272
|
}
|
|
@@ -15388,7 +15311,7 @@ function installHermesPlugin(settingsPath, deps = {}) {
|
|
|
15388
15311
|
}
|
|
15389
15312
|
return "unchanged";
|
|
15390
15313
|
}
|
|
15391
|
-
mkdirSync8(
|
|
15314
|
+
mkdirSync8(dirname10(destination), { recursive: true });
|
|
15392
15315
|
const suffix = `${process.pid}-${Date.now()}`;
|
|
15393
15316
|
const temporary = `${destination}.install-${suffix}`;
|
|
15394
15317
|
let linked = false;
|
|
@@ -16194,7 +16117,7 @@ var init_integrations = __esm(() => {
|
|
|
16194
16117
|
const effectiveScope = scope ?? "project";
|
|
16195
16118
|
const settingsPath = effectiveScope === "user" ? resolve12(homedir9(), ".config", "opencode", "opencode.json") : resolve12(process.cwd(), ".opencode", "opencode.json");
|
|
16196
16119
|
const pluginPath = opencodePluginFilePath(settingsPath);
|
|
16197
|
-
mkdirSync8(
|
|
16120
|
+
mkdirSync8(dirname10(pluginPath), { recursive: true });
|
|
16198
16121
|
writeConfigFileAtomic(pluginPath, buildOpenCodePluginShim(binaryPath, effectiveScope), { symlinks: "replace" });
|
|
16199
16122
|
if (!Array.isArray(s.plugin))
|
|
16200
16123
|
s.plugin = [];
|
|
@@ -19305,7 +19228,7 @@ var init_custom_hooks_registry = __esm(() => {
|
|
|
19305
19228
|
// src/hooks/loader-utils.ts
|
|
19306
19229
|
import { readFile as readFile2, writeFile as writeFile2, unlink, access, mkdir, lstat } from "fs/promises";
|
|
19307
19230
|
import { tmpdir as tmpdir2 } from "os";
|
|
19308
|
-
import { resolve as resolve13, dirname as
|
|
19231
|
+
import { resolve as resolve13, dirname as dirname11, relative as relative2, join as join6 } from "path";
|
|
19309
19232
|
import { pathToFileURL } from "url";
|
|
19310
19233
|
import { createHash as createHash5 } from "crypto";
|
|
19311
19234
|
function isTmpArtifact(name) {
|
|
@@ -19346,7 +19269,7 @@ async function findDistIndex() {
|
|
|
19346
19269
|
return candidate;
|
|
19347
19270
|
}
|
|
19348
19271
|
const candidates = [
|
|
19349
|
-
resolve13(
|
|
19272
|
+
resolve13(dirname11(process.execPath), "..", "assets", "dist", "index.js"),
|
|
19350
19273
|
resolve13(process.cwd(), "dist", "index.js"),
|
|
19351
19274
|
resolve13(process.cwd(), "node_modules", "failproofai", "dist", "index.js")
|
|
19352
19275
|
];
|
|
@@ -19437,7 +19360,7 @@ async function rewriteFileTree(entryPath, distUrl, distIndex, tmpSuffix = TMP_SU
|
|
|
19437
19360
|
if (distIndex) {
|
|
19438
19361
|
code = code.replace(/require\s*\(\s*(['"])(?:claudeye|failproofai)\1\s*\)/g, `require('${distIndex.replace(/\\/g, "\\\\")}')`);
|
|
19439
19362
|
}
|
|
19440
|
-
const dir =
|
|
19363
|
+
const dir = dirname11(filePath);
|
|
19441
19364
|
const rewrites = new Map;
|
|
19442
19365
|
for (const re of [LOCAL_IMPORT_RE, LOCAL_REQUIRE_RE]) {
|
|
19443
19366
|
const freshRe = new RegExp(re.source, re.flags);
|
|
@@ -19660,7 +19583,7 @@ var init_telemetry_id2 = __esm(() => {
|
|
|
19660
19583
|
// src/hooks/custom-hooks-loader.ts
|
|
19661
19584
|
import { resolve as resolve14, isAbsolute as isAbsolute2, basename as basename5 } from "node:path";
|
|
19662
19585
|
import { randomUUID } from "crypto";
|
|
19663
|
-
import { existsSync as existsSync16, readdirSync as
|
|
19586
|
+
import { existsSync as existsSync16, readdirSync as readdirSync4 } from "node:fs";
|
|
19664
19587
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
19665
19588
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
19666
19589
|
import { createHash as createHash6 } from "node:crypto";
|
|
@@ -19668,7 +19591,7 @@ function discoverPolicyFiles(dir) {
|
|
|
19668
19591
|
if (!existsSync16(dir))
|
|
19669
19592
|
return [];
|
|
19670
19593
|
try {
|
|
19671
|
-
const entries =
|
|
19594
|
+
const entries = readdirSync4(dir, { withFileTypes: true });
|
|
19672
19595
|
return entries.filter((e) => e.isFile() && CONVENTION_FILE_RE.test(e.name)).sort((a, b) => a.name.localeCompare(b.name)).map((e) => resolve14(dir, e.name));
|
|
19673
19596
|
} catch {
|
|
19674
19597
|
return [];
|
|
@@ -19678,7 +19601,7 @@ function findSkippedPolicyFiles(dir) {
|
|
|
19678
19601
|
if (!existsSync16(dir))
|
|
19679
19602
|
return [];
|
|
19680
19603
|
try {
|
|
19681
|
-
return
|
|
19604
|
+
return readdirSync4(dir, { withFileTypes: true }).filter((e) => e.isFile() && LOADABLE_EXT_RE.test(e.name) && !CONVENTION_FILE_RE.test(e.name) && !e.name.endsWith(".d.ts") && !isTmpArtifact(e.name)).map((e) => e.name).sort((a, b) => a.localeCompare(b));
|
|
19682
19605
|
} catch {
|
|
19683
19606
|
return [];
|
|
19684
19607
|
}
|
|
@@ -21525,7 +21448,7 @@ var init_pack_cli = __esm(() => {
|
|
|
21525
21448
|
// src/hooks/pack-store.ts
|
|
21526
21449
|
import { createHash as createHash7 } from "node:crypto";
|
|
21527
21450
|
import { existsSync as existsSync17, mkdirSync as mkdirSync9, readFileSync as readFileSync10, renameSync as renameSync6, rmSync as rmSync8, writeFileSync as writeFileSync7 } from "node:fs";
|
|
21528
|
-
import { dirname as
|
|
21451
|
+
import { dirname as dirname12, resolve as resolve15 } from "node:path";
|
|
21529
21452
|
function baseUrl2() {
|
|
21530
21453
|
return (process.env.FAILPROOFAI_PACK_BASE_URL || DEFAULT_BASE_URL2).replace(/\/+$/, "");
|
|
21531
21454
|
}
|
|
@@ -21696,7 +21619,7 @@ function sha256(bytes) {
|
|
|
21696
21619
|
function writeAtomic(target, bytes) {
|
|
21697
21620
|
const tempPath = `${target}.${process.pid}.tmp`;
|
|
21698
21621
|
try {
|
|
21699
|
-
mkdirSync9(
|
|
21622
|
+
mkdirSync9(dirname12(target), { recursive: true });
|
|
21700
21623
|
writeFileSync7(tempPath, bytes);
|
|
21701
21624
|
renameSync6(tempPath, target);
|
|
21702
21625
|
} catch (err) {
|
|
@@ -23041,10 +22964,10 @@ import {
|
|
|
23041
22964
|
writeFileSync as writeFileSync8,
|
|
23042
22965
|
appendFileSync as appendFileSync2,
|
|
23043
22966
|
renameSync as renameSync7,
|
|
23044
|
-
readdirSync as
|
|
22967
|
+
readdirSync as readdirSync5,
|
|
23045
22968
|
mkdirSync as mkdirSync10,
|
|
23046
22969
|
existsSync as existsSync18,
|
|
23047
|
-
statSync as
|
|
22970
|
+
statSync as statSync11,
|
|
23048
22971
|
unlinkSync as unlinkSync3
|
|
23049
22972
|
} from "node:fs";
|
|
23050
22973
|
import { join as join7 } from "node:path";
|
|
@@ -23065,7 +22988,7 @@ function acquireLock() {
|
|
|
23065
22988
|
if (e.code !== "EEXIST")
|
|
23066
22989
|
return;
|
|
23067
22990
|
try {
|
|
23068
|
-
const s =
|
|
22991
|
+
const s = statSync11(lockPath);
|
|
23069
22992
|
if (Date.now() - s.mtimeMs > LOCK_STALE_MS) {
|
|
23070
22993
|
writeFileSync8(lockPath, String(process.pid), "utf-8");
|
|
23071
22994
|
return;
|
|
@@ -23253,7 +23176,7 @@ function readJsonlFile(filePath) {
|
|
|
23253
23176
|
}
|
|
23254
23177
|
function getArchiveFiles() {
|
|
23255
23178
|
try {
|
|
23256
|
-
const files =
|
|
23179
|
+
const files = readdirSync5(storeDirValue());
|
|
23257
23180
|
return files.filter((f) => f.startsWith("page-") && f.endsWith(".jsonl")).sort((a, b) => {
|
|
23258
23181
|
const partsA = a.slice(5, -6).split("-");
|
|
23259
23182
|
const partsB = b.slice(5, -6).split("-");
|
|
@@ -23277,7 +23200,7 @@ var init_hook_activity_store = __esm(() => {
|
|
|
23277
23200
|
});
|
|
23278
23201
|
|
|
23279
23202
|
// src/hooks/delivery-health.ts
|
|
23280
|
-
import { existsSync as existsSync19, readFileSync as readFileSync12, readdirSync as
|
|
23203
|
+
import { existsSync as existsSync19, readFileSync as readFileSync12, readdirSync as readdirSync6, statSync as statSync12 } from "node:fs";
|
|
23281
23204
|
import { join as join8 } from "node:path";
|
|
23282
23205
|
function parseParkedName(name) {
|
|
23283
23206
|
const poison = name.endsWith(POISON_SUFFIX);
|
|
@@ -23319,7 +23242,7 @@ function deliveryHealth(home, now = Date.now(), connectedAt = home ? undefined :
|
|
|
23319
23242
|
return EMPTY;
|
|
23320
23243
|
let entries;
|
|
23321
23244
|
try {
|
|
23322
|
-
entries =
|
|
23245
|
+
entries = readdirSync6(dir);
|
|
23323
23246
|
} catch {
|
|
23324
23247
|
return EMPTY;
|
|
23325
23248
|
}
|
|
@@ -23335,7 +23258,7 @@ function deliveryHealth(home, now = Date.now(), connectedAt = home ? undefined :
|
|
|
23335
23258
|
const parsed = parseParkedName(name);
|
|
23336
23259
|
let mtime;
|
|
23337
23260
|
try {
|
|
23338
|
-
mtime =
|
|
23261
|
+
mtime = statSync12(join8(dir, name)).mtimeMs;
|
|
23339
23262
|
} catch {
|
|
23340
23263
|
continue;
|
|
23341
23264
|
}
|
|
@@ -24093,7 +24016,7 @@ var init_cursor_projects = __esm(() => {
|
|
|
24093
24016
|
});
|
|
24094
24017
|
|
|
24095
24018
|
// lib/sqlite-reader.ts
|
|
24096
|
-
import { existsSync as existsSync20, readFileSync as readFileSync13, statSync as
|
|
24019
|
+
import { existsSync as existsSync20, readFileSync as readFileSync13, statSync as statSync13 } from "node:fs";
|
|
24097
24020
|
import initSqlJs from "sql.js/dist/sql-asm.js";
|
|
24098
24021
|
async function tryNodeSqlite(dbPath) {
|
|
24099
24022
|
try {
|
|
@@ -24118,7 +24041,7 @@ function loadSqlJs() {
|
|
|
24118
24041
|
return sqlPromise;
|
|
24119
24042
|
}
|
|
24120
24043
|
function fileVersion2(path) {
|
|
24121
|
-
const stat =
|
|
24044
|
+
const stat = statSync13(path);
|
|
24122
24045
|
return { size: stat.size, mtimeMs: stat.mtimeMs, ctimeMs: stat.ctimeMs };
|
|
24123
24046
|
}
|
|
24124
24047
|
function sameVersion(a, b) {
|
|
@@ -25069,7 +24992,7 @@ var init_openclaw_db = __esm(() => {
|
|
|
25069
24992
|
|
|
25070
24993
|
// lib/openclaw-sessions.ts
|
|
25071
24994
|
import { readFile as readFile7 } from "node:fs/promises";
|
|
25072
|
-
import { readdirSync as
|
|
24995
|
+
import { readdirSync as readdirSync7, statSync as statSync14 } from "node:fs";
|
|
25073
24996
|
import { homedir as homedir16 } from "node:os";
|
|
25074
24997
|
import { join as join17 } from "node:path";
|
|
25075
24998
|
function openclawHome() {
|
|
@@ -25192,7 +25115,7 @@ function openclawLinesToLogEntries(lines, source = "session") {
|
|
|
25192
25115
|
}
|
|
25193
25116
|
function listOpenClawAgents() {
|
|
25194
25117
|
try {
|
|
25195
|
-
return
|
|
25118
|
+
return readdirSync7(join17(openclawHome(), "agents"), { withFileTypes: true }).filter((d) => d.isDirectory() && !d.name.startsWith(".")).map((d) => d.name).sort();
|
|
25196
25119
|
} catch {
|
|
25197
25120
|
return [];
|
|
25198
25121
|
}
|
|
@@ -25202,7 +25125,7 @@ function listOpenClawTranscripts() {
|
|
|
25202
25125
|
const out = [];
|
|
25203
25126
|
let agentIds;
|
|
25204
25127
|
try {
|
|
25205
|
-
agentIds =
|
|
25128
|
+
agentIds = readdirSync7(agentsDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
|
|
25206
25129
|
} catch {
|
|
25207
25130
|
return out;
|
|
25208
25131
|
}
|
|
@@ -25210,7 +25133,7 @@ function listOpenClawTranscripts() {
|
|
|
25210
25133
|
const sessionsDir = join17(agentsDir, agentId, "sessions");
|
|
25211
25134
|
let files;
|
|
25212
25135
|
try {
|
|
25213
|
-
files =
|
|
25136
|
+
files = readdirSync7(sessionsDir);
|
|
25214
25137
|
} catch {
|
|
25215
25138
|
continue;
|
|
25216
25139
|
}
|
|
@@ -25222,7 +25145,7 @@ function listOpenClawTranscripts() {
|
|
|
25222
25145
|
continue;
|
|
25223
25146
|
const transcriptPath = join17(sessionsDir, file);
|
|
25224
25147
|
try {
|
|
25225
|
-
const st =
|
|
25148
|
+
const st = statSync14(transcriptPath);
|
|
25226
25149
|
out.push({
|
|
25227
25150
|
agentId,
|
|
25228
25151
|
sessionId,
|
|
@@ -25467,7 +25390,7 @@ var init_openclaw_projects = __esm(() => {
|
|
|
25467
25390
|
|
|
25468
25391
|
// lib/factory-sessions.ts
|
|
25469
25392
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
25470
|
-
import { readdirSync as
|
|
25393
|
+
import { readdirSync as readdirSync8, statSync as statSync15 } from "node:fs";
|
|
25471
25394
|
import { homedir as homedir17 } from "node:os";
|
|
25472
25395
|
import { join as join19 } from "node:path";
|
|
25473
25396
|
function factoryHome() {
|
|
@@ -25613,7 +25536,7 @@ function listFactoryTranscripts() {
|
|
|
25613
25536
|
const out = [];
|
|
25614
25537
|
let projectDirs;
|
|
25615
25538
|
try {
|
|
25616
|
-
projectDirs =
|
|
25539
|
+
projectDirs = readdirSync8(root, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
25617
25540
|
} catch {
|
|
25618
25541
|
return out;
|
|
25619
25542
|
}
|
|
@@ -25623,7 +25546,7 @@ function listFactoryTranscripts() {
|
|
|
25623
25546
|
const projectPath = join19(root, projectName);
|
|
25624
25547
|
let files;
|
|
25625
25548
|
try {
|
|
25626
|
-
files =
|
|
25549
|
+
files = readdirSync8(projectPath);
|
|
25627
25550
|
} catch {
|
|
25628
25551
|
continue;
|
|
25629
25552
|
}
|
|
@@ -25635,7 +25558,7 @@ function listFactoryTranscripts() {
|
|
|
25635
25558
|
continue;
|
|
25636
25559
|
const transcriptPath = join19(projectPath, file);
|
|
25637
25560
|
try {
|
|
25638
|
-
const st =
|
|
25561
|
+
const st = statSync15(transcriptPath);
|
|
25639
25562
|
out.push({ projectName, cwd, sessionId, transcriptPath, mtimeMs: st.mtimeMs, sizeBytes: st.size });
|
|
25640
25563
|
} catch {}
|
|
25641
25564
|
}
|
|
@@ -26055,7 +25978,7 @@ var init_devin_projects = __esm(() => {
|
|
|
26055
25978
|
|
|
26056
25979
|
// lib/antigravity-sessions.ts
|
|
26057
25980
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
26058
|
-
import { readdirSync as
|
|
25981
|
+
import { readdirSync as readdirSync9, statSync as statSync16 } from "node:fs";
|
|
26059
25982
|
import { homedir as homedir19 } from "node:os";
|
|
26060
25983
|
import { join as join21 } from "node:path";
|
|
26061
25984
|
function antigravityHome() {
|
|
@@ -26180,7 +26103,7 @@ function listAntigravityTranscripts() {
|
|
|
26180
26103
|
const out = [];
|
|
26181
26104
|
let convoDirs;
|
|
26182
26105
|
try {
|
|
26183
|
-
convoDirs =
|
|
26106
|
+
convoDirs = readdirSync9(root, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
26184
26107
|
} catch {
|
|
26185
26108
|
return out;
|
|
26186
26109
|
}
|
|
@@ -26190,7 +26113,7 @@ function listAntigravityTranscripts() {
|
|
|
26190
26113
|
continue;
|
|
26191
26114
|
const transcriptPath = join21(root, conversationId, rel);
|
|
26192
26115
|
try {
|
|
26193
|
-
const st =
|
|
26116
|
+
const st = statSync16(transcriptPath);
|
|
26194
26117
|
if (!st.isFile())
|
|
26195
26118
|
continue;
|
|
26196
26119
|
out.push({ conversationId, transcriptPath, mtimeMs: st.mtimeMs, sizeBytes: st.size });
|
|
@@ -26203,7 +26126,7 @@ function findAntigravityTranscript(conversationId) {
|
|
|
26203
26126
|
return null;
|
|
26204
26127
|
const transcriptPath = join21(antigravityBrainRoot(), conversationId, antigravityTranscriptRelPath());
|
|
26205
26128
|
try {
|
|
26206
|
-
if (
|
|
26129
|
+
if (statSync16(transcriptPath).isFile())
|
|
26207
26130
|
return transcriptPath;
|
|
26208
26131
|
} catch {}
|
|
26209
26132
|
return null;
|
|
@@ -27118,9 +27041,9 @@ var init_log_entries = __esm(() => {
|
|
|
27118
27041
|
});
|
|
27119
27042
|
|
|
27120
27043
|
// lib/codex-sessions.ts
|
|
27121
|
-
import { readFileSync as readFileSync15, readdirSync as
|
|
27044
|
+
import { readFileSync as readFileSync15, readdirSync as readdirSync10, existsSync as existsSync22, writeFileSync as writeFileSync9, mkdirSync as mkdirSync11, statSync as statSync17 } from "node:fs";
|
|
27122
27045
|
import { readFile as readFile11 } from "node:fs/promises";
|
|
27123
|
-
import { dirname as
|
|
27046
|
+
import { dirname as dirname13, join as join27 } from "node:path";
|
|
27124
27047
|
import { homedir as homedir21 } from "node:os";
|
|
27125
27048
|
function readCache() {
|
|
27126
27049
|
try {
|
|
@@ -27133,7 +27056,7 @@ function readCache() {
|
|
|
27133
27056
|
}
|
|
27134
27057
|
function writeCacheEntry(sessionId, path) {
|
|
27135
27058
|
try {
|
|
27136
|
-
mkdirSync11(
|
|
27059
|
+
mkdirSync11(dirname13(CACHE_PATH), { recursive: true });
|
|
27137
27060
|
const cache = readCache();
|
|
27138
27061
|
cache[sessionId] = path;
|
|
27139
27062
|
writeFileSync9(CACHE_PATH, JSON.stringify(cache), "utf-8");
|
|
@@ -27141,7 +27064,7 @@ function writeCacheEntry(sessionId, path) {
|
|
|
27141
27064
|
}
|
|
27142
27065
|
function dirSearch(dir, sessionId) {
|
|
27143
27066
|
try {
|
|
27144
|
-
for (const f of
|
|
27067
|
+
for (const f of readdirSync10(dir, { withFileTypes: true })) {
|
|
27145
27068
|
if (f.isFile() && f.name.includes(sessionId) && f.name.endsWith(".jsonl")) {
|
|
27146
27069
|
return join27(dir, f.name);
|
|
27147
27070
|
}
|
|
@@ -27171,13 +27094,13 @@ function findCodexTranscript(sessionId) {
|
|
|
27171
27094
|
}
|
|
27172
27095
|
}
|
|
27173
27096
|
try {
|
|
27174
|
-
for (const y of
|
|
27097
|
+
for (const y of readdirSync10(root, { withFileTypes: true })) {
|
|
27175
27098
|
if (!y.isDirectory())
|
|
27176
27099
|
continue;
|
|
27177
|
-
for (const m of
|
|
27100
|
+
for (const m of readdirSync10(join27(root, y.name), { withFileTypes: true })) {
|
|
27178
27101
|
if (!m.isDirectory())
|
|
27179
27102
|
continue;
|
|
27180
|
-
for (const d of
|
|
27103
|
+
for (const d of readdirSync10(join27(root, y.name, m.name), { withFileTypes: true })) {
|
|
27181
27104
|
if (!d.isDirectory())
|
|
27182
27105
|
continue;
|
|
27183
27106
|
const hit = dirSearch(join27(root, y.name, m.name, d.name), sessionId);
|
|
@@ -27446,7 +27369,7 @@ var init_resolve_permission_mode = __esm(() => {
|
|
|
27446
27369
|
});
|
|
27447
27370
|
|
|
27448
27371
|
// lib/copilot-sessions.ts
|
|
27449
|
-
import { readFileSync as readFileSync17, readdirSync as
|
|
27372
|
+
import { readFileSync as readFileSync17, readdirSync as readdirSync11, existsSync as existsSync23, statSync as statSync18 } from "node:fs";
|
|
27450
27373
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
27451
27374
|
import { join as join28, resolve as resolve17, sep as sep2 } from "node:path";
|
|
27452
27375
|
import { homedir as homedir22 } from "node:os";
|
|
@@ -27663,7 +27586,7 @@ var init_copilot_sessions = __esm(() => {
|
|
|
27663
27586
|
});
|
|
27664
27587
|
|
|
27665
27588
|
// lib/cursor-sessions.ts
|
|
27666
|
-
import { readFileSync as readFileSync18, readdirSync as
|
|
27589
|
+
import { readFileSync as readFileSync18, readdirSync as readdirSync12, existsSync as existsSync24, statSync as statSync19 } from "node:fs";
|
|
27667
27590
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
27668
27591
|
import { basename as basename6, join as join29, resolve as resolve18, sep as sep3 } from "node:path";
|
|
27669
27592
|
import { homedir as homedir23 } from "node:os";
|
|
@@ -27677,7 +27600,7 @@ function getCursorSessionDir(sessionId) {
|
|
|
27677
27600
|
const projectsRoot = resolve18(home, NEW_PROJECTS_DIR2);
|
|
27678
27601
|
let projectEntries = [];
|
|
27679
27602
|
try {
|
|
27680
|
-
projectEntries =
|
|
27603
|
+
projectEntries = readdirSync12(projectsRoot, { withFileTypes: true });
|
|
27681
27604
|
} catch {}
|
|
27682
27605
|
for (const entry of projectEntries) {
|
|
27683
27606
|
if (!entry.isDirectory())
|
|
@@ -27919,7 +27842,7 @@ var init_cursor_sessions = __esm(() => {
|
|
|
27919
27842
|
});
|
|
27920
27843
|
|
|
27921
27844
|
// lib/pi-sessions.ts
|
|
27922
|
-
import { readFileSync as readFileSync19, readdirSync as
|
|
27845
|
+
import { readFileSync as readFileSync19, readdirSync as readdirSync13, existsSync as existsSync25, statSync as statSync20 } from "node:fs";
|
|
27923
27846
|
import { readFile as readFile14 } from "node:fs/promises";
|
|
27924
27847
|
import { join as join30, resolve as resolve19, sep as sep4 } from "node:path";
|
|
27925
27848
|
import { homedir as homedir24 } from "node:os";
|
|
@@ -27935,7 +27858,7 @@ function findPiTranscript(sessionId) {
|
|
|
27935
27858
|
const root = resolve19(getPiSessionStateRoot());
|
|
27936
27859
|
let cwdDirs;
|
|
27937
27860
|
try {
|
|
27938
|
-
cwdDirs =
|
|
27861
|
+
cwdDirs = readdirSync13(root);
|
|
27939
27862
|
} catch {
|
|
27940
27863
|
return null;
|
|
27941
27864
|
}
|
|
@@ -27945,7 +27868,7 @@ function findPiTranscript(sessionId) {
|
|
|
27945
27868
|
continue;
|
|
27946
27869
|
let files;
|
|
27947
27870
|
try {
|
|
27948
|
-
files =
|
|
27871
|
+
files = readdirSync13(cwdPath);
|
|
27949
27872
|
} catch {
|
|
27950
27873
|
continue;
|
|
27951
27874
|
}
|
|
@@ -28595,7 +28518,7 @@ var init_pack_failclosed = __esm(() => {
|
|
|
28595
28518
|
});
|
|
28596
28519
|
|
|
28597
28520
|
// src/hooks/session-pause.ts
|
|
28598
|
-
import { existsSync as existsSync27, mkdirSync as mkdirSync12, readdirSync as
|
|
28521
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync12, readdirSync as readdirSync14, readFileSync as readFileSync21, rmSync as rmSync10 } from "node:fs";
|
|
28599
28522
|
import { createHash as createHash8 } from "node:crypto";
|
|
28600
28523
|
import { join as join31, resolve as resolve21 } from "node:path";
|
|
28601
28524
|
function pauseStateDir() {
|
|
@@ -28709,7 +28632,7 @@ function listActivePauses(now = Date.now()) {
|
|
|
28709
28632
|
const out = [];
|
|
28710
28633
|
let names;
|
|
28711
28634
|
try {
|
|
28712
|
-
names =
|
|
28635
|
+
names = readdirSync14(dir);
|
|
28713
28636
|
} catch {
|
|
28714
28637
|
return [];
|
|
28715
28638
|
}
|
|
@@ -28760,14 +28683,14 @@ import {
|
|
|
28760
28683
|
existsSync as existsSync28,
|
|
28761
28684
|
mkdirSync as mkdirSync13,
|
|
28762
28685
|
readFileSync as readFileSync22,
|
|
28763
|
-
readdirSync as
|
|
28686
|
+
readdirSync as readdirSync15,
|
|
28764
28687
|
renameSync as renameSync9,
|
|
28765
28688
|
rmSync as rmSync11,
|
|
28766
28689
|
rmdirSync,
|
|
28767
|
-
statSync as
|
|
28690
|
+
statSync as statSync21,
|
|
28768
28691
|
writeFileSync as writeFileSync11
|
|
28769
28692
|
} from "node:fs";
|
|
28770
|
-
import { dirname as
|
|
28693
|
+
import { dirname as dirname14, isAbsolute as isAbsolute3, relative as relative4, resolve as resolve22 } from "node:path";
|
|
28771
28694
|
function migrateConventionPolicies() {
|
|
28772
28695
|
const from = legacy.customPoliciesDir();
|
|
28773
28696
|
if (!existsSync28(from))
|
|
@@ -28776,7 +28699,7 @@ function migrateConventionPolicies() {
|
|
|
28776
28699
|
const mergeInto = (dir, dest, prefix) => {
|
|
28777
28700
|
let entries;
|
|
28778
28701
|
try {
|
|
28779
|
-
entries =
|
|
28702
|
+
entries = readdirSync15(dir, { withFileTypes: true });
|
|
28780
28703
|
} catch {
|
|
28781
28704
|
return;
|
|
28782
28705
|
}
|
|
@@ -28798,7 +28721,7 @@ function migrateConventionPolicies() {
|
|
|
28798
28721
|
} catch {}
|
|
28799
28722
|
continue;
|
|
28800
28723
|
}
|
|
28801
|
-
if (entry.isDirectory() &&
|
|
28724
|
+
if (entry.isDirectory() && statSync21(target).isDirectory()) {
|
|
28802
28725
|
mergeInto(source, target, `${name}/`);
|
|
28803
28726
|
try {
|
|
28804
28727
|
rmdirSync(source);
|
|
@@ -28822,7 +28745,7 @@ function migrateLegacySpool() {
|
|
|
28822
28745
|
continue;
|
|
28823
28746
|
try {
|
|
28824
28747
|
mkdirSync13(to, { recursive: true });
|
|
28825
|
-
for (const entry of
|
|
28748
|
+
for (const entry of readdirSync15(from, { withFileTypes: true })) {
|
|
28826
28749
|
if (!entry.isFile())
|
|
28827
28750
|
continue;
|
|
28828
28751
|
let name = entry.name;
|
|
@@ -28849,7 +28772,7 @@ function migrateHookActivity() {
|
|
|
28849
28772
|
return [];
|
|
28850
28773
|
const moved = [];
|
|
28851
28774
|
try {
|
|
28852
|
-
const entries =
|
|
28775
|
+
const entries = readdirSync15(from, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl"));
|
|
28853
28776
|
if (entries.length === 0)
|
|
28854
28777
|
return [];
|
|
28855
28778
|
const to = hookActivityDir();
|
|
@@ -28965,7 +28888,7 @@ function writeCarriedPolicyConfig(carried) {
|
|
|
28965
28888
|
}
|
|
28966
28889
|
} catch {}
|
|
28967
28890
|
try {
|
|
28968
|
-
mkdirSync13(
|
|
28891
|
+
mkdirSync13(dirname14(to), { recursive: true });
|
|
28969
28892
|
writeFileSync11(to, JSON.stringify({ ...existing, ...carried }, null, 2) + `
|
|
28970
28893
|
`, "utf8");
|
|
28971
28894
|
} catch {
|
|
@@ -29157,12 +29080,12 @@ var init_untraced_note = __esm(() => {
|
|
|
29157
29080
|
});
|
|
29158
29081
|
|
|
29159
29082
|
// src/hooks/agent-roster.ts
|
|
29160
|
-
import { lstatSync as lstatSync4, readFileSync as readFileSync24, statSync as
|
|
29083
|
+
import { lstatSync as lstatSync4, readFileSync as readFileSync24, statSync as statSync22 } from "node:fs";
|
|
29161
29084
|
import { homedir as homedir26 } from "node:os";
|
|
29162
|
-
import { dirname as
|
|
29085
|
+
import { dirname as dirname15, resolve as resolve23 } from "node:path";
|
|
29163
29086
|
function installedHookAt2(path, cli) {
|
|
29164
29087
|
try {
|
|
29165
|
-
const stat =
|
|
29088
|
+
const stat = statSync22(path);
|
|
29166
29089
|
if (!stat.isFile() || stat.size > 131072)
|
|
29167
29090
|
return false;
|
|
29168
29091
|
const text = readFileSync24(path, "utf8");
|
|
@@ -29220,7 +29143,7 @@ function runtimeAgentSettingsPath2(cli, cwd, userHome = homedir26(), hookScope)
|
|
|
29220
29143
|
if (installedHookAt2(path, cli))
|
|
29221
29144
|
matches.add(path);
|
|
29222
29145
|
}
|
|
29223
|
-
const parent =
|
|
29146
|
+
const parent = dirname15(dir);
|
|
29224
29147
|
if (parent === dir)
|
|
29225
29148
|
break;
|
|
29226
29149
|
dir = parent;
|
|
@@ -29313,8 +29236,8 @@ var init_agent_roster2 = __esm(() => {
|
|
|
29313
29236
|
});
|
|
29314
29237
|
|
|
29315
29238
|
// src/hooks/semantic/jev-config.ts
|
|
29316
|
-
import { closeSync as closeSync3, constants as fsConstants4, fstatSync as fstatSync2, openSync as openSync3, readSync as readSync2, statSync as
|
|
29317
|
-
import { dirname as
|
|
29239
|
+
import { closeSync as closeSync3, constants as fsConstants4, fstatSync as fstatSync2, openSync as openSync3, readSync as readSync2, statSync as statSync23 } from "node:fs";
|
|
29240
|
+
import { dirname as dirname16 } from "node:path";
|
|
29318
29241
|
function parseJevMode(raw) {
|
|
29319
29242
|
return raw === "off" || raw === "observe" || raw === "enforce" ? raw : null;
|
|
29320
29243
|
}
|
|
@@ -29574,7 +29497,7 @@ function looseConfigDirMode(path) {
|
|
|
29574
29497
|
if (!modesAreMeaningful())
|
|
29575
29498
|
return null;
|
|
29576
29499
|
try {
|
|
29577
|
-
const mode =
|
|
29500
|
+
const mode = statSync23(dirname16(path)).mode & 511;
|
|
29578
29501
|
return (mode & DIR_WRITABLE_BY_OTHERS2) !== 0 ? mode : null;
|
|
29579
29502
|
} catch {
|
|
29580
29503
|
return null;
|
|
@@ -29635,8 +29558,8 @@ function inspectJevConfig() {
|
|
|
29635
29558
|
path,
|
|
29636
29559
|
mode,
|
|
29637
29560
|
reason: "too-open",
|
|
29638
|
-
problem: `its directory ${
|
|
29639
|
-
fix: `chmod 700 ${
|
|
29561
|
+
problem: `its directory ${dirname16(path)} is ${dirMode.toString(8).padStart(4, "0")} — other users can write there, ` + `so they can put their own config in its place; it must be owner-only (chmod 700 ${dirname16(path)})`,
|
|
29562
|
+
fix: `chmod 700 ${dirname16(path)}`
|
|
29640
29563
|
};
|
|
29641
29564
|
}
|
|
29642
29565
|
if (st.size > MAX_CONFIG_BYTES)
|
|
@@ -29755,14 +29678,14 @@ function jevInputsVersion() {
|
|
|
29755
29678
|
process.platform,
|
|
29756
29679
|
credentials,
|
|
29757
29680
|
statVersion(credentials),
|
|
29758
|
-
statVersion(
|
|
29681
|
+
statVersion(dirname16(credentials)),
|
|
29759
29682
|
config,
|
|
29760
29683
|
statVersion(config)
|
|
29761
29684
|
].join("\x00");
|
|
29762
29685
|
}
|
|
29763
29686
|
function statVersion(path) {
|
|
29764
29687
|
try {
|
|
29765
|
-
const st =
|
|
29688
|
+
const st = statSync23(path, { bigint: true });
|
|
29766
29689
|
return `${st.dev}:${st.ino}:${st.mode}:${st.size}:${st.mtimeNs}:${st.ctimeNs}`;
|
|
29767
29690
|
} catch (err) {
|
|
29768
29691
|
return `-${err.code ?? "error"}`;
|
|
@@ -29990,9 +29913,9 @@ var init_cloud_jev_health = __esm(() => {
|
|
|
29990
29913
|
});
|
|
29991
29914
|
|
|
29992
29915
|
// src/hooks/semantic/facts.ts
|
|
29993
|
-
import { existsSync as existsSync30, readFileSync as readFileSync25, statSync as
|
|
29916
|
+
import { existsSync as existsSync30, readFileSync as readFileSync25, statSync as statSync24 } from "node:fs";
|
|
29994
29917
|
import { homedir as homedir27 } from "node:os";
|
|
29995
|
-
import { dirname as
|
|
29918
|
+
import { dirname as dirname17, isAbsolute as isAbsolute4, resolve as resolve24 } from "node:path";
|
|
29996
29919
|
function classifyTool(toolName) {
|
|
29997
29920
|
if (SHELL_TOOLS.has(toolName))
|
|
29998
29921
|
return { toolClass: "shell", toolIsKnown: true };
|
|
@@ -30219,7 +30142,7 @@ function findGitDir(start) {
|
|
|
30219
30142
|
const candidate = resolve24(dir, ".git");
|
|
30220
30143
|
if (existsSync30(candidate))
|
|
30221
30144
|
return candidate;
|
|
30222
|
-
const parent =
|
|
30145
|
+
const parent = dirname17(dir);
|
|
30223
30146
|
if (parent === dir)
|
|
30224
30147
|
return null;
|
|
30225
30148
|
dir = parent;
|
|
@@ -30230,7 +30153,7 @@ function findProjectRoot(cwd) {
|
|
|
30230
30153
|
if (!cwd)
|
|
30231
30154
|
return null;
|
|
30232
30155
|
const gitDir = findGitDir(cwd);
|
|
30233
|
-
return gitDir ?
|
|
30156
|
+
return gitDir ? dirname17(gitDir) : cwd;
|
|
30234
30157
|
}
|
|
30235
30158
|
function readCurrentBranch(cwd) {
|
|
30236
30159
|
if (!cwd)
|
|
@@ -30240,12 +30163,12 @@ function readCurrentBranch(cwd) {
|
|
|
30240
30163
|
if (!gitPath)
|
|
30241
30164
|
return null;
|
|
30242
30165
|
let headFile = resolve24(gitPath, "HEAD");
|
|
30243
|
-
if (
|
|
30166
|
+
if (statSync24(gitPath).isFile()) {
|
|
30244
30167
|
const pointer = readFileSync25(gitPath, "utf8").trim();
|
|
30245
30168
|
const m = /^gitdir:\s*(.+)$/.exec(pointer);
|
|
30246
30169
|
if (!m)
|
|
30247
30170
|
return null;
|
|
30248
|
-
headFile = resolve24(
|
|
30171
|
+
headFile = resolve24(dirname17(gitPath), m[1], "HEAD");
|
|
30249
30172
|
}
|
|
30250
30173
|
const head = readFileSync25(headFile, "utf8").trim();
|
|
30251
30174
|
const ref = /^ref:\s*refs\/heads\/(.+)$/.exec(head);
|
|
@@ -30640,15 +30563,15 @@ import {
|
|
|
30640
30563
|
closeSync as closeSync4,
|
|
30641
30564
|
mkdirSync as mkdirSync14,
|
|
30642
30565
|
openSync as openSync4,
|
|
30643
|
-
readdirSync as
|
|
30566
|
+
readdirSync as readdirSync16,
|
|
30644
30567
|
readFileSync as readFileSync26,
|
|
30645
30568
|
readSync as readSync3,
|
|
30646
30569
|
renameSync as renameSync10,
|
|
30647
|
-
statSync as
|
|
30570
|
+
statSync as statSync25,
|
|
30648
30571
|
unlinkSync as unlinkSync4,
|
|
30649
30572
|
writeFileSync as writeFileSync12
|
|
30650
30573
|
} from "node:fs";
|
|
30651
|
-
import { dirname as
|
|
30574
|
+
import { dirname as dirname18, resolve as resolve25 } from "node:path";
|
|
30652
30575
|
function intentProfileKey(profile) {
|
|
30653
30576
|
if (validAgentIdentity(profile.agent))
|
|
30654
30577
|
return `${profile.agent.integration}.${profile.agent.instanceId}`;
|
|
@@ -30674,7 +30597,7 @@ function storeDirChain(innermost = sessionsDir()) {
|
|
|
30674
30597
|
chain.push(dir);
|
|
30675
30598
|
if (dir === home)
|
|
30676
30599
|
break;
|
|
30677
|
-
const parent =
|
|
30600
|
+
const parent = dirname18(dir);
|
|
30678
30601
|
if (parent === dir)
|
|
30679
30602
|
break;
|
|
30680
30603
|
dir = parent;
|
|
@@ -30687,7 +30610,7 @@ function looseIntentStoreDir(innermost) {
|
|
|
30687
30610
|
for (const dir of storeDirChain(innermost)) {
|
|
30688
30611
|
let mode;
|
|
30689
30612
|
try {
|
|
30690
|
-
mode =
|
|
30613
|
+
mode = statSync25(dir).mode & 511;
|
|
30691
30614
|
} catch {
|
|
30692
30615
|
continue;
|
|
30693
30616
|
}
|
|
@@ -30695,7 +30618,7 @@ function looseIntentStoreDir(innermost) {
|
|
|
30695
30618
|
continue;
|
|
30696
30619
|
try {
|
|
30697
30620
|
chmodSync7(dir, mode & ~DIR_WRITABLE_BY_OTHERS3);
|
|
30698
|
-
if ((
|
|
30621
|
+
if ((statSync25(dir).mode & DIR_WRITABLE_BY_OTHERS3) !== 0)
|
|
30699
30622
|
return dir;
|
|
30700
30623
|
} catch {
|
|
30701
30624
|
return dir;
|
|
@@ -30732,7 +30655,7 @@ function appendPrompt(slot, entry) {
|
|
|
30732
30655
|
}
|
|
30733
30656
|
function fileExists2(path) {
|
|
30734
30657
|
try {
|
|
30735
|
-
|
|
30658
|
+
statSync25(path);
|
|
30736
30659
|
return true;
|
|
30737
30660
|
} catch {
|
|
30738
30661
|
return false;
|
|
@@ -30742,12 +30665,12 @@ function pruneExpiredSessions(now = Date.now()) {
|
|
|
30742
30665
|
const root = sessionsDir();
|
|
30743
30666
|
let removed = pruneDir(root, now);
|
|
30744
30667
|
try {
|
|
30745
|
-
for (const name of
|
|
30668
|
+
for (const name of readdirSync16(root)) {
|
|
30746
30669
|
if (!PROFILE_DIR_RE.test(name))
|
|
30747
30670
|
continue;
|
|
30748
30671
|
const dir = resolve25(root, name);
|
|
30749
30672
|
try {
|
|
30750
|
-
if (
|
|
30673
|
+
if (statSync25(dir).isDirectory())
|
|
30751
30674
|
removed += pruneDir(dir, now);
|
|
30752
30675
|
} catch {}
|
|
30753
30676
|
}
|
|
@@ -30757,12 +30680,12 @@ function pruneExpiredSessions(now = Date.now()) {
|
|
|
30757
30680
|
function pruneDir(dir, now) {
|
|
30758
30681
|
let removed = 0;
|
|
30759
30682
|
try {
|
|
30760
|
-
for (const name of
|
|
30683
|
+
for (const name of readdirSync16(dir)) {
|
|
30761
30684
|
if (!SESSION_FILE_RE3.test(name))
|
|
30762
30685
|
continue;
|
|
30763
30686
|
const path = resolve25(dir, name);
|
|
30764
30687
|
try {
|
|
30765
|
-
const st =
|
|
30688
|
+
const st = statSync25(path);
|
|
30766
30689
|
if (st.isFile() && now - st.mtimeMs > INTENT_MAX_AGE_MS) {
|
|
30767
30690
|
unlinkSync4(path);
|
|
30768
30691
|
removed++;
|
|
@@ -31077,7 +31000,7 @@ function visitLinesBackwards(transcriptPath, maxBytes, visit) {
|
|
|
31077
31000
|
return;
|
|
31078
31001
|
let fd;
|
|
31079
31002
|
try {
|
|
31080
|
-
const st =
|
|
31003
|
+
const st = statSync25(path);
|
|
31081
31004
|
if (!st.isFile() || st.size === 0)
|
|
31082
31005
|
return;
|
|
31083
31006
|
fd = openSync4(path, "r");
|
|
@@ -31713,7 +31636,7 @@ var init_jev_client = __esm(() => {
|
|
|
31713
31636
|
|
|
31714
31637
|
// src/hooks/semantic/evaluator.ts
|
|
31715
31638
|
import { createHash as createHash9 } from "node:crypto";
|
|
31716
|
-
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync15, renameSync as renameSync11, statSync as
|
|
31639
|
+
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync15, renameSync as renameSync11, statSync as statSync26 } from "node:fs";
|
|
31717
31640
|
import { resolve as resolve26 } from "node:path";
|
|
31718
31641
|
function storeCut(message) {
|
|
31719
31642
|
return typeof message === "string" && message.length >= MAX_USER_MESSAGE_CHARS - STORE_CUT_SLACK && OMISSION_MARK.test(message);
|
|
@@ -31887,7 +31810,7 @@ function appendVerdictLog(row) {
|
|
|
31887
31810
|
const file = verdictLogFile();
|
|
31888
31811
|
mkdirSync15(semanticDir(), { recursive: true, mode: 448 });
|
|
31889
31812
|
try {
|
|
31890
|
-
if (
|
|
31813
|
+
if (statSync26(file).size > VERDICT_LOG_MAX_BYTES)
|
|
31891
31814
|
renameSync11(file, `${file}.1`);
|
|
31892
31815
|
} catch {}
|
|
31893
31816
|
appendFileSync3(file, JSON.stringify(row) + `
|
|
@@ -32612,7 +32535,7 @@ var init_jev_throttle = __esm(() => {
|
|
|
32612
32535
|
});
|
|
32613
32536
|
|
|
32614
32537
|
// src/hooks/semantic/session-root.ts
|
|
32615
|
-
import { mkdirSync as mkdirSync16, readdirSync as
|
|
32538
|
+
import { mkdirSync as mkdirSync16, readdirSync as readdirSync17, readFileSync as readFileSync27, statSync as statSync27, unlinkSync as unlinkSync5, writeFileSync as writeFileSync13 } from "node:fs";
|
|
32616
32539
|
import { isAbsolute as isAbsolute5, resolve as resolve27 } from "node:path";
|
|
32617
32540
|
function validRoot(v) {
|
|
32618
32541
|
return typeof v === "string" && isAbsolute5(v) && resolve27(v) === v && v !== "/";
|
|
@@ -32623,7 +32546,7 @@ function storeIsOurs() {
|
|
|
32623
32546
|
if (looseIntentStoreDir() !== null)
|
|
32624
32547
|
return false;
|
|
32625
32548
|
try {
|
|
32626
|
-
const mode =
|
|
32549
|
+
const mode = statSync27(rootsDir()).mode & 511;
|
|
32627
32550
|
return (mode & DIR_WRITABLE_BY_OTHERS4) === 0;
|
|
32628
32551
|
} catch {
|
|
32629
32552
|
return true;
|
|
@@ -32641,12 +32564,12 @@ function pruneSessionRoots(now = Date.now()) {
|
|
|
32641
32564
|
let removed = 0;
|
|
32642
32565
|
try {
|
|
32643
32566
|
const dir = rootsDir();
|
|
32644
|
-
for (const name of
|
|
32567
|
+
for (const name of readdirSync17(dir)) {
|
|
32645
32568
|
if (!ROOT_FILE_RE.test(name))
|
|
32646
32569
|
continue;
|
|
32647
32570
|
const path = resolve27(dir, name);
|
|
32648
32571
|
try {
|
|
32649
|
-
const st =
|
|
32572
|
+
const st = statSync27(path);
|
|
32650
32573
|
if (st.isFile() && now - st.mtimeMs > SESSION_ROOT_MAX_AGE_MS) {
|
|
32651
32574
|
unlinkSync5(path);
|
|
32652
32575
|
removed++;
|
|
@@ -34585,8 +34508,8 @@ var init_collector_config = __esm(() => {
|
|
|
34585
34508
|
});
|
|
34586
34509
|
|
|
34587
34510
|
// src/hooks/flush-cli.ts
|
|
34588
|
-
import { existsSync as existsSync32, mkdirSync as mkdirSync17, writeFileSync as writeFileSync14, readdirSync as
|
|
34589
|
-
import { dirname as
|
|
34511
|
+
import { existsSync as existsSync32, mkdirSync as mkdirSync17, writeFileSync as writeFileSync14, readdirSync as readdirSync18, statSync as statSync28 } from "node:fs";
|
|
34512
|
+
import { dirname as dirname19, join as join33 } from "node:path";
|
|
34590
34513
|
function flushRequestPath(home) {
|
|
34591
34514
|
return join33(failproofaiHome(home), "state", "flush-request.json");
|
|
34592
34515
|
}
|
|
@@ -34596,14 +34519,14 @@ function spoolDirs(home) {
|
|
|
34596
34519
|
if (!existsSync32(root))
|
|
34597
34520
|
return dirs;
|
|
34598
34521
|
try {
|
|
34599
|
-
return dirs.concat(
|
|
34522
|
+
return dirs.concat(readdirSync18(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "failed").map((e) => join33(root, e.name)));
|
|
34600
34523
|
} catch {
|
|
34601
34524
|
return dirs;
|
|
34602
34525
|
}
|
|
34603
34526
|
}
|
|
34604
34527
|
function parkedBatches(home) {
|
|
34605
34528
|
try {
|
|
34606
|
-
return
|
|
34529
|
+
return readdirSync18(failedDir(home)).filter((f) => f.endsWith(".jsonl")).length;
|
|
34607
34530
|
} catch {
|
|
34608
34531
|
return 0;
|
|
34609
34532
|
}
|
|
@@ -34620,14 +34543,14 @@ function spoolBacklog(home, now = Date.now()) {
|
|
|
34620
34543
|
for (const dir of spoolDirs(home)) {
|
|
34621
34544
|
let names;
|
|
34622
34545
|
try {
|
|
34623
|
-
names =
|
|
34546
|
+
names = readdirSync18(dir).filter((f) => f.endsWith(".jsonl"));
|
|
34624
34547
|
} catch {
|
|
34625
34548
|
continue;
|
|
34626
34549
|
}
|
|
34627
34550
|
count += names.length;
|
|
34628
34551
|
for (const name of names) {
|
|
34629
34552
|
try {
|
|
34630
|
-
const mtime =
|
|
34553
|
+
const mtime = statSync28(join33(dir, name)).mtimeMs;
|
|
34631
34554
|
if (oldest === undefined || mtime < oldest)
|
|
34632
34555
|
oldest = mtime;
|
|
34633
34556
|
} catch {}
|
|
@@ -34689,7 +34612,7 @@ async function runFlushCommand(opts = {}) {
|
|
|
34689
34612
|
return { exitCode: 0, pending: 0, lines: nothing };
|
|
34690
34613
|
}
|
|
34691
34614
|
const path = flushRequestPath(home);
|
|
34692
|
-
mkdirSync17(
|
|
34615
|
+
mkdirSync17(dirname19(path), { recursive: true });
|
|
34693
34616
|
writeFileSync14(path, `${JSON.stringify({ requestedAtMs: Date.now() }, null, 2)}
|
|
34694
34617
|
`, {
|
|
34695
34618
|
mode: 384
|
|
@@ -34733,7 +34656,7 @@ import {
|
|
|
34733
34656
|
rmSync as rmSync12,
|
|
34734
34657
|
writeFileSync as writeFileSync15
|
|
34735
34658
|
} from "node:fs";
|
|
34736
|
-
import { basename as basename7, dirname as
|
|
34659
|
+
import { basename as basename7, dirname as dirname20, join as join34, resolve as resolve28 } from "node:path";
|
|
34737
34660
|
function migrateToLayout4() {
|
|
34738
34661
|
const moves = [
|
|
34739
34662
|
{ from: legacy.authJson(), to: auditSessionFile() },
|
|
@@ -34755,7 +34678,7 @@ function migrateToLayout4() {
|
|
|
34755
34678
|
rmSync12(from, { force: true });
|
|
34756
34679
|
continue;
|
|
34757
34680
|
}
|
|
34758
|
-
mkdirSync18(
|
|
34681
|
+
mkdirSync18(dirname20(to), { recursive: true });
|
|
34759
34682
|
try {
|
|
34760
34683
|
renameSync12(from, to);
|
|
34761
34684
|
} catch {
|
|
@@ -35192,7 +35115,7 @@ var init_install_telemetry = () => {};
|
|
|
35192
35115
|
|
|
35193
35116
|
// lib/install-check.ts
|
|
35194
35117
|
import { existsSync as existsSync34, readFileSync as readFileSync30, writeFileSync as writeFileSync17, mkdirSync as mkdirSync20 } from "node:fs";
|
|
35195
|
-
import { dirname as
|
|
35118
|
+
import { dirname as dirname21, resolve as resolve29 } from "node:path";
|
|
35196
35119
|
import { platform as platform2, arch as arch2, release, homedir as homedir29, hostname as hostname2 } from "node:os";
|
|
35197
35120
|
import { createHmac as createHmac2 } from "node:crypto";
|
|
35198
35121
|
function hashToId4(raw) {
|
|
@@ -35326,7 +35249,7 @@ async function maybeReportInstall(version) {
|
|
|
35326
35249
|
enabled_policy_count: hooks.policyCount
|
|
35327
35250
|
}, { version, timeoutMs: REPORT_TIMEOUT_MS, enabled: telemetryEnabled }));
|
|
35328
35251
|
try {
|
|
35329
|
-
mkdirSync20(
|
|
35252
|
+
mkdirSync20(dirname21(versionFile), { recursive: true });
|
|
35330
35253
|
writeFileSync17(versionFile, version, "utf8");
|
|
35331
35254
|
} catch {}
|
|
35332
35255
|
await Promise.all(events.map((p) => p.catch(() => {})));
|
|
@@ -36794,7 +36717,7 @@ var init_cloud_introspect = __esm(() => {
|
|
|
36794
36717
|
|
|
36795
36718
|
// src/hooks/credential-recovery.ts
|
|
36796
36719
|
import { createHash as createHash11 } from "node:crypto";
|
|
36797
|
-
import { existsSync as existsSync40, mkdirSync as mkdirSync22, readdirSync as
|
|
36720
|
+
import { existsSync as existsSync40, mkdirSync as mkdirSync22, readdirSync as readdirSync19, renameSync as renameSync13 } from "node:fs";
|
|
36798
36721
|
import { join as join38 } from "node:path";
|
|
36799
36722
|
function previousOrgDirectory(id) {
|
|
36800
36723
|
const safe = id && /^[A-Za-z0-9_-]{1,128}$/.test(id) ? id : id ? createHash11("sha256").update(id).digest("hex") : "unknown";
|
|
@@ -36805,7 +36728,7 @@ function recoverCredentialRefusals(sameOrg, oldOrgId) {
|
|
|
36805
36728
|
if (!existsSync40(dir))
|
|
36806
36729
|
return 0;
|
|
36807
36730
|
let recovered = 0;
|
|
36808
|
-
for (const name of
|
|
36731
|
+
for (const name of readdirSync19(dir)) {
|
|
36809
36732
|
if (!/\.c(401|403)\.jsonl$/.test(name) || name.startsWith("."))
|
|
36810
36733
|
continue;
|
|
36811
36734
|
const targetDir = sameOrg ? dir : join38(previousOrgDirectory(oldOrgId), "failed");
|
|
@@ -36842,11 +36765,11 @@ import {
|
|
|
36842
36765
|
readSync as readSync4,
|
|
36843
36766
|
renameSync as renameSync14,
|
|
36844
36767
|
rmSync as rmSync15,
|
|
36845
|
-
statSync as
|
|
36768
|
+
statSync as statSync29,
|
|
36846
36769
|
unlinkSync as unlinkSync6,
|
|
36847
36770
|
writeFileSync as writeFileSync18
|
|
36848
36771
|
} from "node:fs";
|
|
36849
|
-
import { dirname as
|
|
36772
|
+
import { dirname as dirname22 } from "node:path";
|
|
36850
36773
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
36851
36774
|
function writeCloudJevConfig(cloudBase) {
|
|
36852
36775
|
const first = writeCloudJevConfigIfAbsent(cloudBase);
|
|
@@ -36927,7 +36850,7 @@ function writeCloudJevConfigIfAbsent(cloudBase) {
|
|
|
36927
36850
|
return kept(path, cloudBase);
|
|
36928
36851
|
const body = `${JSON.stringify({ provider: JEV_CLOUD_PROVIDER, baseUrl, mode: CLOUD_JEV_INITIAL_MODE }, null, 2)}
|
|
36929
36852
|
`;
|
|
36930
|
-
const dir =
|
|
36853
|
+
const dir = dirname22(path);
|
|
36931
36854
|
const tmp = `${path}.${process.pid}.${randomBytes3(6).toString("hex")}.tmp`;
|
|
36932
36855
|
try {
|
|
36933
36856
|
if (!existsSync41(dir))
|
|
@@ -36992,7 +36915,7 @@ function tightenDir(dir) {
|
|
|
36992
36915
|
if (process.platform === "win32")
|
|
36993
36916
|
return;
|
|
36994
36917
|
try {
|
|
36995
|
-
const before =
|
|
36918
|
+
const before = statSync29(dir).mode & 511;
|
|
36996
36919
|
if ((before & 18) !== 0)
|
|
36997
36920
|
chmodSync9(dir, before & ~18);
|
|
36998
36921
|
} catch {}
|
|
@@ -37415,8 +37338,8 @@ var init_cloud_connection = __esm(() => {
|
|
|
37415
37338
|
});
|
|
37416
37339
|
|
|
37417
37340
|
// src/hooks/setup-state.ts
|
|
37418
|
-
import { existsSync as existsSync42, realpathSync as realpathSync4, statSync as
|
|
37419
|
-
import { dirname as
|
|
37341
|
+
import { existsSync as existsSync42, realpathSync as realpathSync4, statSync as statSync30 } from "node:fs";
|
|
37342
|
+
import { dirname as dirname23, resolve as resolve32 } from "node:path";
|
|
37420
37343
|
import { homedir as homedir31 } from "node:os";
|
|
37421
37344
|
function globalConfigPath(home = homedir31()) {
|
|
37422
37345
|
return globalPolicyConfigFile(home);
|
|
@@ -37429,7 +37352,7 @@ function legacyMarkerPath(home) {
|
|
|
37429
37352
|
}
|
|
37430
37353
|
function isDir(path) {
|
|
37431
37354
|
try {
|
|
37432
|
-
return
|
|
37355
|
+
return statSync30(path).isDirectory();
|
|
37433
37356
|
} catch {
|
|
37434
37357
|
return false;
|
|
37435
37358
|
}
|
|
@@ -37440,7 +37363,7 @@ function findProjectRoot2(start, home = homedir31()) {
|
|
|
37440
37363
|
while (dir !== resolvedHome) {
|
|
37441
37364
|
if (isDir(resolve32(dir, ".failproofai")))
|
|
37442
37365
|
return dir;
|
|
37443
|
-
const parent =
|
|
37366
|
+
const parent = dirname23(dir);
|
|
37444
37367
|
if (parent === dir)
|
|
37445
37368
|
break;
|
|
37446
37369
|
dir = parent;
|
|
@@ -37490,7 +37413,7 @@ var init_setup_state = __esm(() => {
|
|
|
37490
37413
|
|
|
37491
37414
|
// src/hooks/onboarding-attempt.ts
|
|
37492
37415
|
import { existsSync as existsSync43, mkdirSync as mkdirSync24, readFileSync as readFileSync34, rmSync as rmSync17, writeFileSync as writeFileSync19 } from "node:fs";
|
|
37493
|
-
import { dirname as
|
|
37416
|
+
import { dirname as dirname24 } from "node:path";
|
|
37494
37417
|
function readOnboardingAttempt() {
|
|
37495
37418
|
const path = onboardingAttemptFile();
|
|
37496
37419
|
if (!existsSync43(path))
|
|
@@ -37515,7 +37438,7 @@ function readOnboardingAttempt() {
|
|
|
37515
37438
|
function recordOnboardingAttempt(reason, cliVersion, daemonStatus, now = Date.now()) {
|
|
37516
37439
|
try {
|
|
37517
37440
|
const path = onboardingAttemptFile();
|
|
37518
|
-
mkdirSync24(
|
|
37441
|
+
mkdirSync24(dirname24(path), { recursive: true });
|
|
37519
37442
|
const record = {
|
|
37520
37443
|
schemaVersion: SCHEMA_VERSION3,
|
|
37521
37444
|
reason,
|
|
@@ -37623,7 +37546,7 @@ var init_onboarding_lock = __esm(() => {
|
|
|
37623
37546
|
});
|
|
37624
37547
|
|
|
37625
37548
|
// lib/claude-sessions.ts
|
|
37626
|
-
import { readdirSync as
|
|
37549
|
+
import { readdirSync as readdirSync20, statSync as statSync31, existsSync as existsSync44 } from "node:fs";
|
|
37627
37550
|
import { join as join39, basename as basename9 } from "node:path";
|
|
37628
37551
|
function getClaudeProjectsRoot() {
|
|
37629
37552
|
return getClaudeProjectsPath();
|
|
@@ -37632,7 +37555,7 @@ function listClaudeProjects() {
|
|
|
37632
37555
|
const root = getClaudeProjectsRoot();
|
|
37633
37556
|
let entries;
|
|
37634
37557
|
try {
|
|
37635
|
-
entries =
|
|
37558
|
+
entries = readdirSync20(root, { withFileTypes: true });
|
|
37636
37559
|
} catch {
|
|
37637
37560
|
return [];
|
|
37638
37561
|
}
|
|
@@ -37646,7 +37569,7 @@ function listClaudeTranscripts(project) {
|
|
|
37646
37569
|
const out = [];
|
|
37647
37570
|
let entries;
|
|
37648
37571
|
try {
|
|
37649
|
-
entries =
|
|
37572
|
+
entries = readdirSync20(project.path, { withFileTypes: true });
|
|
37650
37573
|
} catch {
|
|
37651
37574
|
return out;
|
|
37652
37575
|
}
|
|
@@ -37657,7 +37580,7 @@ function listClaudeTranscripts(project) {
|
|
|
37657
37580
|
continue;
|
|
37658
37581
|
const transcriptPath = join39(project.path, entry.name);
|
|
37659
37582
|
try {
|
|
37660
|
-
const s =
|
|
37583
|
+
const s = statSync31(transcriptPath);
|
|
37661
37584
|
out.push({
|
|
37662
37585
|
projectName: project.name,
|
|
37663
37586
|
cwd: project.cwd,
|
|
@@ -37674,7 +37597,7 @@ function listClaudeTranscripts(project) {
|
|
|
37674
37597
|
continue;
|
|
37675
37598
|
let subEntries;
|
|
37676
37599
|
try {
|
|
37677
|
-
subEntries =
|
|
37600
|
+
subEntries = readdirSync20(subDir, { withFileTypes: true });
|
|
37678
37601
|
} catch {
|
|
37679
37602
|
continue;
|
|
37680
37603
|
}
|
|
@@ -37684,7 +37607,7 @@ function listClaudeTranscripts(project) {
|
|
|
37684
37607
|
const agentId = sub.name.slice(0, -".jsonl".length);
|
|
37685
37608
|
const transcriptPath = join39(subDir, sub.name);
|
|
37686
37609
|
try {
|
|
37687
|
-
const s =
|
|
37610
|
+
const s = statSync31(transcriptPath);
|
|
37688
37611
|
out.push({
|
|
37689
37612
|
projectName: project.name,
|
|
37690
37613
|
cwd: project.cwd,
|
|
@@ -37900,7 +37823,7 @@ var init_claude = __esm(() => {
|
|
|
37900
37823
|
});
|
|
37901
37824
|
|
|
37902
37825
|
// src/audit/cli-adapters/codex.ts
|
|
37903
|
-
import { statSync as
|
|
37826
|
+
import { statSync as statSync32 } from "node:fs";
|
|
37904
37827
|
async function listCodexTranscriptMetadata(opts = {}) {
|
|
37905
37828
|
const projectFilter = opts.projects ? new Set(opts.projects) : null;
|
|
37906
37829
|
const sinceMs = opts.sinceMs ?? 0;
|
|
@@ -37917,7 +37840,7 @@ async function listCodexTranscriptMetadata(opts = {}) {
|
|
|
37917
37840
|
continue;
|
|
37918
37841
|
let sizeBytes = 0;
|
|
37919
37842
|
try {
|
|
37920
|
-
sizeBytes =
|
|
37843
|
+
sizeBytes = statSync32(s.path).size;
|
|
37921
37844
|
} catch {}
|
|
37922
37845
|
if (!s.sessionId)
|
|
37923
37846
|
continue;
|
|
@@ -37951,7 +37874,7 @@ var init_codex = __esm(() => {
|
|
|
37951
37874
|
});
|
|
37952
37875
|
|
|
37953
37876
|
// src/audit/cli-adapters/copilot.ts
|
|
37954
|
-
import { statSync as
|
|
37877
|
+
import { statSync as statSync33 } from "node:fs";
|
|
37955
37878
|
async function listCopilotTranscriptMetadata(opts = {}) {
|
|
37956
37879
|
const projectFilter = opts.projects ? new Set(opts.projects) : null;
|
|
37957
37880
|
const sinceMs = opts.sinceMs ?? 0;
|
|
@@ -37968,7 +37891,7 @@ async function listCopilotTranscriptMetadata(opts = {}) {
|
|
|
37968
37891
|
continue;
|
|
37969
37892
|
let sizeBytes = 0;
|
|
37970
37893
|
try {
|
|
37971
|
-
sizeBytes =
|
|
37894
|
+
sizeBytes = statSync33(s.path).size;
|
|
37972
37895
|
} catch {}
|
|
37973
37896
|
if (!s.sessionId)
|
|
37974
37897
|
continue;
|
|
@@ -38002,7 +37925,7 @@ var init_copilot = __esm(() => {
|
|
|
38002
37925
|
});
|
|
38003
37926
|
|
|
38004
37927
|
// src/audit/cli-adapters/cursor.ts
|
|
38005
|
-
import { statSync as
|
|
37928
|
+
import { statSync as statSync34 } from "node:fs";
|
|
38006
37929
|
async function listCursorTranscriptMetadata(opts = {}) {
|
|
38007
37930
|
const projectFilter = opts.projects ? new Set(opts.projects) : null;
|
|
38008
37931
|
const sinceMs = opts.sinceMs ?? 0;
|
|
@@ -38019,7 +37942,7 @@ async function listCursorTranscriptMetadata(opts = {}) {
|
|
|
38019
37942
|
continue;
|
|
38020
37943
|
let sizeBytes = 0;
|
|
38021
37944
|
try {
|
|
38022
|
-
sizeBytes =
|
|
37945
|
+
sizeBytes = statSync34(s.path).size;
|
|
38023
37946
|
} catch {}
|
|
38024
37947
|
if (!s.sessionId)
|
|
38025
37948
|
continue;
|
|
@@ -38260,7 +38183,7 @@ var init_opencode = __esm(() => {
|
|
|
38260
38183
|
});
|
|
38261
38184
|
|
|
38262
38185
|
// src/audit/cli-adapters/pi.ts
|
|
38263
|
-
import { statSync as
|
|
38186
|
+
import { statSync as statSync35 } from "node:fs";
|
|
38264
38187
|
async function listPiTranscriptMetadata(opts = {}) {
|
|
38265
38188
|
const projectFilter = opts.projects ? new Set(opts.projects) : null;
|
|
38266
38189
|
const sinceMs = opts.sinceMs ?? 0;
|
|
@@ -38277,7 +38200,7 @@ async function listPiTranscriptMetadata(opts = {}) {
|
|
|
38277
38200
|
continue;
|
|
38278
38201
|
let sizeBytes = 0;
|
|
38279
38202
|
try {
|
|
38280
|
-
sizeBytes =
|
|
38203
|
+
sizeBytes = statSync35(s.path).size;
|
|
38281
38204
|
} catch {}
|
|
38282
38205
|
if (!s.sessionId)
|
|
38283
38206
|
continue;
|
|
@@ -39936,7 +39859,7 @@ var init_api_server_client = __esm(() => {
|
|
|
39936
39859
|
});
|
|
39937
39860
|
|
|
39938
39861
|
// lib/auth/auth-store.ts
|
|
39939
|
-
import { existsSync as existsSync47, readFileSync as readFileSync39, readdirSync as
|
|
39862
|
+
import { existsSync as existsSync47, readFileSync as readFileSync39, readdirSync as readdirSync21, rmSync as rmSync19 } from "node:fs";
|
|
39940
39863
|
import { join as join41, resolve as resolve33 } from "node:path";
|
|
39941
39864
|
function getAuthFilePath() {
|
|
39942
39865
|
const override = process.env.FAILPROOFAI_AUTH_DIR;
|
|
@@ -39977,7 +39900,7 @@ function deleteAuth() {
|
|
|
39977
39900
|
const root = migrationsDir();
|
|
39978
39901
|
if (!existsSync47(root))
|
|
39979
39902
|
return;
|
|
39980
|
-
for (const entry of
|
|
39903
|
+
for (const entry of readdirSync21(root)) {
|
|
39981
39904
|
if (!entry.startsWith("backup-layout"))
|
|
39982
39905
|
continue;
|
|
39983
39906
|
const copy = resolve33(root, entry, "auth.json");
|
|
@@ -40572,7 +40495,7 @@ var init_cli = __esm(() => {
|
|
|
40572
40495
|
// src/hooks/configure-wizard.ts
|
|
40573
40496
|
import { existsSync as existsSync49, mkdirSync as mkdirSync28, writeFileSync as writeFileSync23, readFileSync as readFileSync41 } from "node:fs";
|
|
40574
40497
|
import { homedir as homedir34 } from "node:os";
|
|
40575
|
-
import { dirname as
|
|
40498
|
+
import { dirname as dirname25, resolve as resolve34, sep as sep5 } from "node:path";
|
|
40576
40499
|
async function emit(event, props) {
|
|
40577
40500
|
try {
|
|
40578
40501
|
await trackHookEvent2(getInstanceId2(), event, props);
|
|
@@ -40761,7 +40684,7 @@ function firstRunMarkerPath() {
|
|
|
40761
40684
|
}
|
|
40762
40685
|
function markLauncherSeen() {
|
|
40763
40686
|
try {
|
|
40764
|
-
mkdirSync28(
|
|
40687
|
+
mkdirSync28(dirname25(firstRunMarkerPath()), { recursive: true });
|
|
40765
40688
|
writeFileSync23(firstRunMarkerPath(), "1", "utf8");
|
|
40766
40689
|
} catch {}
|
|
40767
40690
|
}
|
|
@@ -41588,8 +41511,8 @@ var init_configure_wizard = __esm(() => {
|
|
|
41588
41511
|
});
|
|
41589
41512
|
|
|
41590
41513
|
// src/hooks/flush-cli.ts
|
|
41591
|
-
import { existsSync as existsSync50, mkdirSync as mkdirSync29, writeFileSync as writeFileSync24, readdirSync as
|
|
41592
|
-
import { dirname as
|
|
41514
|
+
import { existsSync as existsSync50, mkdirSync as mkdirSync29, writeFileSync as writeFileSync24, readdirSync as readdirSync22, statSync as statSync36 } from "node:fs";
|
|
41515
|
+
import { dirname as dirname26, join as join42 } from "node:path";
|
|
41593
41516
|
function flushRequestPath2(home) {
|
|
41594
41517
|
return join42(failproofaiHome(home), "state", "flush-request.json");
|
|
41595
41518
|
}
|
|
@@ -41599,14 +41522,14 @@ function spoolDirs2(home) {
|
|
|
41599
41522
|
if (!existsSync50(root))
|
|
41600
41523
|
return dirs;
|
|
41601
41524
|
try {
|
|
41602
|
-
return dirs.concat(
|
|
41525
|
+
return dirs.concat(readdirSync22(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "failed").map((e) => join42(root, e.name)));
|
|
41603
41526
|
} catch {
|
|
41604
41527
|
return dirs;
|
|
41605
41528
|
}
|
|
41606
41529
|
}
|
|
41607
41530
|
function parkedBatches2(home) {
|
|
41608
41531
|
try {
|
|
41609
|
-
return
|
|
41532
|
+
return readdirSync22(failedDir(home)).filter((f) => f.endsWith(".jsonl")).length;
|
|
41610
41533
|
} catch {
|
|
41611
41534
|
return 0;
|
|
41612
41535
|
}
|
|
@@ -41623,14 +41546,14 @@ function spoolBacklog2(home, now = Date.now()) {
|
|
|
41623
41546
|
for (const dir of spoolDirs2(home)) {
|
|
41624
41547
|
let names;
|
|
41625
41548
|
try {
|
|
41626
|
-
names =
|
|
41549
|
+
names = readdirSync22(dir).filter((f) => f.endsWith(".jsonl"));
|
|
41627
41550
|
} catch {
|
|
41628
41551
|
continue;
|
|
41629
41552
|
}
|
|
41630
41553
|
count += names.length;
|
|
41631
41554
|
for (const name of names) {
|
|
41632
41555
|
try {
|
|
41633
|
-
const mtime =
|
|
41556
|
+
const mtime = statSync36(join42(dir, name)).mtimeMs;
|
|
41634
41557
|
if (oldest === undefined || mtime < oldest)
|
|
41635
41558
|
oldest = mtime;
|
|
41636
41559
|
} catch {}
|
|
@@ -41692,7 +41615,7 @@ async function runFlushCommand2(opts = {}) {
|
|
|
41692
41615
|
return { exitCode: 0, pending: 0, lines: nothing };
|
|
41693
41616
|
}
|
|
41694
41617
|
const path = flushRequestPath2(home);
|
|
41695
|
-
mkdirSync29(
|
|
41618
|
+
mkdirSync29(dirname26(path), { recursive: true });
|
|
41696
41619
|
writeFileSync24(path, `${JSON.stringify({ requestedAtMs: Date.now() }, null, 2)}
|
|
41697
41620
|
`, {
|
|
41698
41621
|
mode: 384
|
|
@@ -44221,7 +44144,7 @@ var init_main = __esm(() => {
|
|
|
44221
44144
|
// src/hooks/otel-writers.ts
|
|
44222
44145
|
import { homedir as homedir35 } from "node:os";
|
|
44223
44146
|
import { resolve as resolve35 } from "node:path";
|
|
44224
|
-
import { accessSync as accessSync2, constants, readdirSync as
|
|
44147
|
+
import { accessSync as accessSync2, constants, readdirSync as readdirSync23, statSync as statSync37 } from "node:fs";
|
|
44225
44148
|
function vscodeSettingsPath(home = homedir35(), platform = process.platform) {
|
|
44226
44149
|
if (platform === "darwin")
|
|
44227
44150
|
return resolve35(home, "Library/Application Support/Code/User/settings.json");
|
|
@@ -44236,7 +44159,7 @@ function vscodeInstalled(home = homedir35(), platform = process.platform) {
|
|
|
44236
44159
|
const executable = (path) => {
|
|
44237
44160
|
try {
|
|
44238
44161
|
accessSync2(path, platform === "win32" ? constants.F_OK : constants.X_OK);
|
|
44239
|
-
return
|
|
44162
|
+
return statSync37(path).isFile();
|
|
44240
44163
|
} catch {
|
|
44241
44164
|
return false;
|
|
44242
44165
|
}
|
|
@@ -44248,7 +44171,7 @@ function vscodeInstalled(home = homedir35(), platform = process.platform) {
|
|
|
44248
44171
|
return true;
|
|
44249
44172
|
return [".vscode", ".vscode-insiders"].some((folder) => {
|
|
44250
44173
|
try {
|
|
44251
|
-
return
|
|
44174
|
+
return readdirSync23(resolve35(home, folder, "extensions"), { withFileTypes: true }).some((entry) => entry.isDirectory() && /^github\.copilot(?:-chat)?-\d/i.test(entry.name));
|
|
44252
44175
|
} catch {
|
|
44253
44176
|
return false;
|
|
44254
44177
|
}
|
|
@@ -44471,11 +44394,11 @@ import {
|
|
|
44471
44394
|
existsSync as existsSync52,
|
|
44472
44395
|
mkdirSync as mkdirSync30,
|
|
44473
44396
|
readFileSync as readFileSync42,
|
|
44474
|
-
statSync as
|
|
44397
|
+
statSync as statSync38,
|
|
44475
44398
|
unlinkSync as unlinkSync8,
|
|
44476
44399
|
writeFileSync as writeFileSync25
|
|
44477
44400
|
} from "node:fs";
|
|
44478
|
-
import { dirname as
|
|
44401
|
+
import { dirname as dirname27 } from "node:path";
|
|
44479
44402
|
import { createHash as createHash13, randomUUID as randomUUID6 } from "node:crypto";
|
|
44480
44403
|
import { homedir as homedir36 } from "node:os";
|
|
44481
44404
|
import { connect } from "node:net";
|
|
@@ -44535,13 +44458,13 @@ function credential() {
|
|
|
44535
44458
|
function backupOnce(path, original) {
|
|
44536
44459
|
if (existsSync52(`${path}.failproofai-bak`))
|
|
44537
44460
|
return;
|
|
44538
|
-
mkdirSync30(
|
|
44461
|
+
mkdirSync30(dirname27(path), { recursive: true });
|
|
44539
44462
|
writeFileSync25(`${path}.failproofai-bak`, original ?? "", { flag: "wx", mode: 384 });
|
|
44540
44463
|
chmodSync11(`${path}.failproofai-bak`, 384);
|
|
44541
44464
|
}
|
|
44542
44465
|
function savePrivate(agent, state) {
|
|
44543
44466
|
const path = otelAgentStateFile(agent);
|
|
44544
|
-
mkdirSync30(
|
|
44467
|
+
mkdirSync30(dirname27(path), { recursive: true, mode: 448 });
|
|
44545
44468
|
writeConfigFileAtomic(path, JSON.stringify(state), { backup: false, mode: 384 });
|
|
44546
44469
|
chmodSync11(path, 384);
|
|
44547
44470
|
}
|
|
@@ -44646,7 +44569,7 @@ async function enableAgent(agent, yes, localFlag, content, options) {
|
|
|
44646
44569
|
const next = editAgentConfig(original ?? "", agent, [...released, ...writes]);
|
|
44647
44570
|
const state = oldState ?? {
|
|
44648
44571
|
original,
|
|
44649
|
-
originalMode: original === null ? undefined :
|
|
44572
|
+
originalMode: original === null ? undefined : statSync38(file).mode & 511,
|
|
44650
44573
|
writtenHash: "",
|
|
44651
44574
|
previous: writes.map((w) => ({ path: w.path, value: getSetting(parsed, w.path) }))
|
|
44652
44575
|
};
|
|
@@ -45324,8 +45247,8 @@ var init_jev_stats = __esm(() => {
|
|
|
45324
45247
|
});
|
|
45325
45248
|
|
|
45326
45249
|
// src/hooks/jev-cli.ts
|
|
45327
|
-
import { chmodSync as chmodSync12, existsSync as existsSync53, statSync as
|
|
45328
|
-
import { dirname as
|
|
45250
|
+
import { chmodSync as chmodSync12, existsSync as existsSync53, statSync as statSync39, unlinkSync as unlinkSync9 } from "node:fs";
|
|
45251
|
+
import { dirname as dirname28 } from "node:path";
|
|
45329
45252
|
function jevHeader(name, meta, opts) {
|
|
45330
45253
|
return [screenKit(opts).header(meta ? `${name} · ${meta}` : name)];
|
|
45331
45254
|
}
|
|
@@ -45906,13 +45829,13 @@ async function setupRun(argv, deps, opts) {
|
|
|
45906
45829
|
}
|
|
45907
45830
|
let fileMode = null;
|
|
45908
45831
|
try {
|
|
45909
|
-
fileMode =
|
|
45832
|
+
fileMode = statSync39(path).mode & 511;
|
|
45910
45833
|
} catch {}
|
|
45911
|
-
const dir =
|
|
45834
|
+
const dir = dirname28(path);
|
|
45912
45835
|
let tightenedDir = null;
|
|
45913
45836
|
if (process.platform !== "win32") {
|
|
45914
45837
|
try {
|
|
45915
|
-
const before =
|
|
45838
|
+
const before = statSync39(dir).mode & 511;
|
|
45916
45839
|
if ((before & 18) !== 0) {
|
|
45917
45840
|
const after = before & -19;
|
|
45918
45841
|
chmodSync12(dir, after);
|
|
@@ -46034,15 +45957,15 @@ async function cloudSetup(values, bools, opts) {
|
|
|
46034
45957
|
}
|
|
46035
45958
|
if (process.platform !== "win32") {
|
|
46036
45959
|
try {
|
|
46037
|
-
const dir =
|
|
46038
|
-
const before =
|
|
45960
|
+
const dir = dirname28(path);
|
|
45961
|
+
const before = statSync39(dir).mode & 511;
|
|
46039
45962
|
if ((before & 18) !== 0)
|
|
46040
45963
|
chmodSync12(dir, before & -19);
|
|
46041
45964
|
} catch {}
|
|
46042
45965
|
}
|
|
46043
45966
|
let fileMode = null;
|
|
46044
45967
|
try {
|
|
46045
|
-
fileMode =
|
|
45968
|
+
fileMode = statSync39(path).mode & 511;
|
|
46046
45969
|
} catch {}
|
|
46047
45970
|
const cfg = checked.value;
|
|
46048
45971
|
const route = jevRoute(cfg);
|
|
@@ -46671,7 +46594,7 @@ import {
|
|
|
46671
46594
|
openSync as openSync8,
|
|
46672
46595
|
readFileSync as readFileSync43,
|
|
46673
46596
|
readSync as readSync6,
|
|
46674
|
-
statSync as
|
|
46597
|
+
statSync as statSync40,
|
|
46675
46598
|
writeFileSync as writeFileSync26
|
|
46676
46599
|
} from "node:fs";
|
|
46677
46600
|
function detectLayout2() {
|
|
@@ -46755,7 +46678,7 @@ import {
|
|
|
46755
46678
|
rmSync as rmSync21,
|
|
46756
46679
|
writeFileSync as writeFileSync27
|
|
46757
46680
|
} from "node:fs";
|
|
46758
|
-
import { basename as basename10, dirname as
|
|
46681
|
+
import { basename as basename10, dirname as dirname29, join as join43, resolve as resolve38 } from "node:path";
|
|
46759
46682
|
function migrateToLayout42() {
|
|
46760
46683
|
const moves = [
|
|
46761
46684
|
{ from: legacy.authJson(), to: auditSessionFile() },
|
|
@@ -46777,7 +46700,7 @@ function migrateToLayout42() {
|
|
|
46777
46700
|
rmSync21(from, { force: true });
|
|
46778
46701
|
continue;
|
|
46779
46702
|
}
|
|
46780
|
-
mkdirSync32(
|
|
46703
|
+
mkdirSync32(dirname29(to), { recursive: true });
|
|
46781
46704
|
try {
|
|
46782
46705
|
renameSync15(from, to);
|
|
46783
46706
|
} catch {
|
|
@@ -47016,14 +46939,12 @@ import {
|
|
|
47016
46939
|
mkdirSync as mkdirSync33,
|
|
47017
46940
|
mkdtempSync as mkdtempSync2,
|
|
47018
46941
|
readFileSync as readFileSync45,
|
|
47019
|
-
readdirSync as readdirSync25,
|
|
47020
|
-
statSync as statSync42,
|
|
47021
46942
|
writeFileSync as writeFileSync28,
|
|
47022
46943
|
unlinkSync as unlinkSync10,
|
|
47023
46944
|
rmSync as rmSync22
|
|
47024
46945
|
} from "node:fs";
|
|
47025
46946
|
import { homedir as homedir38, tmpdir as tmpdir3, userInfo as userInfo2 } from "node:os";
|
|
47026
|
-
import {
|
|
46947
|
+
import { resolve as resolve39 } from "node:path";
|
|
47027
46948
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
47028
46949
|
function isDaemonSupportedPlatform2() {
|
|
47029
46950
|
return process.platform === "linux" || process.platform === "darwin";
|
|
@@ -47129,60 +47050,6 @@ function systemdUnitDir2() {
|
|
|
47129
47050
|
function systemdUnitPath2(user = serviceUser2()) {
|
|
47130
47051
|
return resolve39(systemdUnitDir2(), systemdUnitName2(user));
|
|
47131
47052
|
}
|
|
47132
|
-
function systemBinaryRoot2(user = serviceUser2()) {
|
|
47133
|
-
return resolve39(process.env.FAILPROOFAI_SYSTEM_BIN_DIR || "/opt/failproofai", user);
|
|
47134
|
-
}
|
|
47135
|
-
function systemBinaryDir2() {
|
|
47136
|
-
return resolve39(systemBinaryRoot2(), "bin");
|
|
47137
|
-
}
|
|
47138
|
-
function systemBinaryTarget2(binaryPath) {
|
|
47139
|
-
if (process.platform !== "linux" || process.env.FAILPROOFAI_DAEMON_BINARY)
|
|
47140
|
-
return null;
|
|
47141
|
-
try {
|
|
47142
|
-
if (!statSync42(binaryPath).isFile())
|
|
47143
|
-
return null;
|
|
47144
|
-
} catch {
|
|
47145
|
-
return null;
|
|
47146
|
-
}
|
|
47147
|
-
return resolve39(systemBinaryDir2(), `failproofaid-${version2}`);
|
|
47148
|
-
}
|
|
47149
|
-
function selinuxEnabled2() {
|
|
47150
|
-
return existsSync56("/sys/fs/selinux/enforce");
|
|
47151
|
-
}
|
|
47152
|
-
function stageSystemBinary2(binaryPath) {
|
|
47153
|
-
const target = systemBinaryTarget2(binaryPath);
|
|
47154
|
-
if (!target)
|
|
47155
|
-
return binaryPath;
|
|
47156
|
-
const dir = systemBinaryDir2();
|
|
47157
|
-
const staging = `${target}.${process.pid}.tmp`;
|
|
47158
|
-
runPrivileged2("install", ["-d", "-m", "0755", dir]);
|
|
47159
|
-
try {
|
|
47160
|
-
runPrivileged2("install", ["-m", "0755", binaryPath, staging]);
|
|
47161
|
-
runPrivileged2("mv", ["-f", staging, target]);
|
|
47162
|
-
} catch (err) {
|
|
47163
|
-
try {
|
|
47164
|
-
runPrivileged2("rm", ["-f", staging]);
|
|
47165
|
-
} catch {}
|
|
47166
|
-
throw err;
|
|
47167
|
-
}
|
|
47168
|
-
if (selinuxEnabled2()) {
|
|
47169
|
-
const root = systemBinaryRoot2();
|
|
47170
|
-
try {
|
|
47171
|
-
runPrivileged2("restorecon", ["-R", root]);
|
|
47172
|
-
} catch (err) {
|
|
47173
|
-
hookLogWarn(`restorecon on ${root} failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
47174
|
-
}
|
|
47175
|
-
}
|
|
47176
|
-
return target;
|
|
47177
|
-
}
|
|
47178
|
-
function pruneSystemBinaries2(current) {
|
|
47179
|
-
try {
|
|
47180
|
-
const dir = systemBinaryDir2();
|
|
47181
|
-
const stale = readdirSync25(dir).filter((f) => f.startsWith("failproofaid-")).map((f) => resolve39(dir, f)).filter((p) => p !== current).map((p) => ({ p, mtime: statSync42(p).mtimeMs })).sort((a, b) => b.mtime - a.mtime).slice(1);
|
|
47182
|
-
for (const { p } of stale)
|
|
47183
|
-
runPrivileged2("rm", ["-f", p]);
|
|
47184
|
-
} catch {}
|
|
47185
|
-
}
|
|
47186
47053
|
function legacySystemdUserUnitPath2() {
|
|
47187
47054
|
return resolve39(homedir38(), ".config", "systemd", "user", "failproofaid.service");
|
|
47188
47055
|
}
|
|
@@ -47355,17 +47222,9 @@ ${envBlock} <key>StandardOutPath</key>
|
|
|
47355
47222
|
}
|
|
47356
47223
|
function daemonInstallCommands2(binaryPath, workerCmd, cliCmd) {
|
|
47357
47224
|
if (process.platform === "linux") {
|
|
47358
|
-
const target = systemBinaryTarget2(binaryPath);
|
|
47359
|
-
const dir = systemBinaryDir2();
|
|
47360
|
-
const stage = target ? [
|
|
47361
|
-
`sudo install -d -m 0755 ${dir}`,
|
|
47362
|
-
`sudo install -m 0755 ${binaryPath} ${target}`,
|
|
47363
|
-
`{ sudo restorecon -R ${systemBinaryRoot2()} 2>/dev/null || true; }`
|
|
47364
|
-
] : [];
|
|
47365
47225
|
return [
|
|
47366
|
-
...stage,
|
|
47367
47226
|
`sudo tee ${systemdUnitPath2()} <<'EOF'
|
|
47368
|
-
${systemdUnitContents2(
|
|
47227
|
+
${systemdUnitContents2(binaryPath, workerCmd, cliCmd)}EOF`,
|
|
47369
47228
|
"sudo systemctl daemon-reload",
|
|
47370
47229
|
`sudo systemctl enable ${systemdUnitName2()}`,
|
|
47371
47230
|
`sudo systemctl restart ${systemdUnitName2()}`
|
|
@@ -47393,11 +47252,9 @@ async function installDaemonService2() {
|
|
|
47393
47252
|
};
|
|
47394
47253
|
}
|
|
47395
47254
|
removeLegacyUserService2();
|
|
47396
|
-
let execPath = binaryPath;
|
|
47397
47255
|
try {
|
|
47398
47256
|
if (process.platform === "linux") {
|
|
47399
|
-
|
|
47400
|
-
writePrivilegedFile2(systemdUnitPath2(), systemdUnitContents2(execPath, workerCmd, cliCmd));
|
|
47257
|
+
writePrivilegedFile2(systemdUnitPath2(), systemdUnitContents2(binaryPath, workerCmd, cliCmd));
|
|
47401
47258
|
runPrivileged2("systemctl", ["daemon-reload"]);
|
|
47402
47259
|
runPrivileged2("systemctl", ["enable", systemdUnitName2()]);
|
|
47403
47260
|
restartSystemdUnit2();
|
|
@@ -47421,8 +47278,6 @@ async function installDaemonService2() {
|
|
|
47421
47278
|
hookLogWarn(`daemon service install failed: ${reason}`);
|
|
47422
47279
|
return { installed: false, reason };
|
|
47423
47280
|
}
|
|
47424
|
-
if (execPath !== binaryPath)
|
|
47425
|
-
pruneSystemBinaries2(execPath);
|
|
47426
47281
|
return { installed: true };
|
|
47427
47282
|
}
|
|
47428
47283
|
async function probeDaemon2() {
|
|
@@ -47831,12 +47686,10 @@ function manualServiceRemoval(servicePath) {
|
|
|
47831
47686
|
return [`sudo launchctl unload -w ${servicePath}`, `sudo rm -f ${servicePath}`];
|
|
47832
47687
|
}
|
|
47833
47688
|
const unit = servicePath.split("/").pop() ?? servicePath;
|
|
47834
|
-
const binDir = daemonSystemBinaryDir();
|
|
47835
47689
|
return [
|
|
47836
47690
|
`sudo systemctl disable --now ${unit}`,
|
|
47837
47691
|
`sudo rm -f ${servicePath}`,
|
|
47838
|
-
`sudo systemctl daemon-reload
|
|
47839
|
-
...binDir ? [`sudo rm -rf ${binDir}`] : []
|
|
47692
|
+
`sudo systemctl daemon-reload`
|
|
47840
47693
|
];
|
|
47841
47694
|
}
|
|
47842
47695
|
var init_uninstall_cli = __esm(() => {
|
|
@@ -47854,8 +47707,8 @@ var init_uninstall_cli = __esm(() => {
|
|
|
47854
47707
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
47855
47708
|
import { homedir as homedir39, tmpdir as tmpdir4 } from "node:os";
|
|
47856
47709
|
import { createHash as createHash14 } from "node:crypto";
|
|
47857
|
-
import { copyFileSync as copyFileSync5, existsSync as existsSync58, mkdirSync as mkdirSync34, mkdtempSync as mkdtempSync3, readFileSync as readFileSync46, readdirSync as
|
|
47858
|
-
import { basename as basename11, dirname as
|
|
47710
|
+
import { copyFileSync as copyFileSync5, existsSync as existsSync58, mkdirSync as mkdirSync34, mkdtempSync as mkdtempSync3, readFileSync as readFileSync46, readdirSync as readdirSync24, realpathSync as realpathSync5, rmSync as rmSync24, statSync as statSync41, writeFileSync as writeFileSync29 } from "node:fs";
|
|
47711
|
+
import { basename as basename11, dirname as dirname30, isAbsolute as isAbsolute6, join as join44, relative as relative5, resolve as resolve40, sep as sep6 } from "node:path";
|
|
47859
47712
|
function parseList(rest, ...flags) {
|
|
47860
47713
|
let found = false;
|
|
47861
47714
|
const out = [];
|
|
@@ -48445,7 +48298,7 @@ function inferTaggedVersion(entryPath, sources) {
|
|
|
48445
48298
|
function findEntry(dir) {
|
|
48446
48299
|
let names;
|
|
48447
48300
|
try {
|
|
48448
|
-
names =
|
|
48301
|
+
names = readdirSync24(dir);
|
|
48449
48302
|
} catch {
|
|
48450
48303
|
return [];
|
|
48451
48304
|
}
|
|
@@ -48455,7 +48308,7 @@ function findEntry(dir) {
|
|
|
48455
48308
|
continue;
|
|
48456
48309
|
const full = resolve40(dir, name);
|
|
48457
48310
|
try {
|
|
48458
|
-
if (
|
|
48311
|
+
if (statSync41(full).size > 512 * 1024)
|
|
48459
48312
|
continue;
|
|
48460
48313
|
const text = readFileSync46(full, "utf8");
|
|
48461
48314
|
if (/from\s+["']failproofai["']/.test(text) && /(?:customPolicies|semanticPolicies)\s*\.\s*add\s*\(/.test(text)) {
|
|
@@ -48474,7 +48327,7 @@ function withLocalImports(sources) {
|
|
|
48474
48327
|
const file = queue.shift();
|
|
48475
48328
|
let text;
|
|
48476
48329
|
try {
|
|
48477
|
-
if (
|
|
48330
|
+
if (statSync41(file).size > 512 * 1024)
|
|
48478
48331
|
continue;
|
|
48479
48332
|
text = readFileSync46(file, "utf8");
|
|
48480
48333
|
} catch {
|
|
@@ -48482,13 +48335,13 @@ function withLocalImports(sources) {
|
|
|
48482
48335
|
}
|
|
48483
48336
|
for (const re of LOCAL_IMPORT_RES) {
|
|
48484
48337
|
for (const match of text.matchAll(re)) {
|
|
48485
|
-
const base = resolve40(
|
|
48338
|
+
const base = resolve40(dirname30(file), match[1]);
|
|
48486
48339
|
for (const ext of LOCAL_IMPORT_EXTENSIONS) {
|
|
48487
48340
|
const candidate = base + ext;
|
|
48488
48341
|
if (seen.has(candidate))
|
|
48489
48342
|
break;
|
|
48490
48343
|
try {
|
|
48491
|
-
if (!
|
|
48344
|
+
if (!statSync41(candidate).isFile())
|
|
48492
48345
|
continue;
|
|
48493
48346
|
} catch {
|
|
48494
48347
|
continue;
|
|
@@ -48735,7 +48588,7 @@ esac
|
|
|
48735
48588
|
return true;
|
|
48736
48589
|
} finally {
|
|
48737
48590
|
try {
|
|
48738
|
-
rmSync24(
|
|
48591
|
+
rmSync24(dirname30(askpass), { recursive: true, force: true });
|
|
48739
48592
|
} catch {}
|
|
48740
48593
|
}
|
|
48741
48594
|
}
|
|
@@ -51247,14 +51100,14 @@ var init_parse_script_args = () => {};
|
|
|
51247
51100
|
|
|
51248
51101
|
// scripts/install-diagnosis.mjs
|
|
51249
51102
|
import { existsSync as existsSync60, readFileSync as readFileSync48, realpathSync as realpathSync6 } from "node:fs";
|
|
51250
|
-
import { dirname as
|
|
51103
|
+
import { dirname as dirname31, resolve as resolve43 } from "node:path";
|
|
51251
51104
|
import { homedir as homedir40, platform as platform5 } from "node:os";
|
|
51252
51105
|
import { spawnSync } from "node:child_process";
|
|
51253
51106
|
function findPackageRoot(start) {
|
|
51254
51107
|
try {
|
|
51255
51108
|
let dir = realpathSync6(start);
|
|
51256
51109
|
if (existsSync60(dir) && !existsSync60(resolve43(dir, "package.json"))) {
|
|
51257
|
-
dir =
|
|
51110
|
+
dir = dirname31(dir);
|
|
51258
51111
|
}
|
|
51259
51112
|
while (true) {
|
|
51260
51113
|
const pkgPath = resolve43(dir, "package.json");
|
|
@@ -51265,7 +51118,7 @@ function findPackageRoot(start) {
|
|
|
51265
51118
|
return dir;
|
|
51266
51119
|
} catch {}
|
|
51267
51120
|
}
|
|
51268
|
-
const parent =
|
|
51121
|
+
const parent = dirname31(dir);
|
|
51269
51122
|
if (parent === dir)
|
|
51270
51123
|
return null;
|
|
51271
51124
|
dir = parent;
|
|
@@ -51796,7 +51649,7 @@ var init_launch_ready = () => {};
|
|
|
51796
51649
|
// scripts/launch.ts
|
|
51797
51650
|
import { spawn as spawn2 } from "child_process";
|
|
51798
51651
|
import { realpathSync as realpathSync7, existsSync as existsSync61 } from "node:fs";
|
|
51799
|
-
import { resolve as resolve44, dirname as
|
|
51652
|
+
import { resolve as resolve44, dirname as dirname32 } from "node:path";
|
|
51800
51653
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
51801
51654
|
function launch(mode, options = {}) {
|
|
51802
51655
|
const { loggingLevel, disableTelemetry, allowedDevOrigins, host, remainingArgs } = parseScriptArgs(process.argv.slice(2));
|
|
@@ -51832,7 +51685,7 @@ ${k.caution(exposedBindWarning(exposed.host))}
|
|
|
51832
51685
|
process.env.PORT = port;
|
|
51833
51686
|
process.env.HOSTNAME = bindHost;
|
|
51834
51687
|
cmd = "node";
|
|
51835
|
-
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ?? resolve44(
|
|
51688
|
+
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ?? resolve44(dirname32(realpathSync7(fileURLToPath2(import.meta.url))), "..");
|
|
51836
51689
|
const serverJsPath = resolve44(packageRoot, ".next/standalone/server.js");
|
|
51837
51690
|
if (!existsSync61(serverJsPath)) {
|
|
51838
51691
|
let shadowMessage = null;
|
|
@@ -53061,7 +52914,7 @@ var init_session_pause_cli2 = __esm(() => {
|
|
|
53061
52914
|
// scripts/launch.ts
|
|
53062
52915
|
import { spawn as spawn3 } from "child_process";
|
|
53063
52916
|
import { realpathSync as realpathSync8, existsSync as existsSync62 } from "node:fs";
|
|
53064
|
-
import { resolve as resolve46, dirname as
|
|
52917
|
+
import { resolve as resolve46, dirname as dirname33 } from "node:path";
|
|
53065
52918
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
53066
52919
|
function launch2(mode, options = {}) {
|
|
53067
52920
|
const { loggingLevel, disableTelemetry, allowedDevOrigins, host, remainingArgs } = parseScriptArgs(process.argv.slice(2));
|
|
@@ -53097,7 +52950,7 @@ ${k.caution(exposedBindWarning(exposed.host))}
|
|
|
53097
52950
|
process.env.PORT = port;
|
|
53098
52951
|
process.env.HOSTNAME = bindHost;
|
|
53099
52952
|
cmd = "node";
|
|
53100
|
-
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ?? resolve46(
|
|
52953
|
+
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ?? resolve46(dirname33(realpathSync8(fileURLToPath3(import.meta.url))), "..");
|
|
53101
52954
|
const serverJsPath = resolve46(packageRoot, ".next/standalone/server.js");
|
|
53102
52955
|
if (!existsSync62(serverJsPath)) {
|
|
53103
52956
|
let shadowMessage = null;
|
|
@@ -53219,17 +53072,17 @@ var init_cli_error2 = __esm(() => {
|
|
|
53219
53072
|
|
|
53220
53073
|
// bin/failproofai.mjs
|
|
53221
53074
|
import { realpathSync as realpathSync9 } from "fs";
|
|
53222
|
-
import { dirname as
|
|
53075
|
+
import { dirname as dirname34, resolve as resolve47 } from "path";
|
|
53223
53076
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
53224
53077
|
// package.json
|
|
53225
|
-
var version = "1.0.13-beta.
|
|
53078
|
+
var version = "1.0.13-beta.3";
|
|
53226
53079
|
|
|
53227
53080
|
// bin/failproofai.mjs
|
|
53228
53081
|
if (!process.env.FAILPROOFAI_PACKAGE_ROOT) {
|
|
53229
|
-
process.env.FAILPROOFAI_PACKAGE_ROOT = resolve47(
|
|
53082
|
+
process.env.FAILPROOFAI_PACKAGE_ROOT = resolve47(dirname34(realpathSync9(fileURLToPath4(import.meta.url))), "..");
|
|
53230
53083
|
}
|
|
53231
53084
|
if (!process.env.FAILPROOFAI_DIST_PATH) {
|
|
53232
|
-
process.env.FAILPROOFAI_DIST_PATH = resolve47(
|
|
53085
|
+
process.env.FAILPROOFAI_DIST_PATH = resolve47(dirname34(realpathSync9(fileURLToPath4(import.meta.url))), "..", "dist");
|
|
53233
53086
|
}
|
|
53234
53087
|
var args = process.argv.slice(2);
|
|
53235
53088
|
if (args[0] === "p" || args[0] === "policy")
|