failproofai 0.0.9-beta.0 → 0.0.9-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/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +6 -6
- 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/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +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/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +2 -2
- 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 +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 +1 -1
- package/.next/standalone/.next/server/app/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +8 -8
- 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/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g72weg._.js +1 -1
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_0z7w.hh._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0ca1zru._.js → [root-of-the-server]__0.f_cyx._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__092s1ta._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09icjsf._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0ea22pr._.js → [root-of-the-server]__0dub28-._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0g.lg8b._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h..k-e._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0vu.o-3._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0w6l33k._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11pa2ra._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12t-wym._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_10lm7or._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_0xerkr6._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_0q-m0y-._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +6 -6
- package/.next/standalone/.next/server/pages/404.html +2 -2
- 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 +9 -9
- package/.next/standalone/.next/static/chunks/{01q52wg_amm60.js → 0_c_yox08g_44.js} +2 -2
- package/.next/standalone/.next/static/chunks/{0amfi~vb_gfgo.js → 0bghqwo4iloy0.js} +1 -1
- package/.next/standalone/.next/static/chunks/0gu87mlr5ssnt.js +6 -0
- package/.next/standalone/.next/static/chunks/{0jce49ygr4fdv.js → 0igf3xbisp1lx.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0uq_5p-p7myfe.js → 0jryicwtm9z2g.js} +2 -2
- package/.next/standalone/.next/static/chunks/{12simlrcfk3g2.js → 0kzk5-mh1_x53.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0mungg3~jpwe7.js → 0p5zh2diw90a1.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0vb8xxj_v2tz8.js → 0ufq8smh~i7wc.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0~mroziiwl1m5.js → 0w1f.k~gi-y6..js} +1 -1
- package/.next/standalone/.next/static/chunks/{03lsndql_yml5.js → 0z-jh701rc~j8.js} +1 -1
- package/.next/standalone/.next/static/chunks/{turbopack-0o7k.hakttp4k.js → turbopack-0s36is87fc9r2.js} +1 -1
- package/.next/standalone/package.json +1 -1
- package/.next/standalone/server.js +1 -1
- package/dist/cli.mjs +103 -19
- package/package.json +1 -1
- package/src/hooks/install-prompt.ts +119 -23
- package/.next/standalone/.next/static/chunks/0v.xuf4ynzp~~.js +0 -6
- /package/.next/standalone/.next/static/{oUO8u4z9JvtTzS_2RJoGo → CiVeb_yiVt-O2JYrzGzB7}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{oUO8u4z9JvtTzS_2RJoGo → CiVeb_yiVt-O2JYrzGzB7}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{oUO8u4z9JvtTzS_2RJoGo → CiVeb_yiVt-O2JYrzGzB7}/_ssgManifest.js +0 -0
package/dist/cli.mjs
CHANGED
|
@@ -2397,7 +2397,7 @@ var init_hook_activity_store = __esm(() => {
|
|
|
2397
2397
|
});
|
|
2398
2398
|
|
|
2399
2399
|
// package.json
|
|
2400
|
-
var version2 = "0.0.9-beta.
|
|
2400
|
+
var version2 = "0.0.9-beta.1";
|
|
2401
2401
|
var init_package = () => {};
|
|
2402
2402
|
|
|
2403
2403
|
// src/posthog-key.ts
|
|
@@ -4655,36 +4655,120 @@ async function resolveTargetClis(explicit) {
|
|
|
4655
4655
|
}
|
|
4656
4656
|
if (!process.stdin.isTTY)
|
|
4657
4657
|
return detected;
|
|
4658
|
+
return promptCliTargetSelection(detected);
|
|
4659
|
+
}
|
|
4660
|
+
async function promptCliTargetSelection(detected) {
|
|
4658
4661
|
const labels = detected.map((id) => getIntegration(id).displayName).join(" + ");
|
|
4659
|
-
|
|
4662
|
+
const options = [
|
|
4663
|
+
{ label: "Both", description: labels, value: detected },
|
|
4664
|
+
...detected.map((id) => ({
|
|
4665
|
+
label: `${getIntegration(id).displayName} only`,
|
|
4666
|
+
description: "",
|
|
4667
|
+
value: [id]
|
|
4668
|
+
}))
|
|
4669
|
+
];
|
|
4670
|
+
let cursor = 0;
|
|
4671
|
+
let lastLineCount = 0;
|
|
4672
|
+
let cursorHidden = false;
|
|
4673
|
+
function hideCursor() {
|
|
4674
|
+
if (!cursorHidden) {
|
|
4675
|
+
process.stdout.write("\x1B[?25l");
|
|
4676
|
+
cursorHidden = true;
|
|
4677
|
+
}
|
|
4678
|
+
}
|
|
4679
|
+
function showCursor() {
|
|
4680
|
+
if (cursorHidden) {
|
|
4681
|
+
process.stdout.write("\x1B[?25h");
|
|
4682
|
+
cursorHidden = false;
|
|
4683
|
+
}
|
|
4684
|
+
}
|
|
4685
|
+
function truncateLine(line, width) {
|
|
4686
|
+
let visual = 0;
|
|
4687
|
+
let result = "";
|
|
4688
|
+
let i = 0;
|
|
4689
|
+
while (i < line.length) {
|
|
4690
|
+
if (line[i] === "\x1B" && line[i + 1] === "[") {
|
|
4691
|
+
let j = i + 2;
|
|
4692
|
+
while (j < line.length && !/[A-Za-z]/.test(line[j]))
|
|
4693
|
+
j++;
|
|
4694
|
+
j++;
|
|
4695
|
+
result += line.slice(i, j);
|
|
4696
|
+
i = j;
|
|
4697
|
+
} else {
|
|
4698
|
+
if (visual >= width)
|
|
4699
|
+
break;
|
|
4700
|
+
result += line[i];
|
|
4701
|
+
visual++;
|
|
4702
|
+
i++;
|
|
4703
|
+
}
|
|
4704
|
+
}
|
|
4705
|
+
return result;
|
|
4706
|
+
}
|
|
4707
|
+
function render() {
|
|
4708
|
+
const cols = process.stdout.columns || 120;
|
|
4709
|
+
hideCursor();
|
|
4710
|
+
const lines = [];
|
|
4711
|
+
lines.push(" Failproof AI — Install Hooks");
|
|
4712
|
+
lines.push("");
|
|
4713
|
+
lines.push(` \x1B[2mDetected ${labels}. Choose where to install:\x1B[0m`);
|
|
4714
|
+
lines.push("");
|
|
4715
|
+
for (let i = 0;i < options.length; i++) {
|
|
4716
|
+
const opt = options[i];
|
|
4717
|
+
const isActive = i === cursor;
|
|
4718
|
+
const pointer = isActive ? "\x1B[36m❯\x1B[0m" : " ";
|
|
4719
|
+
const labelPart = isActive ? `\x1B[1;36m${opt.label}\x1B[0m` : opt.label;
|
|
4720
|
+
const pad = opt.description ? " ".repeat(Math.max(2, 22 - opt.label.length)) : "";
|
|
4721
|
+
const desc = opt.description ? `\x1B[2m${opt.description}\x1B[0m` : "";
|
|
4722
|
+
lines.push(` ${pointer} ${labelPart}${pad}${desc}`);
|
|
4723
|
+
}
|
|
4724
|
+
lines.push("");
|
|
4725
|
+
lines.push(" \x1B[2m" + "─".repeat(Math.max(2, cols - 2)) + "\x1B[0m");
|
|
4726
|
+
lines.push(" [↑↓] Move [Enter] Select [^C] Quit");
|
|
4727
|
+
if (lastLineCount > 0) {
|
|
4728
|
+
process.stdout.write(`\x1B[${lastLineCount}A\x1B[J`);
|
|
4729
|
+
}
|
|
4730
|
+
const output = lines.map((l) => l === "" ? l : truncateLine(l, cols)).join(`
|
|
4731
|
+
`) + `
|
|
4732
|
+
`;
|
|
4733
|
+
process.stdout.write(output);
|
|
4734
|
+
lastLineCount = lines.length;
|
|
4735
|
+
}
|
|
4660
4736
|
return new Promise((resolve7) => {
|
|
4737
|
+
render();
|
|
4661
4738
|
readline2.emitKeypressEvents(process.stdin);
|
|
4662
4739
|
const wasRaw = process.stdin.isRaw;
|
|
4663
4740
|
if (process.stdin.setRawMode)
|
|
4664
4741
|
process.stdin.setRawMode(true);
|
|
4665
|
-
|
|
4742
|
+
process.stdin.resume();
|
|
4743
|
+
function cleanup() {
|
|
4744
|
+
showCursor();
|
|
4745
|
+
process.stdin.removeListener("keypress", onKey);
|
|
4666
4746
|
if (process.stdin.setRawMode)
|
|
4667
4747
|
process.stdin.setRawMode(wasRaw ?? false);
|
|
4668
|
-
process.stdin.
|
|
4669
|
-
}
|
|
4670
|
-
|
|
4671
|
-
if (key
|
|
4672
|
-
|
|
4748
|
+
process.stdin.pause();
|
|
4749
|
+
}
|
|
4750
|
+
function onKey(_str, key) {
|
|
4751
|
+
if (!key)
|
|
4752
|
+
return;
|
|
4753
|
+
if (key.ctrl && (key.name === "c" || key.name === "d")) {
|
|
4754
|
+
cleanup();
|
|
4673
4755
|
process.stdout.write(`
|
|
4674
4756
|
`);
|
|
4675
4757
|
process.exit(130);
|
|
4676
4758
|
}
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4759
|
+
if (key.name === "up") {
|
|
4760
|
+
cursor = cursor > 0 ? cursor - 1 : options.length - 1;
|
|
4761
|
+
render();
|
|
4762
|
+
} else if (key.name === "down") {
|
|
4763
|
+
cursor = cursor < options.length - 1 ? cursor + 1 : 0;
|
|
4764
|
+
render();
|
|
4765
|
+
} else if (key.name === "return" || key.name === "space") {
|
|
4766
|
+
cleanup();
|
|
4767
|
+
process.stdout.write(`
|
|
4680
4768
|
`);
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
resolve7(["codex"]);
|
|
4685
|
-
else
|
|
4686
|
-
resolve7(detected);
|
|
4687
|
-
};
|
|
4769
|
+
resolve7(options[cursor].value);
|
|
4770
|
+
}
|
|
4771
|
+
}
|
|
4688
4772
|
process.stdin.on("keypress", onKey);
|
|
4689
4773
|
});
|
|
4690
4774
|
}
|
|
@@ -5315,7 +5399,7 @@ import { realpathSync as realpathSync2 } from "fs";
|
|
|
5315
5399
|
import { dirname as dirname8, resolve as resolve9 } from "path";
|
|
5316
5400
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
5317
5401
|
// package.json
|
|
5318
|
-
var version = "0.0.9-beta.
|
|
5402
|
+
var version = "0.0.9-beta.1";
|
|
5319
5403
|
|
|
5320
5404
|
// bin/failproofai.mjs
|
|
5321
5405
|
if (!process.env.FAILPROOFAI_PACKAGE_ROOT) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "failproofai",
|
|
3
|
-
"version": "0.0.9-beta.
|
|
3
|
+
"version": "0.0.9-beta.1",
|
|
4
4
|
"description": "The easiest way to manage policies that keep your AI agents reliable, on-task, and running autonomously — for Claude Code & the Agents SDK",
|
|
5
5
|
"bin": {
|
|
6
6
|
"failproofai": "./dist/cli.mjs"
|
|
@@ -37,8 +37,8 @@ export interface PromptOptions {
|
|
|
37
37
|
* • If `explicit` is provided (from `--cli`), use it as-is.
|
|
38
38
|
* • Else, detect installed CLIs (PATH probe).
|
|
39
39
|
* • If exactly one detected → use just that one (no prompt).
|
|
40
|
-
* • If
|
|
41
|
-
* • Otherwise → default to ["claude"]
|
|
40
|
+
* • If multiple detected and stdin is a TTY → arrow-key single-select.
|
|
41
|
+
* • Otherwise → default to all detected (or ["claude"] when none).
|
|
42
42
|
*
|
|
43
43
|
* Returns the selected IntegrationType[] (always non-empty).
|
|
44
44
|
*/
|
|
@@ -61,38 +61,134 @@ export async function resolveTargetClis(explicit?: IntegrationType[]): Promise<I
|
|
|
61
61
|
return detected;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
//
|
|
65
|
-
if (!process.stdin.isTTY) return detected; // non-interactive: install for
|
|
64
|
+
// Multiple detected. Prompt or default.
|
|
65
|
+
if (!process.stdin.isTTY) return detected; // non-interactive: install for all detected
|
|
66
66
|
|
|
67
|
+
return promptCliTargetSelection(detected);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Interactive arrow-key single-select for "install for which CLI?" when
|
|
72
|
+
* multiple agent CLIs are detected. Visual style mirrors promptPolicySelection.
|
|
73
|
+
*/
|
|
74
|
+
async function promptCliTargetSelection(
|
|
75
|
+
detected: IntegrationType[],
|
|
76
|
+
): Promise<IntegrationType[]> {
|
|
67
77
|
const labels = detected.map((id) => getIntegration(id).displayName).join(" + ");
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
78
|
+
const options: Array<{ label: string; description: string; value: IntegrationType[] }> = [
|
|
79
|
+
{ label: "Both", description: labels, value: detected },
|
|
80
|
+
...detected.map((id) => ({
|
|
81
|
+
label: `${getIntegration(id).displayName} only`,
|
|
82
|
+
description: "",
|
|
83
|
+
value: [id] as IntegrationType[],
|
|
84
|
+
})),
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
let cursor = 0;
|
|
88
|
+
let lastLineCount = 0;
|
|
89
|
+
let cursorHidden = false;
|
|
90
|
+
|
|
91
|
+
function hideCursor(): void {
|
|
92
|
+
if (!cursorHidden) {
|
|
93
|
+
process.stdout.write("\x1B[?25l");
|
|
94
|
+
cursorHidden = true;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function showCursor(): void {
|
|
98
|
+
if (cursorHidden) {
|
|
99
|
+
process.stdout.write("\x1B[?25h");
|
|
100
|
+
cursorHidden = false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function truncateLine(line: string, width: number): string {
|
|
105
|
+
let visual = 0;
|
|
106
|
+
let result = "";
|
|
107
|
+
let i = 0;
|
|
108
|
+
while (i < line.length) {
|
|
109
|
+
if (line[i] === "\x1B" && line[i + 1] === "[") {
|
|
110
|
+
let j = i + 2;
|
|
111
|
+
while (j < line.length && !/[A-Za-z]/.test(line[j])) j++;
|
|
112
|
+
j++;
|
|
113
|
+
result += line.slice(i, j);
|
|
114
|
+
i = j;
|
|
115
|
+
} else {
|
|
116
|
+
if (visual >= width) break;
|
|
117
|
+
result += line[i];
|
|
118
|
+
visual++;
|
|
119
|
+
i++;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function render(): void {
|
|
126
|
+
const cols = process.stdout.columns || 120;
|
|
127
|
+
hideCursor();
|
|
128
|
+
|
|
129
|
+
const lines: string[] = [];
|
|
130
|
+
lines.push(" Failproof AI — Install Hooks");
|
|
131
|
+
lines.push("");
|
|
132
|
+
lines.push(` \x1B[2mDetected ${labels}. Choose where to install:\x1B[0m`);
|
|
133
|
+
lines.push("");
|
|
134
|
+
|
|
135
|
+
for (let i = 0; i < options.length; i++) {
|
|
136
|
+
const opt = options[i];
|
|
137
|
+
const isActive = i === cursor;
|
|
138
|
+
const pointer = isActive ? "\x1B[36m❯\x1B[0m" : " ";
|
|
139
|
+
const labelPart = isActive ? `\x1B[1;36m${opt.label}\x1B[0m` : opt.label;
|
|
140
|
+
const pad = opt.description ? " ".repeat(Math.max(2, 22 - opt.label.length)) : "";
|
|
141
|
+
const desc = opt.description ? `\x1B[2m${opt.description}\x1B[0m` : "";
|
|
142
|
+
lines.push(` ${pointer} ${labelPart}${pad}${desc}`);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
lines.push("");
|
|
146
|
+
lines.push(" \x1B[2m" + "─".repeat(Math.max(2, cols - 2)) + "\x1B[0m");
|
|
147
|
+
lines.push(" [↑↓] Move [Enter] Select [^C] Quit");
|
|
148
|
+
|
|
149
|
+
if (lastLineCount > 0) {
|
|
150
|
+
process.stdout.write(`\x1B[${lastLineCount}A\x1B[J`);
|
|
151
|
+
}
|
|
152
|
+
const output =
|
|
153
|
+
lines.map((l) => (l === "" ? l : truncateLine(l, cols))).join("\n") + "\n";
|
|
154
|
+
process.stdout.write(output);
|
|
155
|
+
lastLineCount = lines.length;
|
|
156
|
+
}
|
|
71
157
|
|
|
72
158
|
return new Promise<IntegrationType[]>((resolve) => {
|
|
159
|
+
render();
|
|
73
160
|
readline.emitKeypressEvents(process.stdin);
|
|
74
161
|
const wasRaw = process.stdin.isRaw;
|
|
75
162
|
if (process.stdin.setRawMode) process.stdin.setRawMode(true);
|
|
76
|
-
|
|
77
|
-
|
|
163
|
+
process.stdin.resume();
|
|
164
|
+
|
|
165
|
+
function cleanup(): void {
|
|
166
|
+
showCursor();
|
|
78
167
|
process.stdin.removeListener("keypress", onKey);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (key
|
|
85
|
-
|
|
168
|
+
if (process.stdin.setRawMode) process.stdin.setRawMode(wasRaw ?? false);
|
|
169
|
+
process.stdin.pause();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function onKey(_str: string | undefined, key: readline.Key): void {
|
|
173
|
+
if (!key) return;
|
|
174
|
+
if (key.ctrl && (key.name === "c" || key.name === "d")) {
|
|
175
|
+
cleanup();
|
|
86
176
|
process.stdout.write("\n");
|
|
87
177
|
process.exit(130); // SIGINT-equivalent
|
|
88
178
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
179
|
+
if (key.name === "up") {
|
|
180
|
+
cursor = cursor > 0 ? cursor - 1 : options.length - 1;
|
|
181
|
+
render();
|
|
182
|
+
} else if (key.name === "down") {
|
|
183
|
+
cursor = cursor < options.length - 1 ? cursor + 1 : 0;
|
|
184
|
+
render();
|
|
185
|
+
} else if (key.name === "return" || key.name === "space") {
|
|
186
|
+
cleanup();
|
|
187
|
+
process.stdout.write("\n");
|
|
188
|
+
resolve(options[cursor].value);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
96
192
|
process.stdin.on("keypress", onKey);
|
|
97
193
|
});
|
|
98
194
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,8734,89664,e=>{"use strict";var t=e.i(56420);let r=(0,t.default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",0,r],8734);let s=(0,t.default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",0,s],89664)},84026,29407,16306,e=>{"use strict";var t=e.i(56420);let r=(0,t.default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);e.s(["ShieldCheck",0,r],84026);let s=(0,t.default)("shield-x",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);e.s(["ShieldX",0,s],29407);let n=(0,t.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);e.s(["ShieldAlert",0,n],16306)},66794,8143,e=>{"use strict";let t=(0,e.i(56420).default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["Settings",0,t],66794);var r=e.i(95187);let s=(0,r.createServerReference)("60497a2493bce8a648e2631a59a53c15f4bdb0ab05",r.callServer,void 0,r.findSourceMapURL,"searchHookActivityAction");e.s(["searchHookActivityAction",0,s],8143)},34713,e=>{"use strict";e.s(["formatDuration",0,function(e){if(e<1e3)return`${e}ms`;let t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;let r=Math.floor(t/60);if(r>=60){let e=Math.floor(r/60);return`${e}h ${r%60}m`}let s=(t%60).toFixed(0);return`${r}m ${s}s`},"formatRelativeTime",0,function(e){let t=Date.now()-e;return t<6e4?`${Math.max(1,Math.floor(t/1e3))}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}])},24071,e=>{"use strict";let t=(0,e.i(56420).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",0,t],24071)},67927,e=>{"use strict";let t=(0,e.i(56420).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",0,t],67927)},73520,e=>{"use strict";var t=e.i(43476),r=e.i(24071),s=e.i(67927);e.s(["default",0,function({currentPage:e,totalPages:n,onPageChange:a}){if(n<=1)return null;let o=e=>`px-3 py-2 text-sm rounded-md transition-colors flex items-center gap-1 bg-muted text-muted-foreground ${e?"opacity-50 cursor-not-allowed":"hover:bg-muted/80"}`;return(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 py-4",children:[(0,t.jsxs)("button",{onClick:()=>a(e-1),disabled:1===e,className:o(1===e),"aria-label":"Previous page",children:[(0,t.jsx)(r.ChevronLeft,{className:"w-4 h-4"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:"Previous"})]}),(0,t.jsx)("div",{className:"flex items-center gap-1",children:(()=>{if(n<=7)return Array.from({length:n},(e,t)=>t+1);let t=[1],r=Math.max(2,e-1),s=Math.min(n-1,e+1);e<=3&&(s=Math.min(5,n-1)),e>=n-2&&(r=Math.max(2,n-4)),r>2&&t.push("ellipsis-start");for(let e=r;e<=s;e++)t.push(e);return s<n-1&&t.push("ellipsis-end"),t.push(n),t})().map(r=>"string"==typeof r?(0,t.jsx)("span",{className:"px-2 text-muted-foreground",children:"..."},r):(0,t.jsx)("button",{onClick:()=>a(r),className:`min-w-[2.5rem] px-3 py-2 text-sm rounded-md transition-colors ${e===r?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"}`,"aria-label":`Page ${r}`,"aria-current":e===r?"page":void 0,children:r},r))}),(0,t.jsxs)("button",{onClick:()=>a(e+1),disabled:e===n,className:o(e===n),"aria-label":"Next page",children:[(0,t.jsx)("span",{className:"hidden sm:inline",children:"Next"}),(0,t.jsx)(s.ChevronRight,{className:"w-4 h-4"})]})]})}])},80060,2711,e=>{"use strict";var t=e.i(18566),r=e.i(71645);function s(e){let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${s}`}function n(e){var t;if(!e||(t=e,!/^\d{4}-\d{2}-\d{2}$/.test(t)||isNaN(Date.parse(t))))return null;let[r,s,n]=e.split("-").map(Number);return new Date(r,s-1,n,12,0,0)}e.s(["useUrlParams",0,function(){let e=(0,t.useSearchParams)(),s=(0,t.useRouter)(),n=(0,t.usePathname)(),a=(0,r.useRef)(null),o=(0,r.useCallback)(t=>e.get(t),[e]),l=(0,r.useCallback)(()=>new URLSearchParams(e.toString()),[e]),i=(0,r.useCallback)(t=>{a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{let r=new URLSearchParams(e.toString());for(let[e,s]of Object.entries(t))void 0===s||""===s?r.delete(e):r.set(e,s);let a=r.toString(),o=a?`${n}?${a}`:n;s.replace(o,{scroll:!1})},150)},[e,n,s]);return(0,r.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),{get:o,getAll:l,setAll:i}}],80060),e.s(["dateRangeToParams",0,function(e){let t={};return e.from&&(t.from=s(e.from)),e.to&&(t.to=s(e.to)),t},"keywordsToParam",0,function(e){if(0!==e.length)return e.map(e=>encodeURIComponent(e)).join(",")},"pageToParam",0,function(e){return e<=1?void 0:String(e)},"paramToKeywords",0,function(e){return e?e.split(",").map(e=>decodeURIComponent(e.trim())).filter(e=>e.length>0):[]},"paramToPage",0,function(e){if(!e)return 1;let t=parseInt(e,10);return Number.isFinite(t)&&t>=1?t:1},"paramToPreset",0,function(e){return e&&["all","last-hour","today","last-7-days","last-30-days","custom"].includes(e)?e:"all"},"paramsToDateRange",0,function(e,t){return{from:n(e),to:n(t)}},"presetToParam",0,function(e){return"all"===e?void 0:e}],2711)},63676,e=>{"use strict";let t=(0,e.i(56420).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["X",0,t],63676)},64245,e=>{"use strict";var t=e.i(43476),r=e.i(71645),s=e.i(74080),n=e.i(22016),a=e.i(56420);let o=(0,a.default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var l=e.i(84026),i=e.i(29407),d=e.i(16306),c=e.i(82954),m=e.i(16327),u=e.i(8734),x=e.i(89664),p=e.i(66794);let h=(0,a.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);var f=e.i(63676),g=e.i(73520),b=e.i(95187);let j=(0,b.createServerReference)("40f97b827c15fe1b9e591dde54240690c4ac67fdff",b.callServer,void 0,b.findSourceMapURL,"getHookActivityAction");var v=e.i(8143);let y=(0,b.createServerReference)("00bdbd9d7e30af9d0ddf750da58501c124e1ed9aed",b.callServer,void 0,b.findSourceMapURL,"getHooksConfigAction"),N=(0,b.createServerReference)("60dbade700713edb71f8a5aa8734553cd42f0f0dc0",b.callServer,void 0,b.findSourceMapURL,"togglePolicyAction"),k=(0,b.createServerReference)("60cd3a7ccf6103e5092c5047696bada1d78b6986a0",b.callServer,void 0,b.findSourceMapURL,"installHooksWebAction"),w=(0,b.createServerReference)("604db2d0590ccf93e465f921ffa3b791a021ec4fc3",b.callServer,void 0,b.findSourceMapURL,"removeHooksWebAction"),S=(0,b.createServerReference)("60ffc57ea64ef3d9494abf73678eb30cfc09d02b8c",b.callServer,void 0,b.findSourceMapURL,"updatePolicyParamsAction");var C=e.i(85881),P=e.i(80060),T=e.i(2711),$=e.i(34713),R=e.i(67881);function A({sessionId:e,transcriptPath:r}){if(!e)return(0,t.jsx)("span",{className:"text-muted-foreground",children:"\\u2014"});let s=r?function(e){let t=e.replace(/\\/g,"/").split("/").filter(Boolean);if(t.length<2)return null;let r=t[t.length-2];return!r||r.startsWith(".")?null:r}(r):null,a=e?e.slice(0,8):"—";return s?(0,t.jsx)(n.default,{href:`/project/${encodeURIComponent(s)}/session/${encodeURIComponent(e)}`,className:"text-primary hover:underline font-mono",onClick:e=>e.stopPropagation(),children:a}):(0,t.jsx)("span",{className:"text-muted-foreground font-mono",children:a})}function M({decision:e}){return"deny"===e?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-red-500/10 text-red-400 border border-red-500/20",children:[(0,t.jsx)(i.ShieldX,{className:"h-3 w-3"}),"Deny"]}):"instruct"===e?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[(0,t.jsx)(d.ShieldAlert,{className:"h-3 w-3"}),"Instruct"]}):(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[(0,t.jsx)(l.ShieldCheck,{className:"h-3 w-3"}),"Allow"]})}function I({eventType:e}){return(0,t.jsx)("span",{className:"inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium bg-muted text-muted-foreground border border-border/50",children:e})}function E({integration:e}){if(!e)return null;let r="claude"===e?"Claude Code":"codex"===e?"OpenAI Codex":e,s="codex"===e;return(0,t.jsx)("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium border ${s?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-orange-500/10 text-orange-400 border-orange-500/20"}`,title:`Agent CLI: ${r}`,children:r})}function U({mode:e}){let r="default"===e;return(0,t.jsx)("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium border ${r?"bg-sky-500/10 text-sky-400 border-sky-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:e})}function F({ms:e}){return(0,t.jsx)("span",{className:`font-mono text-[0.7rem] ${e>500?"text-red-400":e>100?"text-amber-400":"text-muted-foreground"}`,children:e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`})}function D({text:e}){let[s,n]=(0,r.useState)(!1),a=async t=>{t.stopPropagation();try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),n(!0),setTimeout(()=>n(!1),1500)}};return(0,t.jsx)("button",{onClick:a,className:"inline-flex items-center justify-center h-5 w-5 rounded hover:bg-muted/50 text-muted-foreground hover:text-foreground transition-colors",title:"Copy",children:s?(0,t.jsx)(x.Check,{className:"h-3 w-3 text-emerald-400"}):(0,t.jsx)(u.Copy,{className:"h-3 w-3"})})}function L({value:e,onChange:r}){return(0,t.jsx)("div",{className:"inline-flex items-center rounded-md border border-border bg-muted/30 p-0.5",children:[{label:"All",value:""},{label:"Allow",value:"allow"},{label:"Instruct",value:"instruct"},{label:"Deny",value:"deny"}].map(s=>(0,t.jsx)("button",{onClick:()=>r(s.value),className:`px-2.5 py-1 text-[0.65rem] font-medium rounded transition-all ${e===s.value?"deny"===s.value?"bg-red-500/15 text-red-400 shadow-sm":"allow"===s.value?"bg-emerald-500/15 text-emerald-400 shadow-sm":"instruct"===s.value?"bg-amber-500/15 text-amber-400 shadow-sm":"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:s.label},s.value))})}function z({stats:e}){let r=e.totalEvents>0?(e.denyCount/e.totalEvents*100).toFixed(0):"0";return(0,t.jsxs)("div",{className:"flex items-center gap-6 text-[0.7rem] text-muted-foreground",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-foreground font-mono font-semibold",children:e.totalEvents})," total events"]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{className:`font-mono font-semibold ${e.denyCount>0?"text-red-400":"text-foreground"}`,children:[r,"%"]})," ","deny rate"]}),(0,t.jsxs)("div",{className:"hidden sm:block",children:["top policy:"," ",(0,t.jsx)("span",{className:"font-mono text-foreground",children:e.topPolicy??"—"})]})]})}function O({item:e}){return(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:10,className:"px-0 py-0",children:(0,t.jsxs)("div",{className:"px-6 py-3 bg-muted/20 border-t border-border/30 space-y-2 text-xs animate-expand",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-1.5",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Session ID: "}),(0,t.jsx)("span",{className:"font-mono text-foreground",children:e.sessionId??"—"}),e.sessionId&&(0,t.jsx)(D,{text:e.sessionId})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"CWD: "}),(0,t.jsx)("span",{className:"font-mono text-foreground",children:e.cwd??"—"}),e.cwd&&(0,t.jsx)(D,{text:e.cwd})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Transcript: "}),(0,t.jsx)("span",{className:"font-mono text-foreground break-all",children:e.transcriptPath??"—"})]})]}),e.policyNames&&e.policyNames.length>1&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Policies: "}),(0,t.jsx)("span",{className:"font-mono text-foreground",children:e.policyNames.join(", ")})]}),e.reason&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Full reason: "}),(0,t.jsx)("span",{className:"text-foreground",children:e.reason})]})]})})})}function B({hooksInstalled:e,onSwitchTab:s}){let{intervalSec:n}=(0,C.useAutoRefresh)(),a=(0,P.useUrlParams)(),o=(0,r.useRef)(!1),[l,i]=(0,r.useState)(()=>(0,T.paramToPage)(a.get("page"))),[d,u]=(0,r.useState)(null),[x,p]=(0,r.useState)(null),[h,f]=(0,r.useState)(()=>{let e=a.get("decision");return"allow"===e||"deny"===e||"instruct"===e?e:""}),[b,y]=(0,r.useState)(()=>a.get("event")??""),[N,k]=(0,r.useState)(()=>a.get("policy")??""),[w,S]=(0,r.useState)(()=>a.get("session")??""),R=(0,r.useRef)(null),D=(0,r.useRef)({filterDecision:h,filterEventType:b,filterPolicy:N,filterSessionId:w});D.current={filterDecision:h,filterEventType:b,filterPolicy:N,filterSessionId:w},(0,r.useEffect)(()=>{if(!o.current){o.current=!0;return}a.setAll({decision:h||void 0,event:b||void 0,policy:N||void 0,session:w||void 0,page:(0,T.pageToParam)(l)})},[h,b,N,w,l]);let H=""!==h||""!==b||""!==N||""!==w,X=(0,r.useCallback)(async e=>{try{let t,{filterDecision:r,filterEventType:s,filterPolicy:n,filterSessionId:a}=D.current;t=""!==r||""!==s||""!==n||""!==a?await (0,v.searchHookActivityAction)({decision:r||void 0,eventType:s||void 0,policyName:n||void 0,sessionId:a||void 0},e):await j(e),u(t)}catch{}},[]);(0,r.useEffect)(()=>{X(l);let e=setInterval(()=>X(l),n>0?1e3*n:5e3);return()=>clearInterval(e)},[l,X,n]),(0,r.useEffect)(()=>(R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{i(1),p(null),X(1)},300),()=>{R.current&&clearTimeout(R.current)}),[h,b,N,w]);let W=d?.entries??[],q=d?.totalPages??1;return(0,t.jsxs)(t.Fragment,{children:[d?.stats&&d.stats.totalEvents>0&&(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsx)(z,{stats:d.stats})}),(0,t.jsxs)("div",{className:"bg-card border border-border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4 py-2.5 border-b border-border bg-muted/20",children:[(0,t.jsx)(L,{value:h,onChange:f}),(0,t.jsxs)("select",{value:b,onChange:e=>y(e.target.value),className:"h-7 rounded-md border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary/40 transition-shadow",children:[(0,t.jsx)("option",{value:"",children:"All Events"}),(0,t.jsx)("option",{value:"PreToolUse",children:"PreToolUse"}),(0,t.jsx)("option",{value:"PostToolUse",children:"PostToolUse"}),(0,t.jsx)("option",{value:"SessionStart",children:"SessionStart"}),(0,t.jsx)("option",{value:"SessionEnd",children:"SessionEnd"}),(0,t.jsx)("option",{value:"UserPromptSubmit",children:"UserPromptSubmit"}),(0,t.jsx)("option",{value:"PermissionRequest",children:"PermissionRequest"})]}),(0,t.jsx)("div",{className:"relative",children:(0,t.jsx)("input",{type:"text",value:N,onChange:e=>k(e.target.value),placeholder:"Filter by policy\\u2026",className:"h-7 rounded-md border border-border bg-background px-2.5 text-xs text-foreground placeholder:text-muted-foreground w-44 focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary/40 transition-shadow"})}),(0,t.jsx)("div",{className:"relative",children:(0,t.jsx)("input",{type:"text",value:w,onChange:e=>S(e.target.value),placeholder:"Filter by session…",className:"h-7 rounded-md border border-border bg-background px-2.5 text-xs text-foreground placeholder:text-muted-foreground w-44 focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary/40 transition-shadow"})})]}),0===W.length?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center",children:[(0,t.jsx)(c.Shield,{className:"h-12 w-12 text-muted-foreground/30"}),!1===e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"text-sm text-muted-foreground mt-4 font-medium",children:"Policies are not installed"}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:["Go to the"," ",(0,t.jsx)("button",{className:"underline hover:text-foreground transition-colors",onClick:()=>s?.("policies"),children:"Policies tab"})," ","and click ",(0,t.jsx)("span",{className:"font-mono bg-muted px-1 rounded",children:"Install"})," to enable policy monitoring."]})]}):(0,t.jsx)("p",{className:"text-sm text-muted-foreground mt-4",children:H?"No matching activity.":"Waiting for hook events…"})]}):(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-xs",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-muted-foreground border-b border-border bg-muted/30",children:[(0,t.jsx)("th",{className:"px-4 py-2.5 font-medium w-6"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Decision"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Event"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"CLI"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Tool"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Policy"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Reason"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Duration"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Session"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Mode"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium text-right",children:"Time"})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border/30",children:W.map((e,s)=>{let n="deny"===e.decision,a=x===s,o="instruct"===e.decision;return(0,t.jsxs)(r.default.Fragment,{children:[(0,t.jsxs)("tr",{onClick:()=>{p(e=>e===s?null:s)},className:`cursor-pointer transition-colors ${n?"bg-red-500/[0.03] hover:bg-red-500/[0.07] border-l-2 border-l-red-500/40":o?"bg-amber-500/[0.03] hover:bg-amber-500/[0.07] border-l-2 border-l-amber-500/40":s%2==0?"hover:bg-muted/30":"bg-muted/[0.04] hover:bg-muted/30"} ${a?"bg-muted/20":""}`,children:[(0,t.jsx)("td",{className:"px-4 py-2",children:(0,t.jsx)(m.ChevronDown,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform duration-150 ${a?"rotate-0":"-rotate-90"}`})}),(0,t.jsx)("td",{className:"px-3 py-2",children:(0,t.jsx)(M,{decision:e.decision})}),(0,t.jsx)("td",{className:"px-3 py-2",children:(0,t.jsx)(I,{eventType:e.eventType})}),(0,t.jsx)("td",{className:"px-3 py-2",children:(0,t.jsx)(E,{integration:e.integration})}),(0,t.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:e.toolName??"—"}),(0,t.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:e.policyNames&&e.policyNames.length>1?(0,t.jsxs)("span",{title:e.policyNames.join(", "),children:[e.policyNames[0],(0,t.jsxs)("span",{className:"text-muted-foreground text-[0.6rem]",children:[" +",e.policyNames.length-1]})]}):e.policyName??"—"}),(0,t.jsx)("td",{className:"px-3 py-2 text-muted-foreground truncate max-w-[240px]",title:e.reason??"",children:e.reason??"—"}),(0,t.jsx)("td",{className:"px-3 py-2",children:(0,t.jsx)(F,{ms:e.durationMs})}),(0,t.jsx)("td",{className:"px-3 py-2",title:e.sessionId??"",children:(0,t.jsx)(A,{sessionId:e.sessionId,transcriptPath:e.transcriptPath})}),(0,t.jsx)("td",{className:"px-3 py-2",children:e.permissionMode?(0,t.jsx)(U,{mode:e.permissionMode}):"—"}),(0,t.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground whitespace-nowrap",title:new Date(e.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),children:(0,$.formatRelativeTime)(e.timestamp)})]}),a&&(0,t.jsx)(O,{item:e})]},`${e.timestamp}-${s}`)})})]})}),(0,t.jsx)(g.default,{currentPage:l,totalPages:q,onPageChange:e=>{i(e),p(null)}})]})]})}function H({enabled:e,onChange:r,disabled:s}){return(0,t.jsx)("button",{onClick:r,disabled:s,className:`relative inline-flex h-4 w-7 shrink-0 items-center rounded-full transition-colors disabled:opacity-40 ${e?"bg-emerald-500":"bg-muted-foreground/30"}`,"aria-label":e?"Disable policy":"Enable policy",children:(0,t.jsx)("span",{className:`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform ${e?"translate-x-3.5":"translate-x-0.5"}`})})}function X({policy:e,onClose:s,onSave:n}){let a=e.params??{},o=e.currentParams??{},[l,i]=(0,r.useState)(()=>{let e={};for(let[t,r]of Object.entries(a)){let s=t in o?o[t]:r.default;e[t]=s}return e});(0,r.useEffect)(()=>{let e=e=>{"Escape"===e.key&&s()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[s]);let d=(e,t)=>{i(r=>({...r,[e]:t}))};return(0,t.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:e=>{e.target===e.currentTarget&&s()},children:(0,t.jsxs)("div",{className:"bg-card border border-border rounded-lg shadow-xl w-full max-w-lg mx-4 max-h-[80vh] flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-mono font-semibold text-foreground",children:e.name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.description})]}),(0,t.jsx)("button",{onClick:s,className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,t.jsx)(f.X,{className:"h-4 w-4"})})]}),(0,t.jsx)("div",{className:"overflow-y-auto flex-1 px-4 py-4 space-y-4",children:Object.entries(a).map(([e,r])=>(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-semibold text-foreground mb-1 font-mono",children:e}),(0,t.jsx)("p",{className:"text-[0.65rem] text-muted-foreground mb-1.5",children:r.description}),((e,r)=>{let s=l[e];if("boolean"===r.type)return(0,t.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:!!s,onChange:t=>d(e,t.target.checked),className:"rounded border-border"}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:r.description})]});if("number"===r.type)return(0,t.jsx)("input",{type:"number",value:"number"==typeof s?s:"",onChange:t=>d(e,Number(t.target.value)),className:"w-full h-7 rounded border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40"});if("string[]"===r.type){let r=Array.isArray(s)?s.join("\n"):"";return(0,t.jsx)("textarea",{value:r,onChange:t=>d(e,t.target.value.split("\n").filter(e=>""!==e.trim())),rows:4,placeholder:"One entry per line",className:"w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground font-mono focus:outline-none focus:ring-2 focus:ring-primary/40 resize-y"})}if("pattern[]"===r.type){let r=Array.isArray(s)?s:[];return(0,t.jsxs)("div",{className:"space-y-1.5",children:[r.map((s,n)=>(0,t.jsxs)("div",{className:"flex gap-1.5 items-center",children:[(0,t.jsx)("input",{type:"text",value:s.regex,onChange:t=>{let s=[...r];s[n]={...s[n],regex:t.target.value},d(e,s)},placeholder:"regex",className:"flex-1 h-6 rounded border border-border bg-background px-2 text-xs font-mono focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,t.jsx)("input",{type:"text",value:s.label,onChange:t=>{let s=[...r];s[n]={...s[n],label:t.target.value},d(e,s)},placeholder:"label",className:"flex-1 h-6 rounded border border-border bg-background px-2 text-xs focus:outline-none focus:ring-2 focus:ring-primary/40"}),(0,t.jsx)("button",{onClick:()=>d(e,r.filter((e,t)=>t!==n)),className:"text-muted-foreground/50 hover:text-destructive transition-colors",children:(0,t.jsx)(f.X,{className:"h-3.5 w-3.5"})})]},n)),(0,t.jsx)("button",{onClick:()=>d(e,[...r,{regex:"",label:""}]),className:"text-xs text-primary hover:underline",children:"+ Add pattern"})]})}return(0,t.jsx)("input",{type:"text",value:"string"==typeof s?s:"",onChange:t=>d(e,t.target.value),className:"w-full h-7 rounded border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40"})})(e,r)]},e))}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[(0,t.jsx)(R.Button,{variant:"outline",size:"sm",onClick:s,className:"h-7 text-xs",children:"Cancel"}),(0,t.jsx)(R.Button,{size:"sm",onClick:()=>n(l),className:"h-7 text-xs",children:"Save"})]})]})})}function W({message:e,onDismiss:r,onInstall:n,isPending:a}){return(0,s.createPortal)((0,t.jsxs)("div",{className:"fixed top-4 right-4 z-[9999] w-full max-w-sm",style:{animation:"slideInFromRight 0.25s ease-out"},children:[(0,t.jsx)("style",{children:`
|
|
2
|
-
@keyframes slideInFromRight {
|
|
3
|
-
from { transform: translateX(calc(100% + 1rem)); opacity: 0; }
|
|
4
|
-
to { transform: translateX(0); opacity: 1; }
|
|
5
|
-
}
|
|
6
|
-
`}),(0,t.jsxs)("div",{className:"rounded-lg border border-red-500/40 bg-red-950/95 shadow-2xl shadow-red-900/40 overflow-hidden backdrop-blur-sm",children:[(0,t.jsx)("div",{className:"h-0.5 w-full bg-gradient-to-r from-red-600 via-red-400 to-red-600"}),(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"shrink-0 mt-0.5 flex h-5 w-5 items-center justify-center rounded-full bg-red-500 ring-2 ring-red-500/30",children:(0,t.jsx)(f.X,{className:"h-3 w-3 text-white",strokeWidth:3})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"text-[0.65rem] font-bold uppercase tracking-widest text-red-400 mb-0.5",children:"Error"}),(0,t.jsx)("p",{className:"text-sm text-red-100 leading-snug",children:e})]}),(0,t.jsx)("button",{onClick:r,className:"shrink-0 -mt-0.5 -mr-0.5 rounded p-0.5 text-red-400/60 transition-colors hover:bg-red-500/20 hover:text-red-200","aria-label":"Dismiss",children:(0,t.jsx)(f.X,{className:"h-4 w-4"})})]}),(0,t.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,t.jsx)(R.Button,{size:"sm",onClick:()=>{r(),n()},disabled:a,className:"h-7 flex-1 border-0 bg-red-500 px-3 text-xs font-semibold text-white hover:bg-red-400 disabled:opacity-50",children:"Install hooks"}),(0,t.jsx)(R.Button,{variant:"ghost",size:"sm",onClick:r,className:"h-7 px-3 text-xs text-red-400 hover:bg-red-500/10 hover:text-red-200",children:"Dismiss"})]})]})]})]}),document.body)}function q({onHooksInstallChange:e}){let[s,n]=(0,r.useState)(null),[a,o]=(0,r.useTransition)(),[l,i]=(0,r.useState)(null),[d,m]=(0,r.useState)(null),[u,x]=(0,r.useState)(null),f=(0,r.useCallback)(async()=>{try{let t=await y();n(t),e?.(t.installedScopes.length>0)}catch{}},[e]);(0,r.useEffect)(()=>{f()},[f]);let g=()=>{o(async()=>{try{i(null),await k("user"),await f()}catch(e){i(e instanceof Error?e.message:"Failed to install hooks.")}})};if(!s)return(0,t.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:"Loading\\u2026"})});let b=s.installedScopes.length>0,j=Array.from(new Set(s.policies.map(e=>e.category)));return(0,t.jsxs)(t.Fragment,{children:[u&&(0,t.jsx)(X,{policy:u,onClose:()=>x(null),onSave:e=>{if(!u)return;let t=u.name;x(null),o(async()=>{try{i(null),await S(t,e),await f()}catch(e){i(e instanceof Error?e.message:"Failed to save configuration.")}})}}),(0,t.jsxs)("div",{className:"bg-card border border-border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-muted/10",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsx)("span",{className:`h-2 w-2 rounded-full shrink-0 ${b?"bg-emerald-500":"bg-muted-foreground/50"}`}),(0,t.jsx)("span",{className:"text-sm text-foreground",children:b?"Policies installed":"Policies not installed"}),b&&(0,t.jsxs)("span",{className:"text-xs text-muted-foreground font-mono hidden sm:inline",children:["· ",s.installedScopes.join(", ")," scope · ",s.settingsPath]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[b&&(0,t.jsx)(R.Button,{variant:"outline",size:"sm",onClick:()=>{o(async()=>{try{i(null),await w("user"),await f()}catch(e){i(e instanceof Error?e.message:"Failed to remove hooks.")}})},disabled:a,className:"text-xs h-7 px-3",children:"Remove"}),(0,t.jsx)(R.Button,{variant:b?"outline":"default",size:"sm",onClick:g,disabled:a,className:"text-xs h-7 px-3",children:b?"Reinstall":"Install policies"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border/40 bg-muted/5",children:[(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,t.jsx)("span",{className:"font-semibold text-foreground",children:s.enabledPolicies.length})," / ",s.policies.length+(s.customPolicies?.length??0)," ","policies enabled"]}),b&&(0,t.jsxs)("span",{className:"text-[0.65rem] text-muted-foreground/60",children:["· active in ",s.installedScopes.join(", ")," scope"]})]}),l&&(0,t.jsx)("div",{className:"px-4 py-2 bg-red-500/10 border-b border-red-500/20 text-xs text-red-400",children:l}),d&&(0,t.jsx)(W,{message:d,onDismiss:()=>m(null),onInstall:g,isPending:a}),j.map(e=>{let r=s.policies.filter(t=>t.category===e),l=r.filter(e=>e.enabled).length;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border/50",children:[(0,t.jsx)("span",{className:"text-[0.7rem] font-semibold uppercase tracking-wider text-muted-foreground",children:e}),(0,t.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground",children:[l," / ",r.length," enabled"]})]}),r.map(e=>(0,t.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 border-b border-border/20 hover:bg-muted/20 transition-colors",children:[(0,t.jsx)("div",{className:"mt-0.5 shrink-0",children:(0,t.jsx)(H,{enabled:e.enabled,onChange:()=>{var t,r;return t=e.name,r=e.enabled,void(!s||(!(s.installedScopes.length>0)?m("Policies are not installed. Install policies to continue."):(m(null),n(e=>e?{...e,policies:e.policies.map(e=>e.name===t?{...e,enabled:!r}:e),enabledPolicies:r?e.enabledPolicies.filter(e=>e!==t):[...e.enabledPolicies,t]}:e),o(async()=>{try{await N(t,!r)}catch{i("Failed to save policy change."),f()}}))))},disabled:a})}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0 w-56 shrink-0 mt-0.5",children:[(0,t.jsx)("span",{className:"text-xs font-mono text-foreground truncate",children:e.name}),e.beta&&(0,t.jsx)("span",{className:"shrink-0 text-[0.6rem] px-1 py-0.5 rounded border bg-violet-500/10 text-violet-400 border-violet-500/20",children:"beta"})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground leading-relaxed",children:e.description}),e.eventScope&&(0,t.jsx)("span",{className:"block text-[0.65rem] text-muted-foreground/40 font-mono mt-0.5 hidden lg:block",children:e.eventScope}),e.params&&Object.keys(e.params).length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mt-1.5",children:Object.entries(e.params).map(([r,s])=>{let n=e.currentParams?.[r]??s.default,a=JSON.stringify(n)!==JSON.stringify(s.default);return(0,t.jsxs)("span",{className:`inline-flex items-center gap-1 font-mono text-[0.6rem] px-1.5 py-0.5 rounded border ${a?"bg-primary/10 text-primary/70 border-primary/20":"bg-muted/40 text-muted-foreground/55 border-border/40"}`,children:[(0,t.jsxs)("span",{className:"opacity-70",children:[r,":"]}),(0,t.jsx)("span",{children:function(e,t){if("string[]"===e||"pattern[]"===e){let r=Array.isArray(t)?t:[];return 0===r.length?"none":"pattern[]"===e?`${r.length} pattern${1!==r.length?"s":""}`:1===r.length?String(r[0]).slice(0,24):`${r.length} values`}return"boolean"===e?t?"on":"off":null==t||""===t?"—":String(t).slice(0,32)}(s.type,n)})]},r)})})]}),e.params&&Object.keys(e.params).length>0&&(0,t.jsx)("button",{className:"shrink-0 mt-0.5 text-muted-foreground hover:text-primary transition-colors",onClick:()=>x(e),title:"Edit parameters",children:(0,t.jsx)(p.Settings,{className:"h-3.5 w-3.5"})})]},e.name))]},e)}),s.customPoliciesPath&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border/50",children:[(0,t.jsx)("span",{className:"text-[0.7rem] font-semibold uppercase tracking-wider text-muted-foreground",children:"Custom Policies"}),(0,t.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground",children:[s.customPolicies?.length??0," detected"]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border/20",children:[(0,t.jsx)(h,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:s.customPoliciesPath})]}),(0,t.jsxs)("div",{className:"flex items-start gap-2 px-4 py-2.5 border-b border-border/20 bg-muted/10",children:[(0,t.jsx)(c.Shield,{className:"h-3.5 w-3.5 text-muted-foreground/60 shrink-0 mt-0.5"}),(0,t.jsx)("p",{className:"text-[0.7rem] text-muted-foreground/70 leading-relaxed",children:"Custom policies are always active. To add, remove, or reorder them, edit the JS file above."})]}),s.customPolicies?.map(e=>(0,t.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 border-b border-border/20 hover:bg-muted/20 transition-colors",children:[(0,t.jsx)("div",{className:"h-4 w-7 shrink-0 mt-0.5"}),(0,t.jsx)("div",{className:"flex items-center gap-1.5 min-w-0 w-56 shrink-0 mt-0.5",children:(0,t.jsx)("span",{className:"text-xs font-mono text-foreground truncate",children:e.name})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[e.description&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground leading-relaxed",children:e.description}),e.eventScope&&(0,t.jsx)("span",{className:"block text-[0.65rem] text-muted-foreground/40 font-mono mt-0.5 hidden lg:block",children:e.eventScope})]})]},e.name))]})]})]})}function V({activeTab:e,onChange:r}){return(0,t.jsx)("div",{className:"inline-flex items-center rounded-md border border-border bg-muted/30 p-0.5 mb-5",children:[{id:"activity",label:"Activity"},{id:"policies",label:"Configure"}].map(s=>(0,t.jsx)("button",{onClick:()=>r(s.id),className:`px-3 py-1.5 text-xs font-medium rounded transition-all ${e===s.id?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:s.label},s.id))})}e.s(["default",0,function({initialTab:e="activity"}){let s=(0,P.useUrlParams)(),[a,l]=(0,r.useState)(e),[i,d]=(0,r.useState)(void 0),[c,m]=(0,r.useState)(null);(0,r.useEffect)(()=>{y().then(e=>{d(e.installedScopes.length>0),m({enabled:e.enabledPolicies.length,total:e.policies.length+(e.customPolicies?.length??0)})}).catch(()=>d(void 0))},[]);let u=e=>{l(e),s.setAll({tab:"activity"===e?void 0:e})};return(0,t.jsxs)("div",{className:"min-h-screen bg-background px-4 py-6 sm:px-6 lg:px-10",children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsxs)(n.default,{href:"/projects",className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,t.jsx)(o,{className:"h-3.5 w-3.5"}),"Back"]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold text-foreground tracking-tight",children:"Policies"}),"activity"===a&&(0,t.jsxs)("span",{className:"relative flex h-2.5 w-2.5 mt-0.5",children:[(0,t.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex rounded-full h-2.5 w-2.5 bg-emerald-500"})]})]}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"activity"===a?(0,t.jsxs)(t.Fragment,{children:["Policy evaluations for Claude",c&&(0,t.jsxs)("span",{className:"text-muted-foreground/60",children:[" · ","enabled policies"," ",(0,t.jsxs)("span",{className:"font-mono text-foreground/70",children:[c.enabled,"/",c.total]})]}),(0,t.jsxs)("span",{className:"block text-xs text-muted-foreground/50 mt-0.5",children:["To configure policies,"," ",(0,t.jsx)("button",{className:"underline underline-offset-2 hover:text-foreground transition-colors",onClick:()=>u("policies"),children:"go here"})]})]}):"Configure Policies"})]}),(0,t.jsx)(V,{activeTab:a,onChange:u}),"activity"===a?(0,t.jsx)(B,{hooksInstalled:i,onSwitchTab:u}):(0,t.jsx)(q,{onHooksInstallChange:d})]})}],64245)}]);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|