failproofai 0.0.12 → 0.0.13-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.cursor/hooks.json +6 -6
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js +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 +7 -7
- 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 +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
- 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 +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 +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +10 -10
- 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/_not-found.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/audit/invite/route.js +2 -2
- 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 +3 -2
- package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-request/route.js +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 +2 -2
- 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 +2 -2
- package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/reminder/route.js +2 -2
- package/.next/standalone/.next/server/app/api/auth/reminder/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/status/route.js +2 -2
- 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 +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 +1 -1
- 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 +15 -15
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +10 -10
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js +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 +8 -8
- package/.next/standalone/.next/server/app/policies/page.js +2 -2
- 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 +3 -2
- 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 +3 -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 +2 -2
- 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/chunks/[root-of-the-server]__0_0xu5z._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0cefjd9._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ekj92q._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0hv08mx._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0obaznk._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0xvsnvt._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__12v-lma._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__136y39g._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__13h8pzr._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1fwl2mz._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1hkdkmz._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1i9rknc._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1mrihkj._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1myjm-d._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0cycwg6._.js → [root-of-the-server]__1tvn4wf._.js} +2 -2
- package/.next/standalone/.next/server/chunks/_1z062h5._.js +3 -0
- package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_17k9e3w.js +5 -5
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__015_i4t._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__03lv-pe._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04bqvos._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0ntd0fz._.js → [root-of-the-server]__099afy6._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0dqgs96._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0hdsupo._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0q5rfxg._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qeuy9c._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qukut7._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s89hoe._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0ehe24g._.js → [root-of-the-server]__0ynf7tx._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__170799-._.js +245 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1d8omgc._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ql-mch._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0vh88nr._.js → [root-of-the-server]__1qlh4jx._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1tkjqka._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/_05whahf._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0ul5rf_._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_11_p9y8._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_11v0g3z._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1p0-leb._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/lib_hermes-projects_ts_05b8-it._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_html-to-image_es_index_0bppeyf.js → node_modules_html-to-image_es_index_0pv57nx.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/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +10 -10
- package/.next/standalone/.next/static/chunks/{3jk5y-qgnnti_.js → 0b6rdtcge_3ec.js} +1 -1
- package/.next/standalone/.next/static/chunks/{09l7dfsd4xapi.js → 0pj_6lbbjd000.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0ys-mwok1j9kp.js → 0xnrgonfdeivm.js} +1 -1
- package/.next/standalone/.next/static/chunks/{00_ypuitb29l0.js → 105w_oznq-van.js} +1 -1
- package/.next/standalone/.next/static/chunks/{3pb3m-89k7ts2.js → 13tbm6i1swiru.js} +1 -1
- package/.next/standalone/.next/static/chunks/{36yb_gsfgfga4.js → 1fhuj4fjovzp5.js} +1 -1
- package/.next/standalone/.next/static/chunks/209ful1jrphvy.js +1 -0
- package/.next/standalone/.next/static/chunks/{0qw65r3wfs089.js → 23odnajn2ltwu.js} +1 -1
- package/.next/standalone/.next/static/chunks/25s52un3k_wht.css +2 -0
- package/.next/standalone/.next/static/chunks/36r2vgi6854za.js +6 -0
- package/.next/standalone/.next/static/chunks/3b77kulbdbrqw.js +1 -0
- package/.next/standalone/.next/static/chunks/3rjg-1s5ouu5r.js +1 -0
- package/.next/standalone/app/components/sessions-list.tsx +19 -0
- package/.next/standalone/app/project/[name]/page.tsx +9 -4
- package/.next/standalone/app/project/[name]/session/[sessionId]/page.tsx +26 -5
- package/.next/standalone/assets/logos/hermes-dark.svg +1 -0
- package/.next/standalone/assets/logos/hermes-light.svg +1 -0
- package/.next/standalone/docker-hook-sync/Dockerfile +75 -0
- package/.next/standalone/docker-hook-sync/entrypoint.sh +109 -0
- package/.next/standalone/lib/cli-registry.ts +6 -1
- package/.next/standalone/lib/download-session.ts +16 -0
- package/.next/standalone/lib/hermes-projects.ts +164 -0
- package/.next/standalone/lib/hermes-sessions.ts +273 -0
- package/.next/standalone/lib/projects.ts +14 -3
- package/.next/standalone/lib/sqlite-reader.ts +102 -0
- package/.next/standalone/package.json +5 -3
- package/.next/standalone/server.js +1 -1
- package/README.md +10 -1
- package/bin/failproofai.mjs +17 -16
- package/dist/cli.mjs +7779 -229
- package/lib/cli-registry.ts +6 -1
- package/lib/download-session.ts +16 -0
- package/lib/hermes-projects.ts +164 -0
- package/lib/hermes-sessions.ts +273 -0
- package/lib/projects.ts +14 -3
- package/lib/sql-js-asm.d.ts +26 -0
- package/lib/sqlite-reader.ts +102 -0
- package/package.json +5 -3
- package/scripts/sync-agent-cli-harnesses-prompt.md +222 -0
- package/src/audit/cli-adapters/hermes.ts +58 -0
- package/src/audit/cli-adapters/index.ts +6 -0
- package/src/hooks/handler.ts +8 -0
- package/src/hooks/install-prompt.ts +7 -3
- package/src/hooks/integrations.ts +191 -10
- package/src/hooks/policy-evaluator.ts +42 -0
- package/src/hooks/resolve-transcript-path.ts +4 -0
- package/src/hooks/tool-name-canonicalize.ts +6 -0
- package/src/hooks/types.ts +107 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0dwpg-h._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0lnenda._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__13i_sva._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1_mqemn._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1m2_4t0._.js +0 -3
- package/.next/standalone/.next/server/chunks/node_modules_0-tu4ot._.js +0 -3
- package/.next/standalone/.next/server/chunks/node_modules_0ttxbz7._.js +0 -3
- package/.next/standalone/.next/server/chunks/node_modules_1bnh1y0._.js +0 -3
- package/.next/standalone/.next/server/chunks/node_modules_1epycqa._.js +0 -3
- package/.next/standalone/.next/server/chunks/node_modules_1wpdcgo._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0808sha._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e4-6d8._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0f62vu9._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0g253ve._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0k65l27._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0vxf0_g._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12mcauo._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1e-x7j4._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1mt35_w._.js +0 -221
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1pcxxwg._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1uvfwgr._.js +0 -4
- package/.next/standalone/.next/static/chunks/0f7d7hnbh4djs.js +0 -1
- package/.next/standalone/.next/static/chunks/1o0xa47736gi9.css +0 -2
- package/.next/standalone/.next/static/chunks/2ey-m4-p9z7e0.js +0 -6
- package/.next/standalone/.next/static/chunks/2wbuxnsvux4di.js +0 -1
- package/.next/standalone/.next/static/chunks/3-veva26100-4.js +0 -1
- package/scripts/sync-hook-events-prompt.md +0 -179
- /package/.next/standalone/.next/static/{PdZTBvCBXzDRLe-duL9yC → 31ZoDDYKHEIN_TrgKv85t}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{PdZTBvCBXzDRLe-duL9yC → 31ZoDDYKHEIN_TrgKv85t}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{PdZTBvCBXzDRLe-duL9yC → 31ZoDDYKHEIN_TrgKv85t}/_ssgManifest.js +0 -0
|
@@ -256,6 +256,25 @@ export async function evaluatePolicies(
|
|
|
256
256
|
};
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
+
// Hermes: the block contract is `{"decision":"block","reason"}` on stdout;
|
|
260
|
+
// Hermes IGNORES exit codes, so the JSON is the only channel. This one
|
|
261
|
+
// return covers every Hermes event we install (PreToolUse / PostToolUse /
|
|
262
|
+
// SubagentStop) — there is no Stop/turn-end event to special-case (Hermes
|
|
263
|
+
// has no turn boundary; the 5 require-*-before-stop builtins never fire for
|
|
264
|
+
// it — see CLAUDE.md / the audit plan). A block on PreToolUse stops the
|
|
265
|
+
// tool before it runs, regardless of the originating platform
|
|
266
|
+
// (slack/telegram/cli/cron) or subagent.
|
|
267
|
+
if (session?.cli === "hermes") {
|
|
268
|
+
return {
|
|
269
|
+
exitCode: 0,
|
|
270
|
+
stdout: JSON.stringify({ decision: "block", reason: blockedMessage }),
|
|
271
|
+
stderr: "",
|
|
272
|
+
policyName: policy.name,
|
|
273
|
+
reason,
|
|
274
|
+
decision: "deny",
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
259
278
|
// OpenCode: `session.idle` is a notification-only bus event — by the
|
|
260
279
|
// time the plugin handler fires, OpenCode has already gone idle and
|
|
261
280
|
// throwing from the handler does not force-retry. The only working
|
|
@@ -552,6 +571,29 @@ export async function evaluatePolicies(
|
|
|
552
571
|
};
|
|
553
572
|
}
|
|
554
573
|
|
|
574
|
+
// Hermes: no additional-context channel on any event (the only actionable
|
|
575
|
+
// response is `{"decision":"block"}`). So instruct degrades to allow +
|
|
576
|
+
// log — we emit a non-blocking `{decision:"allow", reason}` (Hermes lets
|
|
577
|
+
// the tool run) and surface the note on stderr for the operator's logs.
|
|
578
|
+
// Documented limitation; there is no Stop event to force-retry into.
|
|
579
|
+
if (session?.cli === "hermes") {
|
|
580
|
+
const stderrMsg = instructEntries
|
|
581
|
+
.map((e) => `[failproofai] ${e.policyName}: ${e.reason}`)
|
|
582
|
+
.join("\n");
|
|
583
|
+
return {
|
|
584
|
+
exitCode: 0,
|
|
585
|
+
stdout: JSON.stringify({
|
|
586
|
+
decision: "allow",
|
|
587
|
+
reason: `Instruction from failproofai: ${combined}`,
|
|
588
|
+
}),
|
|
589
|
+
stderr: stderrMsg + "\n",
|
|
590
|
+
policyName: policyNames[0],
|
|
591
|
+
policyNames,
|
|
592
|
+
reason: combined,
|
|
593
|
+
decision: "instruct",
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
|
|
555
597
|
// OpenCode: same rationale as the deny branch above — emit
|
|
556
598
|
// additionalContext so the shim submits a follow-up via
|
|
557
599
|
// client.session.prompt instead of throwing into a dead handler.
|
|
@@ -63,6 +63,10 @@ export function resolveTranscriptPath(
|
|
|
63
63
|
return findGeminiTranscript(sessionId) ?? undefined;
|
|
64
64
|
case "opencode":
|
|
65
65
|
return `opencode-db://${sessionId}`;
|
|
66
|
+
case "hermes":
|
|
67
|
+
// Hermes live-hook payloads carry no transcript file; the audit path
|
|
68
|
+
// reads sessions straight from ~/.hermes/state.db (see hermes-sessions.ts).
|
|
69
|
+
return undefined;
|
|
66
70
|
default:
|
|
67
71
|
return undefined;
|
|
68
72
|
}
|
|
@@ -15,6 +15,8 @@ import {
|
|
|
15
15
|
PI_TOOL_MAP,
|
|
16
16
|
PI_TOOL_INPUT_MAP,
|
|
17
17
|
GEMINI_TOOL_MAP,
|
|
18
|
+
HERMES_TOOL_MAP,
|
|
19
|
+
HERMES_TOOL_INPUT_MAP,
|
|
18
20
|
} from "./types";
|
|
19
21
|
|
|
20
22
|
/**
|
|
@@ -33,6 +35,7 @@ export function canonicalizeToolName(
|
|
|
33
35
|
if (cli === "gemini") return GEMINI_TOOL_MAP[raw] ?? raw;
|
|
34
36
|
if (cli === "opencode") return OPENCODE_TOOL_MAP[raw] ?? raw;
|
|
35
37
|
if (cli === "pi") return PI_TOOL_MAP[raw] ?? raw;
|
|
38
|
+
if (cli === "hermes") return HERMES_TOOL_MAP[raw] ?? raw;
|
|
36
39
|
return raw;
|
|
37
40
|
}
|
|
38
41
|
|
|
@@ -56,6 +59,9 @@ export function canonicalizeToolInput(
|
|
|
56
59
|
let perToolMap: Record<string, string> | undefined;
|
|
57
60
|
if (cli === "opencode") perToolMap = OPENCODE_TOOL_INPUT_MAP[toolName];
|
|
58
61
|
else if (cli === "pi") perToolMap = PI_TOOL_INPUT_MAP[toolName];
|
|
62
|
+
// Hermes read_file/write_file/patch deliver the file path as `path`; map it to
|
|
63
|
+
// `file_path` so path/content builtins fire (verified against a live state.db).
|
|
64
|
+
else if (cli === "hermes") perToolMap = HERMES_TOOL_INPUT_MAP[toolName];
|
|
59
65
|
if (!perToolMap) return rawInput;
|
|
60
66
|
const out: Record<string, unknown> = {};
|
|
61
67
|
for (const [k, v] of Object.entries(rawInput as Record<string, unknown>)) {
|
package/src/hooks/types.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
export const HOOK_SCOPES = ["user", "project", "local"] as const;
|
|
6
6
|
export type HookScope = (typeof HOOK_SCOPES)[number];
|
|
7
7
|
|
|
8
|
-
export const INTEGRATION_TYPES = ["claude", "codex", "copilot", "cursor", "opencode", "pi", "gemini"] as const;
|
|
8
|
+
export const INTEGRATION_TYPES = ["claude", "codex", "copilot", "cursor", "opencode", "pi", "gemini", "hermes"] as const;
|
|
9
9
|
export type IntegrationType = (typeof INTEGRATION_TYPES)[number];
|
|
10
10
|
|
|
11
11
|
export const CODEX_HOOK_SCOPES = ["user", "project"] as const;
|
|
@@ -18,6 +18,18 @@ export const CODEX_HOOK_EVENT_TYPES = [
|
|
|
18
18
|
"post_tool_use",
|
|
19
19
|
"user_prompt_submit",
|
|
20
20
|
"stop",
|
|
21
|
+
// Newly documented upstream (https://developers.openai.com/codex/hooks) —
|
|
22
|
+
// snake_case forms of the documented SubagentStart / PreCompact / PostCompact /
|
|
23
|
+
// SubagentStop events. Each has an exact 1:1 canonical HookEventType (already
|
|
24
|
+
// present in HOOK_EVENT_TYPES), so their CODEX_EVENT_MAP entries below are
|
|
25
|
+
// filled in directly. The map is an exhaustive `Record<CodexHookEventType,
|
|
26
|
+
// HookEventType>`, so tsc guarantees every event here keeps a mapping — a
|
|
27
|
+
// partial sync (event added, mapping missing) fails the build instead of
|
|
28
|
+
// silently writing an `undefined` event key into users' .codex/hooks.json.
|
|
29
|
+
"subagent_start",
|
|
30
|
+
"pre_compact",
|
|
31
|
+
"post_compact",
|
|
32
|
+
"subagent_stop",
|
|
21
33
|
] as const;
|
|
22
34
|
export type CodexHookEventType = (typeof CODEX_HOOK_EVENT_TYPES)[number];
|
|
23
35
|
|
|
@@ -28,6 +40,10 @@ export const CODEX_EVENT_MAP: Record<CodexHookEventType, HookEventType> = {
|
|
|
28
40
|
post_tool_use: "PostToolUse",
|
|
29
41
|
user_prompt_submit: "UserPromptSubmit",
|
|
30
42
|
stop: "Stop",
|
|
43
|
+
subagent_start: "SubagentStart",
|
|
44
|
+
pre_compact: "PreCompact",
|
|
45
|
+
post_compact: "PostCompact",
|
|
46
|
+
subagent_stop: "SubagentStop",
|
|
31
47
|
};
|
|
32
48
|
|
|
33
49
|
/**
|
|
@@ -45,6 +61,72 @@ export const CODEX_TOOL_MAP: Record<string, string> = {
|
|
|
45
61
|
write_stdin: "Bash",
|
|
46
62
|
};
|
|
47
63
|
|
|
64
|
+
// ── Hermes (hermes-agent) ───────────────────────────────────────────────────
|
|
65
|
+
//
|
|
66
|
+
// Hermes supports BOTH audit (Pillar 2) and live hooks (Pillar 1). This tool
|
|
67
|
+
// map is consumed by the audit adapter (via `logEntriesToEvents`) AND the
|
|
68
|
+
// live-hook handler, both through `canonicalizeToolName`. Tool names are the
|
|
69
|
+
// granular toolset tools verified
|
|
70
|
+
// against a live ~/.hermes/state.db (frequency in a real gateway session:
|
|
71
|
+
// terminal 574, read_file 124, patch 94, write_file 54, web_search 42, …).
|
|
72
|
+
// Names with a Claude canonical are mapped so builtin policies fire; Hermes-
|
|
73
|
+
// specific tools (skill_view, cronjob, browser_*, memory, session_search,
|
|
74
|
+
// clarify, process) pass through unchanged so they still appear in the audit,
|
|
75
|
+
// just unmatched by builtin policies.
|
|
76
|
+
export const HERMES_TOOL_MAP: Record<string, string> = {
|
|
77
|
+
terminal: "Bash",
|
|
78
|
+
bash: "Bash",
|
|
79
|
+
read_file: "Read",
|
|
80
|
+
write_file: "Write",
|
|
81
|
+
patch: "Edit",
|
|
82
|
+
web_search: "WebSearch",
|
|
83
|
+
web_extract: "WebFetch",
|
|
84
|
+
search_files: "Grep",
|
|
85
|
+
todo: "TodoWrite",
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// Hermes tool-INPUT key canonicalization, keyed by the *canonical* tool name
|
|
89
|
+
// (the handler canonicalizes the name before calling canonicalizeToolInput).
|
|
90
|
+
// Verified against a live ~/.hermes/state.db: read_file / write_file / patch
|
|
91
|
+
// deliver the file path as `path`, but Claude builtins read `file_path`
|
|
92
|
+
// (block-env-files, block-secrets-write, block-read-outside-cwd) — so map it.
|
|
93
|
+
// write_file's `content`, patch's `old_string`/`new_string`, and search_files'
|
|
94
|
+
// `pattern`/`path` are already canonical, so Grep needs no entry. Mirrors
|
|
95
|
+
// PI_TOOL_INPUT_MAP (Pi has the same `path` → `file_path` shape).
|
|
96
|
+
export const HERMES_TOOL_INPUT_MAP: Record<string, Record<string, string>> = {
|
|
97
|
+
Read: { path: "file_path" },
|
|
98
|
+
Write: { path: "file_path" },
|
|
99
|
+
Edit: { path: "file_path" },
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// Hermes live-hook (Pillar 1) events + scopes. Hermes fires these snake_case
|
|
103
|
+
// events with a JSON payload on stdin; the command we install runs
|
|
104
|
+
// `failproofai --hook <event> --cli hermes`. Config is USER-scope only
|
|
105
|
+
// (`~/.hermes/config.yaml`; Hermes has no project scope). `pre_tool_call` is the
|
|
106
|
+
// core deny point — it fires for tool calls from every source
|
|
107
|
+
// (slack/telegram/cli/cron) and internal subagents, so a single install
|
|
108
|
+
// intercepts all platforms. Hermes has NO turn-end `Stop` event, so the
|
|
109
|
+
// `require-*-before-stop` builtins never fire for it (see the audit plan).
|
|
110
|
+
export const HERMES_HOOK_SCOPES = ["user"] as const;
|
|
111
|
+
export type HermesHookScope = (typeof HERMES_HOOK_SCOPES)[number];
|
|
112
|
+
|
|
113
|
+
export const HERMES_HOOK_EVENT_TYPES = [
|
|
114
|
+
"pre_tool_call",
|
|
115
|
+
"post_tool_call",
|
|
116
|
+
"on_session_start",
|
|
117
|
+
"on_session_end",
|
|
118
|
+
"subagent_stop",
|
|
119
|
+
] as const;
|
|
120
|
+
export type HermesHookEventType = (typeof HERMES_HOOK_EVENT_TYPES)[number];
|
|
121
|
+
|
|
122
|
+
export const HERMES_EVENT_MAP: Record<HermesHookEventType, HookEventType> = {
|
|
123
|
+
pre_tool_call: "PreToolUse",
|
|
124
|
+
post_tool_call: "PostToolUse",
|
|
125
|
+
on_session_start: "SessionStart",
|
|
126
|
+
on_session_end: "SessionEnd",
|
|
127
|
+
subagent_stop: "SubagentStop",
|
|
128
|
+
};
|
|
129
|
+
|
|
48
130
|
// ── GitHub Copilot CLI ─────────────────────────────────────────────────────
|
|
49
131
|
//
|
|
50
132
|
// Copilot CLI accepts two payload formats. We install with PascalCase event
|
|
@@ -92,6 +174,18 @@ export const COPILOT_HOOK_EVENT_TYPES = [
|
|
|
92
174
|
"PostToolUse",
|
|
93
175
|
"Stop",
|
|
94
176
|
"SubagentStop",
|
|
177
|
+
// Newly documented upstream (cli-hooks-reference), each with an explicit
|
|
178
|
+
// PascalCase "VS Code compatible" variant shown in the docs. No COPILOT_EVENT_MAP
|
|
179
|
+
// exists (Copilot names are already Pascal), so appending keeps the build green.
|
|
180
|
+
// NOTE: `subagentStart` is also newly documented but appears camelCase-ONLY (no
|
|
181
|
+
// PascalCase variant listed), so it is deferred to the reviewer checklist rather
|
|
182
|
+
// than guessing a casing. `notification`, by contrast, DOES have a documented
|
|
183
|
+
// `Notification` PascalCase variant, so it is appended below.
|
|
184
|
+
"PostToolUseFailure",
|
|
185
|
+
"ErrorOccurred",
|
|
186
|
+
"PreCompact",
|
|
187
|
+
"PermissionRequest",
|
|
188
|
+
"Notification",
|
|
95
189
|
] as const;
|
|
96
190
|
export type CopilotHookEventType = (typeof COPILOT_HOOK_EVENT_TYPES)[number];
|
|
97
191
|
|
|
@@ -556,6 +650,18 @@ export const HOOK_EVENT_TYPES = [
|
|
|
556
650
|
"ElicitationResult",
|
|
557
651
|
"UserPromptExpansion",
|
|
558
652
|
"PostToolBatch",
|
|
653
|
+
// Newly documented upstream (https://code.claude.com/docs/en/hooks lifecycle
|
|
654
|
+
// table). `Setup` fires only on `--init`/`--maintenance` (low-frequency), so it
|
|
655
|
+
// is appended and installed like any other event.
|
|
656
|
+
//
|
|
657
|
+
// `MessageDisplay` is intentionally NOT appended. The docs mark it observe-only
|
|
658
|
+
// (it cannot block or modify anything) and note it fires on *every* assistant
|
|
659
|
+
// message display with no matcher support. Since `writeHookEntries` installs a
|
|
660
|
+
// hook for every entry in this array, appending it would spawn a failproofai
|
|
661
|
+
// subprocess on every message render for zero enforcement value. Deferred to the
|
|
662
|
+
// PR reviewer checklist; add it here only if a future observe-only use case
|
|
663
|
+
// (e.g. redaction/telemetry) justifies the per-message cost.
|
|
664
|
+
"Setup",
|
|
559
665
|
] as const;
|
|
560
666
|
|
|
561
667
|
export type HookEventType = (typeof HOOK_EVENT_TYPES)[number];
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[18622,(e,t,i)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,i)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,i)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,i)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,i)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,i)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},94930,e=>{"use strict";var t=e.i(2157),i=e.i(50227),n=e.i(66680);e.s(["writeJsonAtomically",0,function(e,s,r={}){let a=r.mode??384,o=r.dirMode??448,l=(0,i.dirname)(e);(0,t.existsSync)(l)||(0,t.mkdirSync)(l,{recursive:!0,mode:o});let c=`${e}.${process.pid}.${(0,n.randomBytes)(6).toString("hex")}.tmp`;try{(0,t.writeFileSync)(c,JSON.stringify(s,null,2),{mode:a});try{(63&(0,t.statSync)(c).mode)!=0&&(0,t.chmodSync)(c,a)}catch{}(0,t.renameSync)(c,e);try{(63&(0,t.statSync)(e).mode)!=0&&(0,t.chmodSync)(e,a)}catch{}}catch(e){try{(0,t.rmSync)(c,{force:!0})}catch{}throw e}}])},74533,(e,t,i)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},50227,(e,t,i)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,i)=>{t.exports=e.x("node:os",()=>require("node:os"))},2157,(e,t,i)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},66680,(e,t,i)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},24214,(e,t,i)=>{t.exports={name:"failproofai",version:"0.0.12",description:"The easiest way to manage policies that keep your AI agents reliable, on-task, and running autonomously — for Claude Code & the Agents SDK",bin:{failproofai:"./dist/cli.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/",".next/standalone/","dist/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{predev:"bun run build:cli && bun link",dev:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/dev.ts --port 8020","build:cli":"bun build --target=node --format=esm --outfile=dist/cli.mjs bin/failproofai.mjs --external posthog-node && node -e \"const fs=require('fs');const c=fs.readFileSync('dist/cli.mjs','utf8');fs.writeFileSync('dist/cli.mjs',c.replace('#!/usr/bin/env bun','#!/usr/bin/env node').replace('// @bun\\n',''))\"",build:"bun build --target=node --format=cjs --outfile=dist/index.js src/index.ts && bun run build:cli && bun --bun next build && node -e \"const {cpSync}=require('fs');cpSync('.next/static','.next/standalone/.next/static',{recursive:true});\" && node scripts/prune-standalone.mjs",prestart:"bun run build:cli && bun link",start:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",postinstall:"node scripts/postinstall.mjs",preuninstall:"node scripts/preuninstall.mjs",prepare:"bun run build","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts",translate:"bun scripts/translate-docs/cli.ts","translate:readme":"bun scripts/translate-docs/cli.ts --readme-only","translate:docs":"bun scripts/translate-docs/cli.ts --docs-only","translate:dry-run":"bun scripts/translate-docs/cli.ts --dry-run","translate:validate":"bun scripts/translate-docs/cli.ts --validate","validate:mdx":"bun scripts/validate-mdx.ts"},keywords:["claude","claude-code","claude-agents-sdk","anthropic","ai-agent","agent-reliability","agent-monitoring","autonomous-agent","failure-prevention","developer-tools","devtools","cli","local-first","hooks","policies"],author:"ExosphereHost Inc. <failproofai@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://github.com/FailproofAI/failproofai",repository:{type:"git",url:"https://github.com/FailproofAI/failproofai.git"},bugs:{url:"https://github.com/FailproofAI/failproofai/issues"},publishConfig:{access:"public"},devDependencies:{"@anthropic-ai/sdk":"^0.110.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.3","@testing-library/jest-dom":"^6.9.1","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.1","@types/node":"26.1.0","@types/react":"19.2.17","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.0.1",clsx:"^2.1.1",eslint:"^10.5.0","eslint-config-next":"^16.2.9",jsdom:"^29.1.1","lucide-react":"^1.18.0",next:"^16.2.9",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^4.1.9"},dependencies:{"html-to-image":"^1.11.13",html2canvas:"^1.4.1","posthog-node":"^5.37.1"},overrides:{postcss:"8.5.14","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.28.0"}}},28067,e=>{"use strict";e.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX","POSTHOG_PRODUCT",0,"failproofai-oss"])},10659,e=>{"use strict";let t;var i=e.i(2157),n=e.i(50227),s=e.i(60526),r=e.i(66680);e.i(74533);let a=n.default.join(s.default.homedir(),".failproofai"),o=n.default.join(a,"instance-id");function l(e){return r.default.createHmac("sha256","failproofai-telemetry-v1").update(e).digest("hex")}e.s(["getInstanceId",0,function(){if(t)return t;let e=function(){try{for(let e of(s.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let t=i.default.readFileSync(e,"utf-8").trim();if(t)return t}catch{}}catch{}}();if(e)return t=l(e);let n=[s.default.hostname(),s.default.homedir(),s.default.platform(),s.default.arch(),s.default.cpus()[0]?.model??""].join(":");return t=n?l(n):function(){try{let e=i.default.readFileSync(o,"utf-8").trim();if(e)return e}catch{}let e=r.default.randomUUID();try{i.default.mkdirSync(a,{recursive:!0}),i.default.writeFileSync(o,e,"utf-8")}catch{}return e}()}])},72561,e=>{"use strict";var t=e.i(10659),i=e.i(24214),n=e.i(28067);let s=n.POSTHOG_API_KEY;async function r(e,t){for(let i=1;i<=5;i++){try{let{signal:i,...n}=t,s=await fetch(e,{...n,signal:AbortSignal.timeout(5e3)});if(s.ok)return s}catch{}if(i<5){let e=Math.min(1e3*2**(i-1),8e3);await new Promise(t=>setTimeout(t,e))}}return new Response("{}",{status:200})}function a(){return"1"!==process.env.FAILPROOFAI_TELEMETRY_DISABLED}async function o(){try{if(!a()||globalThis.__FAILPROOFAI_POSTHOG__)return;let t=await e.A(78081),i=process.env.FAILPROOFAI_POSTHOG_KEY??s,n=process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com";globalThis.__FAILPROOFAI_POSTHOG__=new t.PostHog(i,{host:n,flushAt:1,flushInterval:0,requestTimeout:5e3,fetchRetryCount:0,fetch:r});let o=()=>{globalThis.__FAILPROOFAI_POSTHOG__?.shutdown().catch(()=>{})};process.on("beforeExit",o),process.on("SIGTERM",o),process.on("SIGINT",o)}catch(e){console.warn("[failproofai:telemetry] init failed:",e instanceof Error?e.message:e)}}e.s(["initTelemetry",0,o,"trackEvent",0,function(e,s){if(!a())return;let r=globalThis.__FAILPROOFAI_POSTHOG__;r&&r.capture({distinctId:(0,t.getInstanceId)(),event:e,properties:{...s,$lib:"failproofai",failproofai_version:i.version,product:n.POSTHOG_PRODUCT}})}])},47756,48480,e=>{"use strict";var t=e.i(2157),i=e.i(50227),n=e.i(60526),s=e.i(94930);function r(){return(0,i.join)((0,n.homedir)(),".failproofai","audit-dashboard.json")}e.s(["readDashboardCache",0,function(){let e=r();if(!(0,t.existsSync)(e))return null;try{let i=(0,t.readFileSync)(e,"utf-8"),n=JSON.parse(i);if(!n||"object"!=typeof n||"string"!=typeof n.cachedAt||!n.params||"object"!=typeof n.params||!n.result||"object"!=typeof n.result||2!==n.schemaVersion||function(e,t=30){let i=new Date(e).getTime();return!!Number.isNaN(i)||Date.now()-i>6e4*t}(n.cachedAt,10080))return null;return n}catch{return null}},"writeDashboardCache",0,function(e,t){try{let i={schemaVersion:2,cachedAt:new Date().toISOString(),params:e,result:t};return(0,s.writeJsonAtomically)(r(),i),!0}catch{return!1}}],47756);let a={running:!1,error:null};e.s(["finishRun",0,function(e){a.running=!1,a.startedAt=void 0,a.error=e},"getRunState",0,function(){return{...a}},"tryAcquireRun",0,function(){return!a.running&&(a.running=!0,a.startedAt=Date.now(),a.error=null,!0)}],48480)},36203,e=>{"use strict";var t=e.i(12714),i=e.i(60526),n=e.i(50227),s=e.i(81580),r=e.i(83534),a=e.i(71809),o=e.i(28557),l=e.i(40911);let c=(0,n.join)((0,i.homedir)(),".codex","sessions"),u=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i;async function d(e){try{return await (0,t.readdir)(e,{withFileTypes:!0})}catch{return null}}async function f(e){let i=null;try{i=await (0,t.open)(e,"r");let n=Buffer.alloc(262144),{bytesRead:s}=await i.read(n,0,262144,0);if(0===s)return null;let r=n.subarray(0,s),a=r.indexOf(10),o=-1===a?s:a;return r.subarray(0,o).toString("utf-8")}catch{return null}finally{i&&await i.close().catch(()=>{})}}async function m(e){let t=await d(e);return t?t.filter(e=>e.isFile()&&e.name.endsWith(".jsonl")).map(t=>(0,n.join)(e,t.name)):[]}async function p(){let e=await d(c);if(!e)return[];let i=[];for(let t of e){if(!t.isDirectory())continue;let e=await d((0,n.join)(c,t.name));if(e)for(let s of e){if(!s.isDirectory())continue;let e=await d((0,n.join)(c,t.name,s.name));if(e)for(let r of e){if(!r.isDirectory())continue;let e=(0,n.join)(c,t.name,s.name,r.name);i.push(...await m(e))}}}return 0===i.length?[]:(await (0,a.batchAll)(i.map(e=>async()=>{let i,n,s=(n=(e.split("/").pop()??"").match(u))?n[0]:null;if(!s)return null;let r=await f(e);if(!r)return null;let{cwd:a}=function(e){try{let t=JSON.parse(e);if("session_meta"!==t.type)return{};let i=t.payload?.cwd;if("string"!=typeof i||0===i.length)return{};return{cwd:i}}catch{return{}}}(r);if(!a)return null;try{let n=await (0,t.open)(e,"r");try{i=(await n.stat()).mtime}finally{await n.close().catch(()=>{})}}catch{i=new Date(0)}return{filePath:e,fileName:e.split("/").pop()??"",cwd:a,sessionId:s,fileMtime:i}}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}let y=(0,r.runtimeCache)(p,30);async function h(){let e;try{e=await y()}catch(e){return(0,l.logWarn)("Failed to scan Codex sessions:",e),[]}let t=new Map;for(let i of e){let e=t.get(i.cwd);(!e||i.fileMtime.getTime()>e.latest.getTime())&&t.set(i.cwd,{latest:i.fileMtime,cwd:i.cwd})}let i=[];for(let{cwd:e,latest:n}of t.values())i.push({name:(0,s.encodeFolderName)(e),path:e,isDirectory:!0,lastModified:n,lastModifiedFormatted:(0,o.formatDate)(n),cli:["codex"]});return i.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),i}function g(e){let t=e.map(e=>({name:e.fileName.replace(/\.jsonl$/,""),path:e.filePath,lastModified:e.fileMtime,lastModifiedFormatted:(0,o.formatDate)(e.fileMtime),sessionId:e.sessionId,cli:"codex"}));return t.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),t}async function w(e){let t;try{t=await y()}catch(e){return(0,l.logWarn)("Failed to scan Codex sessions:",e),[]}return g(t.filter(t=>t.cwd===e))}async function S(e){let t;try{t=await y()}catch(e){return(0,l.logWarn)("Failed to scan Codex sessions:",e),{cwd:null,sessions:[]}}let i=t.filter(t=>(0,s.encodeFolderName)(t.cwd)===e);return{cwd:i[0]?.cwd??null,sessions:g(i)}}let x=(0,r.runtimeCache)(h,30),_=(0,r.runtimeCache)(e=>w(e),30,{maxSize:50}),C=(0,r.runtimeCache)(e=>S(e),30,{maxSize:50});e.s(["getCachedCodexProjects",0,x,"getCachedCodexSessionsByEncodedName",0,C,"getCachedCodexSessionsForCwd",0,_,"getCodexProjects",0,h,"getCodexSessionsByEncodedName",0,S,"getCodexSessionsForCwd",0,w])},19791,e=>{"use strict";var t=e.i(12714),i=e.i(60526),n=e.i(50227),s=e.i(81580),r=e.i(83534),a=e.i(71809),o=e.i(28557),l=e.i(40911);let c=/^[\d-]+T[\d-]+Z_([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/i;async function u(e){try{return await (0,t.readdir)(e,{withFileTypes:!0})}catch{return null}}async function d(e){try{return(await (0,t.stat)(e)).mtime}catch{return null}}async function f(e){let i;try{i=await (0,t.readFile)(e,"utf-8")}catch{return null}let n=i.indexOf("\n")>=0?i.slice(0,i.indexOf("\n")):i;if(!n)return null;try{let e=JSON.parse(n);if("session"!==e.type||"string"!=typeof e.cwd||0===e.cwd.length)return null;return e.cwd}catch{return null}}async function m(){let e=process.env.PI_SESSIONS_DIR||(0,n.join)((0,i.homedir)(),".pi","agent","sessions"),t=await u(e);if(!t)return[];let s=[];for(let i of t){if(!i.isDirectory())continue;let t=(0,n.join)(e,i.name),r=await u(t);if(r)for(let e of r){if(!e.isFile())continue;let i=c.exec(e.name);i&&s.push({sessionId:i[1],filePath:(0,n.join)(t,e.name)})}}return 0===s.length?[]:(await (0,a.batchAll)(s.map(e=>async()=>{let t=await f(e.filePath);if(!t)return null;let i=await d(e.filePath);return i?{filePath:e.filePath,sessionId:e.sessionId,cwd:t,fileMtime:i}:null}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}let p=(0,r.runtimeCache)(m,30);async function y(){let e;try{e=await p()}catch(e){return(0,l.logWarn)("Failed to scan Pi sessions:",e),[]}let t=new Map;for(let i of e){let e=t.get(i.cwd);(!e||i.fileMtime.getTime()>e.latest.getTime())&&t.set(i.cwd,{latest:i.fileMtime,cwd:i.cwd})}let i=[];for(let{cwd:e,latest:n}of t.values())i.push({name:(0,s.encodeFolderName)(e),path:e,isDirectory:!0,lastModified:n,lastModifiedFormatted:(0,o.formatDate)(n),cli:["pi"]});return i.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),i}function h(e){let t=e.map(e=>({name:e.sessionId,path:e.filePath,lastModified:e.fileMtime,lastModifiedFormatted:(0,o.formatDate)(e.fileMtime),sessionId:e.sessionId,cli:"pi"}));return t.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),t}async function g(e){let t;try{t=await p()}catch(e){return(0,l.logWarn)("Failed to scan Pi sessions:",e),[]}return h(t.filter(t=>t.cwd===e))}async function w(e){let t;try{t=await p()}catch(e){return(0,l.logWarn)("Failed to scan Pi sessions:",e),{cwd:null,sessions:[]}}let i=t.filter(t=>(0,s.encodeFolderName)(t.cwd)===e),n=Array.from(new Set(i.map(e=>e.cwd)));return 1!==n.length?{cwd:null,sessions:[]}:{cwd:n[0],sessions:h(i)}}let S=(0,r.runtimeCache)(y,30),x=(0,r.runtimeCache)(e=>g(e),30,{maxSize:50}),_=(0,r.runtimeCache)(e=>w(e),30,{maxSize:50});e.s(["getCachedPiProjects",0,S,"getCachedPiSessionsByEncodedName",0,_,"getCachedPiSessionsForCwd",0,x,"getPiProjects",0,y,"getPiSessionsByEncodedName",0,w,"getPiSessionsForCwd",0,g])},35435,e=>{"use strict";var t=e.i(74533),i=e.i(81580),n=e.i(83534),s=e.i(28557),r=e.i(40911);function a(e){try{let i=(0,t.execFileSync)("opencode",["db","--format","json",e],{encoding:"utf8",timeout:5e3,stdio:["ignore","pipe","pipe"]});if(!i.trim())return[];let n=JSON.parse(i);if(!Array.isArray(n))return null;return n}catch{return null}}function o(){return a("SELECT id, project_id, slug, directory, title, time_created, time_updated FROM session ORDER BY time_updated DESC LIMIT 1000")}function l(){return a("SELECT id, worktree, vcs, name, time_created, time_updated FROM project")}async function c(){let e=o(),t=l();if(null===e&&null===t)return[];let n=new Map;for(let e of t??[])n.set(e.id,e);let r=new Map;for(let t of e??[]){if(!t.project_id)continue;let e=r.get(t.project_id);e||(e={rows:[],latest:0},r.set(t.project_id,e)),e.rows.push(t),t.time_updated>e.latest&&(e.latest=t.time_updated)}let a=new Set,c=[];for(let[e,t]of r){a.add(e);let r=n.get(e),o=r?.worktree??t.rows[0]?.directory??null,l=o?(0,i.encodeFolderName)(o):e,u=o??"",d=new Date(Math.max(t.latest,r?.time_updated??0));c.push({name:l,path:u,isDirectory:!0,lastModified:d,lastModifiedFormatted:(0,s.formatDate)(d),cli:["opencode"]})}for(let e of t??[]){if(a.has(e.id))continue;let t=e.worktree??"",n=t?(0,i.encodeFolderName)(t):e.id,r=new Date(e.time_updated);c.push({name:n,path:t,isDirectory:!0,lastModified:r,lastModifiedFormatted:(0,s.formatDate)(r),cli:["opencode"]})}return c.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),c}async function u(e){let t=o();return t?t.filter(t=>t.directory===e).map(e=>{let t=new Date(e.time_updated);return{name:e.title??e.slug??e.id,path:`opencode://${e.id}`,lastModified:t,lastModifiedFormatted:(0,s.formatDate)(t),sessionId:e.id,cli:"opencode"}}):[]}async function d(e){let t,n;try{t=l(),n=o()}catch(e){return(0,r.logWarn)("Failed to read OpenCode DB:",e),{cwd:null,sessions:[]}}if(!t||!n)return{cwd:null,sessions:[]};let a=t.find(t=>t.worktree&&(0,i.encodeFolderName)(t.worktree)===e);if(!a||!a.worktree)return{cwd:null,sessions:[]};let c=n.filter(e=>e.project_id===a.id);return{cwd:a.worktree,sessions:c.map(e=>{let t=new Date(e.time_updated);return{name:e.title??e.slug??e.id,path:`opencode://${e.id}`,lastModified:t,lastModifiedFormatted:(0,s.formatDate)(t),sessionId:e.id,cli:"opencode"}})}}let f=(0,n.runtimeCache)(c,30),m=(0,n.runtimeCache)(e=>u(e),30,{maxSize:50}),p=(0,n.runtimeCache)(e=>d(e),30,{maxSize:50});e.s(["getCachedOpenCodeProjects",0,f,"getCachedOpenCodeSessionsByEncodedName",0,p,"getCachedOpenCodeSessionsForCwd",0,m,"getOpenCodeProjects",0,c,"getOpenCodeSessionsByEncodedName",0,d,"getOpenCodeSessionsForCwd",0,u])},55851,e=>{"use strict";var t=e.i(12714),i=e.i(60526),n=e.i(50227),s=e.i(81580),r=e.i(83534),a=e.i(71809),o=e.i(28557),l=e.i(40911);async function c(e){try{return await (0,t.readdir)(e,{withFileTypes:!0})}catch{return null}}async function u(e){try{return(await (0,t.stat)(e)).mtime}catch{return null}}async function d(){let e=(0,n.join)(process.env.COPILOT_HOME||(0,n.join)((0,i.homedir)(),".copilot"),"session-state"),s=await c(e);if(!s)return[];let r=s.filter(e=>e.isDirectory()).map(t=>({sessionId:t.name,workspacePath:(0,n.join)(e,t.name,"workspace.yaml"),eventsPath:(0,n.join)(e,t.name,"events.jsonl")}));return(await (0,a.batchAll)(r.map(e=>async()=>{let i;try{i=await (0,t.readFile)(e.workspacePath,"utf-8")}catch{return null}let n=function(e){let t=e.match(/^cwd\s*:\s*(.+?)\s*$/m);if(t)return t[1].replace(/^['"]|['"]$/g,"")}(i);if(!n)return null;let s=await u(e.eventsPath),r=await u(e.workspacePath),a=null!==s,o=s&&r?new Date(Math.max(s.getTime(),r.getTime())):s??r??new Date(0);return{workspacePath:e.workspacePath,eventsPath:e.eventsPath,sessionId:e.sessionId,cwd:n,fileMtime:o,hasTranscript:a}}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}let f=(0,r.runtimeCache)(d,30);async function m(){let e;try{e=await f()}catch(e){return(0,l.logWarn)("Failed to scan Copilot sessions:",e),[]}let t=new Map;for(let i of e){if(!i.hasTranscript)continue;let e=t.get(i.cwd);(!e||i.fileMtime.getTime()>e.latest.getTime())&&t.set(i.cwd,{latest:i.fileMtime,cwd:i.cwd})}let i=[];for(let{cwd:e,latest:n}of t.values())i.push({name:(0,s.encodeFolderName)(e),path:e,isDirectory:!0,lastModified:n,lastModifiedFormatted:(0,o.formatDate)(n),cli:["copilot"]});return i.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),i}function p(e){let t=e.filter(e=>e.hasTranscript).map(e=>({name:e.sessionId,path:e.eventsPath,lastModified:e.fileMtime,lastModifiedFormatted:(0,o.formatDate)(e.fileMtime),sessionId:e.sessionId,cli:"copilot"}));return t.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),t}async function y(e){let t;try{t=await f()}catch(e){return(0,l.logWarn)("Failed to scan Copilot sessions:",e),[]}return p(t.filter(t=>t.cwd===e))}async function h(e){let t;try{t=await f()}catch(e){return(0,l.logWarn)("Failed to scan Copilot sessions:",e),{cwd:null,sessions:[]}}let i=t.filter(t=>t.hasTranscript&&(0,s.encodeFolderName)(t.cwd)===e);return{cwd:i[0]?.cwd??null,sessions:p(i)}}let g=(0,r.runtimeCache)(m,30),w=(0,r.runtimeCache)(e=>y(e),30,{maxSize:50}),S=(0,r.runtimeCache)(e=>h(e),30,{maxSize:50});e.s(["getCachedCopilotProjects",0,g,"getCachedCopilotSessionsByEncodedName",0,S,"getCachedCopilotSessionsForCwd",0,w,"getCopilotProjects",0,m,"getCopilotSessionsByEncodedName",0,h,"getCopilotSessionsForCwd",0,y])},57232,e=>{"use strict";var t=e.i(2157),i=e.i(12714),n=e.i(50227),s=e.i(60526),r=e.i(83534),a=e.i(54214),o=e.i(67405);let l=(0,n.join)((0,s.homedir)(),".failproofai","cache","codex-session-paths.json");function c(){try{if(!(0,t.existsSync)(l))return{};return JSON.parse((0,t.readFileSync)(l,"utf-8"))}catch{return{}}}function u(e,i){try{(0,t.mkdirSync)((0,n.dirname)(l),{recursive:!0});let s=c();s[e]=i,(0,t.writeFileSync)(l,JSON.stringify(s),"utf-8")}catch{}}function d(e,i){try{for(let s of(0,t.readdirSync)(e,{withFileTypes:!0}))if(s.isFile()&&s.name.includes(i)&&s.name.endsWith(".jsonl"))return(0,n.join)(e,s.name)}catch{}return null}function f(e){let i=c()[e];if(i&&(0,t.existsSync)(i))return i;let r=(0,n.join)((0,s.homedir)(),".codex","sessions"),a=new Date,o=new Date(a.getTime()-864e5);for(let t of[a,o].map(e=>{let t=String(e.getUTCFullYear()),i=String(e.getUTCMonth()+1).padStart(2,"0"),s=String(e.getUTCDate()).padStart(2,"0");return(0,n.join)(r,t,i,s)})){let i=d(t,e);if(i)return u(e,i),i}try{for(let i of(0,t.readdirSync)(r,{withFileTypes:!0}))if(i.isDirectory()){for(let s of(0,t.readdirSync)((0,n.join)(r,i.name),{withFileTypes:!0}))if(s.isDirectory())for(let a of(0,t.readdirSync)((0,n.join)(r,i.name,s.name),{withFileTypes:!0})){if(!a.isDirectory())continue;let t=d((0,n.join)(r,i.name,s.name,a.name),e);if(t)return u(e,t),t}}}catch{}return null}function m(e,t){return Array.isArray(e)?e.filter(e=>e?.type===t&&"string"==typeof e.text).map(e=>e.text).join("\n"):""}async function p(e,t="session"){let i,n=e.split("\n").filter(e=>""!==e.trim()),s=[],r=[],l=new Map,c=new Map,u=!1;for(let e=0;e<n.length;e++){let d;e>0&&e%200==0&&await new Promise(e=>setImmediate(e));let f=n[e];try{d=JSON.parse(f)}catch{continue}let p={...d,_source:t};r.push(p);let y=d.timestamp;if(!y)continue;let h=new Date(y);if(Number.isNaN(h.getTime()))continue;let g=d.type,w=d.payload??{};if("session_meta"===g){let e=w.cwd;"string"!=typeof e||i||(i=e),s.push({type:"system",...(0,a.baseEntry)(p,y,h,t),raw:p});continue}if("response_item"===g){let e=w.type;if("message"===e){let e=w.role,i=w.content;if("user"===e||"developer"===e){let n=m(i,"input_text");if(!n)continue;let r="developer"===e?`[developer] ${n}`:n;s.push({type:"user",...(0,a.baseEntry)(p,y,h,t),message:{role:"user",content:r}});continue}if("assistant"===e){let e=m(i,"output_text");if(!e)continue;let n=[{type:"text",text:e}];s.push({type:"assistant",...(0,a.baseEntry)(p,y,h,t),message:{role:"assistant",content:n}});continue}s.push({type:"system",...(0,a.baseEntry)(p,y,h,t),raw:p});continue}if("function_call"===e){let e=w.call_id,i=w.name??"function_call",n={type:"tool_use",id:e??`${y}-${i}`,name:i,input:function(e){if(!e)return{};try{return JSON.parse(e)}catch{return{}}}(w.arguments)},r={type:"assistant",...(0,a.baseEntry)(p,y,h,t),message:{role:"assistant",content:[n]}};s.push(r),e&&(l.set(e,n),c.set(e,h.getTime()));continue}if("function_call_output"===e){let e=w.call_id,i=e?l.get(e):void 0;if(i){let t=c.get(e)??h.getTime(),n=Math.max(0,h.getTime()-t);i.result={timestamp:y,timestampFormatted:(0,a.formatTimestamp)(h),content:"string"==typeof w.output?w.output:JSON.stringify(w.output),durationMs:n,durationFormatted:(0,o.formatDuration)(n)};continue}s.push({type:"system",...(0,a.baseEntry)(p,y,h,t),raw:p});continue}s.push({type:"system",...(0,a.baseEntry)(p,y,h,t),raw:p});continue}if("event_msg"===g){let e=w.type;if("task_started"===e){let e=u?"Session Resumed":"Session Started";u=!0,s.push({type:"queue-operation",...(0,a.baseEntry)(p,y,h,t),label:e});continue}if("exec_command_end"===e){let e=w.call_id,i=e?l.get(e):void 0;if(i){let t=w.duration,n=t?(t.secs??0)*1e3+Math.round((t.nanos??0)/1e6):Math.max(0,h.getTime()-(c.get(e)??h.getTime())),s=w.aggregated_output;i.result={timestamp:y,timestampFormatted:(0,a.formatTimestamp)(h),content:"string"==typeof s?s:JSON.stringify(s),durationMs:n,durationFormatted:(0,o.formatDuration)(n)};continue}s.push({type:"system",...(0,a.baseEntry)(p,y,h,t),raw:p});continue}if("user_message"===e||"agent_message"===e)continue;s.push({type:"system",...(0,a.baseEntry)(p,y,h,t),raw:p});continue}s.push({type:"system",...(0,a.baseEntry)(p,y,h,t),raw:p})}return s.length>500&&await new Promise(e=>setImmediate(e)),s.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:s,rawLines:r,cwd:i}}async function y(e){let t=f(e);if(!t)return null;let n=await (0,i.readFile)(t,"utf-8"),{entries:s,rawLines:r,cwd:a}=await p(n,"session");return{entries:s,rawLines:r,cwd:a,filePath:t}}(0,r.runtimeCache)(e=>y(e),60,{maxSize:50}),e.s(["findCodexTranscript",0,f,"getCodexSessionLog",0,y])},90172,e=>{"use strict";var t=e.i(12714),i=e.i(60526),n=e.i(50227),s=e.i(83534),r=e.i(71809),a=e.i(28557),o=e.i(81580),l=e.i(40911);let c=/^session-(\d{4}-\d{2}-\d{2}T\d{2}-\d{2})-([0-9a-f]{8})\.jsonl$/i,u=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;async function d(e){try{return await (0,t.readdir)(e,{withFileTypes:!0})}catch{return null}}async function f(e){try{return(await (0,t.stat)(e)).mtime}catch{return null}}async function m(e){let i=null;try{i=await (0,t.open)(e,"r");let n=Buffer.alloc(4096),{bytesRead:s}=await i.read(n,0,4096,0);if(0===s)return null;let r=n.subarray(0,s),a=r.indexOf(10),o=-1===a?s:a;return r.subarray(0,o).toString("utf-8")}catch{return null}finally{i&&await i.close().catch(()=>{})}}async function p(e){try{let i=(await (0,t.readFile)((0,n.join)(e,".project_root"),"utf-8")).trim();return i.length>0?i:null}catch{return null}}async function y(){let e=process.env.GEMINI_SESSIONS_DIR||(0,n.join)((0,i.homedir)(),".gemini","tmp"),t=await d(e);if(!t)return[];let s=[];return await (0,r.batchAll)(t.filter(e=>e.isDirectory()).map(t=>async()=>{let i=(0,n.join)(e,t.name),r=await p(i);if(!r)return;let a=(0,n.join)(i,"chats"),o=await d(a);if(o)for(let e of o){if(!e.isFile()||!c.test(e.name))continue;let t=(0,n.join)(a,e.name),i=await f(t);if(!i)continue;let o=function(e){if(e)try{let t=JSON.parse(e);if("string"!=typeof t.sessionId)return;return u.test(t.sessionId)?t.sessionId:void 0}catch{return}}(await m(t));s.push({filePath:t,sessionFilename:e.name,cwd:r,fileMtime:i,sessionId:o})}}),16),s}async function h(){let e=await y(),t=new Map;for(let i of e){let e=t.get(i.cwd);(!e||i.fileMtime.getTime()>e.mtime.getTime())&&t.set(i.cwd,{mtime:i.fileMtime})}let i=[...t.entries()].map(([e,{mtime:t}])=>({name:(0,o.encodeFolderName)(e),path:e,isDirectory:!0,lastModified:t,lastModifiedFormatted:(0,a.formatDate)(t),cli:["gemini"]}));return i.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),i}async function g(e){let t=(await y()).filter(t=>t.cwd===e).map(e=>({name:e.sessionFilename,path:e.filePath,lastModified:e.fileMtime,lastModifiedFormatted:(0,a.formatDate)(e.fileMtime),sessionId:e.sessionId,cli:"gemini"}));return t.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),t}async function w(e){let t;try{t=await y()}catch(e){return(0,l.logWarn)("Failed to scan Gemini sessions:",e),{cwd:null,sessions:[]}}let i=t.filter(t=>(0,o.encodeFolderName)(t.cwd)===e),n=Array.from(new Set(i.map(e=>e.cwd)));if(1!==n.length)return{cwd:null,sessions:[]};let s=i.map(e=>({name:e.sessionFilename,path:e.filePath,lastModified:e.fileMtime,lastModifiedFormatted:(0,a.formatDate)(e.fileMtime),sessionId:e.sessionId,cli:"gemini"}));return s.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),{cwd:n[0],sessions:s}}let S=(0,s.runtimeCache)(h,30),x=(0,s.runtimeCache)(e=>w(e),30,{maxSize:50});e.s(["getCachedGeminiProjects",0,S,"getCachedGeminiSessionsByEncodedName",0,x,"getGeminiProjects",0,h,"getGeminiSessionsByEncodedName",0,w,"getGeminiSessionsForCwd",0,g])},99440,e=>{"use strict";var t=e.i(74533),i=e.i(83534),n=e.i(54214),s=e.i(67405);function r(e){try{let i=(0,t.execFileSync)("opencode",["db","--format","json",e],{encoding:"utf8",timeout:5e3,stdio:["ignore","pipe","pipe"]});if(!i.trim())return[];let n=JSON.parse(i);if(!Array.isArray(n))return null;return n}catch{return null}}function a(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function o(e){if("string"!=typeof e||0===e.length)return null;try{let t=JSON.parse(e);return a(t)?t:null}catch{return null}}async function l(e){if(!e||!/^[A-Za-z0-9_-]+$/.test(e))return null;let t=r(`SELECT id, project_id, slug, directory, title, time_created, time_updated FROM session WHERE id = '${e}'`);if(!t||0===t.length)return null;let i=t[0],l=r(`SELECT id, session_id, time_created, time_updated, data FROM message WHERE session_id = '${e}' ORDER BY time_created ASC`),c=r(`SELECT id, message_id, session_id, time_created, time_updated, data FROM part WHERE session_id = '${e}' ORDER BY time_created ASC`);if(!l)return{entries:[],rawLines:[],cwd:i.directory??void 0,filePath:`opencode://${e}`};let u=new Map;for(let e of c??[]){let t=u.get(e.message_id);t||(t=[],u.set(e.message_id,t)),t.push(e)}let d=[],f=[];for(let e of l){let t=u.get(e.id)??[];d.push(function(e,t,i){let r=o(e.data)??{},l="string"==typeof r.role?r.role:"system",c=new Date(e.time_created),u=c.toISOString(),d={uuid:e.id,parentUuid:null},f=(0,n.baseEntry)(d,u,c,i),m=[],p="";for(let e of t){let t=o(e.data);if(!t)continue;let i="string"==typeof t.type?t.type:"unknown";if("text"===i){let e="string"==typeof t.text?t.text:"string"==typeof t.content?t.content:"";e&&(m.push({type:"text",text:e}),p+=(p?"\n":"")+e);continue}if("tool"===i){let i="string"==typeof t.tool?t.tool:"string"==typeof t.name?t.name:"tool",r=a(t.state)?t.state:null,o=r&&a(r.input)?r.input:a(t.input)?t.input:a(t.args)?t.args:{},l={type:"tool_use",id:e.id,name:i,input:o},c=r&&"string"==typeof r.status?r.status:"";if(r&&("completed"===c||"error"===c)){let t=("error"===c&&"string"==typeof r.error?r.error:null)??r.output,i="string"==typeof t?t:null!=t?JSON.stringify(t):"",o=a(r.time)?r.time:{},u="number"==typeof o.start?o.start:e.time_created,d="number"==typeof o.end?o.end:e.time_updated,f=Math.max(0,d-u),m=new Date(d);l.result={timestamp:m.toISOString(),timestampFormatted:(0,n.formatTimestamp)(m),content:i,durationMs:f,durationFormatted:(0,s.formatDuration)(f)}}m.push(l);continue}m.push({type:"text",text:`[opencode ${i}]`})}if("user"===l)return{...f,type:"user",message:{role:"user",content:p}};if("assistant"===l){let e=a(r.model)?r.model:null,t=e&&"string"==typeof e.modelID?e.modelID:void 0;return{...f,type:"assistant",message:{role:"assistant",content:m,model:t}}}return{...f,type:"system",raw:{id:e.id,role:l,parts:m}}}(e,t,"session"));let i=o(e.data);f.push({id:e.id,session_id:e.session_id,time_created:e.time_created,data:i??e.data})}return{entries:d,rawLines:f,cwd:i.directory??void 0,filePath:`opencode://${e}`}}async function c(e){if(!e||!/^[A-Za-z0-9_-]+$/.test(e))return null;let t=r(`SELECT id, project_id, slug, directory, title, time_created, time_updated FROM session WHERE id = '${e}'`);if(!t||0===t.length)return null;let i=r(`SELECT id, session_id, time_created, time_updated, data FROM message WHERE session_id = '${e}' ORDER BY time_created ASC`),n=r(`SELECT id, message_id, session_id, time_created, time_updated, data FROM part WHERE session_id = '${e}' ORDER BY time_created ASC`);return null===i||null===n?null:{session:t[0],messages:i.map(e=>({...e,data:o(e.data)??e.data})),parts:n.map(e=>({...e,data:o(e.data)??e.data}))}}(0,i.runtimeCache)(e=>l(e),30,{maxSize:50}),e.s(["getOpenCodeSessionExport",0,c,"getOpenCodeSessionLog",0,l])},88153,e=>{"use strict";var t=e.i(2157),i=e.i(12714),n=e.i(50227),s=e.i(60526),r=e.i(83534),a=e.i(54214);let o=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,l=/^session-(.+)-([0-9a-f]{8})\.jsonl$/i;function c(e){let i;if(!o.test(e))return null;let r=(0,n.resolve)(process.env.GEMINI_SESSIONS_DIR||(0,n.join)((0,s.homedir)(),".gemini","tmp")),a=e.slice(0,8).toLowerCase();try{i=(0,t.readdirSync)(r)}catch{return null}for(let s of i){let i,o=(0,n.resolve)(r,s);if(!o.startsWith(`${r}${n.sep}`))continue;let c=(0,n.resolve)(o,"chats");try{i=(0,t.readdirSync)(c)}catch{continue}for(let s of i){let i=l.exec(s);if(!i||i[2].toLowerCase()!==a)continue;let r=(0,n.resolve)(c,s);if(!r.startsWith(`${c}${n.sep}`)||!(0,t.existsSync)(r))continue;let o=function(e){let i;try{i=(0,t.openSync)(e,"r")}catch{return null}try{let e=Buffer.alloc(4096),n=(0,t.readSync)(i,e,0,e.length,0);if(0===n)return null;let s=e.subarray(0,n).toString("utf-8"),r=s.indexOf("\n");return r>=0?s.slice(0,r):s}catch{return null}finally{try{(0,t.closeSync)(i)}catch{}}}(r);if(o)try{let t=JSON.parse(o);if("string"==typeof t.sessionId&&t.sessionId.toLowerCase()===e.toLowerCase())return r}catch{continue}}}return null}async function u(e,t="session",i){let n=e.split("\n").filter(e=>""!==e.trim()),s=[],r=[],o=!1;for(let e=0;e<n.length;e++){let i;e>0&&e%200==0&&await new Promise(e=>setImmediate(e));let l=n[e];try{i=JSON.parse(l)}catch{continue}let c={...i,_source:t};if(r.push(c),"string"==typeof i.sessionId&&"string"==typeof i.startTime){let e=new Date(i.startTime);if(!Number.isNaN(e.getTime())){let i=o?"Session Resumed":"Session Started";o=!0,s.push({type:"queue-operation",...(0,a.baseEntry)(c,e.toISOString(),e,t),label:i})}continue}if(i.$set)continue;let u=i.timestamp;if(!u)continue;let d=new Date(u);if(Number.isNaN(d.getTime()))continue;let f=d.toISOString(),m=i.type;if("user"===m){let e=function(e){if(!Array.isArray(e))return"";let t=[];for(let i of e)"string"==typeof i?.text&&t.push(i.text);return t.join("\n\n")}(i.content);if(!e)continue;s.push({type:"user",...(0,a.baseEntry)(c,f,d,t),message:{role:"user",content:e}});continue}if("assistant"===m||"model"===m){let e=function(e){if(!Array.isArray(e))return[];let t=[];for(let i of e)"string"==typeof i?.text&&i.text.length>0&&t.push({type:"text",text:i.text});return t}(i.content);if(0===e.length){s.push({type:"system",...(0,a.baseEntry)(c,f,d,t),raw:c});continue}s.push({type:"assistant",...(0,a.baseEntry)(c,f,d,t),message:{role:"assistant",content:e}});continue}s.push({type:"system",...(0,a.baseEntry)(c,f,d,t),raw:c})}return s.length>500&&await new Promise(e=>setImmediate(e)),s.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:s,rawLines:r,cwd:i}}async function d(e){let s,r,a=c(e);if(!a)return null;try{s=await (0,i.readFile)(a,"utf-8")}catch{return null}let o=function(e){let i=(0,n.resolve)(e,".."),s=(0,n.resolve)(i,".."),r=(0,n.join)(s,".project_root");try{let e=(0,t.readFileSync)(r,"utf-8").trim();return e.length>0?e:void 0}catch{return}}(a);try{r=await u(s,"session",o)}catch{return null}return{entries:r.entries,rawLines:r.rawLines,cwd:r.cwd,filePath:a}}(0,r.runtimeCache)(e=>d(e),60,{maxSize:50}),e.s(["findGeminiTranscript",0,c,"getGeminiSessionLog",0,d])},78166,e=>{"use strict";var t=e.i(2157),i=e.i(12714),n=e.i(50227),s=e.i(60526),r=e.i(83534),a=e.i(54214),o=e.i(67405);function l(e,t){let i=function(e){if(!e)return null;let t=(0,n.resolve)((0,n.join)(process.env.COPILOT_HOME||(0,n.join)((0,s.homedir)(),".copilot"),"session-state")),i=(0,n.resolve)(t,e);return i!==t&&i.startsWith(`${t}${n.sep}`)?i:null}(e);return i?(0,n.join)(i,t):null}function c(e){let i=l(e,"events.jsonl");return i&&(0,t.existsSync)(i)?i:null}async function u(e,t="session"){let i,n=e.split("\n").filter(e=>""!==e.trim()),s=[],r=[],l=new Map,c=new Map,d=!1;for(let e=0;e<n.length;e++){let u;e>0&&e%200==0&&await new Promise(e=>setImmediate(e));let f=n[e];try{u=JSON.parse(f)}catch{continue}let m={...u,_source:t};r.push(m);let p=u.timestamp;if(!p)continue;let y=new Date(p);if(Number.isNaN(y.getTime()))continue;let h=y.toISOString(),g=u.type,w=u.data??{};if("session.start"===g){let e=w.context,n=e?.cwd;"string"!=typeof n||i||(i=n);let r=d?"Session Resumed":"Session Started";d=!0,s.push({type:"queue-operation",...(0,a.baseEntry)(m,h,y,t),label:r});continue}if("user.message"===g){let e=w.content??"";if(!e)continue;s.push({type:"user",...(0,a.baseEntry)(m,h,y,t),message:{role:"user",content:e}});continue}if("system.message"===g){s.push({type:"system",...(0,a.baseEntry)(m,h,y,t),raw:m});continue}if("assistant.message"===g){let e=w.content??"";if(!e){s.push({type:"system",...(0,a.baseEntry)(m,h,y,t),raw:m});continue}let i=[{type:"text",text:e}];s.push({type:"assistant",...(0,a.baseEntry)(m,h,y,t),message:{role:"assistant",content:i}});continue}if("tool.execution_start"===g){let e=w.toolCallId,i=w.toolName??"tool",n=w.arguments??{},r={type:"tool_use",id:e??`${y.getTime()}-${i}`,name:i,input:n},o={type:"assistant",...(0,a.baseEntry)(m,h,y,t),message:{role:"assistant",content:[r]}};s.push(o),e&&(l.set(e,r),c.set(e,y.getTime()));continue}if("tool.execution_complete"===g){let e=w.toolCallId,i=e?l.get(e):void 0;if(i){let t=c.get(e)??y.getTime(),n=w.result??{},s=w.toolTelemetry??{},r=s.metrics?.commandTimeMs??s.metrics?.durationMs??null,l="number"==typeof r&&r>=0?r:Math.max(0,y.getTime()-t),u=n.detailedContent??n.content??"";i.result={timestamp:h,timestampFormatted:(0,a.formatTimestamp)(y),content:"string"==typeof u?u:JSON.stringify(u),durationMs:l,durationFormatted:(0,o.formatDuration)(l)};continue}s.push({type:"system",...(0,a.baseEntry)(m,h,y,t),raw:m});continue}s.push({type:"system",...(0,a.baseEntry)(m,h,y,t),raw:m})}return s.length>500&&await new Promise(e=>setImmediate(e)),s.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:s,rawLines:r,cwd:i}}async function d(e){let n,s=c(e);if(!s)return null;try{n=await (0,i.readFile)(s,"utf-8")}catch{return null}let{entries:r,rawLines:a,cwd:o}=await u(n,"session");return{entries:r,rawLines:a,cwd:o??function(e){let i,n=(i=l(e,"workspace.yaml"))&&(0,t.existsSync)(i)?i:null;if(n)try{let e=(0,t.readFileSync)(n,"utf-8"),i=RegExp("^cwd\\s*:\\s*(.+?)\\s*$","m"),s=e.match(i);if(!s)return;return s[1].replace(/^['"]|['"]$/g,"")}catch{return}}(e),filePath:s}}(0,r.runtimeCache)(e=>d(e),60,{maxSize:50}),e.s(["findCopilotTranscript",0,c,"getCopilotSessionLog",0,d])},46413,e=>{"use strict";var t=e.i(12714),i=e.i(60526),n=e.i(50227),s=e.i(81580),r=e.i(83534),a=e.i(71809),o=e.i(28557),l=e.i(40911);let c=["agent-sessions","conversations","sessions"],u=["meta.json","session.json","workspace.json","workspace.yaml"],d=["events.jsonl","transcript.jsonl","messages.jsonl"];async function f(e){try{return await (0,t.readdir)(e,{withFileTypes:!0})}catch{return null}}async function m(e){try{return(await (0,t.stat)(e)).mtime}catch{return null}}async function p(e,i){for(let s of i){let i,r=(0,n.join)(e,s);if(await m(r)===null)continue;try{i=await (0,t.readFile)(r,"utf-8")}catch{continue}let a=function(e){try{let t=JSON.parse(e);if("string"==typeof t.cwd&&t.cwd.length>0)return t.cwd}catch{}let t=e.match(/^\s*cwd\s*:\s*(.+?)\s*$/m);if(t){let e=t[1].replace(/^['"]|['"]$/g,"");if(e.length>0)return e}}(i);if(a)return{path:r,cwd:a}}return null}async function y(e,t){for(let i of t){let t=(0,n.join)(e,i);if(await m(t)!==null)return t}return null}async function h(){let e=process.env.CURSOR_HOME||(0,n.join)((0,i.homedir)(),".cursor"),t=[],r=[],o=(0,n.join)(e,"projects"),l=await f(o);if(l)for(let e of l){if(!e.isDirectory())continue;let i=(0,s.decodeFolderName)(e.name),r=i.startsWith("/")||/^[A-Za-z]:\//.test(i)?i:`/${i}`,a=(0,n.join)(o,e.name,"agent-transcripts"),l=await f(a);if(l)for(let e of l)e.isDirectory()&&t.push({sessionId:e.name,dir:(0,n.join)(a,e.name),cwd:r})}for(let t of c){let i=(0,n.join)(e,t),s=await f(i);if(s)for(let e of s)e.isDirectory()&&r.push({sessionId:e.name,dir:(0,n.join)(i,e.name)})}return 0===t.length&&0===r.length?[]:(await (0,a.batchAll)([...t.map(e=>async()=>{let t=(0,n.join)(e.dir,`${e.sessionId}.jsonl`),i=await m(t);return i?{metaPath:e.dir,transcriptPath:t,sessionId:e.sessionId,cwd:e.cwd,fileMtime:i,hasTranscript:!0}:null}),...r.map(e=>async()=>{let t=await p(e.dir,u);if(!t)return null;let i=await y(e.dir,d),n=i?await m(i):null,s=await m(t.path),r=n&&s?new Date(Math.max(n.getTime(),s.getTime())):n??s??new Date(0);return{metaPath:t.path,transcriptPath:i,sessionId:e.sessionId,cwd:t.cwd,fileMtime:r,hasTranscript:null!==i}})],16)).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}let g=(0,r.runtimeCache)(h,30);async function w(){let e;try{e=await g()}catch(e){return(0,l.logWarn)("Failed to scan Cursor sessions:",e),[]}let t=new Map;for(let i of e){if(!i.hasTranscript)continue;let e=t.get(i.cwd);(!e||i.fileMtime.getTime()>e.latest.getTime())&&t.set(i.cwd,{latest:i.fileMtime,cwd:i.cwd})}let i=[];for(let{cwd:e,latest:n}of t.values())i.push({name:(0,s.encodeFolderName)(e),path:e,isDirectory:!0,lastModified:n,lastModifiedFormatted:(0,o.formatDate)(n),cli:["cursor"]});return i.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),i}function S(e){let t=e.filter(e=>e.hasTranscript&&e.transcriptPath).map(e=>({name:e.sessionId,path:e.transcriptPath,lastModified:e.fileMtime,lastModifiedFormatted:(0,o.formatDate)(e.fileMtime),sessionId:e.sessionId,cli:"cursor"}));return t.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),t}async function x(e){let t;try{t=await g()}catch(e){return(0,l.logWarn)("Failed to scan Cursor sessions:",e),[]}return S(t.filter(t=>t.cwd===e))}async function _(e){let t;try{t=await g()}catch(e){return(0,l.logWarn)("Failed to scan Cursor sessions:",e),{cwd:null,sessions:[]}}let i=t.filter(t=>t.hasTranscript&&(0,s.encodeFolderName)(t.cwd)===e);return{cwd:i[0]?.cwd??null,sessions:S(i)}}let C=(0,r.runtimeCache)(w,30),T=(0,r.runtimeCache)(e=>x(e),30,{maxSize:50}),b=(0,r.runtimeCache)(e=>_(e),30,{maxSize:50});e.s(["getCachedCursorProjects",0,C,"getCachedCursorSessionsByEncodedName",0,b,"getCachedCursorSessionsForCwd",0,T,"getCursorProjects",0,w,"getCursorSessionsByEncodedName",0,_,"getCursorSessionsForCwd",0,x])},85116,e=>{"use strict";var t=e.i(2157),i=e.i(12714),n=e.i(50227),s=e.i(60526),r=e.i(83534),a=e.i(54214);let o=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,l=/^[\d-]+T[\d-]+Z_([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/i;function c(e){let i;if(!o.test(e))return null;let r=(0,n.resolve)(process.env.PI_SESSIONS_DIR||(0,n.join)((0,s.homedir)(),".pi","agent","sessions"));try{i=(0,t.readdirSync)(r)}catch{return null}for(let s of i){let i,a=(0,n.resolve)(r,s);if(a.startsWith(`${r}${n.sep}`)){try{i=(0,t.readdirSync)(a)}catch{continue}for(let s of i){let i=l.exec(s);if(!i||i[1].toLowerCase()!==e.toLowerCase())continue;let r=(0,n.resolve)(a,s);if(r.startsWith(`${a}${n.sep}`)&&(0,t.existsSync)(r))return r}}}return null}async function u(e,t="session"){let i,n=e.split("\n").filter(e=>""!==e.trim()),s=[],r=[],o=!1;for(let e=0;e<n.length;e++){let l;e>0&&e%200==0&&await new Promise(e=>setImmediate(e));let c=n[e];try{l=JSON.parse(c)}catch{continue}let u={...l,_source:t};r.push(u);let d=l.timestamp;if(!d)continue;let f=new Date(d);if(Number.isNaN(f.getTime()))continue;let m=f.toISOString(),p=l.type;if("session"===p){"string"!=typeof l.cwd||i||(i=l.cwd);let e=o?"Session Resumed":"Session Started";o=!0,s.push({type:"queue-operation",...(0,a.baseEntry)(u,m,f,t),label:e});continue}if("message"===p&&l.message&&"object"==typeof l.message){let e=l.message.role,i=l.message.content;if("user"===e){let e=function(e){if(!Array.isArray(e))return"";let t=[];for(let i of e)i?.type==="text"&&"string"==typeof i.text&&t.push(i.text);return t.join("\n\n")}(i);if(!e)continue;s.push({type:"user",...(0,a.baseEntry)(u,m,f,t),message:{role:"user",content:e}});continue}if("assistant"===e){let e=function(e){if(!Array.isArray(e))return[];let t=[];for(let i of e)i?.type==="text"&&"string"==typeof i.text&&i.text.length>0&&t.push({type:"text",text:i.text}),i?.type==="thinking"&&"string"==typeof i.thinking&&i.thinking.length>0&&t.push({type:"text",text:`[thinking] ${i.thinking}`});return t}(i);if(0===e.length){s.push({type:"system",...(0,a.baseEntry)(u,m,f,t),raw:u});continue}s.push({type:"assistant",...(0,a.baseEntry)(u,m,f,t),message:{role:"assistant",content:e}});continue}s.push({type:"system",...(0,a.baseEntry)(u,m,f,t),raw:u});continue}s.push({type:"system",...(0,a.baseEntry)(u,m,f,t),raw:u})}return s.length>500&&await new Promise(e=>setImmediate(e)),s.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:s,rawLines:r,cwd:i}}async function d(e){let t,n,s=c(e);if(!s)return null;try{t=await (0,i.readFile)(s,"utf-8")}catch{return null}try{n=await u(t,"session")}catch{return null}return{entries:n.entries,rawLines:n.rawLines,cwd:n.cwd,filePath:s}}(0,r.runtimeCache)(e=>d(e),60,{maxSize:50}),a.formatTimestamp,e.s(["findPiTranscript",0,c,"getPiSessionLog",0,d])},72094,e=>{"use strict";var t=e.i(2157),i=e.i(12714),n=e.i(50227),s=e.i(60526),r=e.i(83534),a=e.i(54214),o=e.i(67405);let l=["agent-sessions","conversations","sessions"],c=["events.jsonl","transcript.jsonl","messages.jsonl"],u="agent-transcripts";function d(e){let i=function(e){if(!e)return null;let i=(0,n.resolve)(process.env.CURSOR_HOME||(0,n.join)((0,s.homedir)(),".cursor")),r=(0,n.resolve)(i,"projects"),a=[];try{a=(0,t.readdirSync)(r,{withFileTypes:!0})}catch{}for(let i of a){if(!i.isDirectory())continue;let s=(0,n.resolve)(r,i.name,u,e),a=(0,n.resolve)(r,i.name,u);if(s!==a&&s.startsWith(`${a}${n.sep}`)&&(0,t.existsSync)(s))return s}for(let s of l){let r=(0,n.resolve)(i,s),a=(0,n.resolve)(r,e);if(a!==r&&a.startsWith(`${r}${n.sep}`)&&(0,t.existsSync)(a))return a}return null}(e);if(!i)return null;let r=(0,n.join)(i,`${(0,n.basename)(i)}.jsonl`);if((0,t.existsSync)(r))return r;for(let e of c){let s=(0,n.join)(i,e);if((0,t.existsSync)(s))return s}return null}async function f(e,t="session"){let i,n=e.split("\n").filter(e=>""!==e.trim()),s=[],r=[],l=new Map,c=new Map,u=!1,d=Date.now();for(let e=0;e<n.length;e++){let f;e>0&&e%200==0&&await new Promise(e=>setImmediate(e));let m=n[e];try{f=JSON.parse(m)}catch{continue}let p={...f,_source:t};if(r.push(p),!f.type&&f.role&&f.message?.content){let i=new Date(d+e),n=i.toISOString(),r=f.message.content.filter(e=>e?.type==="text"&&"string"==typeof e.text).map(e=>e.text).join("");if("user"===f.role){let e=/<user_query>\s*([\s\S]*?)\s*<\/user_query>/.exec(r),o=e?e[1]:r;o&&s.push({type:"user",...(0,a.baseEntry)(p,n,i,t),message:{role:"user",content:o}});continue}if("assistant"===f.role){let e=r?[{type:"text",text:r}]:[];0===e.length?s.push({type:"system",...(0,a.baseEntry)(p,n,i,t),raw:p}):s.push({type:"assistant",...(0,a.baseEntry)(p,n,i,t),message:{role:"assistant",content:e}});continue}s.push({type:"system",...(0,a.baseEntry)(p,n,i,t),raw:p});continue}let y=f.timestamp;if(!y)continue;let h=new Date(y);if(Number.isNaN(h.getTime()))continue;let g=h.toISOString(),w=f.type,S=f.data??{};if("session.start"===w||"sessionStart"===w||"session_start"===w){let e=S.context??S,n=e.cwd;"string"!=typeof n||i||(i=n),!i&&Array.isArray(e.workspace_roots)&&"string"==typeof e.workspace_roots[0]&&(i=e.workspace_roots[0]);let r=u?"Session Resumed":"Session Started";u=!0,s.push({type:"queue-operation",...(0,a.baseEntry)(p,g,h,t),label:r});continue}if("user.message"===w||"userMessage"===w){let e="string"==typeof S.content?S.content:"string"==typeof S.text?S.text:"";if(!e)continue;s.push({type:"user",...(0,a.baseEntry)(p,g,h,t),message:{role:"user",content:e}});continue}if("system.message"===w||"systemMessage"===w){s.push({type:"system",...(0,a.baseEntry)(p,g,h,t),raw:p});continue}if("assistant.message"===w||"assistantMessage"===w){let e="string"==typeof S.content?S.content:"string"==typeof S.text?S.text:"";if(!e){s.push({type:"system",...(0,a.baseEntry)(p,g,h,t),raw:p});continue}let i=[{type:"text",text:e}];s.push({type:"assistant",...(0,a.baseEntry)(p,g,h,t),message:{role:"assistant",content:i}});continue}if("tool.execution_start"===w||"tool.executionStart"===w||"preToolUse"===w){let e=S.toolCallId??S.tool_use_id,i=S.toolName??S.tool_name??"tool",n=S.arguments??S.tool_input??{},r={type:"tool_use",id:e??`${h.getTime()}-${i}`,name:i,input:n},o={type:"assistant",...(0,a.baseEntry)(p,g,h,t),message:{role:"assistant",content:[r]}};s.push(o),e&&(l.set(e,r),c.set(e,h.getTime()));continue}if("tool.execution_complete"===w||"tool.executionComplete"===w||"postToolUse"===w){let e=S.toolCallId??S.tool_use_id,i=e?l.get(e):void 0;if(i){let t=c.get(e)??h.getTime(),n=S.result??{},s=S.duration,r="number"==typeof s&&s>=0?s:Math.max(0,h.getTime()-t),l=n.detailedContent??n.content??S.tool_output??"";i.result={timestamp:g,timestampFormatted:(0,a.formatTimestamp)(h),content:"string"==typeof l?l:JSON.stringify(l),durationMs:r,durationFormatted:(0,o.formatDuration)(r)};continue}s.push({type:"system",...(0,a.baseEntry)(p,g,h,t),raw:p});continue}s.push({type:"system",...(0,a.baseEntry)(p,g,h,t),raw:p})}return s.length>500&&await new Promise(e=>setImmediate(e)),s.sort((e,t)=>e.timestampMs-t.timestampMs),{entries:s,rawLines:r,cwd:i}}async function m(e){let t,n=d(e);if(!n)return null;try{t=await (0,i.readFile)(n,"utf-8")}catch{return null}let{entries:s,rawLines:r,cwd:a}=await f(t,"session");return{entries:s,rawLines:r,cwd:a,filePath:n}}(0,r.runtimeCache)(e=>m(e),60,{maxSize:50}),e.s(["findCursorTranscript",0,d,"getCursorSessionLog",0,m])},37352,e=>{e.v(e=>Promise.resolve().then(()=>e(36203)))},5807,e=>{e.v(e=>Promise.resolve().then(()=>e(55851)))},97452,e=>{e.v(e=>Promise.resolve().then(()=>e(46413)))},82978,e=>{e.v(e=>Promise.resolve().then(()=>e(35435)))},45093,e=>{e.v(e=>Promise.resolve().then(()=>e(19791)))},61489,e=>{e.v(e=>Promise.resolve().then(()=>e(90172)))},78081,e=>{e.v(t=>Promise.all(["server/chunks/[externals]__1_g_b3t._.js","server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js"].map(t=>e.l(t))).then(()=>t(39702)))}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__0dwpg-h._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},74533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},2157,(e,t,r)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},66680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},10659,e=>{"use strict";let t;var r=e.i(2157),s=e.i(50227),a=e.i(60526),n=e.i(66680);e.i(74533);let i=s.default.join(a.default.homedir(),".failproofai"),o=s.default.join(i,"instance-id");function l(e){return n.default.createHmac("sha256","failproofai-telemetry-v1").update(e).digest("hex")}e.s(["getInstanceId",0,function(){if(t)return t;let e=function(){try{for(let e of(a.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let t=r.default.readFileSync(e,"utf-8").trim();if(t)return t}catch{}}catch{}}();if(e)return t=l(e);let s=[a.default.hostname(),a.default.homedir(),a.default.platform(),a.default.arch(),a.default.cpus()[0]?.model??""].join(":");return t=s?l(s):function(){try{let e=r.default.readFileSync(o,"utf-8").trim();if(e)return e}catch{}let e=n.default.randomUUID();try{r.default.mkdirSync(i,{recursive:!0}),r.default.writeFileSync(o,e,"utf-8")}catch{}return e}()}])},24214,(e,t,r)=>{t.exports={name:"failproofai",version:"0.0.12",description:"The easiest way to manage policies that keep your AI agents reliable, on-task, and running autonomously — for Claude Code & the Agents SDK",bin:{failproofai:"./dist/cli.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/",".next/standalone/","dist/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{predev:"bun run build:cli && bun link",dev:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/dev.ts --port 8020","build:cli":"bun build --target=node --format=esm --outfile=dist/cli.mjs bin/failproofai.mjs --external posthog-node && node -e \"const fs=require('fs');const c=fs.readFileSync('dist/cli.mjs','utf8');fs.writeFileSync('dist/cli.mjs',c.replace('#!/usr/bin/env bun','#!/usr/bin/env node').replace('// @bun\\n',''))\"",build:"bun build --target=node --format=cjs --outfile=dist/index.js src/index.ts && bun run build:cli && bun --bun next build && node -e \"const {cpSync}=require('fs');cpSync('.next/static','.next/standalone/.next/static',{recursive:true});\" && node scripts/prune-standalone.mjs",prestart:"bun run build:cli && bun link",start:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",postinstall:"node scripts/postinstall.mjs",preuninstall:"node scripts/preuninstall.mjs",prepare:"bun run build","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts",translate:"bun scripts/translate-docs/cli.ts","translate:readme":"bun scripts/translate-docs/cli.ts --readme-only","translate:docs":"bun scripts/translate-docs/cli.ts --docs-only","translate:dry-run":"bun scripts/translate-docs/cli.ts --dry-run","translate:validate":"bun scripts/translate-docs/cli.ts --validate","validate:mdx":"bun scripts/validate-mdx.ts"},keywords:["claude","claude-code","claude-agents-sdk","anthropic","ai-agent","agent-reliability","agent-monitoring","autonomous-agent","failure-prevention","developer-tools","devtools","cli","local-first","hooks","policies"],author:"ExosphereHost Inc. <failproofai@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://github.com/FailproofAI/failproofai",repository:{type:"git",url:"https://github.com/FailproofAI/failproofai.git"},bugs:{url:"https://github.com/FailproofAI/failproofai/issues"},publishConfig:{access:"public"},devDependencies:{"@anthropic-ai/sdk":"^0.110.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.3","@testing-library/jest-dom":"^6.9.1","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.1","@types/node":"26.1.0","@types/react":"19.2.17","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.0.1",clsx:"^2.1.1",eslint:"^10.5.0","eslint-config-next":"^16.2.9",jsdom:"^29.1.1","lucide-react":"^1.18.0",next:"^16.2.9",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^4.1.9"},dependencies:{"html-to-image":"^1.11.13",html2canvas:"^1.4.1","posthog-node":"^5.37.1"},overrides:{postcss:"8.5.14","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.28.0"}}},28067,e=>{"use strict";e.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX","POSTHOG_PRODUCT",0,"failproofai-oss"])},72561,e=>{"use strict";var t=e.i(10659),r=e.i(24214),s=e.i(28067);let a=s.POSTHOG_API_KEY;async function n(e,t){for(let r=1;r<=5;r++){try{let{signal:r,...s}=t,a=await fetch(e,{...s,signal:AbortSignal.timeout(5e3)});if(a.ok)return a}catch{}if(r<5){let e=Math.min(1e3*2**(r-1),8e3);await new Promise(t=>setTimeout(t,e))}}return new Response("{}",{status:200})}function i(){return"1"!==process.env.FAILPROOFAI_TELEMETRY_DISABLED}async function o(){try{if(!i()||globalThis.__FAILPROOFAI_POSTHOG__)return;let t=await e.A(78081),r=process.env.FAILPROOFAI_POSTHOG_KEY??a,s=process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com";globalThis.__FAILPROOFAI_POSTHOG__=new t.PostHog(r,{host:s,flushAt:1,flushInterval:0,requestTimeout:5e3,fetchRetryCount:0,fetch:n});let o=()=>{globalThis.__FAILPROOFAI_POSTHOG__?.shutdown().catch(()=>{})};process.on("beforeExit",o),process.on("SIGTERM",o),process.on("SIGINT",o)}catch(e){console.warn("[failproofai:telemetry] init failed:",e instanceof Error?e.message:e)}}e.s(["initTelemetry",0,o,"trackEvent",0,function(e,a){if(!i())return;let n=globalThis.__FAILPROOFAI_POSTHOG__;n&&n.capture({distinctId:(0,t.getInstanceId)(),event:e,properties:{...a,$lib:"failproofai",failproofai_version:r.version,product:s.POSTHOG_PRODUCT}})}])},6375,e=>{"use strict";var t=e.i(72561);function r(){return(process.env.FAILPROOF_API_URL??process.env.FAILPROOFAI_API_URL??"https://api.befailproof.ai").replace(/\/+$/,"")}class s extends Error{status;code;retryAfterSecs;constructor(e,t,r,s){super(r),this.status=e,this.code=t,this.retryAfterSecs=s,this.name="AuthApiError"}}async function a(e){let t={};try{t=await e.json()}catch{}let r=t.code??`http_${e.status}`,a=t.message??t.detail??e.statusText??"request failed",n=t.retry_after_secs;if(void 0===n){let t=e.headers.get("retry-after");if(t){let e=Number(t);Number.isFinite(e)&&(n=e)}}return void 0!==n&&(n=Math.max(0,Math.min(86400,n))),new s(e.status,r,a,n)}async function n(e,r){try{return await fetch(e,{...r,signal:function(e){let t=AbortSignal.timeout(1e4);if(!e)return t;let r=AbortSignal.any;if(r)return r([t,e]);let s=new AbortController;if(t.aborted)s.abort(t.reason);else t.addEventListener("abort",()=>s.abort(t.reason),{once:!0});if(e.aborted)s.abort(e.reason);else e.addEventListener("abort",()=>s.abort(e.reason),{once:!0});return s.signal}(r.signal??void 0)})}catch(n){let a=function(e){if(null===e||"object"!=typeof e)return!1;let t=e.name;return"AbortError"===t||"TimeoutError"===t}(n);if((0,t.trackEvent)("api_server_unreachable",{kind:a?"timeout":"network",path:function(e){try{return new URL(e).pathname}catch{return e}}(e),method:"string"==typeof r.method?r.method:"GET"}),a)throw new s(0,"timeout",`request to ${e} timed out after 10000ms`);throw n}}async function i(e,t,s){let i={"content-type":"application/json"};s?.accessToken&&(i.authorization=`Bearer ${s.accessToken}`);let o=await n(`${r()}${e}`,{method:"POST",headers:i,body:JSON.stringify(t)});if(204!==o.status){if(!o.ok)throw await a(o);return await o.json()}}async function o(e,t){let s=await n(`${r()}${e}`,{method:"GET",headers:{authorization:`Bearer ${t}`}});if(!s.ok)throw await a(s);return await s.json()}async function l(e){return i("/v0/auth/login/request",{email:e})}async function u(e,t){return i("/v0/auth/login/verify",{email:e,code:t})}async function c(e){return i("/v0/auth/token/refresh",{refresh_token:e})}async function d(e,t){await i("/v0/auth/logout",{refresh_token:t},{accessToken:e})}async function p(e){return o("/v0/auth/me",e)}async function f(e,t){return(await i("/v0/reminders",t,{accessToken:e})).reminder}async function h(e){let t=await n(`${r()}/v0/reminders`,{method:"DELETE",headers:{authorization:`Bearer ${e}`}});if(204!==t.status&&!t.ok)throw await a(t)}async function m(e,t,r){return i("/v0/invite",void 0===r?{to:t}:{to:t,score:r},{accessToken:e})}e.s(["AuthApiError",0,s,"cancelReminder",0,h,"fetchMe",0,p,"logoutSession",0,d,"refreshAccessToken",0,c,"requestLoginCode",0,l,"scheduleReminder",0,f,"sendInvites",0,m,"verifyLoginCode",0,u],6375)},51481,e=>{"use strict";var t=e.i(47909),r=e.i(74017),s=e.i(96250),a=e.i(59756),n=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),u=e.i(87718),c=e.i(95169),d=e.i(47587),p=e.i(66012),f=e.i(70101),h=e.i(26937),m=e.i(10372),v=e.i(93695);e.i(20232);var g=e.i(220),_=e.i(89171),b=e.i(6375),y=e.i(72561);async function x(e){await (0,y.initTelemetry)();let t={};try{t=await e.json()}catch{return(0,y.trackEvent)("audit_otp_requested",{status:"validation_error",source:"dashboard",reason:"invalid_json"}),_.NextResponse.json({code:"validation_error",message:"Invalid JSON body"},{status:400})}if("string"!=typeof t.email||!t.email.trim())return(0,y.trackEvent)("audit_otp_requested",{status:"validation_error",source:"dashboard",reason:"missing_email"}),_.NextResponse.json({code:"validation_error",message:"email is required"},{status:400});let r=t.email.trim().toLowerCase();try{let e=await (0,b.requestLoginCode)(t.email);return(0,y.trackEvent)("audit_otp_requested",{status:"success",email:r,source:"dashboard",expires_in:e.expires_in,resend_available_in:e.resend_available_in}),_.NextResponse.json({status:e.status,expires_in:e.expires_in,resend_available_in:e.resend_available_in},{status:200})}catch(t){if(t instanceof b.AuthApiError){(0,y.trackEvent)("audit_otp_requested",{status:"failed",email:r,source:"dashboard",error_code:t.code,http_status:t.status,retry_after_secs:t.retryAfterSecs??null});let e=t.status>=200&&t.status<600?t.status:504;return _.NextResponse.json({code:t.code,message:t.message,...void 0!==t.retryAfterSecs?{retry_after_secs:t.retryAfterSecs}:{}},{status:e})}let e=t instanceof Error?t.message:String(t);return(0,y.trackEvent)("audit_otp_requested",{status:"failed",email:r,source:"dashboard",error_code:"upstream_unreachable",error_message:e.slice(0,200)}),_.NextResponse.json({code:"upstream_unreachable",message:`api-server unreachable: ${e}`},{status:502})}}e.s(["POST",0,x,"dynamic",0,"force-dynamic"],61403);var E=e.i(61403);let R=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/auth/login-request/route",pathname:"/api/auth/login-request",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/auth/login-request/route.ts",nextConfigOutput:"standalone",userland:E,...{}}),{workAsyncStorage:w,workUnitAsyncStorage:A,serverHooks:O}=R;async function I(e,t,s){s.requestMeta&&(0,a.setRequestMeta)(e,s.requestMeta),R.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let _="/api/auth/login-request/route";_=_.replace(/\/index$/,"")||"/";let b=await R.prepare(e,t,{srcPage:_,multiZoneDraftMode:!1});if(!b)return t.statusCode=400,t.end("Bad Request"),null==s.waitUntil||s.waitUntil.call(s,Promise.resolve()),null;let{buildId:y,deploymentId:x,params:E,nextConfig:w,parsedUrl:A,isDraftMode:O,prerenderManifest:I,routerServerContext:S,isOnDemandRevalidate:T,revalidateOnlyGenerated:P,resolvedPathname:k,clientReferenceManifest:j,serverActionsManifest:C}=b,q=(0,o.normalizeAppPath)(_),F=!!(I.dynamicRoutes[q]||I.routes[k]),N=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,A,!1):t.end("This page could not be found"),null);if(F&&!O){let e=!!I.routes[k],t=I.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(w.adapterPath)return await N();throw new v.NoFallbackError}}let L=null;!F||R.isDev||O||(L="/index"===(L=k)?"/":L);let H=!0===R.isDev||!F,D=F&&!H;C&&j&&(0,i.setManifestsSingleton)({page:_,clientReferenceManifest:j,serverActionsManifest:C});let M=e.method||"GET",U=(0,n.getTracer)(),$=U.getActiveScopeSpan(),G=!!(null==S?void 0:S.isWrappedByNextServer),K=!!(0,a.getRequestMeta)(e,"minimalMode"),B=(0,a.getRequestMeta)(e,"incrementalCache")||await R.getIncrementalCache(e,w,I,K);null==B||B.resetRequestCache(),globalThis.__incrementalCache=B;let Y={params:E,previewProps:I.preview,renderOpts:{experimental:{authInterrupts:!!w.experimental.authInterrupts},cacheComponents:!!w.cacheComponents,supportsDynamicResponse:H,incrementalCache:B,cacheLifeProfiles:w.cacheLife,waitUntil:s.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,s,a)=>R.onRequestError(e,t,s,a,S)},sharedContext:{buildId:y,deploymentId:x}},z=new l.NodeNextRequest(e),W=new l.NodeNextResponse(t),X=u.NextRequestAdapter.fromNodeNextRequest(z,(0,u.signalFromNodeResponse)(t));try{let a,i=async e=>R.handle(X,Y).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=U.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==c.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let s=r.get("next.route");if(s){let t=`${M} ${s}`;e.setAttributes({"next.route":s,"http.route":s,"next.span_name":t}),e.updateName(t),a&&a!==e&&(a.setAttribute("http.route",s),a.updateName(t))}else e.updateName(`${M} ${_}`)}),o=async a=>{var n,o;let l=async({previousCacheEntry:r})=>{try{if(!K&&T&&P&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await i(a);e.fetchMetrics=Y.renderOpts.fetchMetrics;let o=Y.renderOpts.pendingWaitUntil;o&&s.waitUntil&&(s.waitUntil(o),o=void 0);let l=Y.renderOpts.collectedTags;if(!F)return await (0,p.sendResponse)(z,W,n,Y.renderOpts.pendingWaitUntil),null;{let e=await n.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(n.headers);l&&(t[m.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==Y.renderOpts.collectedRevalidate&&!(Y.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&Y.renderOpts.collectedRevalidate,s=void 0===Y.renderOpts.collectedExpire||Y.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:Y.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:s}}}}catch(t){throw(null==r?void 0:r.isStale)&&await R.onRequestError(e,t,{routerKind:"App Router",routePath:_,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:T})},!1,S),t}},u=await R.handleResponse({req:e,nextConfig:w,cacheKey:L,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:I,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:P,responseGenerator:l,waitUntil:s.waitUntil,isMinimalMode:K});if(!F)return null;if((null==u||null==(n=u.value)?void 0:n.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(o=u.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",T?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),O&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let c=(0,f.fromNodeOutgoingHttpHeaders)(u.value.headers);return K&&F||c.delete(m.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||c.get("Cache-Control")||c.set("Cache-Control",(0,h.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(z,W,new Response(u.value.body,{headers:c,status:u.value.status||200})),null};G&&$?await o($):(a=U.getActiveScopeSpan(),await U.withPropagatedContext(e.headers,()=>U.trace(c.BaseServerSpan.handleRequest,{spanName:`${M} ${_}`,kind:n.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},o),void 0,!G))}catch(t){if(t instanceof v.NoFallbackError||await R.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:T})},!1,S),F)throw t;return await (0,p.sendResponse)(z,W,new Response(null,{status:500})),null}}e.s(["handler",0,I,"patchFetch",0,function(){return(0,s.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:A})},"routeModule",0,R,"serverHooks",0,O,"workAsyncStorage",0,w,"workUnitAsyncStorage",0,A],51481)},78081,e=>{e.v(t=>Promise.all(["server/chunks/[externals]__14odj07._.js","server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js"].map(t=>e.l(t))).then(()=>t(39702)))}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__0lnenda._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},94930,e=>{"use strict";var t=e.i(2157),r=e.i(50227),n=e.i(66680);e.s(["writeJsonAtomically",0,function(e,s,i={}){let a=i.mode??384,o=i.dirMode??448,c=(0,r.dirname)(e);(0,t.existsSync)(c)||(0,t.mkdirSync)(c,{recursive:!0,mode:o});let u=`${e}.${process.pid}.${(0,n.randomBytes)(6).toString("hex")}.tmp`;try{(0,t.writeFileSync)(u,JSON.stringify(s,null,2),{mode:a});try{(63&(0,t.statSync)(u).mode)!=0&&(0,t.chmodSync)(u,a)}catch{}(0,t.renameSync)(u,e);try{(63&(0,t.statSync)(e).mode)!=0&&(0,t.chmodSync)(e,a)}catch{}}catch(e){try{(0,t.rmSync)(u,{force:!0})}catch{}throw e}}])},74533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},2157,(e,t,r)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},66680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},10659,e=>{"use strict";let t;var r=e.i(2157),n=e.i(50227),s=e.i(60526),i=e.i(66680);e.i(74533);let a=n.default.join(s.default.homedir(),".failproofai"),o=n.default.join(a,"instance-id");function c(e){return i.default.createHmac("sha256","failproofai-telemetry-v1").update(e).digest("hex")}e.s(["getInstanceId",0,function(){if(t)return t;let e=function(){try{for(let e of(s.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let t=r.default.readFileSync(e,"utf-8").trim();if(t)return t}catch{}}catch{}}();if(e)return t=c(e);let n=[s.default.hostname(),s.default.homedir(),s.default.platform(),s.default.arch(),s.default.cpus()[0]?.model??""].join(":");return t=n?c(n):function(){try{let e=r.default.readFileSync(o,"utf-8").trim();if(e)return e}catch{}let e=i.default.randomUUID();try{r.default.mkdirSync(a,{recursive:!0}),r.default.writeFileSync(o,e,"utf-8")}catch{}return e}()}])},24214,(e,t,r)=>{t.exports={name:"failproofai",version:"0.0.12",description:"The easiest way to manage policies that keep your AI agents reliable, on-task, and running autonomously — for Claude Code & the Agents SDK",bin:{failproofai:"./dist/cli.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/",".next/standalone/","dist/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{predev:"bun run build:cli && bun link",dev:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/dev.ts --port 8020","build:cli":"bun build --target=node --format=esm --outfile=dist/cli.mjs bin/failproofai.mjs --external posthog-node && node -e \"const fs=require('fs');const c=fs.readFileSync('dist/cli.mjs','utf8');fs.writeFileSync('dist/cli.mjs',c.replace('#!/usr/bin/env bun','#!/usr/bin/env node').replace('// @bun\\n',''))\"",build:"bun build --target=node --format=cjs --outfile=dist/index.js src/index.ts && bun run build:cli && bun --bun next build && node -e \"const {cpSync}=require('fs');cpSync('.next/static','.next/standalone/.next/static',{recursive:true});\" && node scripts/prune-standalone.mjs",prestart:"bun run build:cli && bun link",start:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",postinstall:"node scripts/postinstall.mjs",preuninstall:"node scripts/preuninstall.mjs",prepare:"bun run build","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts",translate:"bun scripts/translate-docs/cli.ts","translate:readme":"bun scripts/translate-docs/cli.ts --readme-only","translate:docs":"bun scripts/translate-docs/cli.ts --docs-only","translate:dry-run":"bun scripts/translate-docs/cli.ts --dry-run","translate:validate":"bun scripts/translate-docs/cli.ts --validate","validate:mdx":"bun scripts/validate-mdx.ts"},keywords:["claude","claude-code","claude-agents-sdk","anthropic","ai-agent","agent-reliability","agent-monitoring","autonomous-agent","failure-prevention","developer-tools","devtools","cli","local-first","hooks","policies"],author:"ExosphereHost Inc. <failproofai@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://github.com/FailproofAI/failproofai",repository:{type:"git",url:"https://github.com/FailproofAI/failproofai.git"},bugs:{url:"https://github.com/FailproofAI/failproofai/issues"},publishConfig:{access:"public"},devDependencies:{"@anthropic-ai/sdk":"^0.110.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.3","@testing-library/jest-dom":"^6.9.1","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.1","@types/node":"26.1.0","@types/react":"19.2.17","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.0.1",clsx:"^2.1.1",eslint:"^10.5.0","eslint-config-next":"^16.2.9",jsdom:"^29.1.1","lucide-react":"^1.18.0",next:"^16.2.9",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^4.1.9"},dependencies:{"html-to-image":"^1.11.13",html2canvas:"^1.4.1","posthog-node":"^5.37.1"},overrides:{postcss:"8.5.14","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.28.0"}}},28067,e=>{"use strict";e.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX","POSTHOG_PRODUCT",0,"failproofai-oss"])},72561,e=>{"use strict";var t=e.i(10659),r=e.i(24214),n=e.i(28067);let s=n.POSTHOG_API_KEY;async function i(e,t){for(let r=1;r<=5;r++){try{let{signal:r,...n}=t,s=await fetch(e,{...n,signal:AbortSignal.timeout(5e3)});if(s.ok)return s}catch{}if(r<5){let e=Math.min(1e3*2**(r-1),8e3);await new Promise(t=>setTimeout(t,e))}}return new Response("{}",{status:200})}function a(){return"1"!==process.env.FAILPROOFAI_TELEMETRY_DISABLED}async function o(){try{if(!a()||globalThis.__FAILPROOFAI_POSTHOG__)return;let t=await e.A(78081),r=process.env.FAILPROOFAI_POSTHOG_KEY??s,n=process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com";globalThis.__FAILPROOFAI_POSTHOG__=new t.PostHog(r,{host:n,flushAt:1,flushInterval:0,requestTimeout:5e3,fetchRetryCount:0,fetch:i});let o=()=>{globalThis.__FAILPROOFAI_POSTHOG__?.shutdown().catch(()=>{})};process.on("beforeExit",o),process.on("SIGTERM",o),process.on("SIGINT",o)}catch(e){console.warn("[failproofai:telemetry] init failed:",e instanceof Error?e.message:e)}}e.s(["initTelemetry",0,o,"trackEvent",0,function(e,s){if(!a())return;let i=globalThis.__FAILPROOFAI_POSTHOG__;i&&i.capture({distinctId:(0,t.getInstanceId)(),event:e,properties:{...s,$lib:"failproofai",failproofai_version:r.version,product:n.POSTHOG_PRODUCT}})}])},6375,e=>{"use strict";var t=e.i(72561);function r(){return(process.env.FAILPROOF_API_URL??process.env.FAILPROOFAI_API_URL??"https://api.befailproof.ai").replace(/\/+$/,"")}class n extends Error{status;code;retryAfterSecs;constructor(e,t,r,n){super(r),this.status=e,this.code=t,this.retryAfterSecs=n,this.name="AuthApiError"}}async function s(e){let t={};try{t=await e.json()}catch{}let r=t.code??`http_${e.status}`,s=t.message??t.detail??e.statusText??"request failed",i=t.retry_after_secs;if(void 0===i){let t=e.headers.get("retry-after");if(t){let e=Number(t);Number.isFinite(e)&&(i=e)}}return void 0!==i&&(i=Math.max(0,Math.min(86400,i))),new n(e.status,r,s,i)}async function i(e,r){try{return await fetch(e,{...r,signal:function(e){let t=AbortSignal.timeout(1e4);if(!e)return t;let r=AbortSignal.any;if(r)return r([t,e]);let n=new AbortController;if(t.aborted)n.abort(t.reason);else t.addEventListener("abort",()=>n.abort(t.reason),{once:!0});if(e.aborted)n.abort(e.reason);else e.addEventListener("abort",()=>n.abort(e.reason),{once:!0});return n.signal}(r.signal??void 0)})}catch(i){let s=function(e){if(null===e||"object"!=typeof e)return!1;let t=e.name;return"AbortError"===t||"TimeoutError"===t}(i);if((0,t.trackEvent)("api_server_unreachable",{kind:s?"timeout":"network",path:function(e){try{return new URL(e).pathname}catch{return e}}(e),method:"string"==typeof r.method?r.method:"GET"}),s)throw new n(0,"timeout",`request to ${e} timed out after 10000ms`);throw i}}async function a(e,t,n){let a={"content-type":"application/json"};n?.accessToken&&(a.authorization=`Bearer ${n.accessToken}`);let o=await i(`${r()}${e}`,{method:"POST",headers:a,body:JSON.stringify(t)});if(204!==o.status){if(!o.ok)throw await s(o);return await o.json()}}async function o(e,t){let n=await i(`${r()}${e}`,{method:"GET",headers:{authorization:`Bearer ${t}`}});if(!n.ok)throw await s(n);return await n.json()}async function c(e){return a("/v0/auth/login/request",{email:e})}async function u(e,t){return a("/v0/auth/login/verify",{email:e,code:t})}async function l(e){return a("/v0/auth/token/refresh",{refresh_token:e})}async function d(e,t){await a("/v0/auth/logout",{refresh_token:t},{accessToken:e})}async function f(e){return o("/v0/auth/me",e)}async function p(e,t){return(await a("/v0/reminders",t,{accessToken:e})).reminder}async function h(e){let t=await i(`${r()}/v0/reminders`,{method:"DELETE",headers:{authorization:`Bearer ${e}`}});if(204!==t.status&&!t.ok)throw await s(t)}async function m(e,t,r){return a("/v0/invite",void 0===r?{to:t}:{to:t,score:r},{accessToken:e})}e.s(["AuthApiError",0,n,"cancelReminder",0,h,"fetchMe",0,f,"logoutSession",0,d,"refreshAccessToken",0,l,"requestLoginCode",0,c,"scheduleReminder",0,p,"sendInvites",0,m,"verifyLoginCode",0,u],6375)},17707,e=>{"use strict";var t=e.i(2157),r=e.i(60526),n=e.i(50227),s=e.i(94930),i=e.i(6375);function a(){let e=process.env.FAILPROOFAI_AUTH_DIR;return e||(0,n.join)((0,r.homedir)(),".failproofai")}function o(){return(0,n.join)(a(),"auth.json")}function c(){return(0,n.join)(a(),"next-audit.json")}function u(){let e=o();if(!(0,t.existsSync)(e))return null;try{let r=(0,t.readFileSync)(e,"utf-8"),n=JSON.parse(r);if("string"!=typeof n.access_token||"string"!=typeof n.refresh_token||"number"!=typeof n.access_expires_at||"object"!=typeof n.user||!n.user||"string"!=typeof n.user.id||"string"!=typeof n.user.email)return null;return{access_token:n.access_token,refresh_token:n.refresh_token,access_expires_at:n.access_expires_at,refresh_expires_at:"number"==typeof n.refresh_expires_at?n.refresh_expires_at:n.access_expires_at,user:{id:n.user.id,email:n.user.email}}}catch{return null}}function l(e){(0,s.writeJsonAtomically)(o(),e)}function d(){let e=o();(0,t.existsSync)(e)&&(0,t.rmSync)(e,{force:!0})}function f(e,t){let r=Math.floor(Date.now()/1e3),n=e.user??t;if(!n)throw Error("authFromTokenResponse: missing user identity");return{access_token:e.access_token,refresh_token:e.refresh_token,access_expires_at:r+e.access_expires_in,refresh_expires_at:r+e.refresh_expires_in,user:n}}let p=new Map;async function h(e){let t=p.get(e.refresh_token);if(t)return t;let r=(async()=>{let t=f(await (0,i.refreshAccessToken)(e.refresh_token),e.user);return l(t),t})();p.set(e.refresh_token,r);try{return await r}finally{p.delete(e.refresh_token)}}async function m(){let e=u();if(!e)return null;let t=Math.floor(Date.now()/1e3);if(e.access_expires_at-t>60)return e;try{return await h(e)}catch(e){return e instanceof i.AuthApiError&&401===e.status&&d(),null}}async function y(){let e=await m();if(!e)return null;try{return{me:await (0,i.fetchMe)(e.access_token),auth:e}}catch(e){if(e instanceof i.AuthApiError&&401===e.status){let e=u();if(!e)return null;try{let t=await h(e);return{me:await (0,i.fetchMe)(t.access_token),auth:t}}catch(e){e instanceof i.AuthApiError&&401===e.status&&d()}}return null}}e.s(["authFromTokenResponse",0,f,"deleteAuth",0,d,"deleteReminder",0,function(){let e=c();(0,t.existsSync)(e)&&(0,t.rmSync)(e,{force:!0})},"readAuth",0,u,"readReminder",0,function(){let e=c();if(!(0,t.existsSync)(e))return null;try{let r=(0,t.readFileSync)(e,"utf-8"),n=JSON.parse(r);if("number"!=typeof n.next_audit_at||"string"!=typeof n.user_email||"number"!=typeof n.set_at)return null;return{next_audit_at:n.next_audit_at,user_email:n.user_email,set_at:n.set_at}}catch{return null}},"whoAmI",0,y,"writeAuth",0,l,"writeReminder",0,function(e){(0,s.writeJsonAtomically)(c(),e)}])}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__13i_sva._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[74533,(e,t,s)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},50227,(e,t,s)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,s)=>{t.exports=e.x("node:os",()=>require("node:os"))},2157,(e,t,s)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},66680,(e,t,s)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},15855,e=>{"use strict";let t;var s=e.i(2157),i=e.i(50227),n=e.i(60526),r=e.i(66680);e.i(74533);let o=i.default.join(n.default.homedir(),".failproofai"),a=i.default.join(o,"instance-id");function l(e){return r.default.createHmac("sha256","failproofai-telemetry-v1").update(e).digest("hex")}e.s(["getInstanceId",0,function(){if(t)return t;let e=function(){try{for(let e of(n.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let t=s.default.readFileSync(e,"utf-8").trim();if(t)return t}catch{}}catch{}}();if(e)return t=l(e);let i=[n.default.hostname(),n.default.homedir(),n.default.platform(),n.default.arch(),n.default.cpus()[0]?.model??""].join(":");return t=i?l(i):function(){try{let e=s.default.readFileSync(a,"utf-8").trim();if(e)return e}catch{}let e=r.default.randomUUID();try{s.default.mkdirSync(o,{recursive:!0}),s.default.writeFileSync(a,e,"utf-8")}catch{}return e}()},"hashToId",0,l])},93133,(e,t,s)=>{t.exports={name:"failproofai",version:"0.0.12",description:"The easiest way to manage policies that keep your AI agents reliable, on-task, and running autonomously — for Claude Code & the Agents SDK",bin:{failproofai:"./dist/cli.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/",".next/standalone/","dist/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{predev:"bun run build:cli && bun link",dev:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/dev.ts --port 8020","build:cli":"bun build --target=node --format=esm --outfile=dist/cli.mjs bin/failproofai.mjs --external posthog-node && node -e \"const fs=require('fs');const c=fs.readFileSync('dist/cli.mjs','utf8');fs.writeFileSync('dist/cli.mjs',c.replace('#!/usr/bin/env bun','#!/usr/bin/env node').replace('// @bun\\n',''))\"",build:"bun build --target=node --format=cjs --outfile=dist/index.js src/index.ts && bun run build:cli && bun --bun next build && node -e \"const {cpSync}=require('fs');cpSync('.next/static','.next/standalone/.next/static',{recursive:true});\" && node scripts/prune-standalone.mjs",prestart:"bun run build:cli && bun link",start:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",postinstall:"node scripts/postinstall.mjs",preuninstall:"node scripts/preuninstall.mjs",prepare:"bun run build","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts",translate:"bun scripts/translate-docs/cli.ts","translate:readme":"bun scripts/translate-docs/cli.ts --readme-only","translate:docs":"bun scripts/translate-docs/cli.ts --docs-only","translate:dry-run":"bun scripts/translate-docs/cli.ts --dry-run","translate:validate":"bun scripts/translate-docs/cli.ts --validate","validate:mdx":"bun scripts/validate-mdx.ts"},keywords:["claude","claude-code","claude-agents-sdk","anthropic","ai-agent","agent-reliability","agent-monitoring","autonomous-agent","failure-prevention","developer-tools","devtools","cli","local-first","hooks","policies"],author:"ExosphereHost Inc. <failproofai@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://github.com/FailproofAI/failproofai",repository:{type:"git",url:"https://github.com/FailproofAI/failproofai.git"},bugs:{url:"https://github.com/FailproofAI/failproofai/issues"},publishConfig:{access:"public"},devDependencies:{"@anthropic-ai/sdk":"^0.110.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.3","@testing-library/jest-dom":"^6.9.1","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.1","@types/node":"26.1.0","@types/react":"19.2.17","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.0.1",clsx:"^2.1.1",eslint:"^10.5.0","eslint-config-next":"^16.2.9",jsdom:"^29.1.1","lucide-react":"^1.18.0",next:"^16.2.9",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^4.1.9"},dependencies:{"html-to-image":"^1.11.13",html2canvas:"^1.4.1","posthog-node":"^5.37.1"},overrides:{postcss:"8.5.14","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.28.0"}}},34324,e=>{"use strict";var t=e.i(15855),s=e.i(93133);async function i(e,t){for(let s=1;s<=5;s++){try{let{signal:s,...i}=t,n=await fetch(e,{...i,signal:AbortSignal.timeout(5e3)});if(n.ok)return n}catch{}if(s<5){let e=Math.min(1e3*2**(s-1),8e3);await new Promise(t=>setTimeout(t,e))}}return new Response("{}",{status:200})}function n(){return"1"!==process.env.FAILPROOFAI_TELEMETRY_DISABLED}async function r(){try{if(!n()||globalThis.__FAILPROOFAI_POSTHOG__)return;let t=await e.A(37581),s=process.env.FAILPROOFAI_POSTHOG_KEY??"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX",r=process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com";globalThis.__FAILPROOFAI_POSTHOG__=new t.PostHog(s,{host:r,flushAt:1,flushInterval:0,requestTimeout:5e3,fetchRetryCount:0,fetch:i});let o=()=>{globalThis.__FAILPROOFAI_POSTHOG__?.shutdown().catch(()=>{})};process.on("beforeExit",o),process.on("SIGTERM",o),process.on("SIGINT",o)}catch(e){console.warn("[failproofai:telemetry] init failed:",e instanceof Error?e.message:e)}}async function o(){let e=globalThis.__FAILPROOFAI_POSTHOG__;e&&await e.flush()}e.s(["flushTelemetry",0,o,"initTelemetry",0,r,"trackEvent",0,function(e,i){if(!n())return;let r=globalThis.__FAILPROOFAI_POSTHOG__;r&&r.capture({distinctId:(0,t.getInstanceId)(),event:e,properties:{...i,$lib:"failproofai",failproofai_version:s.version,product:"failproofai-oss"}})}],34324)},37581,e=>{e.v(t=>Promise.all(["server/chunks/[externals]__1s61mel._.js","server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p7._.js"].map(t=>e.l(t))).then(()=>t(28864)))}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__1_mqemn._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},40911,e=>{"use strict";let t={info:0,warn:1,error:2};function r(e){return t[e]>=t.warn}function a(e){return`[failproofai${new Date().toISOString()}] ${e}`}e.s(["logActivity",0,function(e,t,n){if(!r("info"))return;let o=[`user=${e}`,`action=${t}`];n&&o.push(n),console.log(a("ACTIVITY"),o.join(" "))},"logError",0,function(e,t){void 0!==t?console.error(a("ERROR"),e,t):console.error(a("ERROR"),e)},"logWarn",0,function(e,t){r("warn")&&(void 0!==t?console.warn(a("WARN"),e,t):console.warn(a("WARN"),e))}])},81580,e=>{"use strict";var t=e.i(46786),r=e.i(14747);e.s(["decodeFolderName",0,function(e){return/^[A-Za-z]--/.test(e)?e[0]+":/"+e.slice(3).replace(/-/g,"/"):e.replace(/-/g,"/")},"encodeFolderName",0,function(e){let t=/^([A-Za-z]):[\\/](.*)$/.exec(e);return t?t[1]+"--"+t[2].replace(/[\\/]/g,"-"):e.replace(/[\\/]/g,"-")},"getClaudeProjectsPath",0,function(){let e=process.env.CLAUDE_PROJECTS_PATH;return e||(0,r.join)((0,t.homedir)(),".claude","projects")}])},83534,e=>{"use strict";e.s(["runtimeCache",0,function(e,t,r){let a=new Map,n=new Map,o=r?.maxSize;return async(...r)=>{let i=JSON.stringify(r),s=a.get(i);if(s&&Date.now()<s.expiry)return s.data;let l=n.get(i);if(l)return l;let d=e(...r).then(e=>{if(n.delete(i),o&&a.size>=o){let e=a.keys().next().value;a.delete(e)}return a.set(i,{data:e,expiry:Date.now()+1e3*t}),e},e=>{throw n.delete(i),e});return n.set(i,d),d}}])},28557,e=>{"use strict";e.s(["formatDate",0,function(e){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}).format(e)}])},71809,e=>{"use strict";async function t(e,t){let r=Array(e.length),a=0;async function n(){for(;a<e.length;){let t=a++;try{r[t]={status:"fulfilled",value:await e[t]()}}catch(e){r[t]={status:"rejected",reason:e}}}}let o=Array.from({length:Math.min(t,e.length)},()=>n());return await Promise.all(o),r}e.s(["batchAll",0,t])},24868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},56936,e=>{"use strict";var t=e.i(12714),r=e.i(50227),a=e.i(81580),n=e.i(83534),o=e.i(71809),i=e.i(40911),s=e.i(28557);let l=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;async function d(e,r){try{return(await (0,t.stat)(e)).mtime}catch(e){return(0,i.logWarn)(`Failed to stat ${r}:`,e),new Date(0)}}async function u(e){try{if(!(await (0,t.stat)(e)).isDirectory())return null;return await (0,t.readdir)(e,{withFileTypes:!0})}catch{return null}}async function c(){try{let e=(0,a.getClaudeProjectsPath)(),t=await u(e);if(!t)return[];let n=(await (0,o.batchAll)(t.filter(e=>e.isDirectory()).map(t=>async()=>{let a=(0,r.join)(e,t.name),n=await d(a,t.name);return{name:t.name,path:a,isDirectory:!0,lastModified:n,lastModifiedFormatted:(0,s.formatDate)(n),cli:["claude"]}}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value);return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}catch(e){return(0,i.logError)("Error reading Claude project folders:",e),[]}}async function p(){let[{getCodexProjects:t},{getCopilotProjects:r},{getCursorProjects:a},{getOpenCodeProjects:n},{getPiProjects:o},{getGeminiProjects:s}]=await Promise.all([e.A(37352),e.A(5807),e.A(97452),e.A(82978),e.A(45093),e.A(61489)]),[l,d,u,p,f,h,m]=await Promise.all([c(),t().catch(e=>((0,i.logError)("Error reading Codex projects:",e),[])),r().catch(e=>((0,i.logError)("Error reading Copilot projects:",e),[])),a().catch(e=>((0,i.logError)("Error reading Cursor projects:",e),[])),n().catch(e=>((0,i.logError)("Error reading OpenCode projects:",e),[])),o().catch(e=>((0,i.logError)("Error reading Pi projects:",e),[])),s().catch(e=>((0,i.logError)("Error reading Gemini projects:",e),[]))]);return function(...e){let t=new Map;for(let r of e)for(let e of r){let r=t.get(e.name);if(!r){t.set(e.name,{...e,cli:[...e.cli]});continue}let a=[...r.cli];for(let t of e.cli)a.includes(t)||a.push(t);let n=e.lastModified.getTime()>r.lastModified.getTime()?e:r;t.set(e.name,{...r,cli:a,lastModified:n.lastModified,lastModifiedFormatted:n.lastModifiedFormatted})}let r=Array.from(t.values());return r.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),r}(l,d,u,p,f,h,m)}function f(e){if(!e)throw RangeError("Empty project name");if(/^[/\\]/.test(e))throw RangeError("Absolute project name");let t=(0,r.resolve)((0,a.getClaudeProjectsPath)()),n=(0,r.resolve)((0,r.join)(t,e));if(!n.startsWith(t+r.sep))throw RangeError("Project path escapes root");return n}function h(e){let t=e.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i);return t?t[0]:void 0}async function m(e){try{let t=await u(e);if(!t)return[];let a=t.filter(e=>e.isFile()&&e.name.endsWith(".jsonl")&&h(e.name)),n=(await (0,o.batchAll)(a.map(t=>async()=>{let a=(0,r.join)(e,t.name),n=await d(a,t.name);return{name:t.name,path:a,lastModified:n,lastModifiedFormatted:(0,s.formatDate)(n),sessionId:h(t.name),cli:"claude"}}),16)).filter(e=>"fulfilled"===e.status).map(e=>e.value);return n.sort((e,t)=>t.lastModified.getTime()-e.lastModified.getTime()),n}catch(e){return(0,i.logError)("Error reading session files:",e),[]}}(0,n.runtimeCache)(p,30),(0,n.runtimeCache)(e=>m(e),30),e.s(["UUID_RE",0,l,"resolveProjectPath",0,f,"resolveSessionFilePath",0,function(e,t){if(!l.test(t))throw RangeError("Invalid session ID");let a=f(e);return(0,r.join)(a,`${t}.jsonl`)}])},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},88947,(e,t,r)=>{t.exports=e.x("stream",()=>require("stream"))},9311,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),o=e.i(61916),i=e.i(74677),s=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),f=e.i(70101),h=e.i(26937),m=e.i(10372),g=e.i(93695);e.i(20232);var v=e.i(220),x=e.i(89171),w=e.i(22734),y=e.i(24868),R=e.i(88947),E=e.i(40911);let b={claude:{id:"claude",label:"Claude Code",badgeClasses:"bg-orange-500/10 text-orange-400 border-orange-500/20"},codex:{id:"codex",label:"OpenAI Codex",badgeClasses:"bg-purple-500/10 text-purple-400 border-purple-500/20"},copilot:{id:"copilot",label:"GitHub Copilot",badgeClasses:"bg-blue-500/10 text-blue-400 border-blue-500/20"},cursor:{id:"cursor",label:"Cursor Agent",badgeClasses:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20"},opencode:{id:"opencode",label:"OpenCode",badgeClasses:"bg-amber-500/10 text-amber-400 border-amber-500/20"},pi:{id:"pi",label:"Pi",badgeClasses:"bg-pink-500/10 text-pink-400 border-pink-500/20"},gemini:{id:"gemini",label:"Gemini CLI",badgeClasses:"bg-sky-500/10 text-sky-400 border-sky-500/20"}};var C=e.i(56936);let j=/^ses_[A-Za-z0-9]+$/;async function _(t,r,a){if("opencode"===t?!j.test(a):!C.UUID_RE.test(a))throw RangeError("Invalid session ID");if("claude"===t)return{kind:"file",path:(0,C.resolveSessionFilePath)(r,a)};if("codex"===t){let{findCodexTranscript:t}=await e.A(18944),r=t(a);return r?{kind:"file",path:r}:null}if("copilot"===t){let{findCopilotTranscript:t}=await e.A(21476),r=t(a);return r?{kind:"file",path:r}:null}if("cursor"===t){let{findCursorTranscript:t}=await e.A(23414),r=t(a);return r?{kind:"file",path:r}:null}if("pi"===t){let{findPiTranscript:t}=await e.A(41330),r=t(a);return r?{kind:"file",path:r}:null}if("gemini"===t){let{findGeminiTranscript:t}=await e.A(82912),r=t(a);return r?{kind:"file",path:r}:null}if("opencode"===t){let{getOpenCodeSessionExport:t}=await e.A(82859),r=await t(a);return r?{kind:"synthesized",body:JSON.stringify(r,null,2)+"\n",contentType:"application/json",extension:"json"}:null}return t}function A(e,t){return x.NextResponse.json({error:e},{status:t})}async function P(e,{params:t}){let r,{project:a,session:n}=await t,o=e.nextUrl.searchParams.get("cli")??"claude";if(!("string"==typeof o&&Object.prototype.hasOwnProperty.call(b,o)))return A("Unknown cli",400);try{r=await _(o,a,n)}catch(e){if(e instanceof RangeError)return A("Invalid project or session",400);return A("Failed to resolve session log",500)}if(!r)return A("Session log not found",404);if((0,E.logActivity)("anonymous","download-log",`cli=${o} project=${a} session=${n}`),"synthesized"===r.kind)return new x.NextResponse(r.body,{headers:{"Content-Type":r.contentType,"Content-Disposition":`attachment; filename="${n}.${r.extension}"`}});try{await (0,y.stat)(r.path);let e=(0,w.createReadStream)(r.path),t=R.Readable.toWeb(e);return new x.NextResponse(t,{headers:{"Content-Type":"application/x-ndjson","Content-Disposition":`attachment; filename="${n}.jsonl"`}})}catch(e){if("ENOENT"===e.code||e instanceof RangeError)return A("Session log not found",404);return A("Failed to read session log",500)}}e.s(["GET",0,P],32525);var k=e.i(32525);let T=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/download/[project]/[session]/route",pathname:"/api/download/[project]/[session]",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/download/[project]/[session]/route.ts",nextConfigOutput:"standalone",userland:k,...{}}),{workAsyncStorage:N,workUnitAsyncStorage:M,serverHooks:q}=T;async function S(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),T.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let x="/api/download/[project]/[session]/route";x=x.replace(/\/index$/,"")||"/";let w=await T.prepare(e,t,{srcPage:x,multiZoneDraftMode:!1});if(!w)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:y,deploymentId:R,params:E,nextConfig:b,parsedUrl:C,isDraftMode:j,prerenderManifest:_,routerServerContext:A,isOnDemandRevalidate:P,revalidateOnlyGenerated:k,resolvedPathname:N,clientReferenceManifest:M,serverActionsManifest:q}=w,S=(0,s.normalizeAppPath)(x),O=!!(_.dynamicRoutes[S]||_.routes[N]),D=async()=>((null==A?void 0:A.render404)?await A.render404(e,t,C,!1):t.end("This page could not be found"),null);if(O&&!j){let e=!!_.routes[N],t=_.dynamicRoutes[S];if(t&&!1===t.fallback&&!e){if(b.adapterPath)return await D();throw new g.NoFallbackError}}let I=null;!O||T.isDev||j||(I="/index"===(I=N)?"/":I);let U=!0===T.isDev||!O,$=O&&!U;q&&M&&(0,i.setManifestsSingleton)({page:x,clientReferenceManifest:M,serverActionsManifest:q});let F=e.method||"GET",H=(0,o.getTracer)(),z=H.getActiveScopeSpan(),W=!!(null==A?void 0:A.isWrappedByNextServer),K=!!(0,n.getRequestMeta)(e,"minimalMode"),G=(0,n.getRequestMeta)(e,"incrementalCache")||await T.getIncrementalCache(e,b,_,K);null==G||G.resetRequestCache(),globalThis.__incrementalCache=G;let L={params:E,previewProps:_.preview,renderOpts:{experimental:{authInterrupts:!!b.experimental.authInterrupts},cacheComponents:!!b.cacheComponents,supportsDynamicResponse:U,incrementalCache:G,cacheLifeProfiles:b.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>T.onRequestError(e,t,a,n,A)},sharedContext:{buildId:y,deploymentId:R}},B=new l.NodeNextRequest(e),V=new l.NodeNextResponse(t),Z=d.NextRequestAdapter.fromNodeNextRequest(B,(0,d.signalFromNodeResponse)(t));try{let n,i=async e=>T.handle(Z,L).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=H.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${F} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${F} ${x}`)}),s=async n=>{var o,s;let l=async({previousCacheEntry:r})=>{try{if(!K&&P&&k&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await i(n);e.fetchMetrics=L.renderOpts.fetchMetrics;let s=L.renderOpts.pendingWaitUntil;s&&a.waitUntil&&(a.waitUntil(s),s=void 0);let l=L.renderOpts.collectedTags;if(!O)return await (0,p.sendResponse)(B,V,o,L.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(o.headers);l&&(t[m.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==L.renderOpts.collectedRevalidate&&!(L.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&L.renderOpts.collectedRevalidate,a=void 0===L.renderOpts.collectedExpire||L.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:L.renderOpts.collectedExpire;return{value:{kind:v.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await T.onRequestError(e,t,{routerKind:"App Router",routePath:x,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:P})},!1,A),t}},d=await T.handleResponse({req:e,nextConfig:b,cacheKey:I,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:_,isRoutePPREnabled:!1,isOnDemandRevalidate:P,revalidateOnlyGenerated:k,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:K});if(!O)return null;if((null==d||null==(o=d.value)?void 0:o.kind)!==v.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(s=d.value)?void 0:s.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",P?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),j&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return K&&O||u.delete(m.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,h.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(B,V,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};W&&z?await s(z):(n=H.getActiveScopeSpan(),await H.withPropagatedContext(e.headers,()=>H.trace(u.BaseServerSpan.handleRequest,{spanName:`${F} ${x}`,kind:o.SpanKind.SERVER,attributes:{"http.method":F,"http.target":e.url}},s),void 0,!W))}catch(t){if(t instanceof g.NoFallbackError||await T.onRequestError(e,t,{routerKind:"App Router",routePath:S,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:P})},!1,A),O)throw t;return await (0,p.sendResponse)(B,V,new Response(null,{status:500})),null}}e.s(["handler",0,S,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:N,workUnitAsyncStorage:M})},"routeModule",0,T,"serverHooks",0,q,"workAsyncStorage",0,N,"workUnitAsyncStorage",0,M],9311)},37352,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__1jm9fw6._.js"].map(t=>e.l(t))).then(()=>t(36203)))},5807,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__1w9zl9-._.js"].map(t=>e.l(t))).then(()=>t(55851)))},97452,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__1ou2ehh._.js"].map(t=>e.l(t))).then(()=>t(46413)))},82978,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__1mhmdzs._.js"].map(t=>e.l(t))).then(()=>t(35435)))},45093,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__0f7mikp._.js"].map(t=>e.l(t))).then(()=>t(19791)))},61489,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__1hgv_75._.js"].map(t=>e.l(t))).then(()=>t(90172)))},82859,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__1qxztj-._.js"].map(t=>e.l(t))).then(()=>t(99440)))},82912,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__0cag8qd._.js"].map(t=>e.l(t))).then(()=>t(88153)))},41330,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__0q-v9z2._.js"].map(t=>e.l(t))).then(()=>t(85116)))},23414,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__0rv7m0k._.js"].map(t=>e.l(t))).then(()=>t(72094)))},21476,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__1legmza._.js"].map(t=>e.l(t))).then(()=>t(78166)))},18944,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__17g9wh7._.js"].map(t=>e.l(t))).then(()=>t(57232)))}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__1m2_4t0._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[69005,e=>{"use strict";var t=e.i(47909),a=e.i(74017),r=e.i(96250),n=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),u=e.i(16795),d=e.i(87718),l=e.i(95169),c=e.i(47587),p=e.i(66012),h=e.i(70101),v=e.i(26937),_=e.i(10372),m=e.i(93695);e.i(20232);var R=e.i(220),f=e.i(89171),g=e.i(17707),E=e.i(6375),y=e.i(72561);let w=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;async function b(e){let t;await (0,y.initTelemetry)();let a=await (0,g.whoAmI)();if(!a)return(0,y.trackEvent)("audit_invite_sent",{status:"unauthorized",source:"dashboard"}),f.NextResponse.json({code:"unauthorized",message:"Sign in before sending invites."},{status:401});let r={},n=await e.text();if(n.trim().length>0)try{let e=JSON.parse(n);if(null===e||"object"!=typeof e||Array.isArray(e))return(0,y.trackEvent)("audit_invite_sent",{status:"validation_error",source:"dashboard",reason:"not_an_object",user_id:a.me.id}),f.NextResponse.json({code:"validation_error",message:"Request body must be a JSON object."},{status:400});r=e}catch{return(0,y.trackEvent)("audit_invite_sent",{status:"validation_error",source:"dashboard",reason:"malformed_json",user_id:a.me.id}),f.NextResponse.json({code:"validation_error",message:"Request body is not valid JSON."},{status:400})}if(!Array.isArray(r.to))return(0,y.trackEvent)("audit_invite_sent",{status:"validation_error",source:"dashboard",reason:"missing_to",user_id:a.me.id}),f.NextResponse.json({code:"validation_error",message:"`to` must be a list of email addresses."},{status:400});let s=[],i=new Set;for(let e of r.to){if("string"!=typeof e)continue;let t=e.trim().toLowerCase();t&&w.test(t)&&t!==a.me.email.toLowerCase()&&(i.has(t)||(i.add(t),s.push(t)))}if(0===s.length)return(0,y.trackEvent)("audit_invite_sent",{status:"validation_error",source:"dashboard",reason:"no_valid_recipients",user_id:a.me.id,input_count:Array.isArray(r.to)?r.to.length:0}),f.NextResponse.json({code:"validation_error",message:"Provide at least one valid email address (other than your own)."},{status:400});if(s.length>10)return(0,y.trackEvent)("audit_invite_sent",{status:"validation_error",source:"dashboard",reason:"too_many_recipients",user_id:a.me.id,input_count:s.length}),f.NextResponse.json({code:"validation_error",message:"Up to 10 recipients per invite batch. Please send the rest in a follow-up."},{status:400});"number"==typeof r.score&&Number.isFinite(r.score)&&(t=Math.max(0,Math.min(100,Math.round(r.score))));try{let e=await (0,E.sendInvites)(a.auth.access_token,s,t);return(0,y.trackEvent)("audit_invite_sent",{status:"success",source:"dashboard",user_id:a.me.id,sent_count:e.sent.length,failed_count:e.failed.length}),f.NextResponse.json(e,{status:200})}catch(t){if(t instanceof E.AuthApiError){(0,y.trackEvent)("audit_invite_sent",{status:"failed",source:"dashboard",user_id:a.me.id,error_code:t.code,http_status:t.status,recipient_count:s.length});let e=t.status>=200&&t.status<600?t.status:504;return f.NextResponse.json({code:t.code,message:t.message,...void 0!==t.retryAfterSecs?{retry_after_secs:t.retryAfterSecs}:{}},{status:e})}let e=t instanceof Error?t.name:"unknown";return(0,y.trackEvent)("audit_invite_sent",{status:"failed",source:"dashboard",user_id:a.me.id,error_code:"upstream_unreachable",error_name:e.slice(0,50),recipient_count:s.length}),f.NextResponse.json({code:"upstream_unreachable",message:"Invite service is unreachable. Please try again in a moment."},{status:502})}}e.s(["POST",0,b,"dynamic",0,"force-dynamic"],72993);var x=e.i(72993);let A=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/audit/invite/route",pathname:"/api/audit/invite",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/audit/invite/route.ts",nextConfigOutput:"standalone",userland:x,...{}}),{workAsyncStorage:C,workUnitAsyncStorage:N,serverHooks:S}=A;async function P(e,t,r){r.requestMeta&&(0,n.setRequestMeta)(e,r.requestMeta),A.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let f="/api/audit/invite/route";f=f.replace(/\/index$/,"")||"/";let g=await A.prepare(e,t,{srcPage:f,multiZoneDraftMode:!1});if(!g)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:E,deploymentId:y,params:w,nextConfig:b,parsedUrl:x,isDraftMode:C,prerenderManifest:N,routerServerContext:S,isOnDemandRevalidate:P,revalidateOnlyGenerated:T,resolvedPathname:k,clientReferenceManifest:O,serverActionsManifest:j}=g,q=(0,o.normalizeAppPath)(f),I=!!(N.dynamicRoutes[q]||N.routes[k]),M=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,x,!1):t.end("This page could not be found"),null);if(I&&!C){let e=!!N.routes[k],t=N.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(b.adapterPath)return await M();throw new m.NoFallbackError}}let H=null;!I||A.isDev||C||(H="/index"===(H=k)?"/":H);let U=!0===A.isDev||!I,D=I&&!U;j&&O&&(0,i.setManifestsSingleton)({page:f,clientReferenceManifest:O,serverActionsManifest:j});let $=e.method||"GET",F=(0,s.getTracer)(),K=F.getActiveScopeSpan(),L=!!(null==S?void 0:S.isWrappedByNextServer),B=!!(0,n.getRequestMeta)(e,"minimalMode"),z=(0,n.getRequestMeta)(e,"incrementalCache")||await A.getIncrementalCache(e,b,N,B);null==z||z.resetRequestCache(),globalThis.__incrementalCache=z;let G={params:w,previewProps:N.preview,renderOpts:{experimental:{authInterrupts:!!b.experimental.authInterrupts},cacheComponents:!!b.cacheComponents,supportsDynamicResponse:U,incrementalCache:z,cacheLifeProfiles:b.cacheLife,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,r,n)=>A.onRequestError(e,t,r,n,S)},sharedContext:{buildId:E,deploymentId:y}},J=new u.NodeNextRequest(e),V=new u.NodeNextResponse(t),W=d.NextRequestAdapter.fromNodeNextRequest(J,(0,d.signalFromNodeResponse)(t));try{let n,i=async e=>A.handle(W,G).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let a=F.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==l.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let r=a.get("next.route");if(r){let t=`${$} ${r}`;e.setAttributes({"next.route":r,"http.route":r,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",r),n.updateName(t))}else e.updateName(`${$} ${f}`)}),o=async n=>{var s,o;let u=async({previousCacheEntry:a})=>{try{if(!B&&P&&T&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(n);e.fetchMetrics=G.renderOpts.fetchMetrics;let o=G.renderOpts.pendingWaitUntil;o&&r.waitUntil&&(r.waitUntil(o),o=void 0);let u=G.renderOpts.collectedTags;if(!I)return await (0,p.sendResponse)(J,V,s,G.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);u&&(t[_.NEXT_CACHE_TAGS_HEADER]=u),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=_.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,r=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=_.INFINITE_CACHE?void 0:G.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:r}}}}catch(t){throw(null==a?void 0:a.isStale)&&await A.onRequestError(e,t,{routerKind:"App Router",routePath:f,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:P})},!1,S),t}},d=await A.handleResponse({req:e,nextConfig:b,cacheKey:H,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:P,revalidateOnlyGenerated:T,responseGenerator:u,waitUntil:r.waitUntil,isMinimalMode:B});if(!I)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(o=d.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});B||t.setHeader("x-nextjs-cache",P?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,h.fromNodeOutgoingHttpHeaders)(d.value.headers);return B&&I||l.delete(_.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,v.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(J,V,new Response(d.value.body,{headers:l,status:d.value.status||200})),null};L&&K?await o(K):(n=F.getActiveScopeSpan(),await F.withPropagatedContext(e.headers,()=>F.trace(l.BaseServerSpan.handleRequest,{spanName:`${$} ${f}`,kind:s.SpanKind.SERVER,attributes:{"http.method":$,"http.target":e.url}},o),void 0,!L))}catch(t){if(t instanceof m.NoFallbackError||await A.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:P})},!1,S),I)throw t;return await (0,p.sendResponse)(J,V,new Response(null,{status:500})),null}}e.s(["handler",0,P,"patchFetch",0,function(){return(0,r.patchFetch)({workAsyncStorage:C,workUnitAsyncStorage:N})},"routeModule",0,A,"serverHooks",0,S,"workAsyncStorage",0,C,"workUnitAsyncStorage",0,N],69005)},78081,e=>{e.v(t=>Promise.all(["server/chunks/[externals]__14odj07._.js","server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js"].map(t=>e.l(t))).then(()=>t(39702)))}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=node_modules_0-tu4ot._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[52263,e=>{"use strict";var t=e.i(47909),a=e.i(74017),r=e.i(96250),n=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),d=e.i(16795),l=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),h=e.i(70101),m=e.i(26937),_=e.i(10372),R=e.i(93695);e.i(20232);var f=e.i(220),v=e.i(89171),E=e.i(17707),g=e.i(6375),w=e.i(72561);async function y(){let e=await (0,E.whoAmI)(),t=(0,E.readReminder)();return t&&e&&e.me.email===t.user_email?v.NextResponse.json({authenticated:!0,reminder:{next_audit_at:t.next_audit_at,user_email:t.user_email,set_at:t.set_at}}):v.NextResponse.json({authenticated:!!e,reminder:null})}async function x(e){let t;await (0,w.initTelemetry)();let a=await (0,E.whoAmI)();if(!a)return(0,w.trackEvent)("audit_reminder_set",{status:"unauthorized",source:"dashboard"}),v.NextResponse.json({code:"unauthorized",message:"Sign in before setting a reminder."},{status:401});let r={},n=await e.text();if(n.trim().length>0){let e;try{e=JSON.parse(n)}catch{return(0,w.trackEvent)("audit_reminder_set",{status:"validation_error",source:"dashboard",reason:"malformed_json",user_id:a.me.id}),v.NextResponse.json({code:"validation_error",message:"Request body is not valid JSON."},{status:400})}if(null===e||"object"!=typeof e||Array.isArray(e))return(0,w.trackEvent)("audit_reminder_set",{status:"validation_error",source:"dashboard",reason:"not_an_object",user_id:a.me.id}),v.NextResponse.json({code:"validation_error",message:"Request body must be a JSON object."},{status:400});r=e}let s=Math.floor(Date.now()/1e3),i=s+31536e3;if((t="number"==typeof r.at&&Number.isFinite(r.at)?Math.floor(r.at):s+86400*("number"==typeof r.in_days&&Number.isFinite(r.in_days)?Math.max(1,Math.min(365,Math.floor(r.in_days))):7))<=s)return(0,w.trackEvent)("audit_reminder_set",{status:"validation_error",source:"dashboard",reason:"in_the_past",user_id:a.me.id}),v.NextResponse.json({code:"validation_error",message:"Reminder must be in the future."},{status:400});if(t>i)return(0,w.trackEvent)("audit_reminder_set",{status:"validation_error",source:"dashboard",reason:"too_far_in_future",user_id:a.me.id}),v.NextResponse.json({code:"validation_error",message:"Reminder must be within 365 days. Did you pass milliseconds instead of seconds?"},{status:400});let o={next_audit_at:t,user_email:a.me.email,set_at:s};(0,E.writeReminder)(o);let d="skipped",l=null;try{await (0,g.scheduleReminder)(a.auth.access_token,{at:t}),d="scheduled"}catch(e){d="failed",l=e instanceof g.AuthApiError?`${e.code}: ${e.message}`.slice(0,200):e instanceof Error?e.message.slice(0,200):String(e).slice(0,200)}return(0,w.trackEvent)("audit_reminder_set",{status:"success",source:"dashboard",user_id:a.me.id,offset_days:Math.round((t-s)/86400),upstream:d,upstream_error:l}),v.NextResponse.json({authenticated:!0,reminder:o})}async function b(){await (0,w.initTelemetry)();let e=await (0,E.whoAmI)(),t=(0,E.readReminder)();(0,E.deleteReminder)();let a="skipped",r=null;if(e)try{await (0,g.cancelReminder)(e.auth.access_token),a="cancelled"}catch(e){a="failed",r=e instanceof g.AuthApiError?`${e.code}: ${e.message}`.slice(0,200):e instanceof Error?e.message.slice(0,200):String(e).slice(0,200)}return(0,w.trackEvent)("audit_reminder_cleared",{source:"dashboard",had_local_reminder:null!==t,user_id:e?.me.id??null,upstream:a,upstream_error:r}),v.NextResponse.json({ok:!0})}e.s(["DELETE",0,b,"GET",0,y,"POST",0,x,"dynamic",0,"force-dynamic"],13757);var A=e.i(13757);let N=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/auth/reminder/route",pathname:"/api/auth/reminder",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/auth/reminder/route.ts",nextConfigOutput:"standalone",userland:A,...{}}),{workAsyncStorage:C,workUnitAsyncStorage:T,serverHooks:S}=N;async function k(e,t,r){r.requestMeta&&(0,n.setRequestMeta)(e,r.requestMeta),N.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/auth/reminder/route";v=v.replace(/\/index$/,"")||"/";let E=await N.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!E)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:g,deploymentId:w,params:y,nextConfig:x,parsedUrl:b,isDraftMode:A,prerenderManifest:C,routerServerContext:T,isOnDemandRevalidate:S,revalidateOnlyGenerated:k,resolvedPathname:P,clientReferenceManifest:O,serverActionsManifest:j}=E,M=(0,o.normalizeAppPath)(v),q=!!(C.dynamicRoutes[M]||C.routes[P]),I=async()=>((null==T?void 0:T.render404)?await T.render404(e,t,b,!1):t.end("This page could not be found"),null);if(q&&!A){let e=!!C.routes[P],t=C.dynamicRoutes[M];if(t&&!1===t.fallback&&!e){if(x.adapterPath)return await I();throw new R.NoFallbackError}}let H=null;!q||N.isDev||A||(H="/index"===(H=P)?"/":H);let D=!0===N.isDev||!q,U=q&&!D;j&&O&&(0,i.setManifestsSingleton)({page:v,clientReferenceManifest:O,serverActionsManifest:j});let $=e.method||"GET",F=(0,s.getTracer)(),K=F.getActiveScopeSpan(),B=!!(null==T?void 0:T.isWrappedByNextServer),L=!!(0,n.getRequestMeta)(e,"minimalMode"),G=(0,n.getRequestMeta)(e,"incrementalCache")||await N.getIncrementalCache(e,x,C,L);null==G||G.resetRequestCache(),globalThis.__incrementalCache=G;let z={params:y,previewProps:C.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:D,incrementalCache:G,cacheLifeProfiles:x.cacheLife,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,r,n)=>N.onRequestError(e,t,r,n,T)},sharedContext:{buildId:g,deploymentId:w}},J=new d.NodeNextRequest(e),V=new d.NodeNextResponse(t),W=l.NextRequestAdapter.fromNodeNextRequest(J,(0,l.signalFromNodeResponse)(t));try{let n,i=async e=>N.handle(W,z).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let a=F.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let r=a.get("next.route");if(r){let t=`${$} ${r}`;e.setAttributes({"next.route":r,"http.route":r,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",r),n.updateName(t))}else e.updateName(`${$} ${v}`)}),o=async n=>{var s,o;let d=async({previousCacheEntry:a})=>{try{if(!L&&S&&k&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(n);e.fetchMetrics=z.renderOpts.fetchMetrics;let o=z.renderOpts.pendingWaitUntil;o&&r.waitUntil&&(r.waitUntil(o),o=void 0);let d=z.renderOpts.collectedTags;if(!q)return await (0,p.sendResponse)(J,V,s,z.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);d&&(t[_.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==z.renderOpts.collectedRevalidate&&!(z.renderOpts.collectedRevalidate>=_.INFINITE_CACHE)&&z.renderOpts.collectedRevalidate,r=void 0===z.renderOpts.collectedExpire||z.renderOpts.collectedExpire>=_.INFINITE_CACHE?void 0:z.renderOpts.collectedExpire;return{value:{kind:f.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:r}}}}catch(t){throw(null==a?void 0:a.isStale)&&await N.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:S})},!1,T),t}},l=await N.handleResponse({req:e,nextConfig:x,cacheKey:H,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:S,revalidateOnlyGenerated:k,responseGenerator:d,waitUntil:r.waitUntil,isMinimalMode:L});if(!q)return null;if((null==l||null==(s=l.value)?void 0:s.kind)!==f.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==l||null==(o=l.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});L||t.setHeader("x-nextjs-cache",S?"REVALIDATED":l.isMiss?"MISS":l.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,h.fromNodeOutgoingHttpHeaders)(l.value.headers);return L&&q||u.delete(_.NEXT_CACHE_TAGS_HEADER),!l.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,m.getCacheControlHeader)(l.cacheControl)),await (0,p.sendResponse)(J,V,new Response(l.value.body,{headers:u,status:l.value.status||200})),null};B&&K?await o(K):(n=F.getActiveScopeSpan(),await F.withPropagatedContext(e.headers,()=>F.trace(u.BaseServerSpan.handleRequest,{spanName:`${$} ${v}`,kind:s.SpanKind.SERVER,attributes:{"http.method":$,"http.target":e.url}},o),void 0,!B))}catch(t){if(t instanceof R.NoFallbackError||await N.onRequestError(e,t,{routerKind:"App Router",routePath:M,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:S})},!1,T),q)throw t;return await (0,p.sendResponse)(J,V,new Response(null,{status:500})),null}}e.s(["handler",0,k,"patchFetch",0,function(){return(0,r.patchFetch)({workAsyncStorage:C,workUnitAsyncStorage:T})},"routeModule",0,N,"serverHooks",0,S,"workAsyncStorage",0,C,"workUnitAsyncStorage",0,T],52263)},78081,e=>{e.v(t=>Promise.all(["server/chunks/[externals]__14odj07._.js","server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js"].map(t=>e.l(t))).then(()=>t(39702)))}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=node_modules_0ttxbz7._.js.map
|