@rockcarver/frodo-cli 5.0.0-8 → 5.0.0-9

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/dist/app.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
2
2
  const require_Console = require("./Console-1LBCP_JZ.cjs");
3
- const require_FrodoCommand = require("./FrodoCommand-DueD-n-I.cjs");
4
- const require_EscapableSelectPrompt = require("./EscapableSelectPrompt-BljVxNDm.cjs");
5
- const require_EntityPickers = require("./EntityPickers-BGrRn1Yq.cjs");
6
- const require_ResolveInteractiveInputs = require("./ResolveInteractiveInputs-D_-5704M.cjs");
3
+ const require_FrodoCommand = require("./FrodoCommand-BYl0VUkM.cjs");
4
+ const require_EscapableSelectPrompt = require("./EscapableSelectPrompt-CYqJdCqN.cjs");
5
+ const require_EntityPickers = require("./EntityPickers-DBhC-5mV.cjs");
6
+ const require_ResolveInteractiveInputs = require("./ResolveInteractiveInputs-DqsZuoJZ.cjs");
7
7
  const require_DefaultsStore = require("./DefaultsStore-RlEkAWqT.cjs");
8
8
  const require_RealmOps = require("./RealmOps-Buhw-nZ1.cjs");
9
9
  let util = require("util");
@@ -11404,7 +11404,7 @@ async function describeConnectionProfile(host, showSecrets) {
11404
11404
  require_Console.debugMessage(`ConnectionProfileOps.describeConnectionProfile: start`);
11405
11405
  const profile = await getConnectionProfileByHost$1(host);
11406
11406
  if (profile) {
11407
- require_Console.debugMessage(profile);
11407
+ require_Console.debugMessage(`ConnectionProfileOps.describeConnectionProfile: profile for host '${profile.tenant ?? host}', username '${profile.username ?? ""}', svcacctId '${profile.svcacctId ?? ""}', logApiKey '${profile.logApiKey ?? ""}'`);
11408
11408
  const present = "[present]";
11409
11409
  const jwk = profile.svcacctJwk;
11410
11410
  const privateKey = profile.amsterPrivateKey;
@@ -12189,33 +12189,6 @@ function setup$214() {
12189
12189
  //#endregion
12190
12190
  //#region src/ops/DebugLogOps.ts
12191
12191
  /**
12192
- * `frodo debug` — AIC-only, topic-scoped smart log tail (item 25).
12193
- *
12194
- * @remarks
12195
- * Reuses the existing `frodo.cloud.log.createLogTailStream()` polling
12196
- * primitive (the same one `frodo log tail` already uses) — the new part is
12197
- * classifying each raw audit-log event by topic and rendering it as a
12198
- * short, human-readable line instead of dumping the full raw JSON payload.
12199
- *
12200
- * Journey and OAuth transforms below were built against real, live event
12201
- * payloads captured this session against a real AIC tenant (including a
12202
- * deliberately broken authentication tree, to see a genuine script-failure
12203
- * payload rather than only success cases) — see `compactFailureReason`'s
12204
- * own remarks for the exact raw string that was verified.
12205
- *
12206
- * SAML and sync topics are best-effort only: no real SAML SSO flow or IDM
12207
- * reconciliation run was exercised this session (both would need
12208
- * additional live-tenant setup — a configured external IdP/SP for SAML,
12209
- * an active sync mapping for IDM recon — that wasn't available or safe to
12210
- * improvise against a real tenant in this pass), so their event-name
12211
- * recognition is inferred from naming convention alone, not confirmed
12212
- * against real payloads. The generic fallback formatter means an
12213
- * unrecognized SAML/sync event still renders as a short, readable line
12214
- * (never silently dropped, never raw JSON) — it just isn't specially
12215
- * compacted the way journey/OAuth events are.
12216
- */
12217
- const { createLogTailStream: createLogTailStream$1 } = require_Console.frodo.cloud.log;
12218
- /**
12219
12192
  * Log sources to poll per topic. `journey` and `oauth` are live-verified
12220
12193
  * (see this file's own remarks); `saml`/`sync` are best-effort guesses at
12221
12194
  * the right sources, not confirmed live this session.
@@ -12377,6 +12350,33 @@ function formatGenericAuditEvent(payload) {
12377
12350
  return parts.join(" ");
12378
12351
  }
12379
12352
  /**
12353
+ * Renders one `am-core`/`idm-access` debug-log line (the `-everything`
12354
+ * sources carry them; they have no `component`/`eventName`, so they fall
12355
+ * through every audit classifier above and used to hit the generic
12356
+ * fallback as a contentless bare "event" — confirmed live in the
12357
+ * debug-tail recording). Follows the aggregator's discipline: only
12358
+ * WARN/ERROR/FATAL am-core lines are worth a row (INFO/DEBUG/TRACE is
12359
+ * high-volume routine traffic); `idm-access` lines are always audit
12360
+ * events (`eventName: 'access'`) and never reach here. The Java logger
12361
+ * FQCN is shortened to its last segment, the message compacted through
12362
+ * `compactFailureReason` (strips the ScriptException wrapper chain,
12363
+ * decodes HTML entities) and truncated — a tail row, not a stack dump.
12364
+ */
12365
+ function formatDebugLogLine(payload) {
12366
+ if (!payload.level || ![
12367
+ "WARN",
12368
+ "ERROR",
12369
+ "FATAL"
12370
+ ].includes(payload.level)) return void 0;
12371
+ const logger = payload.logger?.split(".").pop() ?? "am-core";
12372
+ const message = payload.message ? truncateLine(compactFailureReason(payload.message), 160) : payload.exception ?? "";
12373
+ return `${payload.level} ${logger}: ${message}`.trimEnd();
12374
+ }
12375
+ /** Hard-truncates a line past `max` chars with an ellipsis (last resort — the formatters above already compact). */
12376
+ function truncateLine(line, max) {
12377
+ return line.length <= max ? line : `${line.slice(0, max - 1)}…`;
12378
+ }
12379
+ /**
12380
12380
  * Classifies and formats one raw log event for the given topic. Returns
12381
12381
  * `undefined` when the event doesn't belong to the topic at all (filtered
12382
12382
  * out); otherwise always returns a short, human-readable line — either
@@ -12385,6 +12385,7 @@ function formatGenericAuditEvent(payload) {
12385
12385
  function formatDebugEvent(event, topic) {
12386
12386
  const payload = getAuditPayload(event);
12387
12387
  if (!payload) return void 0;
12388
+ if (!payload.component && !payload.eventName && typeof payload.level === "string") return formatDebugLogLine(payload);
12388
12389
  const isJourney = payload.component === "Authentication";
12389
12390
  const isOAuth = payload.component === "OAuth";
12390
12391
  const isSaml = payload.component === "SAML2" || /saml/i.test(payload.eventName ?? "") || /saml/i.test(payload.http?.request?.path ?? "");
@@ -12402,69 +12403,282 @@ function formatDebugEvent(event, topic) {
12402
12403
  default: return;
12403
12404
  }
12404
12405
  }
12406
+ //#endregion
12407
+ //#region src/utils/interactive/DebugTailPrompt.ts
12408
+ /**
12409
+ * The interactive tail behind `frodo debug oauth|saml|sync|all`.
12410
+ *
12411
+ * @remarks
12412
+ * The presentation shell for `DebugLogOps`'s event formatters: the
12413
+ * cli action injects a `readEvents` loader (the EntityPickers injection
12414
+ * pattern -- zero `src/ops` imports here), this prompt buffers events in
12415
+ * a capped ring, and renders them inside the shared frame design (Navigate
12416
+ * bar + framed panel + `frameStatusTitle`). Replaces the old passive
12417
+ * `debugTail()` print loop, which was Ctrl+C-only.
12418
+ *
12419
+ * Behavior: newest event at the BOTTOM (tail semantics -- the view is a
12420
+ * `tail -f`), capped at {@link MAX_TAIL_EVENTS} (drop-oldest). The cursor
12421
+ * rides the bottom while it carries the follow sentinel -1 (auto-follow);
12422
+ * scrolling up detaches it and pins the visible window to the reviewed
12423
+ * event -- new events append below, unseen, never yanking the view -- and
12424
+ * scrolling back to the bottom re-arms the follow. First poll replays only ~15s of
12425
+ * log backlog (frodo-lib's LogTailStream), so startup is never a flood.
12426
+ *
12427
+ * Keys: exactly `[⏶⏷] review` and `[ESC] exit` -- a passive tail has
12428
+ * nothing to pin, select, or conclude ("silence = key does nothing",
12429
+ * the same discipline as the pickers' hint). The first ESC opens the
12430
+ * double-ESC grace (ExitAll.ts); the second exits everything.
12431
+ */
12432
+ /** The ring-buffer capacity: a busy tenant's ~15s `am-everything` backlog can exceed 200 events, but the cap means the panel always shows the LATEST 200 -- correct tail semantics. */
12433
+ const MAX_TAIL_EVENTS = 200;
12434
+ /** How many wrapped rows render at once (the visible window ending at the cursor). */
12435
+ const PAGE_SIZE = 18;
12436
+ const POLL_INTERVAL_MS$2 = 5e3;
12437
+ /** Drops the date part of an ISO timestamp, keeping `HH:MM:SS` (log lines are a same-session stream; the date is noise). */
12438
+ function formatTailTimestamp(iso) {
12439
+ if (!iso) return "--:--:--";
12440
+ const time = iso.match(/[T ](\d{2}:\d{2}:\d{2})/);
12441
+ return time ? time[1] : iso;
12442
+ }
12443
+ /**
12444
+ * Builds the panel rows for the visible window: `HH:MM:SS` muted prefix +
12445
+ * the event line, word-wrapped to the frame with continuation rows
12446
+ * indented past the timestamp column (wrapLine strips ANSI, so this only
12447
+ * receives plain lines -- the formatters' output is plain by contract).
12448
+ * `endIndex` bounds the window: rows for events `0..endIndex` inclusive,
12449
+ * returning at most the LAST `limit` visual rows of that slice (the tail
12450
+ * is the newest-at-bottom list, so the review window also slides at its
12451
+ * bottom edge -- never at the top, which would hide the re-follow path).
12452
+ * Pass `events.length - 1` for follow mode (or just omit it).
12453
+ */
12454
+ function buildTailRows(events, limit = PAGE_SIZE, innerWidth = 116, endIndex = events.length - 1) {
12455
+ const TS_COL = 11;
12456
+ const allRows = [];
12457
+ for (const event of events.slice(0, endIndex + 1)) {
12458
+ const ts = require_Console.theme.muted(formatTailTimestamp(event.timestamp));
12459
+ const plainTs = formatTailTimestamp(event.timestamp);
12460
+ require_EscapableSelectPrompt.wrapLine(event.line, innerWidth - TS_COL).forEach((part, index) => {
12461
+ const plain = index === 0 ? `${plainTs} ${part}` : `${" ".repeat(TS_COL)}${part}`;
12462
+ allRows.push({
12463
+ text: index === 0 ? `${ts} ${part}` : `${require_Console.theme.muted(" ".repeat(TS_COL))}${part}`,
12464
+ plain
12465
+ });
12466
+ });
12467
+ }
12468
+ return allRows.slice(-limit);
12469
+ }
12470
+ /** The ring-buffer append: newest at the end, drop-oldest past the cap (exported for the unit tests). */
12471
+ function appendTailEvent(buffer, event, cap = MAX_TAIL_EVENTS) {
12472
+ const next = [...buffer, event];
12473
+ return next.length > cap ? next.slice(next.length - cap) : next;
12474
+ }
12405
12475
  /**
12406
- * Continuously tails and smart-renders logs for one topic, matching
12407
- * `frodo log tail`'s existing recursive-poll pattern (a 5-second interval)
12408
- * — this is not new polling machinery, just a new rendering layer on top
12409
- * of `frodo.cloud.log.createLogTailStream()`, the deduped `tail()` wrapper
12410
- * (cookie-tracking and redelivery-dedup both live centrally in frodo-lib
12411
- * now -- see its own remarks on why raw `tail()` needs a wrapper at all).
12412
- * `stream` is only ever passed by this function's own recursive call, to
12413
- * carry the same stream (and its dedup state) forward across polls rather
12414
- * than starting a fresh one — external callers always omit it.
12476
+ * Follow-resume: after new events append, the cursor stays pinned to the
12477
+ * last row ONLY if it carries the follow sentinel (classic `tail -f`); a
12478
+ * detached cursor (reviewing history) stays put. Exported for the unit
12479
+ * tests.
12480
+ *
12481
+ * @param wasAtBottom Whether the cursor was in follow mode (-1) before the append.
12415
12482
  */
12416
- async function debugTail(topic, stream) {
12417
- try {
12418
- const source = DEBUG_TOPIC_SOURCES[topic];
12419
- const tailStream = stream ?? createLogTailStream$1(source);
12420
- const events = await tailStream.poll();
12421
- for (const event of events) {
12422
- const line = formatDebugEvent(event, topic);
12423
- if (line) require_Console.printMessage(line, "data");
12483
+ function resolveFollowCursor(wasAtBottom, newBufferLength, lastIndexBefore) {
12484
+ return wasAtBottom ? -1 : Math.min(lastIndexBefore, newBufferLength - 1);
12485
+ }
12486
+ const debugTailPromptImpl = require_EscapableSelectPrompt.createPrompt((config, done) => {
12487
+ const [events, setEvents] = require_EscapableSelectPrompt.useState([]);
12488
+ const [warning, setWarning] = require_EscapableSelectPrompt.useState(void 0);
12489
+ const [done_, setDone] = require_EscapableSelectPrompt.useState(false);
12490
+ const [escapeGraceOpen, setEscapeGraceOpen] = require_EscapableSelectPrompt.useState(false);
12491
+ const prefix = require_EscapableSelectPrompt.usePrefix({ status: done_ ? "done" : "idle" });
12492
+ const [cursorIndex, setCursorIndex] = require_EscapableSelectPrompt.useState(-1);
12493
+ const cursorIndexRef = require_EscapableSelectPrompt.useRef(cursorIndex);
12494
+ cursorIndexRef.current = cursorIndex;
12495
+ const escapeGraceRef = require_EscapableSelectPrompt.useRef(void 0);
12496
+ require_EscapableSelectPrompt.useEffect(() => () => escapeGraceRef.current?.dispose(), []);
12497
+ const resolveExit = (exitAll) => {
12498
+ setEscapeGraceOpen(false);
12499
+ setDone(true);
12500
+ done(exitAll ? require_EscapableSelectPrompt.EXIT_ALL : void 0);
12501
+ };
12502
+ require_EscapableSelectPrompt.useEffect(() => {
12503
+ let cancelled = false;
12504
+ let inFlight = false;
12505
+ const runPoll = async () => {
12506
+ if (inFlight || cancelled) return;
12507
+ inFlight = true;
12508
+ try {
12509
+ const incoming = await config.readEvents();
12510
+ if (cancelled) return;
12511
+ setWarning(void 0);
12512
+ if (incoming.length > 0) setEvents((previous) => {
12513
+ let next = previous;
12514
+ for (const event of incoming) next = appendTailEvent(next, event);
12515
+ setCursorIndex((cursorBefore) => resolveFollowCursor(cursorBefore === -1, next.length, cursorBefore));
12516
+ return next;
12517
+ });
12518
+ } catch (error) {
12519
+ if (!cancelled) setWarning(`debug: poll failed, will retry -- ${error instanceof Error ? error.message : String(error)}`);
12520
+ } finally {
12521
+ inFlight = false;
12522
+ }
12523
+ };
12524
+ runPoll();
12525
+ const interval = setInterval(() => void runPoll(), POLL_INTERVAL_MS$2);
12526
+ return () => {
12527
+ cancelled = true;
12528
+ clearInterval(interval);
12529
+ };
12530
+ }, [config.readEvents]);
12531
+ require_EscapableSelectPrompt.useKeypress((key) => {
12532
+ if (done_) return;
12533
+ if (key.name === "escape") {
12534
+ if (escapeGraceRef.current) {
12535
+ const grace = escapeGraceRef.current;
12536
+ escapeGraceRef.current = void 0;
12537
+ grace.secondEscape();
12538
+ return;
12539
+ }
12540
+ setEscapeGraceOpen(true);
12541
+ escapeGraceRef.current = require_EscapableSelectPrompt.armEscapeGrace({
12542
+ onSecondEscape: () => resolveExit(true),
12543
+ onGraceExpire: () => resolveExit(false)
12544
+ });
12545
+ return;
12424
12546
  }
12425
- setTimeout(() => {
12426
- debugTail(topic, tailStream);
12427
- }, 5e3);
12547
+ escapeGraceRef.current?.otherKey();
12548
+ escapeGraceRef.current = void 0;
12549
+ setEscapeGraceOpen(false);
12550
+ if (require_EscapableSelectPrompt.isUpKey(key) || require_EscapableSelectPrompt.isDownKey(key)) setCursorIndex((previous) => {
12551
+ const last = events.length - 1;
12552
+ if (last < 0) return -1;
12553
+ const next = (previous === -1 ? last : previous) + (require_EscapableSelectPrompt.isUpKey(key) ? -1 : 1);
12554
+ if (require_EscapableSelectPrompt.isUpKey(key)) return Math.max(0, next);
12555
+ return next >= last - 1 ? -1 : Math.max(0, next);
12556
+ });
12557
+ });
12558
+ if (done_) return `${prefix} Debug tail ended.`;
12559
+ try {
12560
+ const isFollowing = cursorIndex === -1;
12561
+ const rows = buildTailRows(events, PAGE_SIZE, 116, isFollowing ? events.length - 1 : cursorIndex);
12562
+ const graceLine = escapeGraceOpen ? {
12563
+ text: require_Console.theme.muted("esc again to exit all -- or wait to exit"),
12564
+ plain: "esc again to exit all -- or wait to exit"
12565
+ } : void 0;
12566
+ const panelLines = [];
12567
+ if (graceLine) panelLines.push(graceLine);
12568
+ if (rows.length === 0) panelLines.push({
12569
+ text: require_Console.theme.muted("(connected -- waiting for events...)"),
12570
+ plain: "(connected -- waiting for events...)"
12571
+ });
12572
+ else panelLines.push(...rows);
12573
+ if (warning) panelLines.push({
12574
+ text: require_Console.theme.warning(warning),
12575
+ plain: warning
12576
+ });
12577
+ if (!isFollowing && rows.length > 0) panelLines.push({
12578
+ text: require_Console.theme.muted("(reviewing history -- scroll down to re-follow)"),
12579
+ plain: "(reviewing history -- scroll down to re-follow)"
12580
+ });
12581
+ return [require_EscapableSelectPrompt.renderNavigationMenu(require_EscapableSelectPrompt.navigationMenuItems({ escape: "exit · [ESC]×2 exit all" })), require_EscapableSelectPrompt.renderFramedBox({
12582
+ title: require_EscapableSelectPrompt.frameStatusTitle(`${prefix} Debugging ${config.topic}`, [`(${config.hostLabel} · ${config.realmLabel})`, isFollowing ? void 0 : `row ${cursorIndex + 1}/${events.length}`].filter((suffix) => suffix !== void 0)),
12583
+ lines: panelLines
12584
+ })].join("\n");
12585
+ } catch (error) {
12586
+ return [require_EscapableSelectPrompt.renderNavigationMenu(require_EscapableSelectPrompt.navigationMenuItems({ escape: "exit · [ESC]×2 exit all" })), require_EscapableSelectPrompt.renderFramedBox({
12587
+ title: require_EscapableSelectPrompt.frameStatusTitle(`${prefix} Debugging ${config.topic}`),
12588
+ lines: [{
12589
+ text: require_Console.theme.negative(`Internal error rendering this view, will retry -- ${error instanceof Error ? error.message : String(error)}`),
12590
+ plain: `Internal error rendering this view, will retry -- ${error instanceof Error ? error.message : String(error)}`
12591
+ }]
12592
+ })].join("\n");
12593
+ }
12594
+ });
12595
+ /**
12596
+ * Runs the interactive debug tail until the user exits (ESC, 400ms grace)
12597
+ * or exits all the way out (fast double-ESC). Ctrl+C rejects with
12598
+ * ExitPromptError and resolves to a clean, silent exit (erase-on-conclude
12599
+ * has already restored the screen).
12600
+ */
12601
+ async function runDebugTailPrompt(config) {
12602
+ try {
12603
+ if (await debugTailPromptImpl(config, { clearPromptOnDone: true }) === require_EscapableSelectPrompt.EXIT_ALL) throw require_EscapableSelectPrompt.EXIT_ALL_SIGNAL;
12428
12604
  } catch (error) {
12429
- require_Console.printError(error);
12605
+ if (error instanceof require_EscapableSelectPrompt.ExitPromptError) return;
12606
+ throw error;
12430
12607
  }
12431
12608
  }
12432
12609
  //#endregion
12433
12610
  //#region src/cli/debug/debug-tail-topic.ts
12434
12611
  const { CLOUD_DEPLOYMENT_TYPE_KEY: CLOUD_DEPLOYMENT_TYPE_KEY$79 } = require_Console.frodo.utils.constants;
12612
+ const { createLogTailStream: createLogTailStream$1 } = require_Console.frodo.cloud.log;
12435
12613
  const deploymentTypes$95 = [CLOUD_DEPLOYMENT_TYPE_KEY$79];
12436
12614
  /**
12437
- * Builds a `frodo debug <topic>` command for one of the plain-tail topics
12438
- * (oauth/saml/sync/all) -- every one of those four differs only in which
12439
- * log sources it tails and what its own help text says, so they share this
12440
- * one action body rather than repeating it four times.
12615
+ * Builds a `frodo debug <topic>` command for one of the interactive-tail
12616
+ * topics (oauth/saml/sync/all) -- every one of those four differs only in
12617
+ * which log sources it tails and what its own help text says, so they
12618
+ * share this one action body rather than repeating it four times.
12441
12619
  *
12442
12620
  * @remarks
12443
12621
  * `journey` is deliberately NOT built with this factory (see
12444
12622
  * `debug-journey.ts`): it needs a full authenticated session (realm
12445
12623
  * authentication settings, per-tree journey definitions), not just Log API
12446
12624
  * credentials, and launches the interactive session aggregator instead of
12447
- * a passive tail.
12625
+ * the tail.
12626
+ *
12627
+ * The action follows the injected-loader pattern (see DebugTailPrompt):
12628
+ * the stream + `formatDebugEvent` mapping close over here, the prompt
12629
+ * stays free of `src/ops` imports.
12448
12630
  */
12449
12631
  function createDebugTailTopicCommand(fullName, topic, description, notes) {
12450
12632
  const program = new require_FrodoCommand.FrodoCommand(fullName, ["realm"], deploymentTypes$95);
12451
12633
  program.description(description).addHelpText("after", notes).action(async (host, user, password, options, command) => {
12452
12634
  command.handleDefaultArgsAndOpts(host, user, password, options, command);
12635
+ const typedHost = require_Console.state.getHost() || host || "";
12453
12636
  if (!await ensureLogApiCredentials(deploymentTypes$95)) {
12454
12637
  require_Console.printMessage("No log api credentials found!", "error");
12455
12638
  process.exitCode = 1;
12456
12639
  program.help();
12457
12640
  return;
12458
12641
  }
12459
- require_Console.printMessage(`Debugging topic '${topic}'...`, "info");
12460
- await debugTail(topic);
12642
+ const conn = await require_Console.frodo.conn.getConnectionProfile();
12643
+ const hostLabel = conn?.alias ?? typedHost ?? hostLabelFromTenant(conn?.tenant ?? require_Console.state.getHost());
12644
+ const realmLabel = normalizeRealm(require_Console.state.getRealm());
12645
+ const tailStream = createLogTailStream$1(DEBUG_TOPIC_SOURCES[topic]);
12646
+ await runDebugTailPrompt({
12647
+ topic,
12648
+ hostLabel,
12649
+ realmLabel,
12650
+ readEvents: async () => {
12651
+ const events = await tailStream.poll();
12652
+ const mapped = [];
12653
+ for (const event of events) {
12654
+ const line = formatDebugEvent(event, topic);
12655
+ if (line) mapped.push({
12656
+ timestamp: event.timestamp,
12657
+ line
12658
+ });
12659
+ }
12660
+ return mapped;
12661
+ }
12662
+ });
12461
12663
  });
12462
12664
  return program;
12463
12665
  }
12666
+ /** Falls back to the tenant URL's host part (e.g. `openam-frodo-dev.forgeblocks.com`) when no alias exists. */
12667
+ function hostLabelFromTenant(tenant) {
12668
+ try {
12669
+ return new URL(tenant).host ?? tenant;
12670
+ } catch {
12671
+ return tenant;
12672
+ }
12673
+ }
12674
+ /** Normalizes the realm token for the title: trims slashes, empty -> `root`. */
12675
+ function normalizeRealm(realm) {
12676
+ return (realm ?? "").replace(/^\/+|\/+$/g, "") || "root";
12677
+ }
12464
12678
  //#endregion
12465
12679
  //#region src/cli/debug/debug-all.ts
12466
12680
  function setup$213() {
12467
- return createDebugTailTopicCommand("frodo debug all", "all", "Debug all Identity Cloud activity — a passive log tail across every log source.", "Notes:\n Tails am-everything and idm-everything. Unrecognized events still print a short generic summary — never silently dropped, never raw JSON.\n");
12681
+ return createDebugTailTopicCommand("frodo debug all", "all", "Debug all Identity Cloud activity — a live event tail across every log source.", "Notes:\n Tails am-everything and idm-everything. Unrecognized events still render a short generic summary — never silently dropped, never raw JSON.\n");
12468
12682
  }
12469
12683
  //#endregion
12470
12684
  //#region src/ops/JourneyDebugAggregator.ts
@@ -13245,6 +13459,24 @@ function pickDefined(obj) {
13245
13459
  * or minutes for a real journey to start -- and is rendered as a plain
13246
13460
  * waiting message, never as an error or a blank screen.
13247
13461
  */
13462
+ /** `stripAnsi` as a single-argument helper for the panelRow discipline: every framed row carries its honest {text, plain} pair. */
13463
+ function stripAnsiOf(text) {
13464
+ return require_EscapableSelectPrompt.stripAnsi(text);
13465
+ }
13466
+ /** Panel-row width discipline applied at the top: the list's page rows must also fit the frame's inner width (a very wide terminal is not a license to draw past 120 -- same default as every box). */
13467
+ function clampListWidthToFrame(widths) {
13468
+ const fixed = 4 + STATUS_COL_WIDTH + 5;
13469
+ const budget = require_EscapableSelectPrompt.frameInnerWidth() - fixed - 20;
13470
+ const measured = widths.journey + widths.user + widths.age;
13471
+ if (measured <= budget) return widths;
13472
+ const overflow = measured - budget;
13473
+ const takeJourney = Math.min(overflow, widths.journey - 7);
13474
+ return {
13475
+ journey: Math.max(7, widths.journey - takeJourney),
13476
+ user: Math.max(4, widths.user - (overflow - takeJourney)),
13477
+ age: widths.age
13478
+ };
13479
+ }
13248
13480
  const POLL_INTERVAL_MS$1 = 5e3;
13249
13481
  const QUIET_HINT_AFTER_MS = 3 * POLL_INTERVAL_MS$1;
13250
13482
  const STATUS_COL_WIDTH = 9;
@@ -13301,20 +13533,23 @@ function statusLabel(session) {
13301
13533
  return statusColorFn(session.status)(session.status);
13302
13534
  }
13303
13535
  function renderListHeader(widths) {
13304
- const cells = [
13536
+ const plain = [
13305
13537
  " ",
13306
13538
  padCell("STATUS", STATUS_COL_WIDTH),
13307
13539
  padCell("JOURNEY", widths.journey),
13308
13540
  padCell("USER", widths.user),
13309
13541
  padCell("AGE", widths.age),
13310
13542
  "DETAIL"
13311
- ];
13312
- return require_Console.theme.heading(cells.join(" "));
13543
+ ].join(" ");
13544
+ return {
13545
+ text: require_Console.theme.heading(plain),
13546
+ plain
13547
+ };
13313
13548
  }
13314
13549
  function renderListRow(session, isActive, widths) {
13315
13550
  const now = Date.now();
13316
13551
  const pin = session.pinned ? "📌 " : " ";
13317
- const cursor = isActive ? "› " : " ";
13552
+ const marker = (isActive ? "› " : " ") + pin;
13318
13553
  const statusCell = statusColorFn(session.status)(padCell(session.status, STATUS_COL_WIDTH));
13319
13554
  const treeCell = padCell(session.treeName ? truncate(session.treeName, MAX_JOURNEY_COL_WIDTH) : "(unknown tree)", widths.journey);
13320
13555
  const journeyCell = session.treeName ? treeCell : require_Console.theme.muted(treeCell);
@@ -13322,14 +13557,44 @@ function renderListRow(session, isActive, widths) {
13322
13557
  const userCell = require_Console.theme.muted(padCell(displayUser ? truncate(displayUser, MAX_USER_COL_WIDTH) : "", widths.user));
13323
13558
  const ageCell = require_Console.theme.muted(padCell(formatElapsed(now - session.startedAt), widths.age));
13324
13559
  const detailCell = session.status === "failed" && session.failureReason ? require_Console.theme.muted(`- ${truncate(session.failureReason, MAX_DETAIL_COL_WIDTH)}`) : session.lastNode ? require_Console.theme.muted(`@ ${truncate(session.lastNode, MAX_DETAIL_COL_WIDTH)}`) : "";
13325
- const line = [
13326
- cursor + pin,
13560
+ const line = `${marker}${[
13327
13561
  statusCell,
13328
13562
  journeyCell,
13329
13563
  userCell,
13330
13564
  ageCell
13331
- ].join(" ").concat(detailCell ? ` ${detailCell}` : "");
13332
- return isActive ? require_Console.theme.command(line) : line;
13565
+ ].join(" ").concat(detailCell ? ` ${detailCell}` : "")}`;
13566
+ return {
13567
+ text: isActive ? require_Console.theme.command(line) : line,
13568
+ plain: require_EscapableSelectPrompt.stripAnsi(line)
13569
+ };
13570
+ }
13571
+ /**
13572
+ * Property rows for the two detail views: `Label:` in the label color
13573
+ * followed by the value, wrapped to the frame's inner width when the
13574
+ * value runs long (a raw AM exception message alone confirmed live past
13575
+ * 190 chars) -- one PanelRow per VISUAL row, continuation lines indented
13576
+ * past the label column. wrapLine strips ANSI before measuring, so the
13577
+ * wrap goes over the plain value and the drawn text re-colors per row
13578
+ * (continuation rows render plain -- losing a colored value's ANSI on
13579
+ * its wrapped tail is the accepted trade for honest walls).
13580
+ */
13581
+ function propertyPanelRows(properties) {
13582
+ const labelWidth = Math.max(...properties.map((p) => p.label.length)) + 1;
13583
+ const innerWidth = require_EscapableSelectPrompt.frameInnerWidth();
13584
+ const rows = [];
13585
+ for (const p of properties) {
13586
+ const label = padCell(`${p.label}:`, labelWidth);
13587
+ const colorFn = p.labelColor ?? require_Console.theme.emphasis;
13588
+ const plainValue = require_EscapableSelectPrompt.stripAnsi(p.value);
13589
+ require_EscapableSelectPrompt.wrapLine(plainValue, innerWidth - label.length - 1).forEach((part, index) => {
13590
+ const plain = index === 0 ? `${label} ${part}` : `${" ".repeat(labelWidth)} ${part}`;
13591
+ rows.push({
13592
+ text: index === 0 ? `${colorFn(label)} ${part}` : require_Console.theme.muted(plain),
13593
+ plain
13594
+ });
13595
+ });
13596
+ }
13597
+ return rows;
13333
13598
  }
13334
13599
  function renderDetail(session, activeEventIndex) {
13335
13600
  const now = Date.now();
@@ -13379,15 +13644,24 @@ function renderDetail(session, activeEventIndex) {
13379
13644
  value: session.failureReason,
13380
13645
  labelColor: require_Console.theme.negative
13381
13646
  });
13382
- const labelWidth = Math.max(...properties.map((p) => p.label.length)) + 1;
13383
- const lines = properties.map((p) => {
13384
- return `${(p.labelColor ?? require_Console.theme.emphasis)(padCell(`${p.label}:`, labelWidth))} ${p.value}`;
13647
+ const lines = propertyPanelRows(properties);
13648
+ lines.push({
13649
+ text: "",
13650
+ plain: ""
13651
+ }, {
13652
+ text: require_Console.theme.emphasis("Recent events:"),
13653
+ plain: "Recent events:"
13385
13654
  });
13386
- lines.push("", require_Console.theme.emphasis("Recent events:"));
13387
13655
  const shown = session.events.slice(-40);
13388
13656
  const omitted = session.events.length - shown.length;
13389
- if (omitted > 0) lines.push(require_Console.theme.muted(` (${omitted} earlier events omitted)`));
13390
- if (shown.length === 0) lines.push(require_Console.theme.muted(" (none yet)"));
13657
+ if (omitted > 0) lines.push({
13658
+ text: require_Console.theme.muted(` (${omitted} earlier events omitted)`),
13659
+ plain: ` (${omitted} earlier events omitted)`
13660
+ });
13661
+ if (shown.length === 0) lines.push({
13662
+ text: require_Console.theme.muted(" (none yet)"),
13663
+ plain: " (none yet)"
13664
+ });
13391
13665
  else {
13392
13666
  let elapsedWidth = 4;
13393
13667
  let stepWidth = 4;
@@ -13397,20 +13671,25 @@ function renderDetail(session, activeEventIndex) {
13397
13671
  stepWidth = Math.max(stepWidth, truncate(event.step, MAX_STEP_COL_WIDTH).length);
13398
13672
  if (event.type) typeWidth = Math.max(typeWidth, truncate(event.type, MAX_TYPE_COL_WIDTH).length);
13399
13673
  }
13400
- lines.push(require_Console.theme.heading(` ${padCell("TIME", elapsedWidth)} ${padCell("SRC", SRC_COL_WIDTH)} ${padCell("STEP", stepWidth)} ${padCell("TYPE", typeWidth)} OUTCOME`));
13674
+ lines.push({
13675
+ text: require_Console.theme.heading(` ${padCell("TIME", elapsedWidth)} ${padCell("SRC", SRC_COL_WIDTH)} ${padCell("STEP", stepWidth)} ${padCell("TYPE", typeWidth)} OUTCOME`),
13676
+ plain: ` ${padCell("TIME", elapsedWidth)} ${padCell("SRC", SRC_COL_WIDTH)} ${padCell("STEP", stepWidth)} ${padCell("TYPE", typeWidth)} OUTCOME`
13677
+ });
13401
13678
  shown.forEach((event, index) => {
13402
13679
  const isActive = index === activeEventIndex;
13403
- const cursor = isActive ? "› " : " ";
13404
- const elapsedCell = require_Console.theme.muted(padCell(`+${formatElapsed(event.at - session.startedAt)}`, elapsedWidth));
13405
- const srcCell = require_Console.theme.muted(padCell(event.source, SRC_COL_WIDTH));
13406
- const stepCell = padCell(truncate(event.step, MAX_STEP_COL_WIDTH), stepWidth);
13407
- const typeCell = padCell(event.type ? truncate(event.type, MAX_TYPE_COL_WIDTH) : "", typeWidth);
13408
- const repeatSuffix = event.repeatCount && event.repeatCount > 1 ? require_Console.theme.muted(` (×${event.repeatCount})`) : "";
13409
- const row = ` ${cursor}${elapsedCell} ${srcCell} ${stepCell} ${typeCell} ${`${event.outcome ?? ""}${repeatSuffix}`}`.trimEnd();
13410
- lines.push(isActive ? require_Console.theme.command(row) : row);
13680
+ const prefixPlain = ` ${isActive ? "› " : " "}${padCell(`+${formatElapsed(event.at - session.startedAt)}`, elapsedWidth)} ${padCell(event.source, SRC_COL_WIDTH)} ${padCell(truncate(event.step, MAX_STEP_COL_WIDTH), stepWidth)} ${padCell(event.type ? truncate(event.type, MAX_TYPE_COL_WIDTH) : "", typeWidth)}`;
13681
+ const outcomePlain = `${event.outcome ?? ""}${event.repeatCount && event.repeatCount > 1 ? ` (×${event.repeatCount})` : ""}`;
13682
+ const outcomeWidth = Math.max(10, require_EscapableSelectPrompt.frameInnerWidth() - prefixPlain.length - 1);
13683
+ require_EscapableSelectPrompt.wrapLine(outcomePlain, outcomeWidth).forEach((part, partIndex) => {
13684
+ const plain = partIndex === 0 ? `${prefixPlain} ${part}`.trimEnd() : `${" ".repeat(prefixPlain.length + 1)}${part}`;
13685
+ lines.push({
13686
+ text: partIndex === 0 ? isActive ? require_Console.theme.command(plain) : plain : require_Console.theme.muted(plain),
13687
+ plain
13688
+ });
13689
+ });
13411
13690
  });
13412
13691
  }
13413
- return lines.join("\n");
13692
+ return lines;
13414
13693
  }
13415
13694
  /** Turns a camelCase raw-field key into a human label, e.g. `authIndexValue` -> `Auth Index Value`. */
13416
13695
  function prettifyKey(key) {
@@ -13457,8 +13736,7 @@ function renderEventDetail(session, event) {
13457
13736
  label: prettifyKey(key),
13458
13737
  value: formatRawValue(value)
13459
13738
  });
13460
- const labelWidth = Math.max(...properties.map((p) => p.label.length)) + 1;
13461
- return properties.map((p) => `${require_Console.theme.emphasis(padCell(`${p.label}:`, labelWidth))} ${p.value}`).join("\n");
13739
+ return propertyPanelRows(properties);
13462
13740
  }
13463
13741
  const EMPTY_DERIVED_STATE = {
13464
13742
  clampedActive: 0,
@@ -13499,6 +13777,35 @@ const journeyDebugPromptImpl = require_EscapableSelectPrompt.createPrompt((confi
13499
13777
  const [selectedEventId, setSelectedEventId] = require_EscapableSelectPrompt.useState(void 0);
13500
13778
  const [done_, setDone] = require_EscapableSelectPrompt.useState(false);
13501
13779
  const prefix = require_EscapableSelectPrompt.usePrefix({ status: done_ ? "done" : "idle" });
13780
+ const escapeGraceRef = require_EscapableSelectPrompt.useRef(void 0);
13781
+ const [escapeGraceOpen, setEscapeGraceOpen] = require_EscapableSelectPrompt.useState(false);
13782
+ require_EscapableSelectPrompt.useEffect(() => () => escapeGraceRef.current?.dispose(), []);
13783
+ /** Cancels any open grace (every non-ESC key breaks the streak). */
13784
+ const cancelEscapeGrace = () => {
13785
+ escapeGraceRef.current?.otherKey();
13786
+ escapeGraceRef.current = void 0;
13787
+ setEscapeGraceOpen(false);
13788
+ };
13789
+ /** First ESC from the CURRENT view: arm the grace window. */
13790
+ const armViewEscapeGrace = () => {
13791
+ setEscapeGraceOpen(true);
13792
+ escapeGraceRef.current = require_EscapableSelectPrompt.armEscapeGrace({
13793
+ onSecondEscape: () => {
13794
+ setEscapeGraceOpen(false);
13795
+ setDone(true);
13796
+ done(require_EscapableSelectPrompt.EXIT_ALL);
13797
+ },
13798
+ onGraceExpire: () => {
13799
+ setEscapeGraceOpen(false);
13800
+ if (viewMode === "event") setViewMode("detail");
13801
+ else if (viewMode === "detail") setViewMode("list");
13802
+ else {
13803
+ setDone(true);
13804
+ done();
13805
+ }
13806
+ }
13807
+ });
13808
+ };
13502
13809
  require_EscapableSelectPrompt.useEffect(() => {
13503
13810
  let cancelled = false;
13504
13811
  let inFlight = false;
@@ -13539,9 +13846,19 @@ const journeyDebugPromptImpl = require_EscapableSelectPrompt.createPrompt((confi
13539
13846
  require_EscapableSelectPrompt.useKeypress((key) => {
13540
13847
  try {
13541
13848
  if (done_) return;
13849
+ if (key.name === "escape") {
13850
+ if (escapeGraceRef.current) {
13851
+ const grace = escapeGraceRef.current;
13852
+ escapeGraceRef.current = void 0;
13853
+ grace.secondEscape();
13854
+ return;
13855
+ }
13856
+ armViewEscapeGrace();
13857
+ return;
13858
+ }
13859
+ cancelEscapeGrace();
13542
13860
  if (viewMode === "event") {
13543
- if (key.name === "escape") setViewMode("detail");
13544
- else if ((require_EscapableSelectPrompt.isUpKey(key) || require_EscapableSelectPrompt.isDownKey(key)) && shownEvents.length) {
13861
+ if ((require_EscapableSelectPrompt.isUpKey(key) || require_EscapableSelectPrompt.isDownKey(key)) && shownEvents.length) {
13545
13862
  const offset = require_EscapableSelectPrompt.isUpKey(key) ? -1 : 1;
13546
13863
  const nextIndex = (clampedEventIndex + offset + shownEvents.length) % shownEvents.length;
13547
13864
  const nextEvent = shownEvents[nextIndex];
@@ -13550,8 +13867,7 @@ const journeyDebugPromptImpl = require_EscapableSelectPrompt.createPrompt((confi
13550
13867
  return;
13551
13868
  }
13552
13869
  if (viewMode === "detail") {
13553
- if (key.name === "escape") setViewMode("list");
13554
- else if (require_EscapableSelectPrompt.isSpaceKey(key) && detailSession) {
13870
+ if (require_EscapableSelectPrompt.isSpaceKey(key) && detailSession) {
13555
13871
  aggregator.togglePin(detailSession.transactionId);
13556
13872
  setSessions(aggregator.getSessions());
13557
13873
  } else if (require_EscapableSelectPrompt.isEnterKey(key) && shownEvents.length) {
@@ -13565,10 +13881,7 @@ const journeyDebugPromptImpl = require_EscapableSelectPrompt.createPrompt((confi
13565
13881
  }
13566
13882
  return;
13567
13883
  }
13568
- if (key.name === "escape") {
13569
- setDone(true);
13570
- done();
13571
- } else if (require_EscapableSelectPrompt.isEnterKey(key) && sessions.length) {
13884
+ if (require_EscapableSelectPrompt.isEnterKey(key) && sessions.length) {
13572
13885
  setDetailId(sessions[clampedActive].transactionId);
13573
13886
  setSelectedEventId(void 0);
13574
13887
  setViewMode("detail");
@@ -13586,60 +13899,107 @@ const journeyDebugPromptImpl = require_EscapableSelectPrompt.createPrompt((confi
13586
13899
  });
13587
13900
  if (done_) return `${prefix} Journey debugging ended.`;
13588
13901
  const warningLine = warning ? require_Console.theme.warning(warning) : "";
13902
+ /**
13903
+ * One panel body row from a rendered (colored) string -- plain
13904
+ * mirrors it ANSI-free so `renderFramedBox`'s measure stays honest.
13905
+ * `stripAnsi` is imported for exactly this discipline.
13906
+ */
13907
+ const panelRow = (row) => ({
13908
+ text: row,
13909
+ plain: stripAnsiOf(row)
13910
+ });
13911
+ const graceLine = escapeGraceOpen ? panelRow(require_Console.theme.muted("esc again to exit all -- or wait to go back")) : void 0;
13589
13912
  try {
13590
13913
  if (derivedError) throw new Error(derivedError);
13591
- if (viewMode === "event" && detailSession && activeEvent) return [
13592
- `${prefix} ${require_Console.theme.heading("Event detail")}`,
13593
- renderEventDetail(detailSession, activeEvent),
13594
- "",
13595
- require_Console.theme.muted("(↑↓ select another event · esc back to journey detail)"),
13596
- warningLine
13597
- ].filter(Boolean).join("\n");
13598
- if (viewMode === "detail" && detailSession) return [
13599
- `${prefix} ${require_Console.theme.heading("Journey detail")}`,
13600
- renderDetail(detailSession, clampedEventIndex),
13601
- "",
13602
- require_Console.theme.muted("(↑↓ select event · enter view event · space pin/unpin · esc back to list)"),
13603
- warningLine
13604
- ].filter(Boolean).join("\n");
13914
+ if (viewMode === "event" && detailSession && activeEvent) {
13915
+ const panelLines = [];
13916
+ if (graceLine) panelLines.push(graceLine);
13917
+ panelLines.push(...renderEventDetail(detailSession, activeEvent));
13918
+ return [
13919
+ require_EscapableSelectPrompt.renderNavigationMenu(require_EscapableSelectPrompt.navigationMenuItems({ escape: "back · [ESC]×2 exit all" })),
13920
+ require_EscapableSelectPrompt.renderFramedBox({
13921
+ title: require_EscapableSelectPrompt.frameStatusTitle(`${prefix} Event detail`),
13922
+ lines: panelLines
13923
+ }),
13924
+ warningLine
13925
+ ].filter(Boolean).join("\n");
13926
+ }
13927
+ if (viewMode === "detail" && detailSession) {
13928
+ const panelLines = [];
13929
+ if (graceLine) panelLines.push(graceLine);
13930
+ panelLines.push(...renderDetail(detailSession, clampedEventIndex));
13931
+ return [
13932
+ require_EscapableSelectPrompt.renderNavigationMenu(require_EscapableSelectPrompt.navigationMenuItems({
13933
+ enter: "view event",
13934
+ space: "pin/unpin",
13935
+ escape: "back · [ESC]×2 exit all"
13936
+ })),
13937
+ require_EscapableSelectPrompt.renderFramedBox({
13938
+ title: require_EscapableSelectPrompt.frameStatusTitle(`${prefix} Journey detail`),
13939
+ lines: panelLines
13940
+ }),
13941
+ warningLine
13942
+ ].filter(Boolean).join("\n");
13943
+ }
13605
13944
  const filterLabel = describeFilter(config, aggregator.getResolvedUserIdAlias());
13606
- if (sessions.length === 0) return [
13607
- `${prefix} ${require_Console.theme.heading("Debugging journeys")}`,
13608
- require_Console.theme.muted(filterLabel ? `No journey activity matching [${filterLabel}] detected yet -- waiting for a match (or check the filter for a typo)...` : "No journey activity detected yet -- waiting for a journey to start (this can take a few minutes)..."),
13609
- require_Console.theme.muted("(esc exit)"),
13610
- warningLine
13611
- ].filter(Boolean).join("\n");
13612
- const listWidths = computeListColumnWidths(sessions);
13945
+ const title = require_EscapableSelectPrompt.frameStatusTitle(`${prefix} Debugging journeys`, [...sessions.length ? [`(${sessions.length} tracked)`] : [], ...filterLabel ? [`[${filterLabel}]`] : []]);
13946
+ if (sessions.length === 0) {
13947
+ const waitingLine = filterLabel ? `No journey activity matching [${filterLabel}] detected yet -- waiting for a match (or check the filter for a typo)...` : "No journey activity detected yet -- waiting for a journey to start...";
13948
+ return [require_EscapableSelectPrompt.renderNavigationMenu(require_EscapableSelectPrompt.navigationMenuItems({ escape: "exit · [ESC]×2 exit all" })), require_EscapableSelectPrompt.renderFramedBox({
13949
+ title,
13950
+ lines: [
13951
+ ...graceLine ? [graceLine] : [],
13952
+ panelRow(require_Console.theme.muted(waitingLine)),
13953
+ ...warningLine ? [panelRow(warningLine)] : []
13954
+ ]
13955
+ })].filter(Boolean).join("\n");
13956
+ }
13957
+ const listWidths = clampListWidthToFrame(computeListColumnWidths(sessions));
13613
13958
  const page = require_EscapableSelectPrompt.usePagination({
13614
13959
  items: sessions,
13615
13960
  active: clampedActive,
13616
- renderItem: ({ item, isActive }) => renderListRow(item, isActive, listWidths),
13961
+ renderItem: ({ item, isActive }) => renderListRow(item, isActive, listWidths).text,
13617
13962
  pageSize: 15,
13618
13963
  loop: true
13619
13964
  });
13620
- return [
13621
- `${prefix} ${require_Console.theme.heading("Debugging journeys")} ${require_Console.theme.muted(`(${sessions.length} tracked)`)}${filterLabel ? ` ${require_Console.theme.muted(`[${filterLabel}]`)}` : ""}`,
13622
- renderListHeader(listWidths),
13623
- page,
13624
- require_Console.theme.muted("(↑↓ navigate · enter drill-down · space pin/unpin · esc exit)"),
13625
- warningLine
13626
- ].filter(Boolean).join("\n");
13627
- } catch (error) {
13628
- return [
13629
- `${prefix} ${require_Console.theme.heading("Debugging journeys")}`,
13630
- require_Console.theme.negative(`Internal error rendering this view, will retry on the next update -- ${error instanceof Error ? error.message : String(error)}`),
13631
- require_Console.theme.muted("(esc exit)"),
13632
- warningLine
13633
- ].filter(Boolean).join("\n");
13965
+ const panelLines = [];
13966
+ if (graceLine) panelLines.push(graceLine);
13967
+ panelLines.push(renderListHeader(listWidths));
13968
+ for (const row of page.split("\n")) panelLines.push(panelRow(row));
13969
+ if (warningLine) panelLines.push(panelRow(warningLine));
13970
+ return [require_EscapableSelectPrompt.renderNavigationMenu(require_EscapableSelectPrompt.navigationMenuItems({
13971
+ enter: "drill down",
13972
+ space: "pin/unpin",
13973
+ escape: "exit · [ESC]×2 exit all"
13974
+ })), require_EscapableSelectPrompt.renderFramedBox({
13975
+ title,
13976
+ lines: panelLines
13977
+ })].filter(Boolean).join("\n");
13978
+ } catch (error) {
13979
+ return [require_EscapableSelectPrompt.renderNavigationMenu(require_EscapableSelectPrompt.navigationMenuItems({ escape: "exit · [ESC]×2 exit all" })), require_EscapableSelectPrompt.renderFramedBox({
13980
+ title: require_EscapableSelectPrompt.frameStatusTitle(`${prefix} Debugging journeys`),
13981
+ lines: [
13982
+ ...graceLine ? [graceLine] : [],
13983
+ panelRow(require_Console.theme.negative(`Internal error rendering this view, will retry on the next update -- ${error instanceof Error ? error.message : String(error)}`)),
13984
+ ...warningLine ? [panelRow(warningLine)] : []
13985
+ ]
13986
+ })].filter(Boolean).join("\n");
13634
13987
  }
13635
13988
  });
13636
13989
  /**
13637
- * Runs the interactive journey-debugging session until the user presses
13638
- * Escape from the top-level list. Assumes `state`/credentials are already
13639
- * set up by the caller (same convention as `frodo debug`'s other topics).
13990
+ * Runs the interactive journey-debugging session until the user backs out
13991
+ * (single ESC from the top-level list, 400ms grace) or exits all the way
13992
+ * out (fast double-ESC from any view). Assumes `state`/credentials are
13993
+ * already set up by the caller (same convention as `frodo debug`'s other
13994
+ * topics).
13640
13995
  */
13641
13996
  async function runJourneyDebugPrompt(config = {}) {
13642
- await journeyDebugPromptImpl(config, { clearPromptOnDone: true });
13997
+ try {
13998
+ if (await journeyDebugPromptImpl(config, { clearPromptOnDone: true }) === require_EscapableSelectPrompt.EXIT_ALL) throw require_EscapableSelectPrompt.EXIT_ALL_SIGNAL;
13999
+ } catch (error) {
14000
+ if (error instanceof require_EscapableSelectPrompt.ExitPromptError) return;
14001
+ throw error;
14002
+ }
13643
14003
  }
13644
14004
  //#endregion
13645
14005
  //#region src/cli/debug/debug-journey.ts
@@ -13670,23 +14030,23 @@ function setup$212() {
13670
14030
  //#endregion
13671
14031
  //#region src/cli/debug/debug-oauth.ts
13672
14032
  function setup$211() {
13673
- return createDebugTailTopicCommand("frodo debug oauth", "oauth", "Debug OAuth2/OIDC activity — a smart-filtered passive log tail.", "Notes:\n A smart-filtered passive log tail, verified against real log traffic on a live tenant.\n");
14033
+ return createDebugTailTopicCommand("frodo debug oauth", "oauth", "Debug OAuth2/OIDC activity — a live, smart-filtered event tail.", "Notes:\n A live, self-updating tail of smart-filtered OAuth2/OIDC events, verified against real log traffic on a live tenant.\n");
13674
14034
  }
13675
14035
  //#endregion
13676
14036
  //#region src/cli/debug/debug-saml.ts
13677
14037
  function setup$210() {
13678
- return createDebugTailTopicCommand("frodo debug saml", "saml", "Debug SAML activity — a best-effort passive log tail.", "Notes:\n A best-effort passive tail: recognized by naming convention only, not yet verified against a real SAML SSO flow. Unrecognized events still print a short generic summary — never silently dropped, never raw JSON.\n");
14038
+ return createDebugTailTopicCommand("frodo debug saml", "saml", "Debug SAML activity — a best-effort live event tail.", "Notes:\n A best-effort tail: events recognized by naming convention only, not yet verified against a real SAML SSO flow. Unrecognized events still render a short generic summary — never silently dropped, never raw JSON.\n");
13679
14039
  }
13680
14040
  //#endregion
13681
14041
  //#region src/cli/debug/debug-sync.ts
13682
14042
  function setup$209() {
13683
- return createDebugTailTopicCommand("frodo debug sync", "sync", "Debug IDM sync/reconciliation activity — a best-effort passive log tail.", "Notes:\n A best-effort passive tail: recognized by naming convention only, not yet verified against a real IDM reconciliation run. Unrecognized events still print a short generic summary — never silently dropped, never raw JSON.\n");
14043
+ return createDebugTailTopicCommand("frodo debug sync", "sync", "Debug IDM sync/reconciliation activity — a best-effort live event tail.", "Notes:\n A best-effort tail: events recognized by naming convention only, not yet verified against a real IDM reconciliation run. Unrecognized events still render a short generic summary — never silently dropped, never raw JSON.\n");
13684
14044
  }
13685
14045
  //#endregion
13686
14046
  //#region src/cli/debug/debug.ts
13687
14047
  function setup$208() {
13688
14048
  const { CLOUD_DEPLOYMENT_TYPE_KEY } = require_Console.frodo.utils.constants;
13689
- const program = new require_FrodoCommand.FrodoStubCommand("debug", [CLOUD_DEPLOYMENT_TYPE_KEY]).summary("Interactively debug Identity Cloud activity").description("Interactively debug Identity Cloud activity for one functional area — for journeys, this launches a live, self-updating list of in-flight/recent journey executions (detected from the log stream) to drill into; other topics print a smart-filtered log tail instead.").withStability("experimental");
14049
+ const program = new require_FrodoCommand.FrodoStubCommand("debug", [CLOUD_DEPLOYMENT_TYPE_KEY]).summary("Interactively debug Identity Cloud activity").description("Interactively debug Identity Cloud activity for one functional area — for journeys, this launches a live, self-updating list of in-flight/recent journey executions (detected from the log stream) to drill into; other topics run a live, self-updating tail of smart-filtered log events.").withStability("experimental");
13690
14050
  program.addCommand(setup$212().name("journey"));
13691
14051
  program.addCommand(setup$211().name("oauth"));
13692
14052
  program.addCommand(setup$210().name("saml"));
@@ -19133,7 +19493,7 @@ function setup$101() {
19133
19493
  }
19134
19494
  //#endregion
19135
19495
  //#region package.json
19136
- var version$1 = "5.0.0-8";
19496
+ var version$1 = "5.0.0-9";
19137
19497
  //#endregion
19138
19498
  //#region node_modules/@modelcontextprotocol/server/dist/chunk-Br0eD_fh.mjs
19139
19499
  var __create = Object.create;
@@ -43960,7 +44320,7 @@ const { getVersion, getBuildTimestamp, getAllVersions } = require_Console.frodo.
43960
44320
  * rather than a tsup build, since no bundler ever substitutes the
43961
44321
  * identifier there.
43962
44322
  */
43963
- const getCliBuildTimestamp = () => "2026-10-14T22:31:17.156Z";
44323
+ const getCliBuildTimestamp = () => "2026-10-15T17:40:08.375Z";
43964
44324
  const VERSION_CACHE_FILE = `${os.default.homedir()}/.frodo/Versions.json`;
43965
44325
  const VERSION_CHECK_INTERVAL = 86400;
43966
44326
  const ENDPOINTS = [{