failproofai 1.0.12-beta.1 → 1.0.12-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +2 -2
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +3 -3
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
- package/.next/standalone/.next/server/app/policies/page.js +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.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +8 -8
- package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/_0tovk6q0miud6._.js +1 -1
- package/.next/standalone/.next/server/chunks/_0trp3ycqv17cl._.js +1 -1
- package/.next/standalone/.next/server/chunks/_1ek68lnh2daur._.js +2 -2
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4vkpxxu7._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_hooks_0_em82s16zfym._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__00l2u6j86cb8y._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__08ch3staq3ejw._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0bigvy9xmv2ka._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h86bl2qf0k_o._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0pia5h3p8re4c._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0pwj2h2efe5f-._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1-ey9fgesfbc0._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__15usvs-ms-0hf._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__16gb3_92zvk5x._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1avi2kypusyb_._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1r7drlqli-ado._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0b78b0j8iyv6l._.js → [root-of-the-server]__1vofkb2oq7p7e._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0bseae9u7g98r._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0eoura3_9gjb-._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0mouhaflye1ro._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_1a3tubds7s7ow._.js → _0ouu886szh6yj._.js} +4 -4
- package/.next/standalone/.next/server/chunks/ssr/_0pedwblqdoh58._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1djqs9i27e4kg._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1fw0_nzkae5ao._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_20hn4gn87nsjc._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo5_vm5f.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9snixb5fd-._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47q0xq5w._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_components_project-list_tsx_1ke6anr0vt64h._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x33jqb6._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpcz0uxur._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h47jmhhd._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_html-to-image_es_index_1i8oid1gc7s1f.js → node_modules_html-to-image_es_index_1fv03uigni8s5.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_0janj0i6dqko7._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/package_json_[json]_cjs_013tntikdft59._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_0agdmptetetdt._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_0mdwgjisv4fub._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-config_ts_04t589gp4p60j._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_pack-cli_ts_0t7me658zqmh_._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/preview-props.json +3 -3
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +23 -23
- package/.next/standalone/.next/static/chunks/{2-tf6_7u623kd.js → 0ay__-d2h1xb5.js} +1 -1
- package/.next/standalone/.next/static/chunks/{18433qz-8njv3.js → 0tbm3vjm62h-2.js} +1 -1
- package/.next/standalone/.next/static/chunks/{1b32-afqacaen.js → 1c_jf6g5wnslk.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0_zfad4co-t2z.js → 1my3-5p47t7r-.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0jutamwqz8pg5.js → 20py8k1gd_i1m.js} +1 -1
- package/.next/standalone/.next/static/chunks/21hckpmsc4g70.js +6 -0
- package/.next/standalone/.next/static/chunks/2hmex93ppj1ke.js +1 -0
- package/.next/standalone/.next/static/chunks/{42e8zab314654.js → 2o6d37j425uci.js} +1 -1
- package/.next/standalone/.next/static/chunks/40oworn_-x12p.js +1 -0
- package/.next/standalone/.next/static/chunks/{24w3x2da9sk49.js → 42xptz88mtq3x.js} +1 -1
- package/.next/standalone/app/actions/update-jev-config.ts +5 -3
- package/.next/standalone/app/settings/jev-panel.tsx +1 -1
- package/.next/standalone/fp-cloud-cli/CHANGELOG.md +9 -18
- package/.next/standalone/fp-cloud-cli/README.md +7 -9
- package/.next/standalone/fp-cloud-cli/fp_cli/client.py +1 -27
- package/.next/standalone/fp-cloud-cli/fp_cli/commands/fleet_cmds.py +12 -216
- package/.next/standalone/fp-cloud-cli/fp_cli/enforcement.py +7 -53
- package/.next/standalone/fp-cloud-cli/fp_cli/output.py +2 -71
- package/.next/standalone/fp-cloud-cli/skill/SKILL.md +1 -1
- package/.next/standalone/fp-cloud-cli/skill/references/commands.md +6 -7
- package/.next/standalone/fp-cloud-cli/tests/test_cloud_jev.py +32 -197
- package/.next/standalone/hermes-plugin/__init__.py +11 -0
- package/.next/standalone/hermes-plugin/plugin.yaml +1 -1
- package/.next/standalone/package.json +11 -10
- package/.next/standalone/sdk/python/uv.lock +31 -8
- package/.next/standalone/server.js +1 -1
- package/dist/cli.mjs +1686 -612
- package/dist/worker.mjs +354 -49
- package/hermes-plugin/__init__.py +11 -0
- package/hermes-plugin/plugin.yaml +1 -1
- package/package.json +11 -10
- package/src/audit/open-browser.ts +24 -7
- package/src/hooks/agent-roster.ts +9 -1
- package/src/hooks/agent-skill.ts +203 -0
- package/src/hooks/cloud-connection.ts +27 -51
- package/src/hooks/cloud-introspect.ts +5 -2
- package/src/hooks/cloud-login.ts +248 -0
- package/src/hooks/cloud-managed-policies.ts +54 -4
- package/src/hooks/codex-system-hooks.ts +10 -4
- package/src/hooks/config-status.ts +9 -3
- package/src/hooks/configure-wizard.ts +356 -32
- package/src/hooks/delivery-health.ts +47 -2
- package/src/hooks/effective-reviewers.ts +14 -0
- package/src/hooks/fp-config.ts +19 -0
- package/src/hooks/handler.ts +21 -2
- package/src/hooks/hook-activity-store.ts +7 -1
- package/src/hooks/integrations.ts +18 -3
- package/src/hooks/jev-activity.ts +117 -1
- package/src/hooks/jev-cli.ts +7 -9
- package/src/hooks/manager.ts +80 -46
- package/src/hooks/policy-evaluator.ts +17 -0
- package/src/hooks/policy-reviewability.ts +4 -2
- package/src/hooks/semantic/cloud-jev.ts +219 -28
- package/src/hooks/semantic/combine.ts +26 -1
- package/src/hooks/semantic/jev-client.ts +1 -1
- package/src/hooks/semantic/jev-config.ts +6 -27
- package/src/hooks/semantic/jev-review.ts +90 -2
- package/src/hooks/tui.ts +280 -0
- package/src/hooks/uninstall-cli.ts +12 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0588st-tpiuia._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_128ebxr83nk6g._.js +0 -3
- package/.next/standalone/.next/static/chunks/114hbolvrv94e.js +0 -1
- package/.next/standalone/.next/static/chunks/1p-hsi58i-6h0.js +0 -6
- package/.next/standalone/.next/static/chunks/3-pku9qwv1yfu.js +0 -1
- /package/.next/standalone/.next/static/{xq8UgF5yFxty1VWxY2hyn → LHCtFxVG0mdvd4lsXAOFC}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{xq8UgF5yFxty1VWxY2hyn → LHCtFxVG0mdvd4lsXAOFC}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{xq8UgF5yFxty1VWxY2hyn → LHCtFxVG0mdvd4lsXAOFC}/_ssgManifest.js +0 -0
package/src/hooks/tui.ts
CHANGED
|
@@ -1348,6 +1348,286 @@ export function promptCloudKey(opts: CloudKeyPromptOptions): Promise<CloudKeyAns
|
|
|
1348
1348
|
});
|
|
1349
1349
|
}
|
|
1350
1350
|
|
|
1351
|
+
/** What starting a browser login produced. */
|
|
1352
|
+
export type BrowserLoginStart =
|
|
1353
|
+
| { ok: true; url: string; expiresIn: number; interval: number }
|
|
1354
|
+
/** `retryable` is false when trying again cannot help — an older server. The
|
|
1355
|
+
* screen then leaves at once (`BACK`), so `line` is for the caller to show. */
|
|
1356
|
+
| { ok: false; line: string; retryable: boolean };
|
|
1357
|
+
|
|
1358
|
+
/** One "approved yet?" answer. */
|
|
1359
|
+
export type BrowserLoginPoll<T> =
|
|
1360
|
+
| { state: "pending"; interval?: number }
|
|
1361
|
+
| { state: "slow_down" }
|
|
1362
|
+
| { state: "approved"; value: T }
|
|
1363
|
+
| { state: "denied" }
|
|
1364
|
+
| { state: "expired" }
|
|
1365
|
+
/** Could not ask. Polling goes on: a dropped connection is not a refusal. */
|
|
1366
|
+
| { state: "unreachable"; line: string };
|
|
1367
|
+
|
|
1368
|
+
export interface BrowserLoginOptions<T> {
|
|
1369
|
+
/** The heading, e.g. "Connect to cloud". */
|
|
1370
|
+
message: string;
|
|
1371
|
+
/** Grey text after the heading: the host the login goes to. */
|
|
1372
|
+
meta?: string;
|
|
1373
|
+
/** What is being connected, as the link and the browser page will name it. */
|
|
1374
|
+
machineLabel: string;
|
|
1375
|
+
start: () => Promise<BrowserLoginStart>;
|
|
1376
|
+
poll: () => Promise<BrowserLoginPoll<T>>;
|
|
1377
|
+
/** Try to open the link; false means "print it, do not open" (SSH, no display). */
|
|
1378
|
+
open: (url: string) => boolean;
|
|
1379
|
+
/** The lines the screen collapses to once approved. */
|
|
1380
|
+
collapsed: (value: T) => string[];
|
|
1381
|
+
stdin?: TTYIn;
|
|
1382
|
+
stdout?: TTYOut;
|
|
1383
|
+
/** Injectable clock, for tests. */
|
|
1384
|
+
now?: () => number;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
/** The poll interval after a `slow_down`: two seconds slower, up to 10 — and
|
|
1388
|
+
* never faster, so a server already asking for more than 10 keeps its number. */
|
|
1389
|
+
export function slowedDown(interval: number): number {
|
|
1390
|
+
return Math.max(interval, Math.min(10, interval + 2));
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
/**
|
|
1394
|
+
* Wait for a person to finish logging in, in a browser.
|
|
1395
|
+
*
|
|
1396
|
+
* Gets a link, opens it (or prints it where a browser cannot be opened — the
|
|
1397
|
+
* link works from any device, so an SSH session needs nothing else), then polls
|
|
1398
|
+
* until the request is approved, refused or expired. Nothing is typed here: the
|
|
1399
|
+
* account side happens entirely in the browser.
|
|
1400
|
+
*
|
|
1401
|
+
* Resolves `{ value }` once approved, `BACK` on Tab or Esc (the caller's menu
|
|
1402
|
+
* of other options is the way on), or `null` on Ctrl-C. An expired or refused
|
|
1403
|
+
* link offers a fresh one on Enter rather than ending the screen. A start that
|
|
1404
|
+
* cannot work here (`retryable: false`) resolves `BACK` straight away: there is
|
|
1405
|
+
* nothing to retry, so the caller says why above its options.
|
|
1406
|
+
*
|
|
1407
|
+
* The link is printed ABOVE the live region, not inside it: the region is
|
|
1408
|
+
* repainted and cut to the terminal width, and a link that is cut cannot be
|
|
1409
|
+
* clicked or copied. Leaving with `BACK` erases it again, wrapped rows
|
|
1410
|
+
* included: a link nobody is polling any more must not sit above the menu
|
|
1411
|
+
* looking live.
|
|
1412
|
+
*/
|
|
1413
|
+
export function promptBrowserLogin<T>(opts: BrowserLoginOptions<T>): Promise<{ value: T } | Back | null> {
|
|
1414
|
+
const stdin: TTYIn = opts.stdin ?? process.stdin;
|
|
1415
|
+
const stdout: TTYOut = opts.stdout ?? process.stdout;
|
|
1416
|
+
if (!stdin.isTTY || !stdout.isTTY) return Promise.resolve(null);
|
|
1417
|
+
|
|
1418
|
+
const now = opts.now ?? Date.now;
|
|
1419
|
+
const c = paint(colorsEnabled(stdout));
|
|
1420
|
+
const kit = screenKit({ cols: stdout.columns || 80, color: colorsEnabled(stdout) });
|
|
1421
|
+
const spinnerFrames = "⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏";
|
|
1422
|
+
const region: Region = { lastCount: 0 };
|
|
1423
|
+
|
|
1424
|
+
type Phase = "starting" | "waiting" | "expired" | "denied" | "failed";
|
|
1425
|
+
let phase: Phase = "starting";
|
|
1426
|
+
let failLine = "";
|
|
1427
|
+
let cautionLine = "";
|
|
1428
|
+
let expiresAt = 0;
|
|
1429
|
+
let interval = 2;
|
|
1430
|
+
let frame = 0;
|
|
1431
|
+
let settled = false;
|
|
1432
|
+
let headingShown = false;
|
|
1433
|
+
// Lines printed above the region (heading + links), so BACK can take them
|
|
1434
|
+
// away too. Counted in rows at the width when leaving, not when printed: a
|
|
1435
|
+
// terminal that was resized meanwhile has re-wrapped them.
|
|
1436
|
+
const above: string[] = [];
|
|
1437
|
+
let pollTimer: ReturnType<typeof setTimeout> | null = null;
|
|
1438
|
+
let spinTimer: ReturnType<typeof setInterval> | null = null;
|
|
1439
|
+
// Bumped on every new link, so a poll answer for an abandoned link is ignored.
|
|
1440
|
+
let attempt = 0;
|
|
1441
|
+
|
|
1442
|
+
const countdown = (): string => {
|
|
1443
|
+
const left = Math.max(0, Math.ceil((expiresAt - now()) / 1000));
|
|
1444
|
+
return `${Math.floor(left / 60)}:${String(left % 60).padStart(2, "0")}`;
|
|
1445
|
+
};
|
|
1446
|
+
|
|
1447
|
+
const build = (): string[] => {
|
|
1448
|
+
const spin = c.ink3(spinnerFrames[frame % spinnerFrames.length]);
|
|
1449
|
+
switch (phase) {
|
|
1450
|
+
case "starting":
|
|
1451
|
+
return [`${INDENT}${spin} Getting a link…`];
|
|
1452
|
+
case "waiting":
|
|
1453
|
+
return [
|
|
1454
|
+
`${INDENT}${spin} Waiting for you to authorize in the browser ${c.ink3(`· expires in ${countdown()}`)}`,
|
|
1455
|
+
...(cautionLine ? [kit.caution(cautionLine)] : []),
|
|
1456
|
+
"",
|
|
1457
|
+
kit.keys(["tab more options", "ctrl-c cancel"]),
|
|
1458
|
+
];
|
|
1459
|
+
case "expired":
|
|
1460
|
+
return [kit.fail("That link expired."), "", kit.keys(["enter new link", "tab more options"])];
|
|
1461
|
+
case "denied":
|
|
1462
|
+
return [kit.fail("Not authorized in the browser."), "", kit.keys(["enter try again", "tab more options"])];
|
|
1463
|
+
case "failed":
|
|
1464
|
+
return [kit.fail(failLine), "", kit.keys(["enter try again", "tab more options"])];
|
|
1465
|
+
}
|
|
1466
|
+
};
|
|
1467
|
+
|
|
1468
|
+
const draw = (): void => {
|
|
1469
|
+
if (settled) return;
|
|
1470
|
+
// Until a link has been printed above (which carries the heading), the
|
|
1471
|
+
// heading lives in the region — so it shows while starting, and above a
|
|
1472
|
+
// failure to start.
|
|
1473
|
+
repaint(stdout, region, headingShown ? build() : [promptHeading(c, opts.message, opts.meta), ...build()]);
|
|
1474
|
+
};
|
|
1475
|
+
|
|
1476
|
+
/** Write lines above the live region, where nothing repaints or cuts them. */
|
|
1477
|
+
const printAbove = (lines: string[]): void => {
|
|
1478
|
+
const clear = region.lastCount > 0 ? `${ESC}[${region.lastCount}A${ESC}[J` : "";
|
|
1479
|
+
stdout.write(`${clear}${lines.join("\n")}\n`);
|
|
1480
|
+
region.lastCount = 0;
|
|
1481
|
+
above.push(...lines);
|
|
1482
|
+
};
|
|
1483
|
+
|
|
1484
|
+
/** Fold what was printed above into the region, so the next repaint erases
|
|
1485
|
+
* it too — the heading goes with it and returns to the region. */
|
|
1486
|
+
const forgetAbove = (): void => {
|
|
1487
|
+
const cols = stdout.columns || 80;
|
|
1488
|
+
for (const line of above) region.lastCount += Math.max(1, Math.ceil(visibleWidth(line) / cols));
|
|
1489
|
+
above.length = 0;
|
|
1490
|
+
headingShown = false;
|
|
1491
|
+
};
|
|
1492
|
+
|
|
1493
|
+
const clearPoll = (): void => {
|
|
1494
|
+
if (pollTimer) clearTimeout(pollTimer);
|
|
1495
|
+
pollTimer = null;
|
|
1496
|
+
};
|
|
1497
|
+
|
|
1498
|
+
const restoreTerminal = (): void => showCursor(stdout);
|
|
1499
|
+
|
|
1500
|
+
return new Promise((resolve) => {
|
|
1501
|
+
const wasRaw = stdin.isRaw;
|
|
1502
|
+
|
|
1503
|
+
const finish = (answer: { value: T } | Back | null): void => {
|
|
1504
|
+
if (settled) return;
|
|
1505
|
+
clearPoll();
|
|
1506
|
+
if (spinTimer) clearInterval(spinTimer);
|
|
1507
|
+
stdin.removeListener("keypress", onKey);
|
|
1508
|
+
stdin.setRawMode?.(wasRaw ?? false);
|
|
1509
|
+
stdin.pause();
|
|
1510
|
+
process.removeListener("exit", restoreTerminal);
|
|
1511
|
+
// Leaving for the menu takes the printed link with it.
|
|
1512
|
+
if (answer === BACK) forgetAbove();
|
|
1513
|
+
const lines =
|
|
1514
|
+
answer === null
|
|
1515
|
+
? [c.ink3("cancelled")]
|
|
1516
|
+
: answer === BACK
|
|
1517
|
+
? []
|
|
1518
|
+
: opts.collapsed(answer.value);
|
|
1519
|
+
repaint(stdout, region, lines, { cut: false });
|
|
1520
|
+
settled = true;
|
|
1521
|
+
restoreTerminal();
|
|
1522
|
+
resolve(answer);
|
|
1523
|
+
};
|
|
1524
|
+
|
|
1525
|
+
const schedulePoll = (forAttempt: number): void => {
|
|
1526
|
+
clearPoll();
|
|
1527
|
+
pollTimer = setTimeout(() => void pollOnce(forAttempt), interval * 1000);
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1530
|
+
const pollOnce = async (forAttempt: number): Promise<void> => {
|
|
1531
|
+
let answer: BrowserLoginPoll<T>;
|
|
1532
|
+
try {
|
|
1533
|
+
answer = await opts.poll();
|
|
1534
|
+
} catch (err) {
|
|
1535
|
+
answer = { state: "unreachable", line: err instanceof Error ? err.message : String(err) };
|
|
1536
|
+
}
|
|
1537
|
+
if (settled || forAttempt !== attempt) return;
|
|
1538
|
+
switch (answer.state) {
|
|
1539
|
+
case "approved":
|
|
1540
|
+
return finish({ value: answer.value });
|
|
1541
|
+
case "denied":
|
|
1542
|
+
phase = "denied";
|
|
1543
|
+
return draw();
|
|
1544
|
+
case "expired":
|
|
1545
|
+
phase = "expired";
|
|
1546
|
+
return draw();
|
|
1547
|
+
case "slow_down":
|
|
1548
|
+
interval = slowedDown(interval);
|
|
1549
|
+
break;
|
|
1550
|
+
case "unreachable":
|
|
1551
|
+
cautionLine = `Can't reach the server right now (${answer.line}) — still trying.`;
|
|
1552
|
+
break;
|
|
1553
|
+
case "pending":
|
|
1554
|
+
cautionLine = "";
|
|
1555
|
+
if (answer.interval && answer.interval > 0) interval = answer.interval;
|
|
1556
|
+
break;
|
|
1557
|
+
}
|
|
1558
|
+
// The server is the authority on expiry, but a link that is past it by
|
|
1559
|
+
// our own clock too is not worth another round trip.
|
|
1560
|
+
if (now() > expiresAt + interval * 1000) {
|
|
1561
|
+
phase = "expired";
|
|
1562
|
+
return draw();
|
|
1563
|
+
}
|
|
1564
|
+
draw();
|
|
1565
|
+
schedulePoll(forAttempt);
|
|
1566
|
+
};
|
|
1567
|
+
|
|
1568
|
+
const begin = async (): Promise<void> => {
|
|
1569
|
+
const mine = ++attempt;
|
|
1570
|
+
clearPoll();
|
|
1571
|
+
cautionLine = "";
|
|
1572
|
+
phase = "starting";
|
|
1573
|
+
// A retry: the expired or refused link is dead, so it leaves the screen
|
|
1574
|
+
// rather than sit above the new one, where it could still be opened.
|
|
1575
|
+
forgetAbove();
|
|
1576
|
+
draw();
|
|
1577
|
+
let started: BrowserLoginStart;
|
|
1578
|
+
try {
|
|
1579
|
+
started = await opts.start();
|
|
1580
|
+
} catch (err) {
|
|
1581
|
+
started = { ok: false, line: err instanceof Error ? err.message : String(err), retryable: true };
|
|
1582
|
+
}
|
|
1583
|
+
if (settled || mine !== attempt) return;
|
|
1584
|
+
if (!started.ok) {
|
|
1585
|
+
if (!started.retryable) return finish(BACK);
|
|
1586
|
+
phase = "failed";
|
|
1587
|
+
failLine = started.line;
|
|
1588
|
+
return draw();
|
|
1589
|
+
}
|
|
1590
|
+
expiresAt = now() + started.expiresIn * 1000;
|
|
1591
|
+
interval = started.interval > 0 ? started.interval : 2;
|
|
1592
|
+
const opened = opts.open(started.url);
|
|
1593
|
+
printAbove([
|
|
1594
|
+
...(headingShown ? [] : [promptHeading(c, opts.message, opts.meta)]),
|
|
1595
|
+
opened
|
|
1596
|
+
? `${INDENT}Opening your browser to connect ${opts.machineLabel}. If it doesn't open, use this link:`
|
|
1597
|
+
: `${INDENT}Open this link in any browser to connect ${opts.machineLabel}:`,
|
|
1598
|
+
`${INDENT}${c.bold(started.url)}`,
|
|
1599
|
+
"",
|
|
1600
|
+
]);
|
|
1601
|
+
headingShown = true;
|
|
1602
|
+
phase = "waiting";
|
|
1603
|
+
draw();
|
|
1604
|
+
schedulePoll(mine);
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1607
|
+
function onKey(_str: string | undefined, key: readline.Key): void {
|
|
1608
|
+
if (!key || settled) return;
|
|
1609
|
+
if (key.ctrl && (key.name === "c" || key.name === "d")) return finish(null);
|
|
1610
|
+
if (key.name === "escape" || key.name === "tab") return finish(BACK);
|
|
1611
|
+
if ((key.name === "return" || key.name === "enter") && phase !== "waiting" && phase !== "starting") {
|
|
1612
|
+
void begin();
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
process.once("exit", restoreTerminal);
|
|
1617
|
+
readline.emitKeypressEvents(stdin);
|
|
1618
|
+
stdin.setRawMode?.(true);
|
|
1619
|
+
stdin.resume();
|
|
1620
|
+
hideCursor(stdout);
|
|
1621
|
+
stdin.on("keypress", onKey);
|
|
1622
|
+
spinTimer = setInterval(() => {
|
|
1623
|
+
frame++;
|
|
1624
|
+
if (phase === "waiting" || phase === "starting") draw();
|
|
1625
|
+
}, 120);
|
|
1626
|
+
spinTimer.unref?.();
|
|
1627
|
+
void begin();
|
|
1628
|
+
});
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1351
1631
|
// ── the kit ──────────────────────────────────────────────────────────────────
|
|
1352
1632
|
/**
|
|
1353
1633
|
* The block builders every PRINTED surface is assembled from.
|
|
@@ -47,6 +47,7 @@ import {
|
|
|
47
47
|
import { listInstallableIds, getIntegration } from "./integrations";
|
|
48
48
|
import type { IntegrationType } from "./types";
|
|
49
49
|
import { removeHooks } from "./manager";
|
|
50
|
+
import { installedAgentSkillDirs, removeAgentSkill } from "./agent-skill";
|
|
50
51
|
import { CODEX_MANAGED_BEGIN, CODEX_MANAGED_END, codexSystemConfigPath, codexSystemHooksPresent } from "./codex-system-hooks";
|
|
51
52
|
import { optsFor, screenKit, type RenderOpts } from "./tui";
|
|
52
53
|
|
|
@@ -110,6 +111,8 @@ export interface UninstallResult {
|
|
|
110
111
|
/** Everything this machine has that uninstalling would remove. */
|
|
111
112
|
interface Leftovers {
|
|
112
113
|
clis: IntegrationType[];
|
|
114
|
+
/** The failproofai skill folders `config` wrote into agents. */
|
|
115
|
+
skillDirs: string[];
|
|
113
116
|
/** failproofai's block in Codex's system config, which only root can remove. */
|
|
114
117
|
codexSystemPath: string | null;
|
|
115
118
|
servicePath: string | null;
|
|
@@ -149,6 +152,7 @@ function survey(cwd?: string): Leftovers {
|
|
|
149
152
|
const servicePath = isDaemonSupportedPlatform() ? daemonServiceFilePath() : null;
|
|
150
153
|
return {
|
|
151
154
|
clis,
|
|
155
|
+
skillDirs: installedAgentSkillDirs(),
|
|
152
156
|
codexSystemPath: codexSystemHooksPresent() ? codexSystemConfigPath() : null,
|
|
153
157
|
servicePath,
|
|
154
158
|
serviceInstalled: !!servicePath && existsSync(servicePath),
|
|
@@ -166,7 +170,7 @@ export async function runUninstallCommand(opts: UninstallOptions = {}): Promise<
|
|
|
166
170
|
const lines: string[] = [];
|
|
167
171
|
|
|
168
172
|
const nothingToDo =
|
|
169
|
-
found.clis.length === 0 && !found.serviceInstalled && !found.daemonConfigured &&
|
|
173
|
+
found.clis.length === 0 && found.skillDirs.length === 0 && !found.serviceInstalled && !found.daemonConfigured &&
|
|
170
174
|
!(opts.purge && found.homeExists);
|
|
171
175
|
if (nothingToDo) {
|
|
172
176
|
return {
|
|
@@ -191,6 +195,7 @@ export async function runUninstallCommand(opts: UninstallOptions = {}): Promise<
|
|
|
191
195
|
const purging = Boolean(opts.purge && found.homeExists);
|
|
192
196
|
const removals: string[] = [];
|
|
193
197
|
if (found.clis.length > 0) removals.push(`failproofai's hooks from ${many(found.clis.length, "agent")}`);
|
|
198
|
+
if (found.skillDirs.length > 0) removals.push(`the failproofai skill from ${many(found.skillDirs.length, "agent folder")}`);
|
|
194
199
|
if (found.serviceInstalled) removals.push("the failproofaid service (needs sudo)");
|
|
195
200
|
if (purging) removals.push(home);
|
|
196
201
|
const releasesDaemon = found.daemonConfigured && !found.serviceInstalled;
|
|
@@ -321,6 +326,12 @@ export async function runUninstallCommand(opts: UninstallOptions = {}): Promise<
|
|
|
321
326
|
}
|
|
322
327
|
}
|
|
323
328
|
|
|
329
|
+
if (found.skillDirs.length > 0) {
|
|
330
|
+
const left = found.skillDirs.length - removeAgentSkill().length;
|
|
331
|
+
if (left === 0) lines.push(kit.ok(`Removed the failproofai skill from ${many(found.skillDirs.length, "agent folder")}.`));
|
|
332
|
+
else failures.push(`Could not remove the failproofai skill from ${many(left, "agent folder")}:\n${installedAgentSkillDirs().join("\n")}`);
|
|
333
|
+
}
|
|
334
|
+
|
|
324
335
|
if (found.serviceInstalled) {
|
|
325
336
|
// Every run that gets here agreed to the whole plan, and the plan names the
|
|
326
337
|
// service: `--yes` is yes to the plan, an interactive yes is the same answer
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[[1375,a=>{var b=a.i(5050);let c=(0,b.createServerReference)("00de9ed6392ff068792d68e272f943ca9a05f589fa",b.callServer,void 0,b.findSourceMapURL,"getTelemetryConfig");a.s(["f",0,c])},3171,a=>{var b=a.i(87924),c=a.i(72131),d=a.i(1375),e=a.i(66036);a.s(["default",0,function({error:a,reset:f}){return(0,c.useEffect)(()=>{(0,d.f)().then(b=>{(0,e.$)(b),(0,e.L)("client_error",{error_message:a.message,error_name:a.name,error_digest:a.digest,boundary:"global"})}).catch(()=>{})},[a]),(0,b.jsx)("html",{children:(0,b.jsx)("body",{children:(0,b.jsx)("main",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"#031035",color:"#f8fafc",fontFamily:"system-ui, sans-serif"},children:(0,b.jsxs)("div",{style:{textAlign:"center",padding:"2rem",border:"1px solid rgba(239,68,68,0.4)",borderRadius:"0.5rem",maxWidth:"500px"},children:[(0,b.jsx)("h2",{style:{color:"#ef4444",marginBottom:"0.5rem",fontSize:"1.25rem"},children:"Something went wrong"}),(0,b.jsx)("p",{style:{color:"#94a3b8",marginBottom:"1.5rem"},children:a.message||"An unexpected error occurred."}),(0,b.jsx)("button",{onClick:f,style:{padding:"0.5rem 1.25rem",background:"#3b82f6",color:"white",border:"none",borderRadius:"0.375rem",cursor:"pointer",fontSize:"0.875rem"},children:"Try again"})]})})})})}])},66036,a=>{a.s(["L",0,function(a,b){},"$",0,function(a){}])},5050,(a,b,c)=>{Object.defineProperty(c,"__esModule",{value:!0});var d={callServer:function(){return f.callServer},createServerReference:function(){return h.createServerReference},findSourceMapURL:function(){return g.findSourceMapURL}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});let f=a.r(20611),g=a.r(1722),h=a.r(38783)},42602,(a,b,c)=>{b.exports=a.r(18622)},9270,(a,b,c)=>{b.exports=a.r(42602).vendored.contexts.AppRouterContext},36313,(a,b,c)=>{b.exports=a.r(42602).vendored.contexts.HooksClientContext},18341,(a,b,c)=>{b.exports=a.r(42602).vendored.contexts.ServerInsertedHtml},35112,(a,b,c)=>{b.exports=a.r(42602).vendored["react-ssr"].ReactDOM},87924,(a,b,c)=>{b.exports=a.r(42602).vendored["react-ssr"].ReactJsxRuntime},38783,(a,b,c)=>{b.exports=a.r(42602).vendored["react-ssr"].ReactServerDOMTurbopackClient},72131,(a,b,c)=>{b.exports=a.r(42602).vendored["react-ssr"].React}],18622,(a,b,c)=>{b.exports=a.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},20635,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},43285,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/dynamic-access-async-storage.external.js",()=>require("next/dist/server/app-render/dynamic-access-async-storage.external.js"))},56704,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},59043,(a,b,c)=>{b.exports=a.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__0588st-tpiuia._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";module.exports=[1375,a=>{var b=a.i(5050);let c=(0,b.createServerReference)("00de9ed6392ff068792d68e272f943ca9a05f589fa",b.callServer,void 0,b.findSourceMapURL,"getTelemetryConfig");a.s(["f",0,c])},18952,a=>{var b=a.i(87924),c=a.i(72131);let d=[],e=0,f=new Set;function g(){for(let a of f)a()}function h(a){return f.add(a),()=>f.delete(a)}function i(){return d}function j({message:a}){let[d,e]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{requestAnimationFrame(()=>e(!0));let a=setTimeout(()=>e(!1),2e3);return()=>clearTimeout(a)},[]),(0,b.jsx)("div",{className:`bg-card border border-border text-foreground text-sm px-4 py-2 rounded-lg shadow-lg transition-opacity duration-300 ${d?"opacity-100":"opacity-0"}`,children:a})}a.s(["Toaster",0,function(){let a=(0,c.useSyncExternalStore)(h,i,i);return(0,b.jsx)("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2",children:a.map(a=>(0,b.jsx)(j,{message:a.message},a.id))})},"toast",0,function(a){let b=e++;d=[...d,{id:b,message:a}],g(),setTimeout(()=>{d=d.filter(a=>a.id!==b),g()},2500)}])},10765,a=>{var b=a.i(87924),c=a.i(72131),d=a.i(50944),e=a.i(1375),f=a.i(66036);let g=(0,c.createContext)(void 0);a.s(["PostHogProvider",0,function({children:a}){let h=(0,d.usePathname)(),i=(0,c.useRef)(null),j=(0,c.useRef)(!1);(0,c.useEffect)(()=>{let a=!1;return(0,e.f)().then(b=>{a||((0,f.$)(b),j.current=!0,(0,f.L)("$pageview"),i.current=window.location.pathname)}),()=>{a=!0}},[]),(0,c.useEffect)(()=>{j.current&&i.current!==h&&(i.current=h,(0,f.L)("$pageview"))},[h]);let k=c.default.useCallback((a,b)=>{(0,f.L)(a,b)},[]);return(0,b.jsx)(g.Provider,{value:{capture:k},children:a})},"usePostHog",0,function(){let a=(0,c.useContext)(g);if(void 0===a)throw Error("usePostHog must be used within a PostHogProvider");return a}])},66036,a=>{a.s(["L",0,function(a,b){},"$",0,function(a){}])},5050,(a,b,c)=>{Object.defineProperty(c,"__esModule",{value:!0});var d={callServer:function(){return f.callServer},createServerReference:function(){return h.createServerReference},findSourceMapURL:function(){return g.findSourceMapURL}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});let f=a.r(20611),g=a.r(1722),h=a.r(38783)}]})();
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=_128ebxr83nk6g._.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,32344,e=>{var a=e.i(95187);let t=(0,a.createServerReference)("601da5259db8771c5daa055322e9f6abf5b570520a",a.callServer,void 0,a.findSourceMapURL,"searchHookActivityAction");e.s(["f",0,t])},73520,e=>{var a=e.i(43476),t=e.i(24071),r=e.i(67927);e.s(["f",0,function({currentPage:e,totalPages:s,onPageChange:n}){if(s<=1)return null;let l=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,a.jsxs)("div",{className:"flex items-center justify-center gap-2 py-4",children:[(0,a.jsxs)("button",{onClick:()=>n(e-1),disabled:1===e,className:l(1===e),"aria-label":"Previous page",children:[(0,a.jsx)(t.f,{className:"w-4 h-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Previous"})]}),(0,a.jsx)("div",{className:"flex items-center gap-1",children:(()=>{if(s<=7)return Array.from({length:s},(e,a)=>a+1);let a=[1],t=Math.max(2,e-1),r=Math.min(s-1,e+1);e<=3&&(r=Math.min(5,s-1)),e>=s-2&&(t=Math.max(2,s-4)),t>2&&a.push("ellipsis-start");for(let e=t;e<=r;e++)a.push(e);return r<s-1&&a.push("ellipsis-end"),a.push(s),a})().map(t=>"string"==typeof t?(0,a.jsx)("span",{className:"px-2 text-muted-foreground",children:"..."},t):(0,a.jsx)("button",{onClick:()=>n(t),className:`min-w-[2.5rem] px-3 py-2 text-sm rounded-md transition-colors ${e===t?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"}`,"aria-label":`Page ${t}`,"aria-current":e===t?"page":void 0,children:t},t))}),(0,a.jsxs)("button",{onClick:()=>n(e+1),disabled:e===s,className:l(e===s),"aria-label":"Next page",children:[(0,a.jsx)("span",{className:"hidden sm:inline",children:"Next"}),(0,a.jsx)(r.f,{className:"w-4 h-4"})]})]})}])},34713,e=>{e.s(["M",0,function(e){if(e<1e3)return`${e}ms`;let a=Math.round(e/100);if(a<600)return`${(a/10).toFixed(1)}s`;let t=Math.round(e/1e3);if(t<3600){let e=Math.floor(t/60);return`${e}m ${t%60}s`}let r=Math.round(e/6e4),s=Math.floor(r/60);return`${s}h ${r%60}m`},"g",0,function(e){let a=Date.now()-e;return a<6e4?`${Math.max(1,Math.floor(a/1e3))}s ago`:a<36e5?`${Math.floor(a/6e4)}m ago`:a<864e5?`${Math.floor(a/36e5)}h ago`:`${Math.floor(a/864e5)}d ago`}])},24071,e=>{var a=e.i(56420);let t={name:"chevron-left",size:24,node:[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]};t.node;let r=(0,a.f)(t);e.s(["f",0,r],24071)},67927,e=>{var a=e.i(56420);let t={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};t.node;let r=(0,a.f)(t);e.s(["f",0,r],67927)},16306,e=>{var a=e.i(56420);let t={name:"shield-alert",size:24,node:[["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"}]]};t.node;let r=(0,a.f)(t);e.s(["f",0,r],16306)},84026,29407,e=>{var a=e.i(56420);let t={name:"shield-check",size:24,node:[["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"}]]};t.node;let r=(0,a.f)(t);e.s(["f",0,r],84026);let s={name:"shield-x",size:24,node:[["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"}]],aliases:["shield-close"]};s.node;let n=(0,a.f)(s);e.s(["f",0,n],29407)},82954,e=>{var a=e.i(56420);let t={name:"shield",size:24,node:[["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"}]]};t.node;let r=(0,a.f)(t);e.s(["f",0,r],82954)}])})();
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,64245,e=>{"use strict";var t=e.i(43476),s=e.i(71645),r=e.i(74080),n=e.i(22016),a=e.i(89664),l=e.i(16327),o=e.i(56420);let i={name:"code",size:24,node:[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]};i.node;let c=(0,o.f)(i);var d=e.i(8734);let m={name:"package",size:24,node:[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]};m.node;let u=(0,o.f)(m),p={name:"plus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]};p.node;let x=(0,o.f)(p);var h=e.i(66794),f=e.i(82954),b=e.i(16306),g=e.i(84026),v=e.i(29407);let j={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};j.node;let y=(0,o.f)(j),N={name:"triangle-alert",size:24,node:[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["alert-triangle"]};N.node;let k=(0,o.f)(N);var w=e.i(63676),S=e.i(73520),P=e.i(95187);let C=(0,P.createServerReference)("40620aef35573c0f70760dade2911af54d7bb6bdcd",P.callServer,void 0,P.findSourceMapURL,"getHookActivityAction");var _=e.i(32344);let $=(0,P.createServerReference)("006ccaa5b797e8c4bed7276f22bca7093b374a7c2d",P.callServer,void 0,P.findSourceMapURL,"getActivePausesAction");function M({pauses:e,now:r}){let[n,a]=(0,s.useState)(()=>Date.now());(0,s.useEffect)(()=>{let e=setInterval(()=>a(Date.now()),3e4);return()=>clearInterval(e)},[]);let l=r??n,o=e.filter(e=>e.expiresAt>l);if(0===o.length)return null;let i=o.reduce((e,t)=>e.expiresAt<t.expiresAt?e:t);return(0,t.jsxs)("div",{role:"status",className:"mb-4 flex items-start gap-2.5 rounded border border-amber-500/40 bg-amber-500/[0.07] px-3 py-2.5",children:[(0,t.jsx)(b.f,{className:"h-4 w-4 shrink-0 text-amber-500 mt-0.5","aria-hidden":"true"}),(0,t.jsxs)("div",{className:"text-xs leading-relaxed",children:[(0,t.jsxs)("p",{className:"font-medium text-foreground",children:["Enforcement is paused for ",o.length," session",1===o.length?"":"s"," —"," ",function(e){if(e<=0)return"expiring now";if(e<6e4)return"under a minute";let t=Math.round(e/6e4);if(t<60)return`${t}m`;let s=Math.floor(t/60),r=t%60;return 0===r?`${s}h`:`${s}h${r}m`}(i.expiresAt-l)," left",o.length>1?" on the next to expire":"","."]}),(0,t.jsxs)("p",{className:"text-muted-foreground mt-0.5",children:["Builtin, custom and convention policies are suspended for"," ",1===o.length?"that session":"those sessions","; cloud-managed policies keep enforcing. It lifts on its own — or run"," ",(0,t.jsx)("span",{className:"font-mono text-foreground",children:"failproofai config --resume"}),"."]})]})]})}function U(){return(0,t.jsx)("span",{title:"Enforcement was paused for this session — local policies did not run",className:"ml-1.5 inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium uppercase tracking-wide border border-amber-500/40 bg-amber-500/10 text-amber-600 dark:text-amber-500",children:"paused"})}function T({item:e}){if(!e.pausedBy)return null;let s="number"==typeof e.pauseExpiresAt?new Date(e.pauseExpiresAt).toLocaleTimeString():null;return(0,t.jsxs)("div",{className:"sm:col-span-2 lg:col-span-3 mt-1 flex items-start gap-2 rounded border border-amber-500/30 bg-amber-500/5 px-2.5 py-2",children:[(0,t.jsx)(k,{className:"h-3.5 w-3.5 shrink-0 text-amber-500/80 mt-0.5","aria-hidden":"true"}),(0,t.jsxs)("p",{className:"text-[0.7rem] leading-relaxed text-muted-foreground",children:[(0,t.jsx)("span",{className:"font-medium text-foreground",children:"Not enforced — paused."})," Enforcement was suspended for this session","cli"===e.pausedBy?" from the CLI":` by ${e.pausedBy}`,s?`, lifting at ${s}`:"",". Builtin, custom and convention policies did not run for this event; cloud-managed policies did."]})]})}let I=["evaluator","jevDecision","jevCleared","jevFallbackReason","jevLatencyMs","jevModel","jevMode"],R=new Set(["jev","jev-fallback"]),A=new Set(["allow","instruct","deny"]),E=new Set(["observe","enforce"]),L=/^([a-z0-9]+(?:-[a-z0-9]+)*)\s*(?:$|[:(])/,D=/^http-\d{3}$/,z="other",F=new Set(["aborted","cloudflare-error","cloudflare-incomplete","config","error","malformed","model-mismatch","network","no-api-key","no-transport","other","out-of-credits","prepare-error","provider-refused","rate-limited","request-cut","request-too-large","timeout","truncated","unavailable","upstream-error"]),W=new Map([["prepare","prepare-error"],["error","error"],["timeout","timeout"],["network","network"],["malformed","malformed"],["truncated","truncated"],["rate-limited","rate-limited"],["out-of-credits","out-of-credits"],["model-mismatch","model-mismatch"],["request-too-large","request-too-large"],["config","config"]]),q=/^[A-Za-z0-9._:/@~+-]{1,200}$/,J=/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/,O=/^(?:custom|pack|cloud|failproofai|\.failproofai-[A-Za-z0-9_-]{1,32})\//;function B(e){return!("string"!=typeof e||0===e.length||[...e].length>200||J.test(e))&&(!/\s/.test(e)||O.test(e))}function H(e){if(!I.some(t=>void 0!==e[t]))return e;let t={...e},s=e=>{delete t[e]};"string"==typeof t.evaluator&&R.has(t.evaluator)||s("evaluator"),"string"==typeof t.jevDecision&&A.has(t.jevDecision)||s("jevDecision");let r=void 0!==t.jevMode&&!("string"==typeof t.jevMode&&E.has(t.jevMode));if("string"==typeof t.jevMode&&E.has(t.jevMode)||s("jevMode"),r&&s("jevCleared"),Array.isArray(t.jevCleared)){let e=[...new Set(t.jevCleared.filter(B))].slice(0,64);t.jevCleared=e}else s("jevCleared");let n=function(e){if("string"!=typeof e)return;let t=e.trim().toLowerCase();if(0===t.length)return;let s=L.exec(t)?.[1];if(void 0===s||s.length>40)return z;if(D.test(s))return s;let r=W.get(s)??s;return F.has(r)?r:z}(t.jevFallbackReason);return void 0===n?s("jevFallbackReason"):t.jevFallbackReason=n,"number"==typeof t.jevLatencyMs&&Number.isFinite(t.jevLatencyMs)&&t.jevLatencyMs>=0?t.jevLatencyMs=Math.round(t.jevLatencyMs):s("jevLatencyMs"),"string"==typeof t.jevModel&&q.test(t.jevModel.trim())?t.jevModel=t.jevModel.trim():s("jevModel"),t}function X(e){return"jev-fallback"===e.evaluator?"fallback":"jev"!==e.evaluator?null:void 0!==e.jevCleared||void 0!==e.jevLatencyMs||void 0!==e.jevModel||"deny"===e.jevDecision||"instruct"===e.jevDecision?"answered":"allow"===e.jevDecision?"no-request":"not-consulted"}let V=new Set(["request-cut","truncated","model-mismatch"]);function G(e){return"jev-fallback"===e.evaluator&&(void 0!==e.jevDecision||V.has(e.jevFallbackReason??""))}let K={allow:0,instruct:1,deny:2},Z={cleared:{label:"jev cleared",title:"Jev reviewed a reviewable policy's block and cleared it",className:"border-sky-500/40 bg-sky-500/10 text-sky-600 dark:text-sky-400"},"would-clear":{label:"jev observe",title:"Observe mode: Jev would have cleared a block here; the regex result was enforced",className:"border-sky-500/30 bg-sky-500/5 text-sky-600/80 dark:text-sky-400/80"},"observe-stricter":{label:"jev observe",title:"Observe mode: Jev would have been stricter here; the regex result was enforced",className:"border-sky-500/30 bg-sky-500/5 text-sky-600/80 dark:text-sky-400/80"},"fallback-stricter":{label:"jev fallback",title:"Jev answered but its answer was not applied (e.g. the call was truncated); it would have been stricter than the regex result",className:"border-amber-500/40 bg-amber-500/10 text-amber-600 dark:text-amber-400"},fallback:{label:"jev fallback",title:"Jev's answer was not used for this call (unavailable, truncated or mismatched); the regex policies decided alone",className:"border-muted-foreground/30 bg-muted/40 text-muted-foreground"}};function Q({item:e}){let s=function(e){let t=H(e),s=X(H(t));if(null===s||"not-consulted"===s||"no-request"===s)return null;let r=()=>(K[t.jevDecision??"allow"]??0)>(K[e.decision??"allow"]??0);if("fallback"===s)return void 0!==t.jevDecision&&r()?"fallback-stricter":"fallback";let n=(t.jevCleared??[]).length>0;return"observe"===t.jevMode?n?"would-clear":r()?"observe-stricter":null:n?"cleared":null}(e);if(!s)return null;let r=Z[s];return(0,t.jsx)("span",{title:r.title,className:`ml-1.5 inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium uppercase tracking-wide border ${r.className}`,children:r.label})}function Y({item:e}){let s=function(e){let t=H(e),s=X(t);if(null===s)return null;if("not-consulted"===s)return["Jev not consulted: a hard policy's deny is final"];if("no-request"===s)return["Jev not asked: no semantic policy applies to this call"];let r=[];if("fallback"===s){let e=t.jevFallbackReason??"unknown reason";return G(t)?(r.push(`Jev's answer not applied: ${e}`),t.jevDecision&&r.push(`Jev verdict (not applied): ${t.jevDecision}`)):r.push(`Jev unavailable: ${e}`),r.push("the regex policies decided alone"),void 0!==t.jevLatencyMs&&r.push(`${t.jevLatencyMs} ms`),t.jevModel&&G(t)&&r.push(t.jevModel),r}t.jevDecision&&r.push(`Jev verdict: ${t.jevDecision}`);let n=t.jevCleared??[];return n.length>0&&r.push(`${"observe"===t.jevMode?"would have cleared":"cleared"} ${n.join(", ")}`),"observe"===t.jevMode&&r.push("observe mode: the regex result was enforced"),void 0!==t.jevLatencyMs&&r.push(`${t.jevLatencyMs} ms`),t.jevModel&&r.push(t.jevModel),0===r.length&&r.push("Jev answered"),r}(e);return s?(0,t.jsxs)("div",{className:"sm:col-span-2 lg:col-span-3",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Semantic review: "}),(0,t.jsx)("span",{className:"font-mono text-foreground",children:s.join(" · ")})]}):null}let ee=(0,P.createServerReference)("004145ebd49b5d18dba71548f4b6b07a797fa0e1de",P.callServer,void 0,P.findSourceMapURL,"getHooksConfigAction"),et=(0,P.createServerReference)("60b28b9d290d8a82cc460b2e532b045a433cf81bdb",P.callServer,void 0,P.findSourceMapURL,"toggleCustomPolicyAction"),es=(0,P.createServerReference)("0032cfa2ccaa3a2ed47f837096c01c34cb8d00a4d7",P.callServer,void 0,P.findSourceMapURL,"addBundledPackWebAction"),er=(0,P.createServerReference)("60cdb09b0c02694cf4f16e8a1305adc0f62e352a45",P.callServer,void 0,P.findSourceMapURL,"addPackWebAction"),en=(0,P.createServerReference)("40ed54eb81f1e3b00fa8324718e84aa7db557f8ef7",P.callServer,void 0,P.findSourceMapURL,"previewPackWebAction"),ea=(0,P.createServerReference)("405e26f69a79aa60d6c8f8f416cba4a66e5b63b9ab",P.callServer,void 0,P.findSourceMapURL,"removePackWebAction"),el=(0,P.createServerReference)("709f017fa941fd26dc2fd74cfd9766b03a5aee1398",P.callServer,void 0,P.findSourceMapURL,"togglePackPolicyAction"),eo=(0,P.createServerReference)("609560002cdd5e1a1c5d5cb8cf8d6842f6f19c8c94",P.callServer,void 0,P.findSourceMapURL,"installHooksWebAction"),ei=(0,P.createServerReference)("608edf5a298f5d8cdcb906e6f9740d0bfddee50697",P.callServer,void 0,P.findSourceMapURL,"removeHooksWebAction"),ec=(0,P.createServerReference)("60cf99e6da55d25519b65a974525baf47fd6b00da6",P.callServer,void 0,P.findSourceMapURL,"updatePolicyParamsAction");var ed=e.i(85881),em=e.i(12344),eu=e.i(80060),ep=e.i(2711),ex=e.i(24578);let eh={claude:{PreToolUse:"block",UserPromptSubmit:"block",PermissionRequest:"block",Stop:"block",SubagentStop:"block",PreCompact:"block",PostToolBatch:"block",ConfigChange:"block",UserPromptExpansion:"block",TaskCreated:"block",TaskCompleted:"block",TeammateIdle:"block",Elicitation:"block",ElicitationResult:"block",PostToolUse:"observe",PostToolUseFailure:"observe",SessionStart:"observe",Setup:"observe",SubagentStart:"observe",SessionEnd:"observe",StopFailure:"observe",PermissionDenied:"observe",Notification:"observe",InstructionsLoaded:"observe",CwdChanged:"observe",FileChanged:"observe",PostCompact:"observe",WorktreeRemove:"observe"},codex:{PreToolUse:"block",PermissionRequest:"block",UserPromptSubmit:"block",Stop:"block",SubagentStop:"block",PostToolUse:"block",SessionStart:"observe",SubagentStart:"observe",PreCompact:"observe",PostCompact:"observe"},copilot:{PreToolUse:"block",Stop:"block",SubagentStop:"block",UserPromptSubmit:"block",PermissionRequest:"block",PostToolUse:"block",SessionStart:"observe",SessionEnd:"observe",PostToolUseFailure:"observe",PreCompact:"observe",Notification:"observe"},cursor:{PreToolUse:"block",Stop:"block",UserPromptSubmit:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe"},opencode:{PreToolUse:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe",UserPromptSubmit:"observe",PermissionRequest:"observe"},pi:{PreToolUse:"block",UserPromptSubmit:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe",Stop:"observe"},hermes:{PreToolUse:"block",PostToolUse:"observe",SubagentStop:"observe",SessionStart:"observe",SessionEnd:"observe"},openclaw:{PreToolUse:"block",UserPromptSubmit:"block",Stop:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe",SubagentStop:"observe",PreCompact:"observe"},factory:{PreToolUse:"block",UserPromptSubmit:"block",Stop:"block",PreCompact:"block",PostToolUse:"observe",SubagentStop:"observe",SessionStart:"observe",SessionEnd:"observe",Notification:"observe"},devin:{PreToolUse:"block",UserPromptSubmit:"block",Stop:"block",PermissionRequest:"block",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe"},antigravity:{PreToolUse:"block",Stop:"block",PostToolUse:"observe",UserPromptSubmit:"observe"},goose:{PreToolUse:"block",UserPromptSubmit:"observe",PostToolUse:"observe",SessionStart:"observe",SessionEnd:"observe"}};var ef=e.i(34713),eb=e.i(67881);function eg({sessionId:e,transcriptPath:s,integration:r,cwd:a}){if(!e)return(0,t.jsx)("span",{className:"text-muted-foreground",children:"\\u2014"});let l=e?e.slice(0,8):"—",o="codex"===r||(s?.includes("/.codex/")??!1),i="copilot"===r||(s?.includes("/.copilot/session-state/")??!1),c="cursor"===r||(s?.includes("/.cursor/")??!1),d="opencode"===r||(s?.includes("/.local/share/opencode/")??!1)||(s?.includes("/.opencode/")??!1),m="pi"===r||(s?.includes("/.pi/")??!1);if(o||i||c||d||m){let s,r=a?(s=/^([A-Za-z]):[\\/](.*)$/.exec(a))?s[1]+"--"+s[2].replace(/[\\/]/g,"-"):a.replace(/[\\/]/g,"-"):o?"codex":i?"copilot":c?"cursor":d?"opencode":"pi";return(0,t.jsx)(n.default,{href:`/project/${encodeURIComponent(r)}/session/${encodeURIComponent(e)}`,className:"text-primary hover:underline font-mono",onClick:e=>e.stopPropagation(),children:l})}let u=s?function(e){let t=e.replace(/\\/g,"/").split("/").filter(Boolean);if(t.length<2)return null;let s=t[t.length-2];return!s||s.startsWith(".")?null:s}(s):null;return u?(0,t.jsx)(n.default,{href:`/project/${encodeURIComponent(u)}/session/${encodeURIComponent(e)}`,className:"text-primary hover:underline font-mono",onClick:e=>e.stopPropagation(),children:l}):(0,t.jsx)("span",{className:"text-muted-foreground font-mono",children:l})}function ev({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)(v.f,{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)(b.f,{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)(g.f,{className:"h-3 w-3"}),"Allow"]})}function ej({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 ey({integration:e}){if(!e)return null;let s=(0,ex.A)(e),r=(0,ex.G)(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}`,title:`Agent CLI: ${s}`,children:s})}function eN({mode:e}){let s="default"===e;return(0,t.jsx)("span",{title:e,className:`inline-block max-w-full truncate rounded px-1.5 py-0.5 align-middle text-[0.6rem] font-medium border ${s?"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 ek({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 ew({text:e,field:r}){let[n,l]=(0,s.useState)(!1),{capture:o}=(0,em.usePostHog)(),i=async t=>{t.stopPropagation(),o("activity_copy_clicked",{field:r??"unknown"});try{await navigator.clipboard.writeText(e),l(!0),setTimeout(()=>l(!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),l(!0),setTimeout(()=>l(!1),1500)}};return(0,t.jsx)("button",{onClick:i,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:n?(0,t.jsx)(a.f,{className:"h-3 w-3 text-emerald-400"}):(0,t.jsx)(d.f,{className:"h-3 w-3"})})}function eS({value:e,onChange:s}){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(r=>(0,t.jsx)("button",{onClick:()=>s(r.value),className:`px-2.5 py-1 text-[0.65rem] font-medium rounded transition-all ${e===r.value?"deny"===r.value?"bg-red-500/15 text-red-400 shadow-sm":"allow"===r.value?"bg-emerald-500/15 text-emerald-400 shadow-sm":"instruct"===r.value?"bg-amber-500/15 text-amber-400 shadow-sm":"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:r.label},r.value))})}function eP({stats:e}){let s=e.totalEvents>0?e.denyCount/e.totalEvents*100:0,r=s.toFixed(s>=10?0:1),n=0===e.denyCount?"":s>=5?" is-deny":s>=2?" is-warn":"";return(0,t.jsxs)("div",{className:"stat-bar",role:"group","aria-label":"Activity stats",children:[(0,t.jsxs)("div",{className:"stat-cell",children:[(0,t.jsx)("span",{className:"eyebrow",children:"total events"}),(0,t.jsx)("span",{className:"value",children:e.totalEvents.toLocaleString()}),(0,t.jsx)("span",{className:"meta",children:"across all installed agents"})]}),(0,t.jsxs)("div",{className:"stat-cell",children:[(0,t.jsx)("span",{className:"eyebrow",children:"deny rate"}),(0,t.jsxs)("span",{className:`value${n}`,children:[r,"%"]}),(0,t.jsxs)("span",{className:"meta",children:[e.denyCount.toLocaleString()," of ",e.totalEvents.toLocaleString()," denied"]})]}),(0,t.jsxs)("div",{className:"stat-cell",children:[(0,t.jsx)("span",{className:"eyebrow",children:"top policy"}),(0,t.jsx)("span",{className:"value",style:{fontSize:16,fontWeight:500,color:e.topPolicy?"var(--accent-pink)":"var(--dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:e.topPolicy??void 0,children:e.topPolicy??"—"}),(0,t.jsx)("span",{className:"meta",children:"most-evaluated policy in scope"})]})]})}function eC({item:e}){if("observe"!==function(e,t){if(!e||!t)return;let s=eh[e];if(s)return s[t]}(e.integration,e.eventType))return null;let s=e.matchedPolicies??[];if(0===s.length)return null;let r=e.integration?(0,ex.A)(e.integration):"This CLI",n=s.map(e=>e.replace(/^(custom|\.failproofai-(project|user))\//,"")),a=1===n.length?n[0]:`${n.length} policies`,l="deny"===e.decision;return(0,t.jsxs)("div",{className:"sm:col-span-2 lg:col-span-3 mt-1 flex items-start gap-2 rounded border border-amber-500/30 bg-amber-500/5 px-2.5 py-2",children:[(0,t.jsx)(k,{className:"h-3.5 w-3.5 shrink-0 text-amber-500/80 mt-0.5","aria-hidden":"true"}),(0,t.jsxs)("p",{className:"text-[0.7rem] leading-relaxed text-muted-foreground",children:[(0,t.jsx)("span",{className:"font-medium text-foreground",children:l?"Not enforced.":"Ran, but cannot enforce here."})," ",(0,t.jsx)("span",{className:"font-mono",children:a})," ran on"," ",(0,t.jsx)("span",{className:"font-mono",children:e.eventType}),", but ",r," discards hook verdicts for this event",l?" — the action went ahead anyway.":", so a policy cannot block here."," ","Move the check to an event ",r," enforces on, such as"," ",(0,t.jsx)("span",{className:"font-mono",children:"PreToolUse"}),"."]})]})}function e_({item:e}){return(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:11,className:"px-0 py-0",children:(0,t.jsxs)("div",{className:"activity-detail animate-expand text-xs",children:[(0,t.jsxs)("span",{className:"activity-detail-eyebrow",children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"▾"}),"event detail"]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-2",children:[(0,t.jsx)(T,{item:e}),(0,t.jsx)(eC,{item:e}),e.policySource&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Decided by: "}),(0,t.jsx)("span",{className:"font-mono text-foreground",children:"cloud"===e.policySource&&e.cloudPolicyId?`cloud \xb7 ${e.cloudPolicyId} version ${e.cloudVersion}`:e.policySource})]}),(0,t.jsx)(Y,{item:e}),void 0!==e.cloudDeployment&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Cloud deployment: "}),(0,t.jsx)("span",{className:"font-mono text-foreground",children:e.cloudDeployment})]}),(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)(ew,{text:e.sessionId,field:"session_id"})]}),(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)(ew,{text:e.cwd,field:"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.transcriptPath?.startsWith("opencode-db://")&&(0,t.jsx)("span",{className:"text-muted-foreground ml-1",children:"(stored in opencode DB)"})]})]}),e.policyNames&&e.policyNames.length>1&&(0,t.jsxs)("div",{style:{marginTop:8},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",{style:{marginTop:8},children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Full reason: "}),(0,t.jsx)("span",{className:"text-foreground",children:e.reason})]})]})})})}function e$({hooksInstalled:e,onSwitchTab:r}){let{intervalSec:n}=(0,ed.useAutoRefresh)(),{capture:a}=(0,em.usePostHog)(),o=(0,eu.f)(),i=(0,s.useRef)(!1),[c,d]=(0,s.useState)(()=>(0,ep.m)(o.get("page"))),[m,u]=(0,s.useState)(null),[p,x]=(0,s.useState)([]),[h,b]=(0,s.useState)(null),[g,v]=(0,s.useState)(()=>{let e=o.get("decision");return"allow"===e||"deny"===e||"instruct"===e?e:""}),[j,y]=(0,s.useState)(()=>o.get("event")??""),[N,k]=(0,s.useState)(()=>o.get("policy")??""),[w,P]=(0,s.useState)(()=>o.get("session")??""),[T,I]=(0,s.useState)(()=>{let e=o.get("cli");return(0,ex.U)(e)?e:""}),[R,A]=(0,s.useState)(()=>{let e=o.get("source");return"custom"===e||"convention"===e||"cloud"===e||"pack"===e||"jev"===e?e:""}),E=(0,s.useRef)(null),L=(0,s.useRef)(!0),D=(0,s.useRef)({filterDecision:g,filterEventType:j,filterPolicy:N,filterSessionId:w,filterCli:T,filterSource:R});D.current={filterDecision:g,filterEventType:j,filterPolicy:N,filterSessionId:w,filterCli:T,filterSource:R},(0,s.useEffect)(()=>{if(!i.current){i.current=!0;return}o.setAll({decision:g||void 0,event:j||void 0,policy:N||void 0,session:w||void 0,cli:T||void 0,source:R||void 0,page:(0,ep.t)(c)})},[g,j,N,w,T,R,c]);let z=""!==g||""!==j||""!==N||""!==w||""!==T||""!==R,F=(0,s.useCallback)(async e=>{try{let t,{filterDecision:s,filterEventType:r,filterPolicy:n,filterSessionId:a,filterCli:l,filterSource:o}=D.current;t=""!==s||""!==r||""!==n||""!==a||""!==l||""!==o?await (0,_.f)({decision:s||void 0,eventType:r||void 0,policyName:n||void 0,sessionId:a||void 0,integration:l||void 0,source:o||void 0},e):await C(e),u(t)}catch{}},[]);(0,s.useEffect)(()=>{F(c);let e=setInterval(()=>F(c),n>0?1e3*n:5e3);return()=>clearInterval(e)},[c,F,n]),(0,s.useEffect)(()=>{let e=!1,t=()=>{$().then(t=>{e||x(t)}).catch(()=>{})};t();let s=setInterval(t,n>0?1e3*n:5e3);return()=>{e=!0,clearInterval(s)}},[n]),(0,s.useEffect)(()=>(E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{if(d(1),b(null),F(1),L.current){L.current=!1;return}a("activity_filter_changed",{active_filter_count:+(""!==g)+ +(""!==j)+ +(""!==N)+ +(""!==w)+ +(""!==T),has_decision:""!==g,has_event_type:""!==j,has_policy:""!==N,has_session:""!==w,has_cli:""!==T,decision:g||null,event_type:j||null,cli:T||null})},300),()=>{E.current&&clearTimeout(E.current)}),[g,j,N,w,T]);let W=m?.entries??[],q=m?.totalPages??1;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(M,{pauses:p}),m?.stats&&m.stats.totalEvents>0&&(0,t.jsx)("div",{style:{marginBottom:18},children:(0,t.jsx)(eP,{stats:m.stats})}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"filter-bar",children:[(0,t.jsxs)("div",{className:"filter-group",children:[(0,t.jsx)("span",{className:"filter-label",children:"decision"}),(0,t.jsx)(eS,{value:g,onChange:v})]}),(0,t.jsxs)("div",{className:"filter-group",children:[(0,t.jsx)("span",{className:"filter-label",children:"event"}),(0,t.jsxs)("select",{value:j,onChange:e=>y(e.target.value),className:"filter-input",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.jsxs)("div",{className:"filter-group",children:[(0,t.jsx)("span",{className:"filter-label",children:"source"}),(0,t.jsxs)("select",{value:R,onChange:e=>{let t=e.target.value;A("custom"===t||"convention"===t||"cloud"===t||"pack"===t||"jev"===t?t:"")},className:"filter-input","aria-label":"Filter by policy source",children:[(0,t.jsx)("option",{value:"",children:"all sources"}),(0,t.jsx)("option",{value:"custom",children:"custom"}),(0,t.jsx)("option",{value:"convention",children:"convention"}),(0,t.jsx)("option",{value:"cloud",children:"cloud"}),(0,t.jsx)("option",{value:"pack",children:"pack"}),(0,t.jsx)("option",{value:"jev",children:"jev"})]})]}),(0,t.jsxs)("div",{className:"filter-group",children:[(0,t.jsx)("span",{className:"filter-label",children:"cli"}),(0,t.jsxs)("select",{value:T,onChange:e=>{let t=e.target.value;I(""===t||(0,ex.U)(t)?t:"")},className:"filter-input","aria-label":"Filter by CLI",children:[(0,t.jsx)("option",{value:"",children:"all clis"}),ex.z.map(e=>(0,t.jsx)("option",{value:e,children:(0,ex.A)(e)},e))]})]}),(0,t.jsxs)("div",{className:"filter-group filter-group--grow",children:[(0,t.jsx)("span",{className:"filter-label",children:"policy"}),(0,t.jsx)("input",{type:"text",value:N,onChange:e=>k(e.target.value),placeholder:"filter by policy…",className:"filter-input"})]}),(0,t.jsxs)("div",{className:"filter-group filter-group--grow",children:[(0,t.jsx)("span",{className:"filter-label",children:"session"}),(0,t.jsx)("input",{type:"text",value:w,onChange:e=>P(e.target.value),placeholder:"filter by session…",className:"filter-input"})]}),z&&(0,t.jsx)("button",{type:"button",className:"filter-clear",onClick:()=>{v(""),y(""),I(""),k(""),P(""),A("")},"aria-label":"Clear all filters",children:"[ clear ]"})]}),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)(f.f,{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:()=>r?.("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:z?"No matching activity.":"Waiting for hook events…"})]}):(0,t.jsx)("div",{className:"overflow-x-auto activity-table-wrap",children:(0,t.jsxs)("table",{className:"w-full text-xs activity-table",style:{tableLayout:"fixed"},children:[(0,t.jsxs)("colgroup",{children:[(0,t.jsx)("col",{style:{width:32}}),(0,t.jsx)("col",{style:{width:"7%"}}),(0,t.jsx)("col",{style:{width:"9%"}}),(0,t.jsx)("col",{style:{width:"12%"}}),(0,t.jsx)("col",{style:{width:"11%"}}),(0,t.jsx)("col",{style:{width:"9%"}}),(0,t.jsx)("col",{style:{width:"13%"}}),(0,t.jsx)("col",{style:{width:"12%"}}),(0,t.jsx)("col",{style:{width:"11%"}}),(0,t.jsx)("col",{style:{width:"8%"}}),(0,t.jsx)("col",{style:{width:"8%"}})]}),(0,t.jsx)("thead",{className:"activity-thead",children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{className:"px-4 py-3"}),(0,t.jsx)("th",{className:"px-3 py-3 activity-th",children:"Time"}),(0,t.jsx)("th",{className:"px-3 py-3 activity-th",children:"Decision"}),(0,t.jsx)("th",{className:"px-3 py-3 activity-th",children:"Event"}),(0,t.jsx)("th",{className:"px-3 py-3 activity-th",children:"CLI"}),(0,t.jsx)("th",{className:"px-3 py-3 activity-th",children:"Tool"}),(0,t.jsx)("th",{className:"px-3 py-3 activity-th",children:"Policy"}),(0,t.jsx)("th",{className:"px-3 py-3 activity-th",children:"Reason"}),(0,t.jsx)("th",{className:"px-3 py-3 activity-th",children:"Mode"}),(0,t.jsx)("th",{className:"px-3 py-3 activity-th",children:"Duration"}),(0,t.jsx)("th",{className:"px-3 py-3 activity-th",children:"Session"})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border/30",children:W.map((e,r)=>{let n="deny"===e.decision,o=h===r,i="instruct"===e.decision;return(0,t.jsxs)(s.Fragment,{children:[(0,t.jsxs)("tr",{onClick:()=>{b(e=>{let t=e===r?null:r,s=W[r];return a("activity_row_toggled",{expanded:null!==t,decision:s?.decision??null,policy_name:s?.policyName??null,event_type:s?.eventType??null}),t})},className:`activity-data-row cursor-pointer transition-colors ${n?"bg-red-500/[0.03] hover:bg-red-500/[0.07] border-l-2 border-l-red-500/40":i?"bg-amber-500/[0.03] hover:bg-amber-500/[0.07] border-l-2 border-l-amber-500/40":r%2==0?"hover:bg-muted/30":"bg-muted/[0.04] hover:bg-muted/30"} ${o?"bg-muted/20":""}`,children:[(0,t.jsx)("td",{className:"px-4 py-2",children:(0,t.jsx)(l.f,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform duration-150 ${o?"rotate-0":"-rotate-90"}`})}),(0,t.jsx)("td",{className:"px-3 py-2 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,ef.g)(e.timestamp)}),(0,t.jsxs)("td",{className:"px-3 py-2",children:[(0,t.jsx)(ev,{decision:e.decision}),e.pausedBy&&(0,t.jsx)(U,{}),(0,t.jsx)(Q,{item:e})]}),(0,t.jsx)("td",{className:"px-3 py-2",children:(0,t.jsx)(ej,{eventType:e.eventType})}),(0,t.jsx)("td",{className:"px-3 py-2",children:(0,t.jsx)(ey,{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",title:e.reason??"",children:e.reason??"—"}),(0,t.jsx)("td",{className:"px-3 py-2",children:e.permissionMode?(0,t.jsx)(eN,{mode:e.permissionMode}):"—"}),(0,t.jsx)("td",{className:"px-3 py-2",children:(0,t.jsx)(ek,{ms:e.durationMs})}),(0,t.jsx)("td",{className:"px-3 py-2",title:e.sessionId??"",children:(0,t.jsx)(eg,{sessionId:e.sessionId,transcriptPath:e.transcriptPath,integration:e.integration,cwd:e.cwd})})]}),o&&(0,t.jsx)(e_,{item:e})]},`${e.timestamp}-${r}`)})})]})}),(0,t.jsx)(S.f,{currentPage:c,totalPages:q,onPageChange:e=>{a("activity_pagination_changed",{from_page:c,to_page:e,total_pages:q}),d(e),b(null)}})]})]})}function eM({enabled:e,onChange:s,disabled:r}){return(0,t.jsx)("button",{onClick:s,disabled:r,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 eU({policy:e,onClose:r,onSave:n}){let a=e.params??{},l=e.currentParams??{},[o,i]=(0,s.useState)(()=>{let e={};for(let[t,s]of Object.entries(a)){let r=t in l?l[t]:s.default;e[t]=r}return e});(0,s.useEffect)(()=>{let e=e=>{"Escape"===e.key&&r()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[r]);let c=(e,t)=>{i(s=>({...s,[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&&r()},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:r,className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,t.jsx)(w.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,s])=>(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:s.description}),((e,s)=>{let r=o[e];if("boolean"===s.type)return(0,t.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:!!r,onChange:t=>c(e,t.target.checked),className:"rounded border-border"}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:s.description})]});if("number"===s.type)return(0,t.jsx)("input",{type:"number",value:"number"==typeof r?r:"",onChange:t=>c(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[]"===s.type){let s=Array.isArray(r)?r.join("\n"):"";return(0,t.jsx)("textarea",{value:s,onChange:t=>c(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[]"===s.type){let s=Array.isArray(r)?r:[];return(0,t.jsxs)("div",{className:"space-y-1.5",children:[s.map((r,n)=>(0,t.jsxs)("div",{className:"flex gap-1.5 items-center",children:[(0,t.jsx)("input",{type:"text",value:r.regex,onChange:t=>{let r=[...s];r[n]={...r[n],regex:t.target.value},c(e,r)},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:r.label,onChange:t=>{let r=[...s];r[n]={...r[n],label:t.target.value},c(e,r)},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:()=>c(e,s.filter((e,t)=>t!==n)),className:"text-muted-foreground/50 hover:text-destructive transition-colors",children:(0,t.jsx)(w.X,{className:"h-3.5 w-3.5"})})]},n)),(0,t.jsx)("button",{onClick:()=>c(e,[...s,{regex:"",label:""}]),className:"text-xs text-primary hover:underline",children:"+ Add pattern"})]})}return(0,t.jsx)("input",{type:"text",value:"string"==typeof r?r:"",onChange:t=>c(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,s)]},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)(eb.f,{variant:"outline",size:"sm",onClick:r,className:"h-7 text-xs",children:"Cancel"}),(0,t.jsx)(eb.f,{size:"sm",onClick:()=>n(o),className:"h-7 text-xs",children:"Save"})]})]})})}function eT({message:e,onDismiss:s,onInstall:n,isPending:a}){let{capture:l}=(0,em.usePostHog)();return(0,r.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)(w.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:s,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)(w.X,{className:"h-4 w-4"})})]}),(0,t.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,t.jsx)(eb.f,{size:"sm",onClick:()=>{l("hooks_install_from_error_clicked",{error_message:e.slice(0,200)}),s(),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)(eb.f,{variant:"ghost",size:"sm",onClick:s,className:"h-7 px-3 text-xs text-red-400 hover:bg-red-500/10 hover:text-red-200",children:"Dismiss"})]})]})]})]}),document.body)}function eI({onHooksInstallChange:e}){let[r,n]=(0,s.useState)(null),[a,l]=(0,s.useTransition)(),[o,i]=(0,s.useState)(null),[d,m]=(0,s.useState)(null),[u,p]=(0,s.useState)(null),[x,b]=(0,s.useState)(()=>new Set),g=(0,s.useRef)(!1),{capture:v}=(0,em.usePostHog)(),j=(0,s.useCallback)((e,t)=>{v("action_error_displayed",{error_type:e,error_message:t.slice(0,200)}),i(t)},[v]),y=(0,s.useCallback)(async()=>{try{let t=await ee();n(t),e?.(t.clis.some(e=>e.installed))}catch{}},[e]);(0,s.useEffect)(()=>{y()},[y]),(0,s.useEffect)(()=>{r&&(g.current?b(new Set(r.clis.filter(e=>e.installed).map(e=>e.id))):(g.current=!0,b(new Set(r.clis.filter(e=>e.installed||e.detected).map(e=>e.id)))))},[r?.clis]);let N=(0,s.useMemo)(()=>new Set((r?.clis??[]).filter(e=>e.installed).map(e=>e.id)),[r?.clis]),k=(0,s.useMemo)(()=>{let e=[],t=[];for(let s of r?.clis??[]){let r=x.has(s.id);r&&!N.has(s.id)&&e.push(s.id),!r&&N.has(s.id)&&t.push(s.id)}return{toInstall:e,toRemove:t}},[r?.clis,x,N]),w=k.toInstall.length>0||k.toRemove.length>0,S=(e,t)=>{r&&(n(s=>s?{...s,customPolicies:s.customPolicies?.map(s=>s.id===e?{...s,enabled:!t}:s),conventionPolicies:s.conventionPolicies.map(s=>({...s,policies:s.policies.map(s=>s.id===e?{...s,enabled:!t}:s)}))}:s),l(async()=>{try{await et(e,!t)}catch{j("custom_policy_toggle","Failed to save custom policy change."),y()}}))},P=()=>{let{toInstall:e,toRemove:t}=k;(0!==e.length||0!==t.length)&&(v("cli_install_remove_submitted",{to_install:e,to_remove:t,count_install:e.length,count_remove:t.length}),l(async()=>{try{i(null),e.length>0&&await eo("user",e),t.length>0&&await ei("user",t)}catch(e){j("cli_apply",e instanceof Error?e.message:"Failed to apply changes.")}finally{await y()}}))};if(!r)return(0,t.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,t.jsxs)("span",{className:"text-sm text-muted-foreground",children:["Loading","…"]})});let C=r.clis.some(e=>e.installed),_=N.size,$=x.size,M=Array.from(new Set(r.policies.map(e=>e.category)));return(0,t.jsxs)(t.Fragment,{children:[u&&(0,t.jsx)(eU,{policy:u,onClose:()=>{v("policy_config_modal_closed",{policy_name:u.name,action:"cancel"}),p(null)},onSave:e=>{var t,s;if(!u)return;let r=u.packId?(t=u.packId,s=u.name,`pack/${t}/${s}`):u.name;p(null),l(async()=>{try{i(null),await ec(r,e),await y()}catch(e){j("param_update",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 gap-4 px-5 py-3.5 border-b border-border/60 bg-muted/10",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-wrap",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:`h-2 w-2 rounded-full transition-shadow ${C?"bg-emerald-400 shadow-[0_0_8px_rgba(52,211,153,0.6)]":"bg-muted-foreground/40"}`,"aria-hidden":!0}),(0,t.jsx)("span",{className:"text-[0.65rem] uppercase tracking-[0.2em] font-mono text-foreground/90",children:"Integrations"})]}),(0,t.jsx)("span",{className:"text-[0.65rem] font-mono text-muted-foreground/40",children:"·"}),(0,t.jsxs)("div",{className:"text-[0.65rem] uppercase tracking-[0.2em] font-mono text-muted-foreground",children:[(0,t.jsx)("span",{className:"text-foreground tabular-nums",children:_.toString().padStart(2,"0")}),(0,t.jsxs)("span",{className:"opacity-50",children:[" / 0",r.clis.length," active"]})]}),w&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-[0.65rem] font-mono text-muted-foreground/40",children:"·"}),(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-[0.65rem] uppercase tracking-[0.2em] font-mono text-pink-400",children:[(0,t.jsx)("span",{className:"h-1 w-1 rounded-full bg-pink-400 animate-pulse"}),k.toInstall.length+k.toRemove.length," pending"]})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,t.jsx)(eb.f,{variant:"outline",size:"sm",onClick:()=>{let e=Array.from(N).filter(e=>x.has(e));0!==e.length&&(v("cli_reinstall_submitted",{cli_ids:e,count:e.length}),l(async()=>{try{i(null),await eo("user",e)}catch(e){j("cli_reinstall",e instanceof Error?e.message:"Failed to reinstall.")}finally{await y()}}))},disabled:a||0===$,className:"text-xs h-7 px-3 font-mono",children:"Reinstall"}),(0,t.jsx)(eb.f,{variant:"default",size:"sm",onClick:P,disabled:a||!w,className:"text-xs h-7 px-3 font-mono",children:"Apply changes"})]})]}),(0,t.jsx)("div",{className:"divide-y divide-border/30 border-b border-border/60",children:r.clis.map((e,s)=>{let n=x.has(e.id),l=N.has(e.id),o=n!==l,i=(0,ex.G)(e.id),c=i.split(" ").find(e=>e.startsWith("text-"))??"text-foreground";return(0,t.jsxs)("label",{className:`group relative flex items-center gap-3 pl-6 pr-5 py-3 cursor-pointer transition-colors hover:bg-muted/15 ${o?"bg-pink-500/[0.04]":""}`,children:[(0,t.jsx)("div",{className:`absolute left-0 top-0 bottom-0 w-[3px] ${c} bg-current transition-opacity ${n?"opacity-100":"opacity-25 group-hover:opacity-60"}`,"aria-hidden":!0}),(0,t.jsx)("div",{className:"font-mono text-[0.65rem] text-muted-foreground/40 tabular-nums w-6 select-none",children:(s+1).toString().padStart(2,"0")}),(0,t.jsxs)("div",{className:"relative shrink-0",children:[(0,t.jsx)("input",{type:"checkbox",checked:n,onChange:()=>{var t;return t=e.id,void b(e=>{let s=new Set(e),n=!s.has(t);n?s.add(t):s.delete(t);let a=r?.clis.find(e=>e.id===t);return v("cli_selection_toggled",{cli_id:t,checked:n,current_state:a?.installed?"installed":a?.detected?"detected":"inactive"}),s})},disabled:a,className:"sr-only peer","aria-label":`Toggle ${e.label}`}),(0,t.jsx)("div",{className:`h-[18px] w-[18px] rounded-sm border transition-all peer-focus-visible:ring-2 peer-focus-visible:ring-primary/40 ${n?"bg-primary border-primary":"bg-background/50 border-border group-hover:border-foreground/40"}`,children:n&&(0,t.jsx)("svg",{viewBox:"0 0 18 18",className:"h-full w-full text-primary-foreground",fill:"none","aria-hidden":!0,children:(0,t.jsx)("path",{d:"M4 9.5L7.5 12.5L14 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),(0,t.jsx)("div",{className:"min-w-[150px] shrink-0",children:(0,t.jsx)("div",{className:"text-sm font-medium text-foreground",children:e.label})}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[l?(0,t.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border ${i}`,children:[(0,t.jsx)("span",{className:"h-1 w-1 rounded-full bg-current shadow-[0_0_4px_currentColor]"}),"Active"]}):e.detected?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border border-border/60 text-muted-foreground/80 bg-muted/20",children:[(0,t.jsx)("span",{className:"h-1 w-1 rounded-full bg-current opacity-60"}),"Detected"]}):(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border border-border/30 text-muted-foreground/40",children:"Inactive"}),o&&(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-sm text-[0.6rem] uppercase tracking-[0.15em] font-mono border border-pink-500/40 text-pink-400 bg-pink-500/10",children:n?"+ install":"− remove"})]}),(0,t.jsx)("div",{className:"ml-auto hidden lg:block text-[0.7rem] font-mono text-muted-foreground/50 truncate max-w-[420px] group-hover:text-muted-foreground/80 transition-colors",title:e.settingsPath,children:e.settingsPath})]},e.id)})}),(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:r.policies.filter(e=>e.enabled).length+(r.customPolicies?.filter(e=>e.enabled).length??0)+(r.conventionPolicies?.reduce((e,t)=>e+t.policies.filter(e=>e.enabled).length,0)??0)})," / ",r.policies.length+(r.customPolicies?.length??0)+(r.conventionPolicies?.reduce((e,t)=>e+t.policies.length,0)??0)," ","policies enabled"]}),C&&(0,t.jsxs)("span",{className:"text-[0.65rem] text-muted-foreground/60",children:["· shared across ",_," active CLI",1===_?"":"s"]})]}),o&&(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:o}),d&&(0,t.jsx)(eT,{message:d,onDismiss:()=>m(null),onInstall:P,isPending:a}),M.map(e=>{let s=r.policies.filter(t=>t.category===e),o=s.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:[o," / ",s.length," enabled"]})]}),s.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)(eM,{enabled:e.enabled,onChange:()=>{var t;let s;return t=e.enabled,s=e.name,void(!r||(!r.clis.some(e=>e.installed)?m("Policies are not installed. Install policies to continue."):(m(null),n(r=>r?{...r,policies:r.policies.map(r=>r.name===s&&r.packId===e.packId?{...r,enabled:!t}:r),packs:r.packs.map(r=>r.id===e.packId?{...r,policies:r.policies.map(e=>e.name===s?{...e,enabled:!t}:e)}:r)}:r),l(async()=>{try{let r=await el(e.packId,s,!t);r.ok||(j("policy_toggle",r.error??"Failed to save policy change."),y())}catch{j("policy_toggle","Failed to save policy change."),y()}}))))},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(([s,r])=>{let n=e.currentParams?.[s]??r.default,a=JSON.stringify(n)!==JSON.stringify(r.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:[s,":"]}),(0,t.jsx)("span",{children:function(e,t){if("string[]"===e||"pattern[]"===e){let s=Array.isArray(t)?t:[];return 0===s.length?"none":"pattern[]"===e?`${s.length} pattern${1!==s.length?"s":""}`:1===s.length?String(s[0]).slice(0,24):`${s.length} values`}return"boolean"===e?t?"on":"off":null==t||""===t?"—":String(t).slice(0,32)}(r.type,n)})]},s)})})]}),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:()=>{let t=Object.entries(e.params??{}).filter(([t,s])=>JSON.stringify(e.currentParams?.[t]??s.default)!==JSON.stringify(s.default)).length;v("policy_config_modal_opened",{policy_name:e.name,param_count:Object.keys(e.params??{}).length,has_customized_params:t>0,customized_count:t}),p(e)},title:"Edit parameters",children:(0,t.jsx)(h.f,{className:"h-3.5 w-3.5"})})]},`${e.packId}/${e.name}`))]},e)}),(r.customPoliciesPaths?.length||r.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:[r.customPolicies?.length??0," detected"]})]}),(r.customPoliciesPaths??[r.customPoliciesPath]).map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border/20",children:[(0,t.jsx)(c,{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:e})]},e)),(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)(f.f,{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:"Re-run the install command to add, remove, or reorder files."})]}),r.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:"mt-0.5 shrink-0",children:(0,t.jsx)(eM,{enabled:e.enabled,onChange:()=>S(e.id,e.enabled),disabled:a})}),(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.id))]}),r.conventionPolicies?.map(e=>(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.jsxs)("span",{className:"text-[0.7rem] font-semibold uppercase tracking-wider text-muted-foreground",children:["Convention Policies — ","project"===e.scope?"Project":"User"]}),(0,t.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground",children:[e.policies.length," hook",1===e.policies.length?"":"s"]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border/20",children:[(0,t.jsx)(c,{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:e.path})]}),0===e.policies.length?(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)(f.f,{className:"h-3.5 w-3.5 text-muted-foreground/60 shrink-0 mt-0.5"}),(0,t.jsxs)("p",{className:"text-[0.7rem] text-muted-foreground/70 leading-relaxed",children:["No policies could be read from this file. It is still loaded at runtime — run ",(0,t.jsx)("span",{className:"font-mono",children:"failproofai policies"})," to see what it registers."]})]}):e.policies.map(s=>(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)(eM,{enabled:s.enabled,onChange:()=>S(s.id,s.enabled),disabled:a})}),(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:s.name})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[s.description&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground leading-relaxed",children:s.description}),s.eventScope&&(0,t.jsx)("span",{className:"block text-[0.65rem] text-muted-foreground/40 font-mono mt-0.5 hidden lg:block",children:s.eventScope})]})]},`${e.path}:${s.name}`))]},e.path)),(0,t.jsx)(eR,{packs:r.packs??[],disabled:a,onChanged:y,onError:e=>j("pack_action",e)})]})]})}function eR({packs:e,disabled:r,onChanged:n,onError:a}){let[l,o]=(0,s.useState)(""),[i,c]=(0,s.useState)(null),[d,m]=(0,s.useState)(null),[p,h]=(0,s.useState)(null),{capture:f}=(0,em.usePostHog)(),b=async()=>{if(l.trim()){c("preview"),h(null);try{let e=await en(l);if(!e.ok)return void a(e.error??"Could not read that pack.");h(e)}finally{c(null)}}},g=async(e,t)=>{c(e),m(null);try{let e=await t();if(!e.ok)return void a(e.error??"Could not install that pack.");m(e.version?`${e.id}@${e.version}`:e.id??null),o(""),n()}catch(e){a(e instanceof Error?e.message:"Could not install that pack.")}finally{c(null)}};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:"Policy Packs"}),(0,t.jsx)("span",{className:"text-[0.7rem] text-muted-foreground",children:0===e.length?"none installed":`${e.length} installed`})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 px-4 py-3 border-b border-border/20",children:[(0,t.jsx)("input",{value:l,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&l.trim()&&!i&&(f("pack_install_submitted",{via:"input"}),g("input",()=>er(l)))},placeholder:"core · acme/ops · acme/ops@v1.2.0 · a release URL",spellCheck:!1,disabled:r||null!==i,className:"flex-1 min-w-[16rem] rounded-md border border-border/60 bg-background px-2.5 py-1.5 text-xs font-mono placeholder:text-muted-foreground/50 focus:outline-none focus:ring-1 focus:ring-ring disabled:opacity-50","aria-label":"Pack source"}),(0,t.jsx)(eb.f,{size:"sm",variant:"outline",disabled:r||null!==i||0===l.trim().length,onClick:()=>{f("pack_preview_submitted",{}),b()},children:"preview"===i?"Reading…":"Preview"}),(0,t.jsxs)(eb.f,{size:"sm",variant:"default",disabled:r||null!==i||0===l.trim().length,onClick:()=>{f("pack_install_submitted",{via:"button"}),g("input",()=>er(l))},children:[(0,t.jsx)(x,{className:"h-3.5 w-3.5"}),"input"===i?"Installing…":"Install"]})]}),p?.ok&&(0,t.jsxs)("div",{className:"border-b border-border/20 bg-muted/5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[(0,t.jsx)(u,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,t.jsxs)("span",{className:"text-xs font-mono text-foreground",children:[p.id,"@",p.version]}),(0,t.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground",children:[p.policies?.length??0," policies ·"," ",p.policies?.filter(e=>e.defaultEnabled).length??0," on by default",p.semantic&&p.semantic.length>0?` \xb7 ${p.semantic.length} Jev ${1===p.semantic.length?"check":"checks"}`:""]}),"observe"===p.effect&&(0,t.jsx)("span",{className:"text-[0.65rem] uppercase tracking-wider text-amber-500",children:"observes only"}),(0,t.jsx)("button",{onClick:()=>h(null),className:"ml-auto text-muted-foreground/60 hover:text-foreground","aria-label":"Close preview",children:(0,t.jsx)(w.X,{className:"h-3.5 w-3.5"})})]}),(0,t.jsx)("div",{className:"max-h-64 overflow-y-auto",children:p.policies?.map(e=>(0,t.jsxs)("div",{className:"flex items-start gap-3 px-4 py-2 border-t border-border/10",children:[(0,t.jsx)("span",{className:`text-[0.65rem] uppercase tracking-wider w-14 shrink-0 mt-0.5 ${e.defaultEnabled?"text-emerald-500":"text-muted-foreground/50"}`,children:e.defaultEnabled?"default":"opt-in"}),(0,t.jsx)("span",{className:"text-xs font-mono text-foreground w-56 shrink-0 truncate",children:e.name}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground leading-relaxed min-w-0",children:[e.description,(0,t.jsx)("span",{className:"block text-[0.65rem] text-muted-foreground/40 font-mono mt-0.5",children:e.category})]})]},e.name))}),(0,t.jsx)("div",{className:"px-4 py-2.5 border-t border-border/20",children:(0,t.jsxs)(eb.f,{size:"sm",variant:"default",disabled:r||null!==i,onClick:()=>{f("pack_install_submitted",{via:"preview"}),g("input",()=>er(l)).then(()=>h(null))},children:[(0,t.jsx)(x,{className:"h-3.5 w-3.5"}),"Install its defaults"]})})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 px-4 py-2.5 border-b border-border/20 bg-muted/10",children:[(0,t.jsx)("span",{className:"text-[0.7rem] text-muted-foreground/70 mr-1",children:"Failproof AI policies:"}),(0,t.jsx)(eb.f,{size:"sm",variant:"outline",disabled:r||null!==i,onClick:()=>{f("pack_install_submitted",{via:"ours"}),g("ours",()=>er("FailproofAI/policies"))},children:"ours"===i?"Installing…":"Install from GitHub"}),(0,t.jsx)(eb.f,{size:"sm",variant:"outline",disabled:r||null!==i,onClick:()=>{f("pack_install_submitted",{via:"bundled"}),g("bundled",()=>es())},children:"bundled"===i?"Installing…":"Install offline copy"}),d&&(0,t.jsxs)("span",{className:"text-[0.7rem] text-emerald-500 font-mono",children:["installed ",d]})]}),e.map(e=>(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border/20",children:[(0,t.jsx)(u,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,t.jsxs)("span",{className:"text-xs font-mono text-foreground truncate",children:[e.id,e.version?`@${e.version}`:""]}),"observe"===e.effect&&(0,t.jsx)("span",{className:"text-[0.65rem] uppercase tracking-wider text-amber-500",children:"observing"}),(0,t.jsx)("span",{className:"text-[0.65rem] text-muted-foreground/50 font-mono truncate hidden lg:inline",children:e.source}),(0,t.jsx)("button",{onClick:()=>void g(e.id,()=>ea(e.id)),disabled:r||null!==i,className:"ml-auto text-muted-foreground/60 hover:text-foreground disabled:opacity-40","aria-label":`Remove ${e.id}`,children:(0,t.jsx)(y,{className:"h-3.5 w-3.5"})})]}),e.error?(0,t.jsxs)("div",{className:"flex items-start gap-2 px-4 py-2.5 border-b border-border/20 bg-amber-500/5",children:[(0,t.jsx)(k,{className:"h-3.5 w-3.5 text-amber-500 shrink-0 mt-0.5"}),(0,t.jsxs)("p",{className:"text-[0.7rem] text-muted-foreground leading-relaxed",children:["This pack will not load: ",e.error]})]}):(0,t.jsx)("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b border-border/20",children:(0,t.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground",children:[e.policies.filter(e=>e.enabled).length," of ",e.policies.length," on — listed by category above"]})})]},`${e.id}@${e.version}`))]})}function eA({activeTab:e,onChange:s}){return(0,t.jsx)("div",{className:"tabs",style:{padding:0,marginBottom:24},children:[{id:"activity",label:"Activity"},{id:"policies",label:"Configure"}].map(r=>(0,t.jsx)("button",{type:"button",onClick:()=>s(r.id),className:`tab${e===r.id?" is-active":""}`,children:r.label.toLowerCase()},r.id))})}e.s(["default",0,function({initialTab:e="activity"}){let r=(0,eu.f)(),{capture:n}=(0,em.usePostHog)(),[a,l]=(0,s.useState)(e),[o,i]=(0,s.useState)(void 0),[c,d]=(0,s.useState)(null),[m,u]=(0,s.useState)([]);(0,s.useEffect)(()=>{ee().then(e=>{i(e.clis.some(e=>e.installed)),d({enabled:e.enabledPolicies.length,total:e.policies.length+(e.customPolicies?.length??0)+(e.conventionPolicies?.reduce((e,t)=>e+t.policies.length,0)??0)}),u(e.clis.filter(e=>e.installed).map(e=>e.label))}).catch(()=>i(void 0))},[]);let p=0===m.length?"Policy evaluations":m.length<=3?`Policy evaluations across ${m.join(", ")}`:`Policy evaluations across ${m.length} agents`,x=e=>{e!==a&&n("policies_tab_switched",{tab:e,from_tab:a}),l(e),r.setAll({tab:"activity"===e?void 0:e})};return(0,t.jsx)("main",{className:"report",children:(0,t.jsxs)("section",{className:"section","data-screen-label":"policies",children:[(0,t.jsx)("h2",{style:{fontFamily:"var(--font-mono)",fontSize:24,fontWeight:600,letterSpacing:"-0.01em",color:"var(--ink)",margin:"0 0 16px"},children:"activity"===a?"Policies":"Configure Policies"}),"activity"===a?(0,t.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:32,flexWrap:"wrap",margin:"0 0 24px"},children:[(0,t.jsxs)("div",{style:{fontFamily:"var(--font-mono)",fontSize:14,color:"var(--ink-2)",lineHeight:1.7,flex:"1 1 480px",minWidth:0},children:[p,c&&(0,t.jsxs)("span",{style:{color:"var(--dim)"},children:[" · ","enabled policies"," ",(0,t.jsxs)("span",{style:{color:"var(--ink)",fontVariantNumeric:"tabular-nums"},children:[c.enabled,"/",c.total]})]})]}),(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:6,flex:"0 0 auto"},children:[(0,t.jsx)("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,letterSpacing:"0.22em",textTransform:"uppercase",color:"var(--dim)"},children:"want to change which policies fire?"}),(0,t.jsx)("button",{type:"button",className:"btn btn-primary",onClick:()=>x("policies"),children:"[ configure policies → ]"})]})]}):(0,t.jsx)("p",{style:{fontFamily:"var(--font-mono)",fontSize:14,color:"var(--ink-2)",lineHeight:1.7,maxWidth:720,margin:"0 0 24px"},children:"switch policies on or off across your installed harnesses."}),(0,t.jsx)(eA,{activeTab:a,onChange:x}),"activity"===a?(0,t.jsx)(e$,{hooksInstalled:o,onSwitchTab:x}):(0,t.jsx)(eI,{onHooksInstallChange:i})]})})}],64245)}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,32344,e=>{var t=e.i(95187);let a=(0,t.createServerReference)("601da5259db8771c5daa055322e9f6abf5b570520a",t.callServer,void 0,t.findSourceMapURL,"searchHookActivityAction");e.s(["f",0,a])},73520,e=>{var t=e.i(43476),a=e.i(24071),r=e.i(67927);e.s(["f",0,function({currentPage:e,totalPages:l,onPageChange:o}){if(l<=1)return null;let n=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:()=>o(e-1),disabled:1===e,className:n(1===e),"aria-label":"Previous page",children:[(0,t.jsx)(a.f,{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(l<=7)return Array.from({length:l},(e,t)=>t+1);let t=[1],a=Math.max(2,e-1),r=Math.min(l-1,e+1);e<=3&&(r=Math.min(5,l-1)),e>=l-2&&(a=Math.max(2,l-4)),a>2&&t.push("ellipsis-start");for(let e=a;e<=r;e++)t.push(e);return r<l-1&&t.push("ellipsis-end"),t.push(l),t})().map(a=>"string"==typeof a?(0,t.jsx)("span",{className:"px-2 text-muted-foreground",children:"..."},a):(0,t.jsx)("button",{onClick:()=>o(a),className:`min-w-[2.5rem] px-3 py-2 text-sm rounded-md transition-colors ${e===a?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"}`,"aria-label":`Page ${a}`,"aria-current":e===a?"page":void 0,children:a},a))}),(0,t.jsxs)("button",{onClick:()=>o(e+1),disabled:e===l,className:n(e===l),"aria-label":"Next page",children:[(0,t.jsx)("span",{className:"hidden sm:inline",children:"Next"}),(0,t.jsx)(r.f,{className:"w-4 h-4"})]})]})}])},24578,e=>{let t={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"},hermes:{id:"hermes",label:"Hermes",badgeClasses:"bg-indigo-500/10 text-indigo-400 border-indigo-500/20"},openclaw:{id:"openclaw",label:"OpenClaw",badgeClasses:"bg-teal-500/10 text-teal-400 border-teal-500/20"},factory:{id:"factory",label:"Factory Droid",badgeClasses:"bg-rose-500/10 text-rose-400 border-rose-500/20"},devin:{id:"devin",label:"Devin CLI",badgeClasses:"bg-violet-500/10 text-violet-400 border-violet-500/20"},antigravity:{id:"antigravity",label:"Antigravity CLI",badgeClasses:"bg-cyan-500/10 text-cyan-400 border-cyan-500/20"},goose:{id:"goose",label:"Goose",badgeClasses:"bg-lime-500/10 text-lime-400 border-lime-500/20"}};e.s(["z",0,["claude","codex","copilot","cursor","opencode","pi","hermes","openclaw","factory","devin","antigravity","goose"],"G",0,function(e){return t[e]?.badgeClasses??t.claude.badgeClasses},"A",0,function(e){return t[e]?.label??e},"U",0,function(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(t,e)}])},34713,e=>{e.s(["M",0,function(e){if(e<1e3)return`${e}ms`;let t=Math.round(e/100);if(t<600)return`${(t/10).toFixed(1)}s`;let a=Math.round(e/1e3);if(a<3600){let e=Math.floor(a/60);return`${e}m ${a%60}s`}let r=Math.round(e/6e4),l=Math.floor(r/60);return`${l}h ${r%60}m`},"g",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`}])},80060,2711,e=>{var t=e.i(18566),a=e.i(71645);function r(e){let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${a}-${r}`}function l(e){var t;if(!e||(t=e,!/^\d{4}-\d{2}-\d{2}$/.test(t)||isNaN(Date.parse(t))))return null;let[a,r,l]=e.split("-").map(Number);return new Date(a,r-1,l,12,0,0)}e.s(["f",0,function(){let e=(0,t.useSearchParams)(),r=(0,t.useRouter)(),l=(0,t.usePathname)(),o=(0,a.useRef)(null),n=(0,a.useCallback)(t=>e.get(t),[e]),s=(0,a.useCallback)(()=>new URLSearchParams(e.toString()),[e]),i=(0,a.useCallback)(t=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{let a=new URLSearchParams(e.toString());for(let[e,r]of Object.entries(t))void 0===r||""===r?a.delete(e):a.set(e,r);let o=a.toString(),n=o?`${l}?${o}`:l;r.replace(n,{scroll:!1})},150)},[e,l,r]);return(0,a.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]),{get:n,getAll:s,setAll:i}}],80060),e.s(["V",0,function(e){let t={};return e.from&&(t.from=r(e.from)),e.to&&(t.to=r(e.to)),t},"l",0,function(e){if(0!==e.length)return e.map(e=>encodeURIComponent(e)).join(",")},"t",0,function(e){return e<=1?void 0:String(e)},"w",0,function(e){return e?e.split(",").map(e=>decodeURIComponent(e.trim())).filter(e=>e.length>0):[]},"m",0,function(e){if(!e)return 1;let t=parseInt(e,10);return Number.isFinite(t)&&t>=1?t:1},"S",0,function(e){return e&&["all","last-hour","today","last-7-days","last-30-days","custom"].includes(e)?e:"all"},"R",0,function(e,t){return{from:l(e),to:l(t)}},"$",0,function(e){return"all"===e?void 0:e}],2711)},89664,e=>{var t=e.i(56420);let a={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],89664)},24071,e=>{var t=e.i(56420);let a={name:"chevron-left",size:24,node:[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],24071)},67927,e=>{var t=e.i(56420);let a={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],67927)},8734,e=>{var t=e.i(56420);let a={name:"copy",size:24,node:[["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"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],8734)},16306,e=>{var t=e.i(56420);let a={name:"shield-alert",size:24,node:[["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"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],16306)},84026,29407,e=>{var t=e.i(56420);let a={name:"shield-check",size:24,node:[["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"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],84026);let l={name:"shield-x",size:24,node:[["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"}]],aliases:["shield-close"]};l.node;let o=(0,t.f)(l);e.s(["f",0,o],29407)},82954,e=>{var t=e.i(56420);let a={name:"shield",size:24,node:[["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"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],82954)},63676,e=>{var t=e.i(56420);let a={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};a.node;let r=(0,t.f)(a);e.s(["X",0,r],63676)}])})();
|
|
File without changes
|
|
File without changes
|
|
File without changes
|