failproofai 1.0.13-beta.3 → 1.0.13
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 +4 -4
- 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/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]__070rqh7scntiu._.js → [root-of-the-server]__1jq2bh84rafc7._.js} +2 -2
- 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/_0ouu886szh6yj._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0pedwblqdoh58._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_1tcvpgd7hugnx._.js → _100nvr7rei3us._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_1djqs9i27e4kg._.js +1 -1
- 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_1p-is71j0j7fb.js → node_modules_html-to-image_es_index_1cmkmhnty0-x7.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuznb72p7z._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/package_json_[json]_cjs_013tntikdft59._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_0agdmptetetdt._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_0mdwgjisv4fub._.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/{2sthn8c56n9m_.js → 0mm-e5t9denbu.js} +1 -1
- package/.next/standalone/.next/static/chunks/{095l2av-xsus2.js → 0rucj5pu307i4.js} +1 -1
- package/.next/standalone/.next/static/chunks/{19l5hbzn475am.js → 1-0se0uwja_ny.js} +1 -1
- package/.next/standalone/.next/static/chunks/{3m9g1l6-yh0s3.js → 173vw1xs-5m5g.js} +1 -1
- package/.next/standalone/.next/static/chunks/{1s__s2o5zcfcy.js → 20cme7d6wv6md.js} +1 -1
- package/.next/standalone/.next/static/chunks/2mz-k_jt_76xt.js +1 -0
- package/.next/standalone/.next/static/chunks/{1uxq_gbvdti30.js → 2u1m0f-wnhz44.js} +1 -1
- package/.next/standalone/.next/static/chunks/{3uaguc-tbu_ik.js → 2ytnb83xmjn3u.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0h7mkux811w5b.js → 40g_e46c1-j4k.js} +1 -1
- package/.next/standalone/.next/static/chunks/44yz8zx53euy1.js +1 -0
- package/.next/standalone/hermes-plugin/plugin.yaml +1 -1
- package/.next/standalone/package.json +11 -10
- package/.next/standalone/sdk/python/uv.lock +6 -6
- package/.next/standalone/sdk/typescript/package-lock.json +31 -61
- package/.next/standalone/sdk/typescript/package.json +3 -0
- package/.next/standalone/server.js +1 -1
- package/dist/cli.mjs +431 -243
- package/dist/worker.mjs +30 -2
- package/hermes-plugin/plugin.yaml +1 -1
- package/openclaw-plugin/daemon-client.js +254 -0
- package/openclaw-plugin/hooks.js +187 -0
- package/openclaw-plugin/index.js +17 -211
- package/package.json +11 -10
- package/src/hooks/antigravity-path-guard.ts +73 -0
- package/src/hooks/daemon-service.ts +188 -18
- package/src/hooks/enforcement-capability.ts +1 -1
- package/src/hooks/handler.ts +24 -0
- package/src/hooks/integrations.ts +5 -2
- package/src/hooks/shell-quote.ts +9 -0
- package/src/hooks/uninstall-cli.ts +30 -8
- package/.next/standalone/.next/static/chunks/3eonfpk9jyceg.js +0 -1
- package/.next/standalone/.next/static/chunks/3zwff_ax3hust.js +0 -1
- /package/.next/standalone/.next/static/{fHR90vZ5ls7d-K8cH9hxe → 4MgI0mZP1iVhhocpUivMm}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{fHR90vZ5ls7d-K8cH9hxe → 4MgI0mZP1iVhhocpUivMm}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{fHR90vZ5ls7d-K8cH9hxe → 4MgI0mZP1iVhhocpUivMm}/_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
|
|
32
|
+
var version2 = "1.0.13", package_default;
|
|
33
33
|
var init_package = __esm(() => {
|
|
34
34
|
package_default = {
|
|
35
35
|
name: "failproofai",
|
|
@@ -156,19 +156,20 @@ var init_package = __esm(() => {
|
|
|
156
156
|
"brace-expansion": "5.0.12",
|
|
157
157
|
sharp: "0.35.5",
|
|
158
158
|
"source-map-js": "1.2.2",
|
|
159
|
-
browserslist: "4.28.8"
|
|
159
|
+
browserslist: "4.28.8",
|
|
160
|
+
minimatch: "11.0.3"
|
|
160
161
|
},
|
|
161
162
|
optionalDependencies: {
|
|
162
|
-
"@failproofai/failproofaid-linux-x64": "1.0.13
|
|
163
|
-
"@failproofai/failproofaid-linux-arm64": "1.0.13
|
|
164
|
-
"@failproofai/failproofaid-darwin-x64": "1.0.13
|
|
165
|
-
"@failproofai/failproofaid-darwin-arm64": "1.0.13
|
|
163
|
+
"@failproofai/failproofaid-linux-x64": "1.0.13",
|
|
164
|
+
"@failproofai/failproofaid-linux-arm64": "1.0.13",
|
|
165
|
+
"@failproofai/failproofaid-darwin-x64": "1.0.13",
|
|
166
|
+
"@failproofai/failproofaid-darwin-arm64": "1.0.13"
|
|
166
167
|
},
|
|
167
168
|
failproofaidBinaries: {
|
|
168
|
-
"linux-x64": "
|
|
169
|
-
"linux-arm64": "
|
|
170
|
-
"darwin-x64": "
|
|
171
|
-
"darwin-arm64": "
|
|
169
|
+
"linux-x64": "f4e4047ea3b1fc005f2b2d825ab76b02f83a322d946f3f25d09f33e9e913f79d",
|
|
170
|
+
"linux-arm64": "5bd5468230f345cedef952293dbd085d68fead2029c88c51d04aefaff629f99b",
|
|
171
|
+
"darwin-x64": "897c2e00e392ee7bd429cd4c65132fd2b1a5cd7c8c66aa8a87d4a9cfdd6117c9",
|
|
172
|
+
"darwin-arm64": "a63bf038330f2a804d659a16d81d0bca265c08a9b37677d0e252106659848366"
|
|
172
173
|
}
|
|
173
174
|
};
|
|
174
175
|
});
|
|
@@ -6040,6 +6041,31 @@ var init_builtin_policies = __esm(() => {
|
|
|
6040
6041
|
}));
|
|
6041
6042
|
});
|
|
6042
6043
|
|
|
6044
|
+
// src/hooks/antigravity-path-guard.ts
|
|
6045
|
+
function antigravityPathGuardActive(paused, cloudPolicies) {
|
|
6046
|
+
return !paused || cloudPolicies.some((p) => p.effect !== "observe");
|
|
6047
|
+
}
|
|
6048
|
+
function antigravityCallLacksPath(eventType, toolName, toolInput) {
|
|
6049
|
+
if (eventType !== "PreToolUse")
|
|
6050
|
+
return false;
|
|
6051
|
+
if (!toolName || !ANTIGRAVITY_PATH_GUARD_MATCH.toolNames?.includes(toolName))
|
|
6052
|
+
return false;
|
|
6053
|
+
const path = toolInput?.file_path;
|
|
6054
|
+
return typeof path !== "string" || path.trim() === "";
|
|
6055
|
+
}
|
|
6056
|
+
function antigravityPathGuard(ctx) {
|
|
6057
|
+
if (!antigravityCallLacksPath(ctx.eventType, ctx.toolName, ctx.toolInput))
|
|
6058
|
+
return allow();
|
|
6059
|
+
return deny(`failproofai could not find a file path in this ${ctx.toolName ?? "file"} call, so it cannot check it against your policies. ` + "Your Antigravity version may have changed its tool arguments: update failproofai.");
|
|
6060
|
+
}
|
|
6061
|
+
var ANTIGRAVITY_PATH_GUARD_NAME = "failproofai/antigravity-file-path-required", ANTIGRAVITY_PATH_GUARD_DESCRIPTION = "Refuse an Antigravity file tool call with no file path failproofai can check.", ANTIGRAVITY_PATH_GUARD_MATCH;
|
|
6062
|
+
var init_antigravity_path_guard = __esm(() => {
|
|
6063
|
+
ANTIGRAVITY_PATH_GUARD_MATCH = {
|
|
6064
|
+
events: ["PreToolUse"],
|
|
6065
|
+
toolNames: ["Read", "Write", "Edit"]
|
|
6066
|
+
};
|
|
6067
|
+
});
|
|
6068
|
+
|
|
6043
6069
|
// node_modules/yaml/dist/nodes/identity.js
|
|
6044
6070
|
var require_identity = __commonJS(function(exports) {
|
|
6045
6071
|
var ALIAS = Symbol.for("yaml.alias");
|
|
@@ -13319,6 +13345,11 @@ var init_daemon_download = __esm(() => {
|
|
|
13319
13345
|
init_fp_home();
|
|
13320
13346
|
});
|
|
13321
13347
|
|
|
13348
|
+
// src/hooks/shell-quote.ts
|
|
13349
|
+
function shellQuote(value) {
|
|
13350
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
13351
|
+
}
|
|
13352
|
+
|
|
13322
13353
|
// src/hooks/daemon-client.ts
|
|
13323
13354
|
import { createConnection as createConnection2 } from "node:net";
|
|
13324
13355
|
import { existsSync as existsSync10 } from "node:fs";
|
|
@@ -13495,12 +13526,14 @@ import {
|
|
|
13495
13526
|
mkdirSync as mkdirSync7,
|
|
13496
13527
|
mkdtempSync,
|
|
13497
13528
|
readFileSync as readFileSync7,
|
|
13529
|
+
readdirSync as readdirSync2,
|
|
13530
|
+
statSync as statSync10,
|
|
13498
13531
|
writeFileSync as writeFileSync5,
|
|
13499
13532
|
unlinkSync,
|
|
13500
13533
|
rmSync as rmSync5
|
|
13501
13534
|
} from "node:fs";
|
|
13502
13535
|
import { homedir as homedir5, tmpdir, userInfo } from "node:os";
|
|
13503
|
-
import { resolve as resolve8 } from "node:path";
|
|
13536
|
+
import { dirname as dirname7, resolve as resolve8 } from "node:path";
|
|
13504
13537
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
13505
13538
|
function setDaemonConfigured(value, installedVersion) {
|
|
13506
13539
|
try {
|
|
@@ -13574,9 +13607,6 @@ function resolveCliCommand() {
|
|
|
13574
13607
|
return null;
|
|
13575
13608
|
return `${shellQuote(process.execPath)} ${shellQuote(cliScript)}`;
|
|
13576
13609
|
}
|
|
13577
|
-
function shellQuote(value) {
|
|
13578
|
-
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
13579
|
-
}
|
|
13580
13610
|
function workerScriptPath() {
|
|
13581
13611
|
if (process.env.FAILPROOFAI_WORKER_CMD)
|
|
13582
13612
|
return null;
|
|
@@ -13612,6 +13642,63 @@ function systemdUnitDir() {
|
|
|
13612
13642
|
function systemdUnitPath(user = serviceUser()) {
|
|
13613
13643
|
return resolve8(systemdUnitDir(), systemdUnitName(user));
|
|
13614
13644
|
}
|
|
13645
|
+
function systemBinaryRoot(user = serviceUser()) {
|
|
13646
|
+
return resolve8(process.env.FAILPROOFAI_SYSTEM_BIN_DIR || "/opt/failproofai", user);
|
|
13647
|
+
}
|
|
13648
|
+
function systemBinaryDir() {
|
|
13649
|
+
return resolve8(systemBinaryRoot(), "bin");
|
|
13650
|
+
}
|
|
13651
|
+
function daemonSystemBinaryDir() {
|
|
13652
|
+
return process.platform === "linux" ? systemBinaryRoot() : null;
|
|
13653
|
+
}
|
|
13654
|
+
function systemBinaryTarget(binaryPath) {
|
|
13655
|
+
if (process.platform !== "linux" || process.env.FAILPROOFAI_DAEMON_BINARY)
|
|
13656
|
+
return null;
|
|
13657
|
+
try {
|
|
13658
|
+
if (!statSync10(binaryPath).isFile())
|
|
13659
|
+
return null;
|
|
13660
|
+
} catch {
|
|
13661
|
+
return null;
|
|
13662
|
+
}
|
|
13663
|
+
return resolve8(systemBinaryDir(), `failproofaid-${version2}`);
|
|
13664
|
+
}
|
|
13665
|
+
function selinuxEnabled() {
|
|
13666
|
+
return existsSync11("/sys/fs/selinux/enforce");
|
|
13667
|
+
}
|
|
13668
|
+
function stageSystemBinary(binaryPath) {
|
|
13669
|
+
const target = systemBinaryTarget(binaryPath);
|
|
13670
|
+
if (!target)
|
|
13671
|
+
return binaryPath;
|
|
13672
|
+
const dir = systemBinaryDir();
|
|
13673
|
+
const staging = `${target}.${process.pid}.tmp`;
|
|
13674
|
+
runPrivileged("install", ["-d", "-m", "0755", dir]);
|
|
13675
|
+
try {
|
|
13676
|
+
runPrivileged("install", ["-m", "0755", binaryPath, staging]);
|
|
13677
|
+
runPrivileged("mv", ["-f", staging, target]);
|
|
13678
|
+
} catch (err) {
|
|
13679
|
+
try {
|
|
13680
|
+
runPrivileged("rm", ["-f", staging]);
|
|
13681
|
+
} catch {}
|
|
13682
|
+
throw err;
|
|
13683
|
+
}
|
|
13684
|
+
if (selinuxEnabled()) {
|
|
13685
|
+
const root = systemBinaryRoot();
|
|
13686
|
+
try {
|
|
13687
|
+
runPrivileged("restorecon", ["-R", root]);
|
|
13688
|
+
} catch (err) {
|
|
13689
|
+
hookLogWarn(`restorecon on ${root} failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
13690
|
+
}
|
|
13691
|
+
}
|
|
13692
|
+
return target;
|
|
13693
|
+
}
|
|
13694
|
+
function pruneSystemBinaries(current) {
|
|
13695
|
+
try {
|
|
13696
|
+
const dir = systemBinaryDir();
|
|
13697
|
+
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);
|
|
13698
|
+
for (const { p } of stale)
|
|
13699
|
+
runPrivileged("rm", ["-f", p]);
|
|
13700
|
+
} catch {}
|
|
13701
|
+
}
|
|
13615
13702
|
function legacySystemdUserUnitPath() {
|
|
13616
13703
|
return resolve8(homedir5(), ".config", "systemd", "user", "failproofaid.service");
|
|
13617
13704
|
}
|
|
@@ -13792,9 +13879,17 @@ ${envBlock} <key>StandardOutPath</key>
|
|
|
13792
13879
|
}
|
|
13793
13880
|
function daemonInstallCommands(binaryPath, workerCmd, cliCmd) {
|
|
13794
13881
|
if (process.platform === "linux") {
|
|
13882
|
+
const target = systemBinaryTarget(binaryPath);
|
|
13883
|
+
const dir = systemBinaryDir();
|
|
13884
|
+
const stage = target ? [
|
|
13885
|
+
`sudo install -d -m 0755 ${shellQuote(dir)}`,
|
|
13886
|
+
`sudo install -m 0755 ${shellQuote(binaryPath)} ${shellQuote(target)}`,
|
|
13887
|
+
`{ sudo restorecon -R ${shellQuote(systemBinaryRoot())} 2>/dev/null || true; }`
|
|
13888
|
+
] : [];
|
|
13795
13889
|
return [
|
|
13890
|
+
...stage,
|
|
13796
13891
|
`sudo tee ${systemdUnitPath()} <<'EOF'
|
|
13797
|
-
${systemdUnitContents(binaryPath, workerCmd, cliCmd)}EOF`,
|
|
13892
|
+
${systemdUnitContents(target ?? binaryPath, workerCmd, cliCmd)}EOF`,
|
|
13798
13893
|
"sudo systemctl daemon-reload",
|
|
13799
13894
|
`sudo systemctl enable ${systemdUnitName()}`,
|
|
13800
13895
|
`sudo systemctl restart ${systemdUnitName()}`
|
|
@@ -13822,9 +13917,11 @@ async function installDaemonService() {
|
|
|
13822
13917
|
};
|
|
13823
13918
|
}
|
|
13824
13919
|
removeLegacyUserService();
|
|
13920
|
+
let execPath = binaryPath;
|
|
13825
13921
|
try {
|
|
13826
13922
|
if (process.platform === "linux") {
|
|
13827
|
-
|
|
13923
|
+
execPath = stageSystemBinary(binaryPath);
|
|
13924
|
+
writePrivilegedFile(systemdUnitPath(), systemdUnitContents(execPath, workerCmd, cliCmd));
|
|
13828
13925
|
runPrivileged("systemctl", ["daemon-reload"]);
|
|
13829
13926
|
runPrivileged("systemctl", ["enable", systemdUnitName()]);
|
|
13830
13927
|
restartSystemdUnit();
|
|
@@ -13848,6 +13945,8 @@ async function installDaemonService() {
|
|
|
13848
13945
|
hookLogWarn(`daemon service install failed: ${reason}`);
|
|
13849
13946
|
return { installed: false, reason };
|
|
13850
13947
|
}
|
|
13948
|
+
if (execPath !== binaryPath)
|
|
13949
|
+
pruneSystemBinaries(execPath);
|
|
13851
13950
|
return { installed: true };
|
|
13852
13951
|
}
|
|
13853
13952
|
async function probeDaemon() {
|
|
@@ -14071,15 +14170,22 @@ async function uninstallDaemonService() {
|
|
|
14071
14170
|
try {
|
|
14072
14171
|
if (process.platform === "linux") {
|
|
14073
14172
|
const unitPath = systemdUnitPath();
|
|
14074
|
-
if (
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
|
|
14082
|
-
}
|
|
14173
|
+
if (existsSync11(unitPath)) {
|
|
14174
|
+
try {
|
|
14175
|
+
runPrivileged("systemctl", ["disable", "--now", systemdUnitName()]);
|
|
14176
|
+
} catch {}
|
|
14177
|
+
runPrivileged("rm", ["-f", unitPath]);
|
|
14178
|
+
try {
|
|
14179
|
+
runPrivileged("systemctl", ["daemon-reload"]);
|
|
14180
|
+
} catch {}
|
|
14181
|
+
}
|
|
14182
|
+
const binRoot = systemBinaryRoot();
|
|
14183
|
+
if (existsSync11(binRoot)) {
|
|
14184
|
+
runPrivileged("rm", ["-rf", binRoot]);
|
|
14185
|
+
try {
|
|
14186
|
+
runPrivileged("rmdir", [dirname7(binRoot)]);
|
|
14187
|
+
} catch {}
|
|
14188
|
+
}
|
|
14083
14189
|
} else {
|
|
14084
14190
|
const plistPath = launchdPlistPath();
|
|
14085
14191
|
if (!existsSync11(plistPath))
|
|
@@ -14162,9 +14268,9 @@ var init_daemon_service = __esm(() => {
|
|
|
14162
14268
|
// src/hooks/codex-system-hooks.ts
|
|
14163
14269
|
import { execSync as execSync3 } from "node:child_process";
|
|
14164
14270
|
import { createHash as createHash4 } from "node:crypto";
|
|
14165
|
-
import { accessSync, chmodSync as chmodSync5, constants as fsConstants3, existsSync as existsSync12, readFileSync as readFileSync8, rmSync as rmSync6, statSync as
|
|
14271
|
+
import { accessSync, chmodSync as chmodSync5, constants as fsConstants3, existsSync as existsSync12, readFileSync as readFileSync8, rmSync as rmSync6, statSync as statSync11 } from "node:fs";
|
|
14166
14272
|
import { homedir as homedir6 } from "node:os";
|
|
14167
|
-
import { dirname as
|
|
14273
|
+
import { dirname as dirname8, resolve as resolve9 } from "node:path";
|
|
14168
14274
|
function codexSystemConfigPath() {
|
|
14169
14275
|
const override = process.env.FAILPROOFAI_CODEX_SYSTEM_CONFIG;
|
|
14170
14276
|
if (override !== undefined)
|
|
@@ -14286,9 +14392,9 @@ function resolvedPath(deps) {
|
|
|
14286
14392
|
return deps.path !== undefined ? deps.path : codexSystemConfigPath();
|
|
14287
14393
|
}
|
|
14288
14394
|
function writableDirectly(path) {
|
|
14289
|
-
let dir =
|
|
14395
|
+
let dir = dirname8(path);
|
|
14290
14396
|
while (!existsSync12(dir)) {
|
|
14291
|
-
const parent =
|
|
14397
|
+
const parent = dirname8(dir);
|
|
14292
14398
|
if (parent === dir)
|
|
14293
14399
|
return false;
|
|
14294
14400
|
dir = parent;
|
|
@@ -14304,7 +14410,7 @@ function writableDirectly(path) {
|
|
|
14304
14410
|
}
|
|
14305
14411
|
function fileMode(path) {
|
|
14306
14412
|
try {
|
|
14307
|
-
return (
|
|
14413
|
+
return (statSync11(path).mode & 511).toString(8).padStart(4, "0");
|
|
14308
14414
|
} catch {
|
|
14309
14415
|
return "0644";
|
|
14310
14416
|
}
|
|
@@ -14315,7 +14421,7 @@ function writeSystemFile(path, contents, mode, direct) {
|
|
|
14315
14421
|
chmodSync5(path, parseInt(mode, 8));
|
|
14316
14422
|
return;
|
|
14317
14423
|
}
|
|
14318
|
-
runPrivileged("install", ["-d", "-m", "0755",
|
|
14424
|
+
runPrivileged("install", ["-d", "-m", "0755", dirname8(path)]);
|
|
14319
14425
|
writePrivilegedFile(path, contents, mode);
|
|
14320
14426
|
}
|
|
14321
14427
|
function removeSystemFile(path, direct) {
|
|
@@ -14681,19 +14787,19 @@ var init_codex_system_hooks = __esm(() => {
|
|
|
14681
14787
|
});
|
|
14682
14788
|
|
|
14683
14789
|
// lib/hermes-profiles.ts
|
|
14684
|
-
import { existsSync as existsSync13, readdirSync as
|
|
14790
|
+
import { existsSync as existsSync13, readdirSync as readdirSync3 } from "node:fs";
|
|
14685
14791
|
import { homedir as homedir7 } from "node:os";
|
|
14686
|
-
import { basename as basename2, dirname as
|
|
14792
|
+
import { basename as basename2, dirname as dirname9, join as join4, resolve as resolve10 } from "node:path";
|
|
14687
14793
|
function hermesRoot() {
|
|
14688
14794
|
const env = (process.env.HERMES_HOME || "").trim();
|
|
14689
14795
|
if (env) {
|
|
14690
14796
|
let home = resolve10(env);
|
|
14691
|
-
const parent =
|
|
14797
|
+
const parent = dirname9(home);
|
|
14692
14798
|
if (basename2(parent) === PROFILES_DIR)
|
|
14693
|
-
home =
|
|
14799
|
+
home = dirname9(parent);
|
|
14694
14800
|
const base = basename2(home);
|
|
14695
14801
|
if (base === STANDARD_HOME || base.startsWith(SIBLING_HOME_PREFIX)) {
|
|
14696
|
-
return join4(
|
|
14802
|
+
return join4(dirname9(home), STANDARD_HOME);
|
|
14697
14803
|
}
|
|
14698
14804
|
return home;
|
|
14699
14805
|
}
|
|
@@ -14716,7 +14822,7 @@ function listHermesProfiles() {
|
|
|
14716
14822
|
const seen = new Set([HERMES_DEFAULT_PROFILE]);
|
|
14717
14823
|
let names = [];
|
|
14718
14824
|
try {
|
|
14719
|
-
names =
|
|
14825
|
+
names = readdirSync3(join4(root, PROFILES_DIR), { withFileTypes: true }).filter((e) => (e.isDirectory() || e.isSymbolicLink()) && !e.name.startsWith(".")).map((e) => e.name).sort();
|
|
14720
14826
|
} catch {}
|
|
14721
14827
|
for (const name of names) {
|
|
14722
14828
|
if (seen.has(name))
|
|
@@ -14727,9 +14833,9 @@ function listHermesProfiles() {
|
|
|
14727
14833
|
if (basename2(root) !== STANDARD_HOME)
|
|
14728
14834
|
return out;
|
|
14729
14835
|
let siblings = [];
|
|
14730
|
-
const parent =
|
|
14836
|
+
const parent = dirname9(root);
|
|
14731
14837
|
try {
|
|
14732
|
-
siblings =
|
|
14838
|
+
siblings = readdirSync3(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) => ({
|
|
14733
14839
|
name: entry.name.slice(SIBLING_HOME_PREFIX.length),
|
|
14734
14840
|
home: join4(parent, entry.name)
|
|
14735
14841
|
})).sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -14770,9 +14876,9 @@ var PROFILES_DIR = "profiles", STANDARD_HOME = ".hermes", SIBLING_HOME_PREFIX =
|
|
|
14770
14876
|
var init_hermes_profiles = () => {};
|
|
14771
14877
|
|
|
14772
14878
|
// lib/openclaw-profiles.ts
|
|
14773
|
-
import { existsSync as existsSync14, readdirSync as
|
|
14879
|
+
import { existsSync as existsSync14, readdirSync as readdirSync4 } from "node:fs";
|
|
14774
14880
|
import { homedir as homedir8 } from "node:os";
|
|
14775
|
-
import { basename as basename3, dirname as
|
|
14881
|
+
import { basename as basename3, dirname as dirname10, join as join5, resolve as resolve11 } from "node:path";
|
|
14776
14882
|
function openclawProfileHome() {
|
|
14777
14883
|
const stateDir = (process.env.OPENCLAW_STATE_DIR ?? "").trim();
|
|
14778
14884
|
if (stateDir)
|
|
@@ -14782,7 +14888,7 @@ function openclawProfileHome() {
|
|
|
14782
14888
|
return resolve11(openclawHome);
|
|
14783
14889
|
const configPath = (process.env.OPENCLAW_CONFIG_PATH || "").trim();
|
|
14784
14890
|
if (configPath)
|
|
14785
|
-
return
|
|
14891
|
+
return dirname10(resolve11(configPath));
|
|
14786
14892
|
return join5(homedir8(), ".openclaw");
|
|
14787
14893
|
}
|
|
14788
14894
|
function listOpenClawProfiles() {
|
|
@@ -14791,14 +14897,14 @@ function listOpenClawProfiles() {
|
|
|
14791
14897
|
if (activeBase !== ".openclaw" && !activeBase.startsWith(".openclaw-")) {
|
|
14792
14898
|
return [{ name: OPENCLAW_DEFAULT_PROFILE, home: activeHome }];
|
|
14793
14899
|
}
|
|
14794
|
-
const parent =
|
|
14900
|
+
const parent = dirname10(activeHome);
|
|
14795
14901
|
const defaultHome = join5(parent, ".openclaw");
|
|
14796
14902
|
const out = [
|
|
14797
14903
|
{ name: OPENCLAW_DEFAULT_PROFILE, home: defaultHome }
|
|
14798
14904
|
];
|
|
14799
14905
|
let entries;
|
|
14800
14906
|
try {
|
|
14801
|
-
entries =
|
|
14907
|
+
entries = readdirSync4(parent, { withFileTypes: true });
|
|
14802
14908
|
} catch {
|
|
14803
14909
|
return out;
|
|
14804
14910
|
}
|
|
@@ -14828,7 +14934,7 @@ import {
|
|
|
14828
14934
|
symlinkSync,
|
|
14829
14935
|
unlinkSync as unlinkSync2
|
|
14830
14936
|
} from "node:fs";
|
|
14831
|
-
import { resolve as resolve12, dirname as
|
|
14937
|
+
import { resolve as resolve12, dirname as dirname11, basename as basename4 } from "node:path";
|
|
14832
14938
|
import { fileURLToPath } from "node:url";
|
|
14833
14939
|
import { homedir as homedir9 } from "node:os";
|
|
14834
14940
|
function readJsonFile(path) {
|
|
@@ -14938,7 +15044,7 @@ function isMarkedCopilotHook(hook) {
|
|
|
14938
15044
|
return false;
|
|
14939
15045
|
}
|
|
14940
15046
|
function opencodePluginFilePath(settingsPath) {
|
|
14941
|
-
return resolve12(
|
|
15047
|
+
return resolve12(dirname11(settingsPath), "plugins", "failproofai.mjs");
|
|
14942
15048
|
}
|
|
14943
15049
|
function buildOpenCodePluginShim(binaryPath, scope) {
|
|
14944
15050
|
const useNpx = scope === "project";
|
|
@@ -15178,7 +15284,7 @@ function getHermesPluginSourcePath() {
|
|
|
15178
15284
|
const fromEnv = process.env.FAILPROOFAI_PACKAGE_ROOT;
|
|
15179
15285
|
if (fromEnv)
|
|
15180
15286
|
return resolve12(fromEnv, HERMES_PLUGIN_SOURCE_DIR);
|
|
15181
|
-
return findHermesPluginSourcePath(
|
|
15287
|
+
return findHermesPluginSourcePath(dirname11(fileURLToPath(import.meta.url)));
|
|
15182
15288
|
}
|
|
15183
15289
|
function findHermesPluginSourcePath(startDir) {
|
|
15184
15290
|
let dir = resolve12(startDir);
|
|
@@ -15186,7 +15292,7 @@ function findHermesPluginSourcePath(startDir) {
|
|
|
15186
15292
|
const candidate = resolve12(dir, HERMES_PLUGIN_SOURCE_DIR);
|
|
15187
15293
|
if (existsSync15(resolve12(candidate, "plugin.yaml")))
|
|
15188
15294
|
return candidate;
|
|
15189
|
-
const parent =
|
|
15295
|
+
const parent = dirname11(dir);
|
|
15190
15296
|
if (parent === dir)
|
|
15191
15297
|
break;
|
|
15192
15298
|
dir = parent;
|
|
@@ -15194,7 +15300,7 @@ function findHermesPluginSourcePath(startDir) {
|
|
|
15194
15300
|
return resolve12(startDir, "..", "..", HERMES_PLUGIN_SOURCE_DIR);
|
|
15195
15301
|
}
|
|
15196
15302
|
function hermesPluginPathForSettings(settingsPath) {
|
|
15197
|
-
return resolve12(
|
|
15303
|
+
return resolve12(dirname11(settingsPath), "plugins", HERMES_PLUGIN_ID);
|
|
15198
15304
|
}
|
|
15199
15305
|
function pathPresent(path) {
|
|
15200
15306
|
try {
|
|
@@ -15208,7 +15314,7 @@ function hasAllHermesPluginFiles(dir) {
|
|
|
15208
15314
|
return HERMES_PLUGIN_FILES.every((file) => existsSync15(resolve12(dir, file)));
|
|
15209
15315
|
}
|
|
15210
15316
|
function hermesLinkRecordPath(pluginPath) {
|
|
15211
|
-
return resolve12(
|
|
15317
|
+
return resolve12(dirname11(pluginPath), HERMES_LINK_RECORD);
|
|
15212
15318
|
}
|
|
15213
15319
|
function readHermesLinkRecord(pluginPath) {
|
|
15214
15320
|
try {
|
|
@@ -15231,10 +15337,10 @@ function isOwnedHermesPluginLink(pluginPath, target) {
|
|
|
15231
15337
|
return true;
|
|
15232
15338
|
if (samePath(target, getHermesPluginSourcePath()))
|
|
15233
15339
|
return true;
|
|
15234
|
-
const pkgRoot =
|
|
15340
|
+
const pkgRoot = dirname11(resolve12(target));
|
|
15235
15341
|
if (basename4(resolve12(target)) !== HERMES_PLUGIN_SOURCE_DIR)
|
|
15236
15342
|
return false;
|
|
15237
|
-
if (basename4(pkgRoot) !== "failproofai" || basename4(
|
|
15343
|
+
if (basename4(pkgRoot) !== "failproofai" || basename4(dirname11(pkgRoot)) !== "node_modules")
|
|
15238
15344
|
return false;
|
|
15239
15345
|
try {
|
|
15240
15346
|
const pkg = JSON.parse(readFileSync9(resolve12(pkgRoot, "package.json"), "utf8"));
|
|
@@ -15266,7 +15372,7 @@ function hermesPluginState(settingsPath) {
|
|
|
15266
15372
|
if (isLink) {
|
|
15267
15373
|
let target;
|
|
15268
15374
|
try {
|
|
15269
|
-
target = resolve12(
|
|
15375
|
+
target = resolve12(dirname11(pluginPath), readlinkSync2(pluginPath));
|
|
15270
15376
|
} catch {
|
|
15271
15377
|
return { kind: "foreign" };
|
|
15272
15378
|
}
|
|
@@ -15311,7 +15417,7 @@ function installHermesPlugin(settingsPath, deps = {}) {
|
|
|
15311
15417
|
}
|
|
15312
15418
|
return "unchanged";
|
|
15313
15419
|
}
|
|
15314
|
-
mkdirSync8(
|
|
15420
|
+
mkdirSync8(dirname11(destination), { recursive: true });
|
|
15315
15421
|
const suffix = `${process.pid}-${Date.now()}`;
|
|
15316
15422
|
const temporary = `${destination}.install-${suffix}`;
|
|
15317
15423
|
let linked = false;
|
|
@@ -16117,7 +16223,7 @@ var init_integrations = __esm(() => {
|
|
|
16117
16223
|
const effectiveScope = scope ?? "project";
|
|
16118
16224
|
const settingsPath = effectiveScope === "user" ? resolve12(homedir9(), ".config", "opencode", "opencode.json") : resolve12(process.cwd(), ".opencode", "opencode.json");
|
|
16119
16225
|
const pluginPath = opencodePluginFilePath(settingsPath);
|
|
16120
|
-
mkdirSync8(
|
|
16226
|
+
mkdirSync8(dirname11(pluginPath), { recursive: true });
|
|
16121
16227
|
writeConfigFileAtomic(pluginPath, buildOpenCodePluginShim(binaryPath, effectiveScope), { symlinks: "replace" });
|
|
16122
16228
|
if (!Array.isArray(s.plugin))
|
|
16123
16229
|
s.plugin = [];
|
|
@@ -16337,6 +16443,7 @@ var init_integrations = __esm(() => {
|
|
|
16337
16443
|
openclaw = {
|
|
16338
16444
|
id: "openclaw",
|
|
16339
16445
|
displayName: "OpenClaw",
|
|
16446
|
+
requiresHealthyDaemon: true,
|
|
16340
16447
|
scopes: OPENCLAW_HOOK_SCOPES,
|
|
16341
16448
|
eventTypes: OPENCLAW_HOOK_EVENT_TYPES,
|
|
16342
16449
|
getSettingsPath() {
|
|
@@ -19228,7 +19335,7 @@ var init_custom_hooks_registry = __esm(() => {
|
|
|
19228
19335
|
// src/hooks/loader-utils.ts
|
|
19229
19336
|
import { readFile as readFile2, writeFile as writeFile2, unlink, access, mkdir, lstat } from "fs/promises";
|
|
19230
19337
|
import { tmpdir as tmpdir2 } from "os";
|
|
19231
|
-
import { resolve as resolve13, dirname as
|
|
19338
|
+
import { resolve as resolve13, dirname as dirname12, relative as relative2, join as join6 } from "path";
|
|
19232
19339
|
import { pathToFileURL } from "url";
|
|
19233
19340
|
import { createHash as createHash5 } from "crypto";
|
|
19234
19341
|
function isTmpArtifact(name) {
|
|
@@ -19269,7 +19376,7 @@ async function findDistIndex() {
|
|
|
19269
19376
|
return candidate;
|
|
19270
19377
|
}
|
|
19271
19378
|
const candidates = [
|
|
19272
|
-
resolve13(
|
|
19379
|
+
resolve13(dirname12(process.execPath), "..", "assets", "dist", "index.js"),
|
|
19273
19380
|
resolve13(process.cwd(), "dist", "index.js"),
|
|
19274
19381
|
resolve13(process.cwd(), "node_modules", "failproofai", "dist", "index.js")
|
|
19275
19382
|
];
|
|
@@ -19360,7 +19467,7 @@ async function rewriteFileTree(entryPath, distUrl, distIndex, tmpSuffix = TMP_SU
|
|
|
19360
19467
|
if (distIndex) {
|
|
19361
19468
|
code = code.replace(/require\s*\(\s*(['"])(?:claudeye|failproofai)\1\s*\)/g, `require('${distIndex.replace(/\\/g, "\\\\")}')`);
|
|
19362
19469
|
}
|
|
19363
|
-
const dir =
|
|
19470
|
+
const dir = dirname12(filePath);
|
|
19364
19471
|
const rewrites = new Map;
|
|
19365
19472
|
for (const re of [LOCAL_IMPORT_RE, LOCAL_REQUIRE_RE]) {
|
|
19366
19473
|
const freshRe = new RegExp(re.source, re.flags);
|
|
@@ -19583,7 +19690,7 @@ var init_telemetry_id2 = __esm(() => {
|
|
|
19583
19690
|
// src/hooks/custom-hooks-loader.ts
|
|
19584
19691
|
import { resolve as resolve14, isAbsolute as isAbsolute2, basename as basename5 } from "node:path";
|
|
19585
19692
|
import { randomUUID } from "crypto";
|
|
19586
|
-
import { existsSync as existsSync16, readdirSync as
|
|
19693
|
+
import { existsSync as existsSync16, readdirSync as readdirSync5 } from "node:fs";
|
|
19587
19694
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
19588
19695
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
19589
19696
|
import { createHash as createHash6 } from "node:crypto";
|
|
@@ -19591,7 +19698,7 @@ function discoverPolicyFiles(dir) {
|
|
|
19591
19698
|
if (!existsSync16(dir))
|
|
19592
19699
|
return [];
|
|
19593
19700
|
try {
|
|
19594
|
-
const entries =
|
|
19701
|
+
const entries = readdirSync5(dir, { withFileTypes: true });
|
|
19595
19702
|
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));
|
|
19596
19703
|
} catch {
|
|
19597
19704
|
return [];
|
|
@@ -19601,7 +19708,7 @@ function findSkippedPolicyFiles(dir) {
|
|
|
19601
19708
|
if (!existsSync16(dir))
|
|
19602
19709
|
return [];
|
|
19603
19710
|
try {
|
|
19604
|
-
return
|
|
19711
|
+
return readdirSync5(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));
|
|
19605
19712
|
} catch {
|
|
19606
19713
|
return [];
|
|
19607
19714
|
}
|
|
@@ -21448,7 +21555,7 @@ var init_pack_cli = __esm(() => {
|
|
|
21448
21555
|
// src/hooks/pack-store.ts
|
|
21449
21556
|
import { createHash as createHash7 } from "node:crypto";
|
|
21450
21557
|
import { existsSync as existsSync17, mkdirSync as mkdirSync9, readFileSync as readFileSync10, renameSync as renameSync6, rmSync as rmSync8, writeFileSync as writeFileSync7 } from "node:fs";
|
|
21451
|
-
import { dirname as
|
|
21558
|
+
import { dirname as dirname13, resolve as resolve15 } from "node:path";
|
|
21452
21559
|
function baseUrl2() {
|
|
21453
21560
|
return (process.env.FAILPROOFAI_PACK_BASE_URL || DEFAULT_BASE_URL2).replace(/\/+$/, "");
|
|
21454
21561
|
}
|
|
@@ -21619,7 +21726,7 @@ function sha256(bytes) {
|
|
|
21619
21726
|
function writeAtomic(target, bytes) {
|
|
21620
21727
|
const tempPath = `${target}.${process.pid}.tmp`;
|
|
21621
21728
|
try {
|
|
21622
|
-
mkdirSync9(
|
|
21729
|
+
mkdirSync9(dirname13(target), { recursive: true });
|
|
21623
21730
|
writeFileSync7(tempPath, bytes);
|
|
21624
21731
|
renameSync6(tempPath, target);
|
|
21625
21732
|
} catch (err) {
|
|
@@ -22964,10 +23071,10 @@ import {
|
|
|
22964
23071
|
writeFileSync as writeFileSync8,
|
|
22965
23072
|
appendFileSync as appendFileSync2,
|
|
22966
23073
|
renameSync as renameSync7,
|
|
22967
|
-
readdirSync as
|
|
23074
|
+
readdirSync as readdirSync6,
|
|
22968
23075
|
mkdirSync as mkdirSync10,
|
|
22969
23076
|
existsSync as existsSync18,
|
|
22970
|
-
statSync as
|
|
23077
|
+
statSync as statSync12,
|
|
22971
23078
|
unlinkSync as unlinkSync3
|
|
22972
23079
|
} from "node:fs";
|
|
22973
23080
|
import { join as join7 } from "node:path";
|
|
@@ -22988,7 +23095,7 @@ function acquireLock() {
|
|
|
22988
23095
|
if (e.code !== "EEXIST")
|
|
22989
23096
|
return;
|
|
22990
23097
|
try {
|
|
22991
|
-
const s =
|
|
23098
|
+
const s = statSync12(lockPath);
|
|
22992
23099
|
if (Date.now() - s.mtimeMs > LOCK_STALE_MS) {
|
|
22993
23100
|
writeFileSync8(lockPath, String(process.pid), "utf-8");
|
|
22994
23101
|
return;
|
|
@@ -23176,7 +23283,7 @@ function readJsonlFile(filePath) {
|
|
|
23176
23283
|
}
|
|
23177
23284
|
function getArchiveFiles() {
|
|
23178
23285
|
try {
|
|
23179
|
-
const files =
|
|
23286
|
+
const files = readdirSync6(storeDirValue());
|
|
23180
23287
|
return files.filter((f) => f.startsWith("page-") && f.endsWith(".jsonl")).sort((a, b) => {
|
|
23181
23288
|
const partsA = a.slice(5, -6).split("-");
|
|
23182
23289
|
const partsB = b.slice(5, -6).split("-");
|
|
@@ -23200,7 +23307,7 @@ var init_hook_activity_store = __esm(() => {
|
|
|
23200
23307
|
});
|
|
23201
23308
|
|
|
23202
23309
|
// src/hooks/delivery-health.ts
|
|
23203
|
-
import { existsSync as existsSync19, readFileSync as readFileSync12, readdirSync as
|
|
23310
|
+
import { existsSync as existsSync19, readFileSync as readFileSync12, readdirSync as readdirSync7, statSync as statSync13 } from "node:fs";
|
|
23204
23311
|
import { join as join8 } from "node:path";
|
|
23205
23312
|
function parseParkedName(name) {
|
|
23206
23313
|
const poison = name.endsWith(POISON_SUFFIX);
|
|
@@ -23242,7 +23349,7 @@ function deliveryHealth(home, now = Date.now(), connectedAt = home ? undefined :
|
|
|
23242
23349
|
return EMPTY;
|
|
23243
23350
|
let entries;
|
|
23244
23351
|
try {
|
|
23245
|
-
entries =
|
|
23352
|
+
entries = readdirSync7(dir);
|
|
23246
23353
|
} catch {
|
|
23247
23354
|
return EMPTY;
|
|
23248
23355
|
}
|
|
@@ -23258,7 +23365,7 @@ function deliveryHealth(home, now = Date.now(), connectedAt = home ? undefined :
|
|
|
23258
23365
|
const parsed = parseParkedName(name);
|
|
23259
23366
|
let mtime;
|
|
23260
23367
|
try {
|
|
23261
|
-
mtime =
|
|
23368
|
+
mtime = statSync13(join8(dir, name)).mtimeMs;
|
|
23262
23369
|
} catch {
|
|
23263
23370
|
continue;
|
|
23264
23371
|
}
|
|
@@ -24016,7 +24123,7 @@ var init_cursor_projects = __esm(() => {
|
|
|
24016
24123
|
});
|
|
24017
24124
|
|
|
24018
24125
|
// lib/sqlite-reader.ts
|
|
24019
|
-
import { existsSync as existsSync20, readFileSync as readFileSync13, statSync as
|
|
24126
|
+
import { existsSync as existsSync20, readFileSync as readFileSync13, statSync as statSync14 } from "node:fs";
|
|
24020
24127
|
import initSqlJs from "sql.js/dist/sql-asm.js";
|
|
24021
24128
|
async function tryNodeSqlite(dbPath) {
|
|
24022
24129
|
try {
|
|
@@ -24041,7 +24148,7 @@ function loadSqlJs() {
|
|
|
24041
24148
|
return sqlPromise;
|
|
24042
24149
|
}
|
|
24043
24150
|
function fileVersion2(path) {
|
|
24044
|
-
const stat =
|
|
24151
|
+
const stat = statSync14(path);
|
|
24045
24152
|
return { size: stat.size, mtimeMs: stat.mtimeMs, ctimeMs: stat.ctimeMs };
|
|
24046
24153
|
}
|
|
24047
24154
|
function sameVersion(a, b) {
|
|
@@ -24992,7 +25099,7 @@ var init_openclaw_db = __esm(() => {
|
|
|
24992
25099
|
|
|
24993
25100
|
// lib/openclaw-sessions.ts
|
|
24994
25101
|
import { readFile as readFile7 } from "node:fs/promises";
|
|
24995
|
-
import { readdirSync as
|
|
25102
|
+
import { readdirSync as readdirSync8, statSync as statSync15 } from "node:fs";
|
|
24996
25103
|
import { homedir as homedir16 } from "node:os";
|
|
24997
25104
|
import { join as join17 } from "node:path";
|
|
24998
25105
|
function openclawHome() {
|
|
@@ -25115,7 +25222,7 @@ function openclawLinesToLogEntries(lines, source = "session") {
|
|
|
25115
25222
|
}
|
|
25116
25223
|
function listOpenClawAgents() {
|
|
25117
25224
|
try {
|
|
25118
|
-
return
|
|
25225
|
+
return readdirSync8(join17(openclawHome(), "agents"), { withFileTypes: true }).filter((d) => d.isDirectory() && !d.name.startsWith(".")).map((d) => d.name).sort();
|
|
25119
25226
|
} catch {
|
|
25120
25227
|
return [];
|
|
25121
25228
|
}
|
|
@@ -25125,7 +25232,7 @@ function listOpenClawTranscripts() {
|
|
|
25125
25232
|
const out = [];
|
|
25126
25233
|
let agentIds;
|
|
25127
25234
|
try {
|
|
25128
|
-
agentIds =
|
|
25235
|
+
agentIds = readdirSync8(agentsDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
|
|
25129
25236
|
} catch {
|
|
25130
25237
|
return out;
|
|
25131
25238
|
}
|
|
@@ -25133,7 +25240,7 @@ function listOpenClawTranscripts() {
|
|
|
25133
25240
|
const sessionsDir = join17(agentsDir, agentId, "sessions");
|
|
25134
25241
|
let files;
|
|
25135
25242
|
try {
|
|
25136
|
-
files =
|
|
25243
|
+
files = readdirSync8(sessionsDir);
|
|
25137
25244
|
} catch {
|
|
25138
25245
|
continue;
|
|
25139
25246
|
}
|
|
@@ -25145,7 +25252,7 @@ function listOpenClawTranscripts() {
|
|
|
25145
25252
|
continue;
|
|
25146
25253
|
const transcriptPath = join17(sessionsDir, file);
|
|
25147
25254
|
try {
|
|
25148
|
-
const st =
|
|
25255
|
+
const st = statSync15(transcriptPath);
|
|
25149
25256
|
out.push({
|
|
25150
25257
|
agentId,
|
|
25151
25258
|
sessionId,
|
|
@@ -25390,7 +25497,7 @@ var init_openclaw_projects = __esm(() => {
|
|
|
25390
25497
|
|
|
25391
25498
|
// lib/factory-sessions.ts
|
|
25392
25499
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
25393
|
-
import { readdirSync as
|
|
25500
|
+
import { readdirSync as readdirSync9, statSync as statSync16 } from "node:fs";
|
|
25394
25501
|
import { homedir as homedir17 } from "node:os";
|
|
25395
25502
|
import { join as join19 } from "node:path";
|
|
25396
25503
|
function factoryHome() {
|
|
@@ -25536,7 +25643,7 @@ function listFactoryTranscripts() {
|
|
|
25536
25643
|
const out = [];
|
|
25537
25644
|
let projectDirs;
|
|
25538
25645
|
try {
|
|
25539
|
-
projectDirs =
|
|
25646
|
+
projectDirs = readdirSync9(root, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
25540
25647
|
} catch {
|
|
25541
25648
|
return out;
|
|
25542
25649
|
}
|
|
@@ -25546,7 +25653,7 @@ function listFactoryTranscripts() {
|
|
|
25546
25653
|
const projectPath = join19(root, projectName);
|
|
25547
25654
|
let files;
|
|
25548
25655
|
try {
|
|
25549
|
-
files =
|
|
25656
|
+
files = readdirSync9(projectPath);
|
|
25550
25657
|
} catch {
|
|
25551
25658
|
continue;
|
|
25552
25659
|
}
|
|
@@ -25558,7 +25665,7 @@ function listFactoryTranscripts() {
|
|
|
25558
25665
|
continue;
|
|
25559
25666
|
const transcriptPath = join19(projectPath, file);
|
|
25560
25667
|
try {
|
|
25561
|
-
const st =
|
|
25668
|
+
const st = statSync16(transcriptPath);
|
|
25562
25669
|
out.push({ projectName, cwd, sessionId, transcriptPath, mtimeMs: st.mtimeMs, sizeBytes: st.size });
|
|
25563
25670
|
} catch {}
|
|
25564
25671
|
}
|
|
@@ -25978,7 +26085,7 @@ var init_devin_projects = __esm(() => {
|
|
|
25978
26085
|
|
|
25979
26086
|
// lib/antigravity-sessions.ts
|
|
25980
26087
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
25981
|
-
import { readdirSync as
|
|
26088
|
+
import { readdirSync as readdirSync10, statSync as statSync17 } from "node:fs";
|
|
25982
26089
|
import { homedir as homedir19 } from "node:os";
|
|
25983
26090
|
import { join as join21 } from "node:path";
|
|
25984
26091
|
function antigravityHome() {
|
|
@@ -26103,7 +26210,7 @@ function listAntigravityTranscripts() {
|
|
|
26103
26210
|
const out = [];
|
|
26104
26211
|
let convoDirs;
|
|
26105
26212
|
try {
|
|
26106
|
-
convoDirs =
|
|
26213
|
+
convoDirs = readdirSync10(root, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
26107
26214
|
} catch {
|
|
26108
26215
|
return out;
|
|
26109
26216
|
}
|
|
@@ -26113,7 +26220,7 @@ function listAntigravityTranscripts() {
|
|
|
26113
26220
|
continue;
|
|
26114
26221
|
const transcriptPath = join21(root, conversationId, rel);
|
|
26115
26222
|
try {
|
|
26116
|
-
const st =
|
|
26223
|
+
const st = statSync17(transcriptPath);
|
|
26117
26224
|
if (!st.isFile())
|
|
26118
26225
|
continue;
|
|
26119
26226
|
out.push({ conversationId, transcriptPath, mtimeMs: st.mtimeMs, sizeBytes: st.size });
|
|
@@ -26126,7 +26233,7 @@ function findAntigravityTranscript(conversationId) {
|
|
|
26126
26233
|
return null;
|
|
26127
26234
|
const transcriptPath = join21(antigravityBrainRoot(), conversationId, antigravityTranscriptRelPath());
|
|
26128
26235
|
try {
|
|
26129
|
-
if (
|
|
26236
|
+
if (statSync17(transcriptPath).isFile())
|
|
26130
26237
|
return transcriptPath;
|
|
26131
26238
|
} catch {}
|
|
26132
26239
|
return null;
|
|
@@ -27041,9 +27148,9 @@ var init_log_entries = __esm(() => {
|
|
|
27041
27148
|
});
|
|
27042
27149
|
|
|
27043
27150
|
// lib/codex-sessions.ts
|
|
27044
|
-
import { readFileSync as readFileSync15, readdirSync as
|
|
27151
|
+
import { readFileSync as readFileSync15, readdirSync as readdirSync11, existsSync as existsSync22, writeFileSync as writeFileSync9, mkdirSync as mkdirSync11, statSync as statSync18 } from "node:fs";
|
|
27045
27152
|
import { readFile as readFile11 } from "node:fs/promises";
|
|
27046
|
-
import { dirname as
|
|
27153
|
+
import { dirname as dirname14, join as join27 } from "node:path";
|
|
27047
27154
|
import { homedir as homedir21 } from "node:os";
|
|
27048
27155
|
function readCache() {
|
|
27049
27156
|
try {
|
|
@@ -27056,7 +27163,7 @@ function readCache() {
|
|
|
27056
27163
|
}
|
|
27057
27164
|
function writeCacheEntry(sessionId, path) {
|
|
27058
27165
|
try {
|
|
27059
|
-
mkdirSync11(
|
|
27166
|
+
mkdirSync11(dirname14(CACHE_PATH), { recursive: true });
|
|
27060
27167
|
const cache = readCache();
|
|
27061
27168
|
cache[sessionId] = path;
|
|
27062
27169
|
writeFileSync9(CACHE_PATH, JSON.stringify(cache), "utf-8");
|
|
@@ -27064,7 +27171,7 @@ function writeCacheEntry(sessionId, path) {
|
|
|
27064
27171
|
}
|
|
27065
27172
|
function dirSearch(dir, sessionId) {
|
|
27066
27173
|
try {
|
|
27067
|
-
for (const f of
|
|
27174
|
+
for (const f of readdirSync11(dir, { withFileTypes: true })) {
|
|
27068
27175
|
if (f.isFile() && f.name.includes(sessionId) && f.name.endsWith(".jsonl")) {
|
|
27069
27176
|
return join27(dir, f.name);
|
|
27070
27177
|
}
|
|
@@ -27094,13 +27201,13 @@ function findCodexTranscript(sessionId) {
|
|
|
27094
27201
|
}
|
|
27095
27202
|
}
|
|
27096
27203
|
try {
|
|
27097
|
-
for (const y of
|
|
27204
|
+
for (const y of readdirSync11(root, { withFileTypes: true })) {
|
|
27098
27205
|
if (!y.isDirectory())
|
|
27099
27206
|
continue;
|
|
27100
|
-
for (const m of
|
|
27207
|
+
for (const m of readdirSync11(join27(root, y.name), { withFileTypes: true })) {
|
|
27101
27208
|
if (!m.isDirectory())
|
|
27102
27209
|
continue;
|
|
27103
|
-
for (const d of
|
|
27210
|
+
for (const d of readdirSync11(join27(root, y.name, m.name), { withFileTypes: true })) {
|
|
27104
27211
|
if (!d.isDirectory())
|
|
27105
27212
|
continue;
|
|
27106
27213
|
const hit = dirSearch(join27(root, y.name, m.name, d.name), sessionId);
|
|
@@ -27369,7 +27476,7 @@ var init_resolve_permission_mode = __esm(() => {
|
|
|
27369
27476
|
});
|
|
27370
27477
|
|
|
27371
27478
|
// lib/copilot-sessions.ts
|
|
27372
|
-
import { readFileSync as readFileSync17, readdirSync as
|
|
27479
|
+
import { readFileSync as readFileSync17, readdirSync as readdirSync12, existsSync as existsSync23, statSync as statSync19 } from "node:fs";
|
|
27373
27480
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
27374
27481
|
import { join as join28, resolve as resolve17, sep as sep2 } from "node:path";
|
|
27375
27482
|
import { homedir as homedir22 } from "node:os";
|
|
@@ -27586,7 +27693,7 @@ var init_copilot_sessions = __esm(() => {
|
|
|
27586
27693
|
});
|
|
27587
27694
|
|
|
27588
27695
|
// lib/cursor-sessions.ts
|
|
27589
|
-
import { readFileSync as readFileSync18, readdirSync as
|
|
27696
|
+
import { readFileSync as readFileSync18, readdirSync as readdirSync13, existsSync as existsSync24, statSync as statSync20 } from "node:fs";
|
|
27590
27697
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
27591
27698
|
import { basename as basename6, join as join29, resolve as resolve18, sep as sep3 } from "node:path";
|
|
27592
27699
|
import { homedir as homedir23 } from "node:os";
|
|
@@ -27600,7 +27707,7 @@ function getCursorSessionDir(sessionId) {
|
|
|
27600
27707
|
const projectsRoot = resolve18(home, NEW_PROJECTS_DIR2);
|
|
27601
27708
|
let projectEntries = [];
|
|
27602
27709
|
try {
|
|
27603
|
-
projectEntries =
|
|
27710
|
+
projectEntries = readdirSync13(projectsRoot, { withFileTypes: true });
|
|
27604
27711
|
} catch {}
|
|
27605
27712
|
for (const entry of projectEntries) {
|
|
27606
27713
|
if (!entry.isDirectory())
|
|
@@ -27842,7 +27949,7 @@ var init_cursor_sessions = __esm(() => {
|
|
|
27842
27949
|
});
|
|
27843
27950
|
|
|
27844
27951
|
// lib/pi-sessions.ts
|
|
27845
|
-
import { readFileSync as readFileSync19, readdirSync as
|
|
27952
|
+
import { readFileSync as readFileSync19, readdirSync as readdirSync14, existsSync as existsSync25, statSync as statSync21 } from "node:fs";
|
|
27846
27953
|
import { readFile as readFile14 } from "node:fs/promises";
|
|
27847
27954
|
import { join as join30, resolve as resolve19, sep as sep4 } from "node:path";
|
|
27848
27955
|
import { homedir as homedir24 } from "node:os";
|
|
@@ -27858,7 +27965,7 @@ function findPiTranscript(sessionId) {
|
|
|
27858
27965
|
const root = resolve19(getPiSessionStateRoot());
|
|
27859
27966
|
let cwdDirs;
|
|
27860
27967
|
try {
|
|
27861
|
-
cwdDirs =
|
|
27968
|
+
cwdDirs = readdirSync14(root);
|
|
27862
27969
|
} catch {
|
|
27863
27970
|
return null;
|
|
27864
27971
|
}
|
|
@@ -27868,7 +27975,7 @@ function findPiTranscript(sessionId) {
|
|
|
27868
27975
|
continue;
|
|
27869
27976
|
let files;
|
|
27870
27977
|
try {
|
|
27871
|
-
files =
|
|
27978
|
+
files = readdirSync14(cwdPath);
|
|
27872
27979
|
} catch {
|
|
27873
27980
|
continue;
|
|
27874
27981
|
}
|
|
@@ -28518,7 +28625,7 @@ var init_pack_failclosed = __esm(() => {
|
|
|
28518
28625
|
});
|
|
28519
28626
|
|
|
28520
28627
|
// src/hooks/session-pause.ts
|
|
28521
|
-
import { existsSync as existsSync27, mkdirSync as mkdirSync12, readdirSync as
|
|
28628
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync12, readdirSync as readdirSync15, readFileSync as readFileSync21, rmSync as rmSync10 } from "node:fs";
|
|
28522
28629
|
import { createHash as createHash8 } from "node:crypto";
|
|
28523
28630
|
import { join as join31, resolve as resolve21 } from "node:path";
|
|
28524
28631
|
function pauseStateDir() {
|
|
@@ -28632,7 +28739,7 @@ function listActivePauses(now = Date.now()) {
|
|
|
28632
28739
|
const out = [];
|
|
28633
28740
|
let names;
|
|
28634
28741
|
try {
|
|
28635
|
-
names =
|
|
28742
|
+
names = readdirSync15(dir);
|
|
28636
28743
|
} catch {
|
|
28637
28744
|
return [];
|
|
28638
28745
|
}
|
|
@@ -28683,14 +28790,14 @@ import {
|
|
|
28683
28790
|
existsSync as existsSync28,
|
|
28684
28791
|
mkdirSync as mkdirSync13,
|
|
28685
28792
|
readFileSync as readFileSync22,
|
|
28686
|
-
readdirSync as
|
|
28793
|
+
readdirSync as readdirSync16,
|
|
28687
28794
|
renameSync as renameSync9,
|
|
28688
28795
|
rmSync as rmSync11,
|
|
28689
28796
|
rmdirSync,
|
|
28690
|
-
statSync as
|
|
28797
|
+
statSync as statSync22,
|
|
28691
28798
|
writeFileSync as writeFileSync11
|
|
28692
28799
|
} from "node:fs";
|
|
28693
|
-
import { dirname as
|
|
28800
|
+
import { dirname as dirname15, isAbsolute as isAbsolute3, relative as relative4, resolve as resolve22 } from "node:path";
|
|
28694
28801
|
function migrateConventionPolicies() {
|
|
28695
28802
|
const from = legacy.customPoliciesDir();
|
|
28696
28803
|
if (!existsSync28(from))
|
|
@@ -28699,7 +28806,7 @@ function migrateConventionPolicies() {
|
|
|
28699
28806
|
const mergeInto = (dir, dest, prefix) => {
|
|
28700
28807
|
let entries;
|
|
28701
28808
|
try {
|
|
28702
|
-
entries =
|
|
28809
|
+
entries = readdirSync16(dir, { withFileTypes: true });
|
|
28703
28810
|
} catch {
|
|
28704
28811
|
return;
|
|
28705
28812
|
}
|
|
@@ -28721,7 +28828,7 @@ function migrateConventionPolicies() {
|
|
|
28721
28828
|
} catch {}
|
|
28722
28829
|
continue;
|
|
28723
28830
|
}
|
|
28724
|
-
if (entry.isDirectory() &&
|
|
28831
|
+
if (entry.isDirectory() && statSync22(target).isDirectory()) {
|
|
28725
28832
|
mergeInto(source, target, `${name}/`);
|
|
28726
28833
|
try {
|
|
28727
28834
|
rmdirSync(source);
|
|
@@ -28745,7 +28852,7 @@ function migrateLegacySpool() {
|
|
|
28745
28852
|
continue;
|
|
28746
28853
|
try {
|
|
28747
28854
|
mkdirSync13(to, { recursive: true });
|
|
28748
|
-
for (const entry of
|
|
28855
|
+
for (const entry of readdirSync16(from, { withFileTypes: true })) {
|
|
28749
28856
|
if (!entry.isFile())
|
|
28750
28857
|
continue;
|
|
28751
28858
|
let name = entry.name;
|
|
@@ -28772,7 +28879,7 @@ function migrateHookActivity() {
|
|
|
28772
28879
|
return [];
|
|
28773
28880
|
const moved = [];
|
|
28774
28881
|
try {
|
|
28775
|
-
const entries =
|
|
28882
|
+
const entries = readdirSync16(from, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl"));
|
|
28776
28883
|
if (entries.length === 0)
|
|
28777
28884
|
return [];
|
|
28778
28885
|
const to = hookActivityDir();
|
|
@@ -28888,7 +28995,7 @@ function writeCarriedPolicyConfig(carried) {
|
|
|
28888
28995
|
}
|
|
28889
28996
|
} catch {}
|
|
28890
28997
|
try {
|
|
28891
|
-
mkdirSync13(
|
|
28998
|
+
mkdirSync13(dirname15(to), { recursive: true });
|
|
28892
28999
|
writeFileSync11(to, JSON.stringify({ ...existing, ...carried }, null, 2) + `
|
|
28893
29000
|
`, "utf8");
|
|
28894
29001
|
} catch {
|
|
@@ -29080,12 +29187,12 @@ var init_untraced_note = __esm(() => {
|
|
|
29080
29187
|
});
|
|
29081
29188
|
|
|
29082
29189
|
// src/hooks/agent-roster.ts
|
|
29083
|
-
import { lstatSync as lstatSync4, readFileSync as readFileSync24, statSync as
|
|
29190
|
+
import { lstatSync as lstatSync4, readFileSync as readFileSync24, statSync as statSync23 } from "node:fs";
|
|
29084
29191
|
import { homedir as homedir26 } from "node:os";
|
|
29085
|
-
import { dirname as
|
|
29192
|
+
import { dirname as dirname16, resolve as resolve23 } from "node:path";
|
|
29086
29193
|
function installedHookAt2(path, cli) {
|
|
29087
29194
|
try {
|
|
29088
|
-
const stat =
|
|
29195
|
+
const stat = statSync23(path);
|
|
29089
29196
|
if (!stat.isFile() || stat.size > 131072)
|
|
29090
29197
|
return false;
|
|
29091
29198
|
const text = readFileSync24(path, "utf8");
|
|
@@ -29143,7 +29250,7 @@ function runtimeAgentSettingsPath2(cli, cwd, userHome = homedir26(), hookScope)
|
|
|
29143
29250
|
if (installedHookAt2(path, cli))
|
|
29144
29251
|
matches.add(path);
|
|
29145
29252
|
}
|
|
29146
|
-
const parent =
|
|
29253
|
+
const parent = dirname16(dir);
|
|
29147
29254
|
if (parent === dir)
|
|
29148
29255
|
break;
|
|
29149
29256
|
dir = parent;
|
|
@@ -29236,8 +29343,8 @@ var init_agent_roster2 = __esm(() => {
|
|
|
29236
29343
|
});
|
|
29237
29344
|
|
|
29238
29345
|
// src/hooks/semantic/jev-config.ts
|
|
29239
|
-
import { closeSync as closeSync3, constants as fsConstants4, fstatSync as fstatSync2, openSync as openSync3, readSync as readSync2, statSync as
|
|
29240
|
-
import { dirname as
|
|
29346
|
+
import { closeSync as closeSync3, constants as fsConstants4, fstatSync as fstatSync2, openSync as openSync3, readSync as readSync2, statSync as statSync24 } from "node:fs";
|
|
29347
|
+
import { dirname as dirname17 } from "node:path";
|
|
29241
29348
|
function parseJevMode(raw) {
|
|
29242
29349
|
return raw === "off" || raw === "observe" || raw === "enforce" ? raw : null;
|
|
29243
29350
|
}
|
|
@@ -29497,7 +29604,7 @@ function looseConfigDirMode(path) {
|
|
|
29497
29604
|
if (!modesAreMeaningful())
|
|
29498
29605
|
return null;
|
|
29499
29606
|
try {
|
|
29500
|
-
const mode =
|
|
29607
|
+
const mode = statSync24(dirname17(path)).mode & 511;
|
|
29501
29608
|
return (mode & DIR_WRITABLE_BY_OTHERS2) !== 0 ? mode : null;
|
|
29502
29609
|
} catch {
|
|
29503
29610
|
return null;
|
|
@@ -29558,8 +29665,8 @@ function inspectJevConfig() {
|
|
|
29558
29665
|
path,
|
|
29559
29666
|
mode,
|
|
29560
29667
|
reason: "too-open",
|
|
29561
|
-
problem: `its directory ${
|
|
29562
|
-
fix: `chmod 700 ${
|
|
29668
|
+
problem: `its directory ${dirname17(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 ${dirname17(path)})`,
|
|
29669
|
+
fix: `chmod 700 ${dirname17(path)}`
|
|
29563
29670
|
};
|
|
29564
29671
|
}
|
|
29565
29672
|
if (st.size > MAX_CONFIG_BYTES)
|
|
@@ -29678,14 +29785,14 @@ function jevInputsVersion() {
|
|
|
29678
29785
|
process.platform,
|
|
29679
29786
|
credentials,
|
|
29680
29787
|
statVersion(credentials),
|
|
29681
|
-
statVersion(
|
|
29788
|
+
statVersion(dirname17(credentials)),
|
|
29682
29789
|
config,
|
|
29683
29790
|
statVersion(config)
|
|
29684
29791
|
].join("\x00");
|
|
29685
29792
|
}
|
|
29686
29793
|
function statVersion(path) {
|
|
29687
29794
|
try {
|
|
29688
|
-
const st =
|
|
29795
|
+
const st = statSync24(path, { bigint: true });
|
|
29689
29796
|
return `${st.dev}:${st.ino}:${st.mode}:${st.size}:${st.mtimeNs}:${st.ctimeNs}`;
|
|
29690
29797
|
} catch (err) {
|
|
29691
29798
|
return `-${err.code ?? "error"}`;
|
|
@@ -29913,9 +30020,9 @@ var init_cloud_jev_health = __esm(() => {
|
|
|
29913
30020
|
});
|
|
29914
30021
|
|
|
29915
30022
|
// src/hooks/semantic/facts.ts
|
|
29916
|
-
import { existsSync as existsSync30, readFileSync as readFileSync25, statSync as
|
|
30023
|
+
import { existsSync as existsSync30, readFileSync as readFileSync25, statSync as statSync25 } from "node:fs";
|
|
29917
30024
|
import { homedir as homedir27 } from "node:os";
|
|
29918
|
-
import { dirname as
|
|
30025
|
+
import { dirname as dirname18, isAbsolute as isAbsolute4, resolve as resolve24 } from "node:path";
|
|
29919
30026
|
function classifyTool(toolName) {
|
|
29920
30027
|
if (SHELL_TOOLS.has(toolName))
|
|
29921
30028
|
return { toolClass: "shell", toolIsKnown: true };
|
|
@@ -30142,7 +30249,7 @@ function findGitDir(start) {
|
|
|
30142
30249
|
const candidate = resolve24(dir, ".git");
|
|
30143
30250
|
if (existsSync30(candidate))
|
|
30144
30251
|
return candidate;
|
|
30145
|
-
const parent =
|
|
30252
|
+
const parent = dirname18(dir);
|
|
30146
30253
|
if (parent === dir)
|
|
30147
30254
|
return null;
|
|
30148
30255
|
dir = parent;
|
|
@@ -30153,7 +30260,7 @@ function findProjectRoot(cwd) {
|
|
|
30153
30260
|
if (!cwd)
|
|
30154
30261
|
return null;
|
|
30155
30262
|
const gitDir = findGitDir(cwd);
|
|
30156
|
-
return gitDir ?
|
|
30263
|
+
return gitDir ? dirname18(gitDir) : cwd;
|
|
30157
30264
|
}
|
|
30158
30265
|
function readCurrentBranch(cwd) {
|
|
30159
30266
|
if (!cwd)
|
|
@@ -30163,12 +30270,12 @@ function readCurrentBranch(cwd) {
|
|
|
30163
30270
|
if (!gitPath)
|
|
30164
30271
|
return null;
|
|
30165
30272
|
let headFile = resolve24(gitPath, "HEAD");
|
|
30166
|
-
if (
|
|
30273
|
+
if (statSync25(gitPath).isFile()) {
|
|
30167
30274
|
const pointer = readFileSync25(gitPath, "utf8").trim();
|
|
30168
30275
|
const m = /^gitdir:\s*(.+)$/.exec(pointer);
|
|
30169
30276
|
if (!m)
|
|
30170
30277
|
return null;
|
|
30171
|
-
headFile = resolve24(
|
|
30278
|
+
headFile = resolve24(dirname18(gitPath), m[1], "HEAD");
|
|
30172
30279
|
}
|
|
30173
30280
|
const head = readFileSync25(headFile, "utf8").trim();
|
|
30174
30281
|
const ref = /^ref:\s*refs\/heads\/(.+)$/.exec(head);
|
|
@@ -30563,15 +30670,15 @@ import {
|
|
|
30563
30670
|
closeSync as closeSync4,
|
|
30564
30671
|
mkdirSync as mkdirSync14,
|
|
30565
30672
|
openSync as openSync4,
|
|
30566
|
-
readdirSync as
|
|
30673
|
+
readdirSync as readdirSync17,
|
|
30567
30674
|
readFileSync as readFileSync26,
|
|
30568
30675
|
readSync as readSync3,
|
|
30569
30676
|
renameSync as renameSync10,
|
|
30570
|
-
statSync as
|
|
30677
|
+
statSync as statSync26,
|
|
30571
30678
|
unlinkSync as unlinkSync4,
|
|
30572
30679
|
writeFileSync as writeFileSync12
|
|
30573
30680
|
} from "node:fs";
|
|
30574
|
-
import { dirname as
|
|
30681
|
+
import { dirname as dirname19, resolve as resolve25 } from "node:path";
|
|
30575
30682
|
function intentProfileKey(profile) {
|
|
30576
30683
|
if (validAgentIdentity(profile.agent))
|
|
30577
30684
|
return `${profile.agent.integration}.${profile.agent.instanceId}`;
|
|
@@ -30597,7 +30704,7 @@ function storeDirChain(innermost = sessionsDir()) {
|
|
|
30597
30704
|
chain.push(dir);
|
|
30598
30705
|
if (dir === home)
|
|
30599
30706
|
break;
|
|
30600
|
-
const parent =
|
|
30707
|
+
const parent = dirname19(dir);
|
|
30601
30708
|
if (parent === dir)
|
|
30602
30709
|
break;
|
|
30603
30710
|
dir = parent;
|
|
@@ -30610,7 +30717,7 @@ function looseIntentStoreDir(innermost) {
|
|
|
30610
30717
|
for (const dir of storeDirChain(innermost)) {
|
|
30611
30718
|
let mode;
|
|
30612
30719
|
try {
|
|
30613
|
-
mode =
|
|
30720
|
+
mode = statSync26(dir).mode & 511;
|
|
30614
30721
|
} catch {
|
|
30615
30722
|
continue;
|
|
30616
30723
|
}
|
|
@@ -30618,7 +30725,7 @@ function looseIntentStoreDir(innermost) {
|
|
|
30618
30725
|
continue;
|
|
30619
30726
|
try {
|
|
30620
30727
|
chmodSync7(dir, mode & ~DIR_WRITABLE_BY_OTHERS3);
|
|
30621
|
-
if ((
|
|
30728
|
+
if ((statSync26(dir).mode & DIR_WRITABLE_BY_OTHERS3) !== 0)
|
|
30622
30729
|
return dir;
|
|
30623
30730
|
} catch {
|
|
30624
30731
|
return dir;
|
|
@@ -30655,7 +30762,7 @@ function appendPrompt(slot, entry) {
|
|
|
30655
30762
|
}
|
|
30656
30763
|
function fileExists2(path) {
|
|
30657
30764
|
try {
|
|
30658
|
-
|
|
30765
|
+
statSync26(path);
|
|
30659
30766
|
return true;
|
|
30660
30767
|
} catch {
|
|
30661
30768
|
return false;
|
|
@@ -30665,12 +30772,12 @@ function pruneExpiredSessions(now = Date.now()) {
|
|
|
30665
30772
|
const root = sessionsDir();
|
|
30666
30773
|
let removed = pruneDir(root, now);
|
|
30667
30774
|
try {
|
|
30668
|
-
for (const name of
|
|
30775
|
+
for (const name of readdirSync17(root)) {
|
|
30669
30776
|
if (!PROFILE_DIR_RE.test(name))
|
|
30670
30777
|
continue;
|
|
30671
30778
|
const dir = resolve25(root, name);
|
|
30672
30779
|
try {
|
|
30673
|
-
if (
|
|
30780
|
+
if (statSync26(dir).isDirectory())
|
|
30674
30781
|
removed += pruneDir(dir, now);
|
|
30675
30782
|
} catch {}
|
|
30676
30783
|
}
|
|
@@ -30680,12 +30787,12 @@ function pruneExpiredSessions(now = Date.now()) {
|
|
|
30680
30787
|
function pruneDir(dir, now) {
|
|
30681
30788
|
let removed = 0;
|
|
30682
30789
|
try {
|
|
30683
|
-
for (const name of
|
|
30790
|
+
for (const name of readdirSync17(dir)) {
|
|
30684
30791
|
if (!SESSION_FILE_RE3.test(name))
|
|
30685
30792
|
continue;
|
|
30686
30793
|
const path = resolve25(dir, name);
|
|
30687
30794
|
try {
|
|
30688
|
-
const st =
|
|
30795
|
+
const st = statSync26(path);
|
|
30689
30796
|
if (st.isFile() && now - st.mtimeMs > INTENT_MAX_AGE_MS) {
|
|
30690
30797
|
unlinkSync4(path);
|
|
30691
30798
|
removed++;
|
|
@@ -31000,7 +31107,7 @@ function visitLinesBackwards(transcriptPath, maxBytes, visit) {
|
|
|
31000
31107
|
return;
|
|
31001
31108
|
let fd;
|
|
31002
31109
|
try {
|
|
31003
|
-
const st =
|
|
31110
|
+
const st = statSync26(path);
|
|
31004
31111
|
if (!st.isFile() || st.size === 0)
|
|
31005
31112
|
return;
|
|
31006
31113
|
fd = openSync4(path, "r");
|
|
@@ -31636,7 +31743,7 @@ var init_jev_client = __esm(() => {
|
|
|
31636
31743
|
|
|
31637
31744
|
// src/hooks/semantic/evaluator.ts
|
|
31638
31745
|
import { createHash as createHash9 } from "node:crypto";
|
|
31639
|
-
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync15, renameSync as renameSync11, statSync as
|
|
31746
|
+
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync15, renameSync as renameSync11, statSync as statSync27 } from "node:fs";
|
|
31640
31747
|
import { resolve as resolve26 } from "node:path";
|
|
31641
31748
|
function storeCut(message) {
|
|
31642
31749
|
return typeof message === "string" && message.length >= MAX_USER_MESSAGE_CHARS - STORE_CUT_SLACK && OMISSION_MARK.test(message);
|
|
@@ -31810,7 +31917,7 @@ function appendVerdictLog(row) {
|
|
|
31810
31917
|
const file = verdictLogFile();
|
|
31811
31918
|
mkdirSync15(semanticDir(), { recursive: true, mode: 448 });
|
|
31812
31919
|
try {
|
|
31813
|
-
if (
|
|
31920
|
+
if (statSync27(file).size > VERDICT_LOG_MAX_BYTES)
|
|
31814
31921
|
renameSync11(file, `${file}.1`);
|
|
31815
31922
|
} catch {}
|
|
31816
31923
|
appendFileSync3(file, JSON.stringify(row) + `
|
|
@@ -32535,7 +32642,7 @@ var init_jev_throttle = __esm(() => {
|
|
|
32535
32642
|
});
|
|
32536
32643
|
|
|
32537
32644
|
// src/hooks/semantic/session-root.ts
|
|
32538
|
-
import { mkdirSync as mkdirSync16, readdirSync as
|
|
32645
|
+
import { mkdirSync as mkdirSync16, readdirSync as readdirSync18, readFileSync as readFileSync27, statSync as statSync28, unlinkSync as unlinkSync5, writeFileSync as writeFileSync13 } from "node:fs";
|
|
32539
32646
|
import { isAbsolute as isAbsolute5, resolve as resolve27 } from "node:path";
|
|
32540
32647
|
function validRoot(v) {
|
|
32541
32648
|
return typeof v === "string" && isAbsolute5(v) && resolve27(v) === v && v !== "/";
|
|
@@ -32546,7 +32653,7 @@ function storeIsOurs() {
|
|
|
32546
32653
|
if (looseIntentStoreDir() !== null)
|
|
32547
32654
|
return false;
|
|
32548
32655
|
try {
|
|
32549
|
-
const mode =
|
|
32656
|
+
const mode = statSync28(rootsDir()).mode & 511;
|
|
32550
32657
|
return (mode & DIR_WRITABLE_BY_OTHERS4) === 0;
|
|
32551
32658
|
} catch {
|
|
32552
32659
|
return true;
|
|
@@ -32564,12 +32671,12 @@ function pruneSessionRoots(now = Date.now()) {
|
|
|
32564
32671
|
let removed = 0;
|
|
32565
32672
|
try {
|
|
32566
32673
|
const dir = rootsDir();
|
|
32567
|
-
for (const name of
|
|
32674
|
+
for (const name of readdirSync18(dir)) {
|
|
32568
32675
|
if (!ROOT_FILE_RE.test(name))
|
|
32569
32676
|
continue;
|
|
32570
32677
|
const path = resolve27(dir, name);
|
|
32571
32678
|
try {
|
|
32572
|
-
const st =
|
|
32679
|
+
const st = statSync28(path);
|
|
32573
32680
|
if (st.isFile() && now - st.mtimeMs > SESSION_ROOT_MAX_AGE_MS) {
|
|
32574
32681
|
unlinkSync5(path);
|
|
32575
32682
|
removed++;
|
|
@@ -33349,6 +33456,9 @@ async function evaluateHookEvent(eventType, cli = "claude", stdinPayload, opts)
|
|
|
33349
33456
|
cli
|
|
33350
33457
|
});
|
|
33351
33458
|
}
|
|
33459
|
+
if (cli === "antigravity" && antigravityPathGuardActive(Boolean(activePause), cloudManagedPolicies) && antigravityCallLacksPath(canonicalEventType, parsed.tool_name, parsed.tool_input)) {
|
|
33460
|
+
registerPolicy(ANTIGRAVITY_PATH_GUARD_NAME, ANTIGRAVITY_PATH_GUARD_DESCRIPTION, antigravityPathGuard, ANTIGRAVITY_PATH_GUARD_MATCH);
|
|
33461
|
+
}
|
|
33352
33462
|
cloudDeployment = cloudManagedPolicies[0]?.deployment ?? readCloudJevState().deployment ?? undefined;
|
|
33353
33463
|
let installedPacks = [];
|
|
33354
33464
|
try {
|
|
@@ -33660,6 +33770,7 @@ var init_handler = __esm(() => {
|
|
|
33660
33770
|
init_tool_name_canonicalize();
|
|
33661
33771
|
init_hooks_config();
|
|
33662
33772
|
init_builtin_policies();
|
|
33773
|
+
init_antigravity_path_guard();
|
|
33663
33774
|
init_policy_evaluator();
|
|
33664
33775
|
init_policy_registry();
|
|
33665
33776
|
init_custom_hooks_loader();
|
|
@@ -34508,8 +34619,8 @@ var init_collector_config = __esm(() => {
|
|
|
34508
34619
|
});
|
|
34509
34620
|
|
|
34510
34621
|
// src/hooks/flush-cli.ts
|
|
34511
|
-
import { existsSync as existsSync32, mkdirSync as mkdirSync17, writeFileSync as writeFileSync14, readdirSync as
|
|
34512
|
-
import { dirname as
|
|
34622
|
+
import { existsSync as existsSync32, mkdirSync as mkdirSync17, writeFileSync as writeFileSync14, readdirSync as readdirSync19, statSync as statSync29 } from "node:fs";
|
|
34623
|
+
import { dirname as dirname20, join as join33 } from "node:path";
|
|
34513
34624
|
function flushRequestPath(home) {
|
|
34514
34625
|
return join33(failproofaiHome(home), "state", "flush-request.json");
|
|
34515
34626
|
}
|
|
@@ -34519,14 +34630,14 @@ function spoolDirs(home) {
|
|
|
34519
34630
|
if (!existsSync32(root))
|
|
34520
34631
|
return dirs;
|
|
34521
34632
|
try {
|
|
34522
|
-
return dirs.concat(
|
|
34633
|
+
return dirs.concat(readdirSync19(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "failed").map((e) => join33(root, e.name)));
|
|
34523
34634
|
} catch {
|
|
34524
34635
|
return dirs;
|
|
34525
34636
|
}
|
|
34526
34637
|
}
|
|
34527
34638
|
function parkedBatches(home) {
|
|
34528
34639
|
try {
|
|
34529
|
-
return
|
|
34640
|
+
return readdirSync19(failedDir(home)).filter((f) => f.endsWith(".jsonl")).length;
|
|
34530
34641
|
} catch {
|
|
34531
34642
|
return 0;
|
|
34532
34643
|
}
|
|
@@ -34543,14 +34654,14 @@ function spoolBacklog(home, now = Date.now()) {
|
|
|
34543
34654
|
for (const dir of spoolDirs(home)) {
|
|
34544
34655
|
let names;
|
|
34545
34656
|
try {
|
|
34546
|
-
names =
|
|
34657
|
+
names = readdirSync19(dir).filter((f) => f.endsWith(".jsonl"));
|
|
34547
34658
|
} catch {
|
|
34548
34659
|
continue;
|
|
34549
34660
|
}
|
|
34550
34661
|
count += names.length;
|
|
34551
34662
|
for (const name of names) {
|
|
34552
34663
|
try {
|
|
34553
|
-
const mtime =
|
|
34664
|
+
const mtime = statSync29(join33(dir, name)).mtimeMs;
|
|
34554
34665
|
if (oldest === undefined || mtime < oldest)
|
|
34555
34666
|
oldest = mtime;
|
|
34556
34667
|
} catch {}
|
|
@@ -34612,7 +34723,7 @@ async function runFlushCommand(opts = {}) {
|
|
|
34612
34723
|
return { exitCode: 0, pending: 0, lines: nothing };
|
|
34613
34724
|
}
|
|
34614
34725
|
const path = flushRequestPath(home);
|
|
34615
|
-
mkdirSync17(
|
|
34726
|
+
mkdirSync17(dirname20(path), { recursive: true });
|
|
34616
34727
|
writeFileSync14(path, `${JSON.stringify({ requestedAtMs: Date.now() }, null, 2)}
|
|
34617
34728
|
`, {
|
|
34618
34729
|
mode: 384
|
|
@@ -34656,7 +34767,7 @@ import {
|
|
|
34656
34767
|
rmSync as rmSync12,
|
|
34657
34768
|
writeFileSync as writeFileSync15
|
|
34658
34769
|
} from "node:fs";
|
|
34659
|
-
import { basename as basename7, dirname as
|
|
34770
|
+
import { basename as basename7, dirname as dirname21, join as join34, resolve as resolve28 } from "node:path";
|
|
34660
34771
|
function migrateToLayout4() {
|
|
34661
34772
|
const moves = [
|
|
34662
34773
|
{ from: legacy.authJson(), to: auditSessionFile() },
|
|
@@ -34678,7 +34789,7 @@ function migrateToLayout4() {
|
|
|
34678
34789
|
rmSync12(from, { force: true });
|
|
34679
34790
|
continue;
|
|
34680
34791
|
}
|
|
34681
|
-
mkdirSync18(
|
|
34792
|
+
mkdirSync18(dirname21(to), { recursive: true });
|
|
34682
34793
|
try {
|
|
34683
34794
|
renameSync12(from, to);
|
|
34684
34795
|
} catch {
|
|
@@ -35115,7 +35226,7 @@ var init_install_telemetry = () => {};
|
|
|
35115
35226
|
|
|
35116
35227
|
// lib/install-check.ts
|
|
35117
35228
|
import { existsSync as existsSync34, readFileSync as readFileSync30, writeFileSync as writeFileSync17, mkdirSync as mkdirSync20 } from "node:fs";
|
|
35118
|
-
import { dirname as
|
|
35229
|
+
import { dirname as dirname22, resolve as resolve29 } from "node:path";
|
|
35119
35230
|
import { platform as platform2, arch as arch2, release, homedir as homedir29, hostname as hostname2 } from "node:os";
|
|
35120
35231
|
import { createHmac as createHmac2 } from "node:crypto";
|
|
35121
35232
|
function hashToId4(raw) {
|
|
@@ -35249,7 +35360,7 @@ async function maybeReportInstall(version) {
|
|
|
35249
35360
|
enabled_policy_count: hooks.policyCount
|
|
35250
35361
|
}, { version, timeoutMs: REPORT_TIMEOUT_MS, enabled: telemetryEnabled }));
|
|
35251
35362
|
try {
|
|
35252
|
-
mkdirSync20(
|
|
35363
|
+
mkdirSync20(dirname22(versionFile), { recursive: true });
|
|
35253
35364
|
writeFileSync17(versionFile, version, "utf8");
|
|
35254
35365
|
} catch {}
|
|
35255
35366
|
await Promise.all(events.map((p) => p.catch(() => {})));
|
|
@@ -36717,7 +36828,7 @@ var init_cloud_introspect = __esm(() => {
|
|
|
36717
36828
|
|
|
36718
36829
|
// src/hooks/credential-recovery.ts
|
|
36719
36830
|
import { createHash as createHash11 } from "node:crypto";
|
|
36720
|
-
import { existsSync as existsSync40, mkdirSync as mkdirSync22, readdirSync as
|
|
36831
|
+
import { existsSync as existsSync40, mkdirSync as mkdirSync22, readdirSync as readdirSync20, renameSync as renameSync13 } from "node:fs";
|
|
36721
36832
|
import { join as join38 } from "node:path";
|
|
36722
36833
|
function previousOrgDirectory(id) {
|
|
36723
36834
|
const safe = id && /^[A-Za-z0-9_-]{1,128}$/.test(id) ? id : id ? createHash11("sha256").update(id).digest("hex") : "unknown";
|
|
@@ -36728,7 +36839,7 @@ function recoverCredentialRefusals(sameOrg, oldOrgId) {
|
|
|
36728
36839
|
if (!existsSync40(dir))
|
|
36729
36840
|
return 0;
|
|
36730
36841
|
let recovered = 0;
|
|
36731
|
-
for (const name of
|
|
36842
|
+
for (const name of readdirSync20(dir)) {
|
|
36732
36843
|
if (!/\.c(401|403)\.jsonl$/.test(name) || name.startsWith("."))
|
|
36733
36844
|
continue;
|
|
36734
36845
|
const targetDir = sameOrg ? dir : join38(previousOrgDirectory(oldOrgId), "failed");
|
|
@@ -36765,11 +36876,11 @@ import {
|
|
|
36765
36876
|
readSync as readSync4,
|
|
36766
36877
|
renameSync as renameSync14,
|
|
36767
36878
|
rmSync as rmSync15,
|
|
36768
|
-
statSync as
|
|
36879
|
+
statSync as statSync30,
|
|
36769
36880
|
unlinkSync as unlinkSync6,
|
|
36770
36881
|
writeFileSync as writeFileSync18
|
|
36771
36882
|
} from "node:fs";
|
|
36772
|
-
import { dirname as
|
|
36883
|
+
import { dirname as dirname23 } from "node:path";
|
|
36773
36884
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
36774
36885
|
function writeCloudJevConfig(cloudBase) {
|
|
36775
36886
|
const first = writeCloudJevConfigIfAbsent(cloudBase);
|
|
@@ -36850,7 +36961,7 @@ function writeCloudJevConfigIfAbsent(cloudBase) {
|
|
|
36850
36961
|
return kept(path, cloudBase);
|
|
36851
36962
|
const body = `${JSON.stringify({ provider: JEV_CLOUD_PROVIDER, baseUrl, mode: CLOUD_JEV_INITIAL_MODE }, null, 2)}
|
|
36852
36963
|
`;
|
|
36853
|
-
const dir =
|
|
36964
|
+
const dir = dirname23(path);
|
|
36854
36965
|
const tmp = `${path}.${process.pid}.${randomBytes3(6).toString("hex")}.tmp`;
|
|
36855
36966
|
try {
|
|
36856
36967
|
if (!existsSync41(dir))
|
|
@@ -36915,7 +37026,7 @@ function tightenDir(dir) {
|
|
|
36915
37026
|
if (process.platform === "win32")
|
|
36916
37027
|
return;
|
|
36917
37028
|
try {
|
|
36918
|
-
const before =
|
|
37029
|
+
const before = statSync30(dir).mode & 511;
|
|
36919
37030
|
if ((before & 18) !== 0)
|
|
36920
37031
|
chmodSync9(dir, before & ~18);
|
|
36921
37032
|
} catch {}
|
|
@@ -37338,8 +37449,8 @@ var init_cloud_connection = __esm(() => {
|
|
|
37338
37449
|
});
|
|
37339
37450
|
|
|
37340
37451
|
// src/hooks/setup-state.ts
|
|
37341
|
-
import { existsSync as existsSync42, realpathSync as realpathSync4, statSync as
|
|
37342
|
-
import { dirname as
|
|
37452
|
+
import { existsSync as existsSync42, realpathSync as realpathSync4, statSync as statSync31 } from "node:fs";
|
|
37453
|
+
import { dirname as dirname24, resolve as resolve32 } from "node:path";
|
|
37343
37454
|
import { homedir as homedir31 } from "node:os";
|
|
37344
37455
|
function globalConfigPath(home = homedir31()) {
|
|
37345
37456
|
return globalPolicyConfigFile(home);
|
|
@@ -37352,7 +37463,7 @@ function legacyMarkerPath(home) {
|
|
|
37352
37463
|
}
|
|
37353
37464
|
function isDir(path) {
|
|
37354
37465
|
try {
|
|
37355
|
-
return
|
|
37466
|
+
return statSync31(path).isDirectory();
|
|
37356
37467
|
} catch {
|
|
37357
37468
|
return false;
|
|
37358
37469
|
}
|
|
@@ -37363,7 +37474,7 @@ function findProjectRoot2(start, home = homedir31()) {
|
|
|
37363
37474
|
while (dir !== resolvedHome) {
|
|
37364
37475
|
if (isDir(resolve32(dir, ".failproofai")))
|
|
37365
37476
|
return dir;
|
|
37366
|
-
const parent =
|
|
37477
|
+
const parent = dirname24(dir);
|
|
37367
37478
|
if (parent === dir)
|
|
37368
37479
|
break;
|
|
37369
37480
|
dir = parent;
|
|
@@ -37413,7 +37524,7 @@ var init_setup_state = __esm(() => {
|
|
|
37413
37524
|
|
|
37414
37525
|
// src/hooks/onboarding-attempt.ts
|
|
37415
37526
|
import { existsSync as existsSync43, mkdirSync as mkdirSync24, readFileSync as readFileSync34, rmSync as rmSync17, writeFileSync as writeFileSync19 } from "node:fs";
|
|
37416
|
-
import { dirname as
|
|
37527
|
+
import { dirname as dirname25 } from "node:path";
|
|
37417
37528
|
function readOnboardingAttempt() {
|
|
37418
37529
|
const path = onboardingAttemptFile();
|
|
37419
37530
|
if (!existsSync43(path))
|
|
@@ -37438,7 +37549,7 @@ function readOnboardingAttempt() {
|
|
|
37438
37549
|
function recordOnboardingAttempt(reason, cliVersion, daemonStatus, now = Date.now()) {
|
|
37439
37550
|
try {
|
|
37440
37551
|
const path = onboardingAttemptFile();
|
|
37441
|
-
mkdirSync24(
|
|
37552
|
+
mkdirSync24(dirname25(path), { recursive: true });
|
|
37442
37553
|
const record = {
|
|
37443
37554
|
schemaVersion: SCHEMA_VERSION3,
|
|
37444
37555
|
reason,
|
|
@@ -37546,7 +37657,7 @@ var init_onboarding_lock = __esm(() => {
|
|
|
37546
37657
|
});
|
|
37547
37658
|
|
|
37548
37659
|
// lib/claude-sessions.ts
|
|
37549
|
-
import { readdirSync as
|
|
37660
|
+
import { readdirSync as readdirSync21, statSync as statSync32, existsSync as existsSync44 } from "node:fs";
|
|
37550
37661
|
import { join as join39, basename as basename9 } from "node:path";
|
|
37551
37662
|
function getClaudeProjectsRoot() {
|
|
37552
37663
|
return getClaudeProjectsPath();
|
|
@@ -37555,7 +37666,7 @@ function listClaudeProjects() {
|
|
|
37555
37666
|
const root = getClaudeProjectsRoot();
|
|
37556
37667
|
let entries;
|
|
37557
37668
|
try {
|
|
37558
|
-
entries =
|
|
37669
|
+
entries = readdirSync21(root, { withFileTypes: true });
|
|
37559
37670
|
} catch {
|
|
37560
37671
|
return [];
|
|
37561
37672
|
}
|
|
@@ -37569,7 +37680,7 @@ function listClaudeTranscripts(project) {
|
|
|
37569
37680
|
const out = [];
|
|
37570
37681
|
let entries;
|
|
37571
37682
|
try {
|
|
37572
|
-
entries =
|
|
37683
|
+
entries = readdirSync21(project.path, { withFileTypes: true });
|
|
37573
37684
|
} catch {
|
|
37574
37685
|
return out;
|
|
37575
37686
|
}
|
|
@@ -37580,7 +37691,7 @@ function listClaudeTranscripts(project) {
|
|
|
37580
37691
|
continue;
|
|
37581
37692
|
const transcriptPath = join39(project.path, entry.name);
|
|
37582
37693
|
try {
|
|
37583
|
-
const s =
|
|
37694
|
+
const s = statSync32(transcriptPath);
|
|
37584
37695
|
out.push({
|
|
37585
37696
|
projectName: project.name,
|
|
37586
37697
|
cwd: project.cwd,
|
|
@@ -37597,7 +37708,7 @@ function listClaudeTranscripts(project) {
|
|
|
37597
37708
|
continue;
|
|
37598
37709
|
let subEntries;
|
|
37599
37710
|
try {
|
|
37600
|
-
subEntries =
|
|
37711
|
+
subEntries = readdirSync21(subDir, { withFileTypes: true });
|
|
37601
37712
|
} catch {
|
|
37602
37713
|
continue;
|
|
37603
37714
|
}
|
|
@@ -37607,7 +37718,7 @@ function listClaudeTranscripts(project) {
|
|
|
37607
37718
|
const agentId = sub.name.slice(0, -".jsonl".length);
|
|
37608
37719
|
const transcriptPath = join39(subDir, sub.name);
|
|
37609
37720
|
try {
|
|
37610
|
-
const s =
|
|
37721
|
+
const s = statSync32(transcriptPath);
|
|
37611
37722
|
out.push({
|
|
37612
37723
|
projectName: project.name,
|
|
37613
37724
|
cwd: project.cwd,
|
|
@@ -37823,7 +37934,7 @@ var init_claude = __esm(() => {
|
|
|
37823
37934
|
});
|
|
37824
37935
|
|
|
37825
37936
|
// src/audit/cli-adapters/codex.ts
|
|
37826
|
-
import { statSync as
|
|
37937
|
+
import { statSync as statSync33 } from "node:fs";
|
|
37827
37938
|
async function listCodexTranscriptMetadata(opts = {}) {
|
|
37828
37939
|
const projectFilter = opts.projects ? new Set(opts.projects) : null;
|
|
37829
37940
|
const sinceMs = opts.sinceMs ?? 0;
|
|
@@ -37840,7 +37951,7 @@ async function listCodexTranscriptMetadata(opts = {}) {
|
|
|
37840
37951
|
continue;
|
|
37841
37952
|
let sizeBytes = 0;
|
|
37842
37953
|
try {
|
|
37843
|
-
sizeBytes =
|
|
37954
|
+
sizeBytes = statSync33(s.path).size;
|
|
37844
37955
|
} catch {}
|
|
37845
37956
|
if (!s.sessionId)
|
|
37846
37957
|
continue;
|
|
@@ -37874,7 +37985,7 @@ var init_codex = __esm(() => {
|
|
|
37874
37985
|
});
|
|
37875
37986
|
|
|
37876
37987
|
// src/audit/cli-adapters/copilot.ts
|
|
37877
|
-
import { statSync as
|
|
37988
|
+
import { statSync as statSync34 } from "node:fs";
|
|
37878
37989
|
async function listCopilotTranscriptMetadata(opts = {}) {
|
|
37879
37990
|
const projectFilter = opts.projects ? new Set(opts.projects) : null;
|
|
37880
37991
|
const sinceMs = opts.sinceMs ?? 0;
|
|
@@ -37891,7 +38002,7 @@ async function listCopilotTranscriptMetadata(opts = {}) {
|
|
|
37891
38002
|
continue;
|
|
37892
38003
|
let sizeBytes = 0;
|
|
37893
38004
|
try {
|
|
37894
|
-
sizeBytes =
|
|
38005
|
+
sizeBytes = statSync34(s.path).size;
|
|
37895
38006
|
} catch {}
|
|
37896
38007
|
if (!s.sessionId)
|
|
37897
38008
|
continue;
|
|
@@ -37925,7 +38036,7 @@ var init_copilot = __esm(() => {
|
|
|
37925
38036
|
});
|
|
37926
38037
|
|
|
37927
38038
|
// src/audit/cli-adapters/cursor.ts
|
|
37928
|
-
import { statSync as
|
|
38039
|
+
import { statSync as statSync35 } from "node:fs";
|
|
37929
38040
|
async function listCursorTranscriptMetadata(opts = {}) {
|
|
37930
38041
|
const projectFilter = opts.projects ? new Set(opts.projects) : null;
|
|
37931
38042
|
const sinceMs = opts.sinceMs ?? 0;
|
|
@@ -37942,7 +38053,7 @@ async function listCursorTranscriptMetadata(opts = {}) {
|
|
|
37942
38053
|
continue;
|
|
37943
38054
|
let sizeBytes = 0;
|
|
37944
38055
|
try {
|
|
37945
|
-
sizeBytes =
|
|
38056
|
+
sizeBytes = statSync35(s.path).size;
|
|
37946
38057
|
} catch {}
|
|
37947
38058
|
if (!s.sessionId)
|
|
37948
38059
|
continue;
|
|
@@ -38183,7 +38294,7 @@ var init_opencode = __esm(() => {
|
|
|
38183
38294
|
});
|
|
38184
38295
|
|
|
38185
38296
|
// src/audit/cli-adapters/pi.ts
|
|
38186
|
-
import { statSync as
|
|
38297
|
+
import { statSync as statSync36 } from "node:fs";
|
|
38187
38298
|
async function listPiTranscriptMetadata(opts = {}) {
|
|
38188
38299
|
const projectFilter = opts.projects ? new Set(opts.projects) : null;
|
|
38189
38300
|
const sinceMs = opts.sinceMs ?? 0;
|
|
@@ -38200,7 +38311,7 @@ async function listPiTranscriptMetadata(opts = {}) {
|
|
|
38200
38311
|
continue;
|
|
38201
38312
|
let sizeBytes = 0;
|
|
38202
38313
|
try {
|
|
38203
|
-
sizeBytes =
|
|
38314
|
+
sizeBytes = statSync36(s.path).size;
|
|
38204
38315
|
} catch {}
|
|
38205
38316
|
if (!s.sessionId)
|
|
38206
38317
|
continue;
|
|
@@ -39859,7 +39970,7 @@ var init_api_server_client = __esm(() => {
|
|
|
39859
39970
|
});
|
|
39860
39971
|
|
|
39861
39972
|
// lib/auth/auth-store.ts
|
|
39862
|
-
import { existsSync as existsSync47, readFileSync as readFileSync39, readdirSync as
|
|
39973
|
+
import { existsSync as existsSync47, readFileSync as readFileSync39, readdirSync as readdirSync22, rmSync as rmSync19 } from "node:fs";
|
|
39863
39974
|
import { join as join41, resolve as resolve33 } from "node:path";
|
|
39864
39975
|
function getAuthFilePath() {
|
|
39865
39976
|
const override = process.env.FAILPROOFAI_AUTH_DIR;
|
|
@@ -39900,7 +40011,7 @@ function deleteAuth() {
|
|
|
39900
40011
|
const root = migrationsDir();
|
|
39901
40012
|
if (!existsSync47(root))
|
|
39902
40013
|
return;
|
|
39903
|
-
for (const entry of
|
|
40014
|
+
for (const entry of readdirSync22(root)) {
|
|
39904
40015
|
if (!entry.startsWith("backup-layout"))
|
|
39905
40016
|
continue;
|
|
39906
40017
|
const copy = resolve33(root, entry, "auth.json");
|
|
@@ -40495,7 +40606,7 @@ var init_cli = __esm(() => {
|
|
|
40495
40606
|
// src/hooks/configure-wizard.ts
|
|
40496
40607
|
import { existsSync as existsSync49, mkdirSync as mkdirSync28, writeFileSync as writeFileSync23, readFileSync as readFileSync41 } from "node:fs";
|
|
40497
40608
|
import { homedir as homedir34 } from "node:os";
|
|
40498
|
-
import { dirname as
|
|
40609
|
+
import { dirname as dirname26, resolve as resolve34, sep as sep5 } from "node:path";
|
|
40499
40610
|
async function emit(event, props) {
|
|
40500
40611
|
try {
|
|
40501
40612
|
await trackHookEvent2(getInstanceId2(), event, props);
|
|
@@ -40684,7 +40795,7 @@ function firstRunMarkerPath() {
|
|
|
40684
40795
|
}
|
|
40685
40796
|
function markLauncherSeen() {
|
|
40686
40797
|
try {
|
|
40687
|
-
mkdirSync28(
|
|
40798
|
+
mkdirSync28(dirname26(firstRunMarkerPath()), { recursive: true });
|
|
40688
40799
|
writeFileSync23(firstRunMarkerPath(), "1", "utf8");
|
|
40689
40800
|
} catch {}
|
|
40690
40801
|
}
|
|
@@ -41511,8 +41622,8 @@ var init_configure_wizard = __esm(() => {
|
|
|
41511
41622
|
});
|
|
41512
41623
|
|
|
41513
41624
|
// src/hooks/flush-cli.ts
|
|
41514
|
-
import { existsSync as existsSync50, mkdirSync as mkdirSync29, writeFileSync as writeFileSync24, readdirSync as
|
|
41515
|
-
import { dirname as
|
|
41625
|
+
import { existsSync as existsSync50, mkdirSync as mkdirSync29, writeFileSync as writeFileSync24, readdirSync as readdirSync23, statSync as statSync37 } from "node:fs";
|
|
41626
|
+
import { dirname as dirname27, join as join42 } from "node:path";
|
|
41516
41627
|
function flushRequestPath2(home) {
|
|
41517
41628
|
return join42(failproofaiHome(home), "state", "flush-request.json");
|
|
41518
41629
|
}
|
|
@@ -41522,14 +41633,14 @@ function spoolDirs2(home) {
|
|
|
41522
41633
|
if (!existsSync50(root))
|
|
41523
41634
|
return dirs;
|
|
41524
41635
|
try {
|
|
41525
|
-
return dirs.concat(
|
|
41636
|
+
return dirs.concat(readdirSync23(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "failed").map((e) => join42(root, e.name)));
|
|
41526
41637
|
} catch {
|
|
41527
41638
|
return dirs;
|
|
41528
41639
|
}
|
|
41529
41640
|
}
|
|
41530
41641
|
function parkedBatches2(home) {
|
|
41531
41642
|
try {
|
|
41532
|
-
return
|
|
41643
|
+
return readdirSync23(failedDir(home)).filter((f) => f.endsWith(".jsonl")).length;
|
|
41533
41644
|
} catch {
|
|
41534
41645
|
return 0;
|
|
41535
41646
|
}
|
|
@@ -41546,14 +41657,14 @@ function spoolBacklog2(home, now = Date.now()) {
|
|
|
41546
41657
|
for (const dir of spoolDirs2(home)) {
|
|
41547
41658
|
let names;
|
|
41548
41659
|
try {
|
|
41549
|
-
names =
|
|
41660
|
+
names = readdirSync23(dir).filter((f) => f.endsWith(".jsonl"));
|
|
41550
41661
|
} catch {
|
|
41551
41662
|
continue;
|
|
41552
41663
|
}
|
|
41553
41664
|
count += names.length;
|
|
41554
41665
|
for (const name of names) {
|
|
41555
41666
|
try {
|
|
41556
|
-
const mtime =
|
|
41667
|
+
const mtime = statSync37(join42(dir, name)).mtimeMs;
|
|
41557
41668
|
if (oldest === undefined || mtime < oldest)
|
|
41558
41669
|
oldest = mtime;
|
|
41559
41670
|
} catch {}
|
|
@@ -41615,7 +41726,7 @@ async function runFlushCommand2(opts = {}) {
|
|
|
41615
41726
|
return { exitCode: 0, pending: 0, lines: nothing };
|
|
41616
41727
|
}
|
|
41617
41728
|
const path = flushRequestPath2(home);
|
|
41618
|
-
mkdirSync29(
|
|
41729
|
+
mkdirSync29(dirname27(path), { recursive: true });
|
|
41619
41730
|
writeFileSync24(path, `${JSON.stringify({ requestedAtMs: Date.now() }, null, 2)}
|
|
41620
41731
|
`, {
|
|
41621
41732
|
mode: 384
|
|
@@ -44144,7 +44255,7 @@ var init_main = __esm(() => {
|
|
|
44144
44255
|
// src/hooks/otel-writers.ts
|
|
44145
44256
|
import { homedir as homedir35 } from "node:os";
|
|
44146
44257
|
import { resolve as resolve35 } from "node:path";
|
|
44147
|
-
import { accessSync as accessSync2, constants, readdirSync as
|
|
44258
|
+
import { accessSync as accessSync2, constants, readdirSync as readdirSync24, statSync as statSync38 } from "node:fs";
|
|
44148
44259
|
function vscodeSettingsPath(home = homedir35(), platform = process.platform) {
|
|
44149
44260
|
if (platform === "darwin")
|
|
44150
44261
|
return resolve35(home, "Library/Application Support/Code/User/settings.json");
|
|
@@ -44159,7 +44270,7 @@ function vscodeInstalled(home = homedir35(), platform = process.platform) {
|
|
|
44159
44270
|
const executable = (path) => {
|
|
44160
44271
|
try {
|
|
44161
44272
|
accessSync2(path, platform === "win32" ? constants.F_OK : constants.X_OK);
|
|
44162
|
-
return
|
|
44273
|
+
return statSync38(path).isFile();
|
|
44163
44274
|
} catch {
|
|
44164
44275
|
return false;
|
|
44165
44276
|
}
|
|
@@ -44171,7 +44282,7 @@ function vscodeInstalled(home = homedir35(), platform = process.platform) {
|
|
|
44171
44282
|
return true;
|
|
44172
44283
|
return [".vscode", ".vscode-insiders"].some((folder) => {
|
|
44173
44284
|
try {
|
|
44174
|
-
return
|
|
44285
|
+
return readdirSync24(resolve35(home, folder, "extensions"), { withFileTypes: true }).some((entry) => entry.isDirectory() && /^github\.copilot(?:-chat)?-\d/i.test(entry.name));
|
|
44175
44286
|
} catch {
|
|
44176
44287
|
return false;
|
|
44177
44288
|
}
|
|
@@ -44394,11 +44505,11 @@ import {
|
|
|
44394
44505
|
existsSync as existsSync52,
|
|
44395
44506
|
mkdirSync as mkdirSync30,
|
|
44396
44507
|
readFileSync as readFileSync42,
|
|
44397
|
-
statSync as
|
|
44508
|
+
statSync as statSync39,
|
|
44398
44509
|
unlinkSync as unlinkSync8,
|
|
44399
44510
|
writeFileSync as writeFileSync25
|
|
44400
44511
|
} from "node:fs";
|
|
44401
|
-
import { dirname as
|
|
44512
|
+
import { dirname as dirname28 } from "node:path";
|
|
44402
44513
|
import { createHash as createHash13, randomUUID as randomUUID6 } from "node:crypto";
|
|
44403
44514
|
import { homedir as homedir36 } from "node:os";
|
|
44404
44515
|
import { connect } from "node:net";
|
|
@@ -44458,13 +44569,13 @@ function credential() {
|
|
|
44458
44569
|
function backupOnce(path, original) {
|
|
44459
44570
|
if (existsSync52(`${path}.failproofai-bak`))
|
|
44460
44571
|
return;
|
|
44461
|
-
mkdirSync30(
|
|
44572
|
+
mkdirSync30(dirname28(path), { recursive: true });
|
|
44462
44573
|
writeFileSync25(`${path}.failproofai-bak`, original ?? "", { flag: "wx", mode: 384 });
|
|
44463
44574
|
chmodSync11(`${path}.failproofai-bak`, 384);
|
|
44464
44575
|
}
|
|
44465
44576
|
function savePrivate(agent, state) {
|
|
44466
44577
|
const path = otelAgentStateFile(agent);
|
|
44467
|
-
mkdirSync30(
|
|
44578
|
+
mkdirSync30(dirname28(path), { recursive: true, mode: 448 });
|
|
44468
44579
|
writeConfigFileAtomic(path, JSON.stringify(state), { backup: false, mode: 384 });
|
|
44469
44580
|
chmodSync11(path, 384);
|
|
44470
44581
|
}
|
|
@@ -44569,7 +44680,7 @@ async function enableAgent(agent, yes, localFlag, content, options) {
|
|
|
44569
44680
|
const next = editAgentConfig(original ?? "", agent, [...released, ...writes]);
|
|
44570
44681
|
const state = oldState ?? {
|
|
44571
44682
|
original,
|
|
44572
|
-
originalMode: original === null ? undefined :
|
|
44683
|
+
originalMode: original === null ? undefined : statSync39(file).mode & 511,
|
|
44573
44684
|
writtenHash: "",
|
|
44574
44685
|
previous: writes.map((w) => ({ path: w.path, value: getSetting(parsed, w.path) }))
|
|
44575
44686
|
};
|
|
@@ -45247,8 +45358,8 @@ var init_jev_stats = __esm(() => {
|
|
|
45247
45358
|
});
|
|
45248
45359
|
|
|
45249
45360
|
// src/hooks/jev-cli.ts
|
|
45250
|
-
import { chmodSync as chmodSync12, existsSync as existsSync53, statSync as
|
|
45251
|
-
import { dirname as
|
|
45361
|
+
import { chmodSync as chmodSync12, existsSync as existsSync53, statSync as statSync40, unlinkSync as unlinkSync9 } from "node:fs";
|
|
45362
|
+
import { dirname as dirname29 } from "node:path";
|
|
45252
45363
|
function jevHeader(name, meta, opts) {
|
|
45253
45364
|
return [screenKit(opts).header(meta ? `${name} · ${meta}` : name)];
|
|
45254
45365
|
}
|
|
@@ -45829,13 +45940,13 @@ async function setupRun(argv, deps, opts) {
|
|
|
45829
45940
|
}
|
|
45830
45941
|
let fileMode = null;
|
|
45831
45942
|
try {
|
|
45832
|
-
fileMode =
|
|
45943
|
+
fileMode = statSync40(path).mode & 511;
|
|
45833
45944
|
} catch {}
|
|
45834
|
-
const dir =
|
|
45945
|
+
const dir = dirname29(path);
|
|
45835
45946
|
let tightenedDir = null;
|
|
45836
45947
|
if (process.platform !== "win32") {
|
|
45837
45948
|
try {
|
|
45838
|
-
const before =
|
|
45949
|
+
const before = statSync40(dir).mode & 511;
|
|
45839
45950
|
if ((before & 18) !== 0) {
|
|
45840
45951
|
const after = before & -19;
|
|
45841
45952
|
chmodSync12(dir, after);
|
|
@@ -45957,15 +46068,15 @@ async function cloudSetup(values, bools, opts) {
|
|
|
45957
46068
|
}
|
|
45958
46069
|
if (process.platform !== "win32") {
|
|
45959
46070
|
try {
|
|
45960
|
-
const dir =
|
|
45961
|
-
const before =
|
|
46071
|
+
const dir = dirname29(path);
|
|
46072
|
+
const before = statSync40(dir).mode & 511;
|
|
45962
46073
|
if ((before & 18) !== 0)
|
|
45963
46074
|
chmodSync12(dir, before & -19);
|
|
45964
46075
|
} catch {}
|
|
45965
46076
|
}
|
|
45966
46077
|
let fileMode = null;
|
|
45967
46078
|
try {
|
|
45968
|
-
fileMode =
|
|
46079
|
+
fileMode = statSync40(path).mode & 511;
|
|
45969
46080
|
} catch {}
|
|
45970
46081
|
const cfg = checked.value;
|
|
45971
46082
|
const route = jevRoute(cfg);
|
|
@@ -46594,7 +46705,7 @@ import {
|
|
|
46594
46705
|
openSync as openSync8,
|
|
46595
46706
|
readFileSync as readFileSync43,
|
|
46596
46707
|
readSync as readSync6,
|
|
46597
|
-
statSync as
|
|
46708
|
+
statSync as statSync41,
|
|
46598
46709
|
writeFileSync as writeFileSync26
|
|
46599
46710
|
} from "node:fs";
|
|
46600
46711
|
function detectLayout2() {
|
|
@@ -46678,7 +46789,7 @@ import {
|
|
|
46678
46789
|
rmSync as rmSync21,
|
|
46679
46790
|
writeFileSync as writeFileSync27
|
|
46680
46791
|
} from "node:fs";
|
|
46681
|
-
import { basename as basename10, dirname as
|
|
46792
|
+
import { basename as basename10, dirname as dirname30, join as join43, resolve as resolve38 } from "node:path";
|
|
46682
46793
|
function migrateToLayout42() {
|
|
46683
46794
|
const moves = [
|
|
46684
46795
|
{ from: legacy.authJson(), to: auditSessionFile() },
|
|
@@ -46700,7 +46811,7 @@ function migrateToLayout42() {
|
|
|
46700
46811
|
rmSync21(from, { force: true });
|
|
46701
46812
|
continue;
|
|
46702
46813
|
}
|
|
46703
|
-
mkdirSync32(
|
|
46814
|
+
mkdirSync32(dirname30(to), { recursive: true });
|
|
46704
46815
|
try {
|
|
46705
46816
|
renameSync15(from, to);
|
|
46706
46817
|
} catch {
|
|
@@ -46939,12 +47050,14 @@ import {
|
|
|
46939
47050
|
mkdirSync as mkdirSync33,
|
|
46940
47051
|
mkdtempSync as mkdtempSync2,
|
|
46941
47052
|
readFileSync as readFileSync45,
|
|
47053
|
+
readdirSync as readdirSync25,
|
|
47054
|
+
statSync as statSync42,
|
|
46942
47055
|
writeFileSync as writeFileSync28,
|
|
46943
47056
|
unlinkSync as unlinkSync10,
|
|
46944
47057
|
rmSync as rmSync22
|
|
46945
47058
|
} from "node:fs";
|
|
46946
47059
|
import { homedir as homedir38, tmpdir as tmpdir3, userInfo as userInfo2 } from "node:os";
|
|
46947
|
-
import { resolve as resolve39 } from "node:path";
|
|
47060
|
+
import { dirname as dirname31, resolve as resolve39 } from "node:path";
|
|
46948
47061
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
46949
47062
|
function isDaemonSupportedPlatform2() {
|
|
46950
47063
|
return process.platform === "linux" || process.platform === "darwin";
|
|
@@ -46999,7 +47112,7 @@ function resolveWorkerCommand2() {
|
|
|
46999
47112
|
const workerScript = resolve39(packageRoot, "dist", "worker.mjs");
|
|
47000
47113
|
if (!existsSync56(workerScript))
|
|
47001
47114
|
return null;
|
|
47002
|
-
return `${
|
|
47115
|
+
return `${shellQuote(process.execPath)} ${shellQuote(workerScript)}`;
|
|
47003
47116
|
}
|
|
47004
47117
|
function resolveCliCommand2() {
|
|
47005
47118
|
if (process.env.FAILPROOFAI_CLI_CMD)
|
|
@@ -47010,10 +47123,7 @@ function resolveCliCommand2() {
|
|
|
47010
47123
|
const cliScript = resolve39(packageRoot, "dist", "cli.mjs");
|
|
47011
47124
|
if (!existsSync56(cliScript))
|
|
47012
47125
|
return null;
|
|
47013
|
-
return `${
|
|
47014
|
-
}
|
|
47015
|
-
function shellQuote2(value) {
|
|
47016
|
-
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
47126
|
+
return `${shellQuote(process.execPath)} ${shellQuote(cliScript)}`;
|
|
47017
47127
|
}
|
|
47018
47128
|
function workerScriptPath2() {
|
|
47019
47129
|
if (process.env.FAILPROOFAI_WORKER_CMD)
|
|
@@ -47050,6 +47160,60 @@ function systemdUnitDir2() {
|
|
|
47050
47160
|
function systemdUnitPath2(user = serviceUser2()) {
|
|
47051
47161
|
return resolve39(systemdUnitDir2(), systemdUnitName2(user));
|
|
47052
47162
|
}
|
|
47163
|
+
function systemBinaryRoot2(user = serviceUser2()) {
|
|
47164
|
+
return resolve39(process.env.FAILPROOFAI_SYSTEM_BIN_DIR || "/opt/failproofai", user);
|
|
47165
|
+
}
|
|
47166
|
+
function systemBinaryDir2() {
|
|
47167
|
+
return resolve39(systemBinaryRoot2(), "bin");
|
|
47168
|
+
}
|
|
47169
|
+
function systemBinaryTarget2(binaryPath) {
|
|
47170
|
+
if (process.platform !== "linux" || process.env.FAILPROOFAI_DAEMON_BINARY)
|
|
47171
|
+
return null;
|
|
47172
|
+
try {
|
|
47173
|
+
if (!statSync42(binaryPath).isFile())
|
|
47174
|
+
return null;
|
|
47175
|
+
} catch {
|
|
47176
|
+
return null;
|
|
47177
|
+
}
|
|
47178
|
+
return resolve39(systemBinaryDir2(), `failproofaid-${version2}`);
|
|
47179
|
+
}
|
|
47180
|
+
function selinuxEnabled2() {
|
|
47181
|
+
return existsSync56("/sys/fs/selinux/enforce");
|
|
47182
|
+
}
|
|
47183
|
+
function stageSystemBinary2(binaryPath) {
|
|
47184
|
+
const target = systemBinaryTarget2(binaryPath);
|
|
47185
|
+
if (!target)
|
|
47186
|
+
return binaryPath;
|
|
47187
|
+
const dir = systemBinaryDir2();
|
|
47188
|
+
const staging = `${target}.${process.pid}.tmp`;
|
|
47189
|
+
runPrivileged2("install", ["-d", "-m", "0755", dir]);
|
|
47190
|
+
try {
|
|
47191
|
+
runPrivileged2("install", ["-m", "0755", binaryPath, staging]);
|
|
47192
|
+
runPrivileged2("mv", ["-f", staging, target]);
|
|
47193
|
+
} catch (err) {
|
|
47194
|
+
try {
|
|
47195
|
+
runPrivileged2("rm", ["-f", staging]);
|
|
47196
|
+
} catch {}
|
|
47197
|
+
throw err;
|
|
47198
|
+
}
|
|
47199
|
+
if (selinuxEnabled2()) {
|
|
47200
|
+
const root = systemBinaryRoot2();
|
|
47201
|
+
try {
|
|
47202
|
+
runPrivileged2("restorecon", ["-R", root]);
|
|
47203
|
+
} catch (err) {
|
|
47204
|
+
hookLogWarn(`restorecon on ${root} failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
47205
|
+
}
|
|
47206
|
+
}
|
|
47207
|
+
return target;
|
|
47208
|
+
}
|
|
47209
|
+
function pruneSystemBinaries2(current) {
|
|
47210
|
+
try {
|
|
47211
|
+
const dir = systemBinaryDir2();
|
|
47212
|
+
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);
|
|
47213
|
+
for (const { p } of stale)
|
|
47214
|
+
runPrivileged2("rm", ["-f", p]);
|
|
47215
|
+
} catch {}
|
|
47216
|
+
}
|
|
47053
47217
|
function legacySystemdUserUnitPath2() {
|
|
47054
47218
|
return resolve39(homedir38(), ".config", "systemd", "user", "failproofaid.service");
|
|
47055
47219
|
}
|
|
@@ -47222,9 +47386,17 @@ ${envBlock} <key>StandardOutPath</key>
|
|
|
47222
47386
|
}
|
|
47223
47387
|
function daemonInstallCommands2(binaryPath, workerCmd, cliCmd) {
|
|
47224
47388
|
if (process.platform === "linux") {
|
|
47389
|
+
const target = systemBinaryTarget2(binaryPath);
|
|
47390
|
+
const dir = systemBinaryDir2();
|
|
47391
|
+
const stage = target ? [
|
|
47392
|
+
`sudo install -d -m 0755 ${shellQuote(dir)}`,
|
|
47393
|
+
`sudo install -m 0755 ${shellQuote(binaryPath)} ${shellQuote(target)}`,
|
|
47394
|
+
`{ sudo restorecon -R ${shellQuote(systemBinaryRoot2())} 2>/dev/null || true; }`
|
|
47395
|
+
] : [];
|
|
47225
47396
|
return [
|
|
47397
|
+
...stage,
|
|
47226
47398
|
`sudo tee ${systemdUnitPath2()} <<'EOF'
|
|
47227
|
-
${systemdUnitContents2(binaryPath, workerCmd, cliCmd)}EOF`,
|
|
47399
|
+
${systemdUnitContents2(target ?? binaryPath, workerCmd, cliCmd)}EOF`,
|
|
47228
47400
|
"sudo systemctl daemon-reload",
|
|
47229
47401
|
`sudo systemctl enable ${systemdUnitName2()}`,
|
|
47230
47402
|
`sudo systemctl restart ${systemdUnitName2()}`
|
|
@@ -47252,9 +47424,11 @@ async function installDaemonService2() {
|
|
|
47252
47424
|
};
|
|
47253
47425
|
}
|
|
47254
47426
|
removeLegacyUserService2();
|
|
47427
|
+
let execPath = binaryPath;
|
|
47255
47428
|
try {
|
|
47256
47429
|
if (process.platform === "linux") {
|
|
47257
|
-
|
|
47430
|
+
execPath = stageSystemBinary2(binaryPath);
|
|
47431
|
+
writePrivilegedFile2(systemdUnitPath2(), systemdUnitContents2(execPath, workerCmd, cliCmd));
|
|
47258
47432
|
runPrivileged2("systemctl", ["daemon-reload"]);
|
|
47259
47433
|
runPrivileged2("systemctl", ["enable", systemdUnitName2()]);
|
|
47260
47434
|
restartSystemdUnit2();
|
|
@@ -47278,6 +47452,8 @@ async function installDaemonService2() {
|
|
|
47278
47452
|
hookLogWarn(`daemon service install failed: ${reason}`);
|
|
47279
47453
|
return { installed: false, reason };
|
|
47280
47454
|
}
|
|
47455
|
+
if (execPath !== binaryPath)
|
|
47456
|
+
pruneSystemBinaries2(execPath);
|
|
47281
47457
|
return { installed: true };
|
|
47282
47458
|
}
|
|
47283
47459
|
async function probeDaemon2() {
|
|
@@ -47515,12 +47691,14 @@ function survey(cwd) {
|
|
|
47515
47691
|
daemonConfigured = readConfig().daemon.configured;
|
|
47516
47692
|
} catch {}
|
|
47517
47693
|
const servicePath = isDaemonSupportedPlatform() ? daemonServiceFilePath() : null;
|
|
47694
|
+
const stagedBinaryDir = isDaemonSupportedPlatform() ? daemonSystemBinaryDir() : null;
|
|
47518
47695
|
return {
|
|
47519
47696
|
clis,
|
|
47520
47697
|
skillDirs: installedAgentSkillDirs(),
|
|
47521
47698
|
codexSystemPath: codexSystemHooksPresent() ? codexSystemConfigPath() : null,
|
|
47522
47699
|
servicePath,
|
|
47523
47700
|
serviceInstalled: !!servicePath && existsSync57(servicePath),
|
|
47701
|
+
stagedBinaryDir: stagedBinaryDir && existsSync57(stagedBinaryDir) ? stagedBinaryDir : null,
|
|
47524
47702
|
daemonConfigured,
|
|
47525
47703
|
homeExists: existsSync57(failproofaiHome())
|
|
47526
47704
|
};
|
|
@@ -47532,7 +47710,7 @@ async function runUninstallCommand(opts = {}) {
|
|
|
47532
47710
|
const many = (n, one) => `${n} ${one}${n === 1 ? "" : "s"}`;
|
|
47533
47711
|
const errText = (err) => err instanceof Error ? err.message : String(err);
|
|
47534
47712
|
const lines = [];
|
|
47535
|
-
const nothingToDo = found.clis.length === 0 && found.skillDirs.length === 0 && !found.serviceInstalled && !found.daemonConfigured && !(opts.purge && found.homeExists);
|
|
47713
|
+
const nothingToDo = found.clis.length === 0 && found.skillDirs.length === 0 && !found.serviceInstalled && !found.stagedBinaryDir && !found.daemonConfigured && !(opts.purge && found.homeExists);
|
|
47536
47714
|
if (nothingToDo) {
|
|
47537
47715
|
return {
|
|
47538
47716
|
exitCode: 0,
|
|
@@ -47550,6 +47728,8 @@ ${home} still holds settings and history. Delete it with \`failproofai uninstal
|
|
|
47550
47728
|
removals.push(`the failproofai skill from ${many(found.skillDirs.length, "agent folder")}`);
|
|
47551
47729
|
if (found.serviceInstalled)
|
|
47552
47730
|
removals.push("the failproofaid service (needs sudo)");
|
|
47731
|
+
else if (found.stagedBinaryDir)
|
|
47732
|
+
removals.push(`the failproofaid binary in ${found.stagedBinaryDir} (needs sudo)`);
|
|
47553
47733
|
if (purging)
|
|
47554
47734
|
removals.push(home);
|
|
47555
47735
|
const releasesDaemon = found.daemonConfigured && !found.serviceInstalled;
|
|
@@ -47643,7 +47823,7 @@ ${home} still holds settings and history. Delete it with \`failproofai uninstal
|
|
|
47643
47823
|
${installedAgentSkillDirs().join(`
|
|
47644
47824
|
`)}`);
|
|
47645
47825
|
}
|
|
47646
|
-
if (found.serviceInstalled) {
|
|
47826
|
+
if (found.serviceInstalled || found.stagedBinaryDir) {
|
|
47647
47827
|
elevateOnce();
|
|
47648
47828
|
const byHand = (servicePath) => `
|
|
47649
47829
|
Remove it as root:
|
|
@@ -47654,8 +47834,14 @@ Check it with \`${daemonStatusCommand()}\`` : "");
|
|
|
47654
47834
|
await uninstallDaemonService();
|
|
47655
47835
|
if (found.servicePath && existsSync57(found.servicePath)) {
|
|
47656
47836
|
failures.push("The failproofaid service is still there, most often because sudo was not available." + byHand(found.servicePath));
|
|
47657
|
-
} else {
|
|
47837
|
+
} else if (found.stagedBinaryDir && existsSync57(found.stagedBinaryDir)) {
|
|
47838
|
+
failures.push(`The failproofaid binary in ${found.stagedBinaryDir} is still there, most often because sudo was not available.` + `
|
|
47839
|
+
Remove it as root:
|
|
47840
|
+
\`sudo rm -rf ${shellQuote(found.stagedBinaryDir)}\``);
|
|
47841
|
+
} else if (found.serviceInstalled) {
|
|
47658
47842
|
lines.push(kit.ok("Stopped and removed the failproofaid service."));
|
|
47843
|
+
} else {
|
|
47844
|
+
lines.push(kit.ok(`Removed the failproofaid binary from ${found.stagedBinaryDir}.`));
|
|
47659
47845
|
}
|
|
47660
47846
|
} catch (err) {
|
|
47661
47847
|
failures.push(`Could not remove the failproofaid service: ${errText(err)}` + (found.servicePath && existsSync57(found.servicePath) ? byHand(found.servicePath) : ""));
|
|
@@ -47683,13 +47869,15 @@ ${home} was kept. Delete it with \`failproofai uninstall --purge\`` : "")));
|
|
|
47683
47869
|
}
|
|
47684
47870
|
function manualServiceRemoval(servicePath) {
|
|
47685
47871
|
if (process.platform === "darwin") {
|
|
47686
|
-
return [`sudo launchctl unload -w ${servicePath}`, `sudo rm -f ${servicePath}`];
|
|
47872
|
+
return [`sudo launchctl unload -w ${shellQuote(servicePath)}`, `sudo rm -f ${shellQuote(servicePath)}`];
|
|
47687
47873
|
}
|
|
47688
47874
|
const unit = servicePath.split("/").pop() ?? servicePath;
|
|
47875
|
+
const binDir = daemonSystemBinaryDir();
|
|
47689
47876
|
return [
|
|
47690
47877
|
`sudo systemctl disable --now ${unit}`,
|
|
47691
|
-
`sudo rm -f ${servicePath}`,
|
|
47692
|
-
`sudo systemctl daemon-reload
|
|
47878
|
+
`sudo rm -f ${shellQuote(servicePath)}`,
|
|
47879
|
+
`sudo systemctl daemon-reload`,
|
|
47880
|
+
...binDir ? [`sudo rm -rf ${shellQuote(binDir)}`] : []
|
|
47693
47881
|
];
|
|
47694
47882
|
}
|
|
47695
47883
|
var init_uninstall_cli = __esm(() => {
|
|
@@ -47707,8 +47895,8 @@ var init_uninstall_cli = __esm(() => {
|
|
|
47707
47895
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
47708
47896
|
import { homedir as homedir39, tmpdir as tmpdir4 } from "node:os";
|
|
47709
47897
|
import { createHash as createHash14 } from "node:crypto";
|
|
47710
|
-
import { copyFileSync as copyFileSync5, existsSync as existsSync58, mkdirSync as mkdirSync34, mkdtempSync as mkdtempSync3, readFileSync as readFileSync46, readdirSync as
|
|
47711
|
-
import { basename as basename11, dirname as
|
|
47898
|
+
import { copyFileSync as copyFileSync5, existsSync as existsSync58, mkdirSync as mkdirSync34, mkdtempSync as mkdtempSync3, readFileSync as readFileSync46, readdirSync as readdirSync26, realpathSync as realpathSync5, rmSync as rmSync24, statSync as statSync43, writeFileSync as writeFileSync29 } from "node:fs";
|
|
47899
|
+
import { basename as basename11, dirname as dirname32, isAbsolute as isAbsolute6, join as join44, relative as relative5, resolve as resolve40, sep as sep6 } from "node:path";
|
|
47712
47900
|
function parseList(rest, ...flags) {
|
|
47713
47901
|
let found = false;
|
|
47714
47902
|
const out = [];
|
|
@@ -48298,7 +48486,7 @@ function inferTaggedVersion(entryPath, sources) {
|
|
|
48298
48486
|
function findEntry(dir) {
|
|
48299
48487
|
let names;
|
|
48300
48488
|
try {
|
|
48301
|
-
names =
|
|
48489
|
+
names = readdirSync26(dir);
|
|
48302
48490
|
} catch {
|
|
48303
48491
|
return [];
|
|
48304
48492
|
}
|
|
@@ -48308,7 +48496,7 @@ function findEntry(dir) {
|
|
|
48308
48496
|
continue;
|
|
48309
48497
|
const full = resolve40(dir, name);
|
|
48310
48498
|
try {
|
|
48311
|
-
if (
|
|
48499
|
+
if (statSync43(full).size > 512 * 1024)
|
|
48312
48500
|
continue;
|
|
48313
48501
|
const text = readFileSync46(full, "utf8");
|
|
48314
48502
|
if (/from\s+["']failproofai["']/.test(text) && /(?:customPolicies|semanticPolicies)\s*\.\s*add\s*\(/.test(text)) {
|
|
@@ -48327,7 +48515,7 @@ function withLocalImports(sources) {
|
|
|
48327
48515
|
const file = queue.shift();
|
|
48328
48516
|
let text;
|
|
48329
48517
|
try {
|
|
48330
|
-
if (
|
|
48518
|
+
if (statSync43(file).size > 512 * 1024)
|
|
48331
48519
|
continue;
|
|
48332
48520
|
text = readFileSync46(file, "utf8");
|
|
48333
48521
|
} catch {
|
|
@@ -48335,13 +48523,13 @@ function withLocalImports(sources) {
|
|
|
48335
48523
|
}
|
|
48336
48524
|
for (const re of LOCAL_IMPORT_RES) {
|
|
48337
48525
|
for (const match of text.matchAll(re)) {
|
|
48338
|
-
const base = resolve40(
|
|
48526
|
+
const base = resolve40(dirname32(file), match[1]);
|
|
48339
48527
|
for (const ext of LOCAL_IMPORT_EXTENSIONS) {
|
|
48340
48528
|
const candidate = base + ext;
|
|
48341
48529
|
if (seen.has(candidate))
|
|
48342
48530
|
break;
|
|
48343
48531
|
try {
|
|
48344
|
-
if (!
|
|
48532
|
+
if (!statSync43(candidate).isFile())
|
|
48345
48533
|
continue;
|
|
48346
48534
|
} catch {
|
|
48347
48535
|
continue;
|
|
@@ -48588,7 +48776,7 @@ esac
|
|
|
48588
48776
|
return true;
|
|
48589
48777
|
} finally {
|
|
48590
48778
|
try {
|
|
48591
|
-
rmSync24(
|
|
48779
|
+
rmSync24(dirname32(askpass), { recursive: true, force: true });
|
|
48592
48780
|
} catch {}
|
|
48593
48781
|
}
|
|
48594
48782
|
}
|
|
@@ -51100,14 +51288,14 @@ var init_parse_script_args = () => {};
|
|
|
51100
51288
|
|
|
51101
51289
|
// scripts/install-diagnosis.mjs
|
|
51102
51290
|
import { existsSync as existsSync60, readFileSync as readFileSync48, realpathSync as realpathSync6 } from "node:fs";
|
|
51103
|
-
import { dirname as
|
|
51291
|
+
import { dirname as dirname33, resolve as resolve43 } from "node:path";
|
|
51104
51292
|
import { homedir as homedir40, platform as platform5 } from "node:os";
|
|
51105
51293
|
import { spawnSync } from "node:child_process";
|
|
51106
51294
|
function findPackageRoot(start) {
|
|
51107
51295
|
try {
|
|
51108
51296
|
let dir = realpathSync6(start);
|
|
51109
51297
|
if (existsSync60(dir) && !existsSync60(resolve43(dir, "package.json"))) {
|
|
51110
|
-
dir =
|
|
51298
|
+
dir = dirname33(dir);
|
|
51111
51299
|
}
|
|
51112
51300
|
while (true) {
|
|
51113
51301
|
const pkgPath = resolve43(dir, "package.json");
|
|
@@ -51118,7 +51306,7 @@ function findPackageRoot(start) {
|
|
|
51118
51306
|
return dir;
|
|
51119
51307
|
} catch {}
|
|
51120
51308
|
}
|
|
51121
|
-
const parent =
|
|
51309
|
+
const parent = dirname33(dir);
|
|
51122
51310
|
if (parent === dir)
|
|
51123
51311
|
return null;
|
|
51124
51312
|
dir = parent;
|
|
@@ -51649,7 +51837,7 @@ var init_launch_ready = () => {};
|
|
|
51649
51837
|
// scripts/launch.ts
|
|
51650
51838
|
import { spawn as spawn2 } from "child_process";
|
|
51651
51839
|
import { realpathSync as realpathSync7, existsSync as existsSync61 } from "node:fs";
|
|
51652
|
-
import { resolve as resolve44, dirname as
|
|
51840
|
+
import { resolve as resolve44, dirname as dirname34 } from "node:path";
|
|
51653
51841
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
51654
51842
|
function launch(mode, options = {}) {
|
|
51655
51843
|
const { loggingLevel, disableTelemetry, allowedDevOrigins, host, remainingArgs } = parseScriptArgs(process.argv.slice(2));
|
|
@@ -51685,7 +51873,7 @@ ${k.caution(exposedBindWarning(exposed.host))}
|
|
|
51685
51873
|
process.env.PORT = port;
|
|
51686
51874
|
process.env.HOSTNAME = bindHost;
|
|
51687
51875
|
cmd = "node";
|
|
51688
|
-
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ?? resolve44(
|
|
51876
|
+
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ?? resolve44(dirname34(realpathSync7(fileURLToPath2(import.meta.url))), "..");
|
|
51689
51877
|
const serverJsPath = resolve44(packageRoot, ".next/standalone/server.js");
|
|
51690
51878
|
if (!existsSync61(serverJsPath)) {
|
|
51691
51879
|
let shadowMessage = null;
|
|
@@ -52914,7 +53102,7 @@ var init_session_pause_cli2 = __esm(() => {
|
|
|
52914
53102
|
// scripts/launch.ts
|
|
52915
53103
|
import { spawn as spawn3 } from "child_process";
|
|
52916
53104
|
import { realpathSync as realpathSync8, existsSync as existsSync62 } from "node:fs";
|
|
52917
|
-
import { resolve as resolve46, dirname as
|
|
53105
|
+
import { resolve as resolve46, dirname as dirname35 } from "node:path";
|
|
52918
53106
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
52919
53107
|
function launch2(mode, options = {}) {
|
|
52920
53108
|
const { loggingLevel, disableTelemetry, allowedDevOrigins, host, remainingArgs } = parseScriptArgs(process.argv.slice(2));
|
|
@@ -52950,7 +53138,7 @@ ${k.caution(exposedBindWarning(exposed.host))}
|
|
|
52950
53138
|
process.env.PORT = port;
|
|
52951
53139
|
process.env.HOSTNAME = bindHost;
|
|
52952
53140
|
cmd = "node";
|
|
52953
|
-
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ?? resolve46(
|
|
53141
|
+
const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ?? resolve46(dirname35(realpathSync8(fileURLToPath3(import.meta.url))), "..");
|
|
52954
53142
|
const serverJsPath = resolve46(packageRoot, ".next/standalone/server.js");
|
|
52955
53143
|
if (!existsSync62(serverJsPath)) {
|
|
52956
53144
|
let shadowMessage = null;
|
|
@@ -53072,17 +53260,17 @@ var init_cli_error2 = __esm(() => {
|
|
|
53072
53260
|
|
|
53073
53261
|
// bin/failproofai.mjs
|
|
53074
53262
|
import { realpathSync as realpathSync9 } from "fs";
|
|
53075
|
-
import { dirname as
|
|
53263
|
+
import { dirname as dirname36, resolve as resolve47 } from "path";
|
|
53076
53264
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
53077
53265
|
// package.json
|
|
53078
|
-
var version = "1.0.13
|
|
53266
|
+
var version = "1.0.13";
|
|
53079
53267
|
|
|
53080
53268
|
// bin/failproofai.mjs
|
|
53081
53269
|
if (!process.env.FAILPROOFAI_PACKAGE_ROOT) {
|
|
53082
|
-
process.env.FAILPROOFAI_PACKAGE_ROOT = resolve47(
|
|
53270
|
+
process.env.FAILPROOFAI_PACKAGE_ROOT = resolve47(dirname36(realpathSync9(fileURLToPath4(import.meta.url))), "..");
|
|
53083
53271
|
}
|
|
53084
53272
|
if (!process.env.FAILPROOFAI_DIST_PATH) {
|
|
53085
|
-
process.env.FAILPROOFAI_DIST_PATH = resolve47(
|
|
53273
|
+
process.env.FAILPROOFAI_DIST_PATH = resolve47(dirname36(realpathSync9(fileURLToPath4(import.meta.url))), "..", "dist");
|
|
53086
53274
|
}
|
|
53087
53275
|
var args = process.argv.slice(2);
|
|
53088
53276
|
if (args[0] === "p" || args[0] === "policy")
|