1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! Per-shell session state for kobe's active target.
//!
//! Thin wrapper around `kunobi_auth::client::session`, which provides
//! the cross-platform parent-PID-keyed file machinery used by all
//! Kunobi CLIs. This module only exists to:
//!
//! - hard-code the `"kobe"` product key in one place so call sites
//! don't pass it everywhere,
//! - declare the kobe-specific [`SessionState`] shape (just
//! `current_target` today; future fields would land here).
//!
//! See `kunobi_auth::client::session` for the storage layout, the
//! `KUNOBI_SESSIONS_DIR` test override, and the rationale for using
//! the parent shell PID instead of env vars or shell hooks.
use Result;
use session as base;
use ;
use PathBuf;
/// Product key under which kobe's session files live in the shared
/// Kunobi cache (`<cache>/kunobi/sessions/kobe/<ppid>.json`).
const PRODUCT: &str = "kobe";
/// Persistent state for one interactive shell's `kobe` session.
/// Read the current shell's session state, if any.
/// Write the current shell's session state, replacing any previous
/// content.
/// Remove the current shell's session file. No-op if it doesn't exist.
/// Currently used only by tests; exposed as `pub` so a future
/// `kobe config logout-target` (or similar) can reuse it without
/// re-deriving the path.
/// Sweep session files whose owning shell PID has exited.