1pub mod apply_patch;
9pub mod approval;
10pub mod atomic;
11pub mod checkpoint;
12pub mod daemon;
13pub mod git;
14pub mod hardening;
15mod pathguard;
16pub mod plugin;
17pub mod policy;
18pub mod redact;
19pub mod sandbox;
20pub mod storage;
21pub mod worktree;
22
23pub(crate) fn hex_lower(bytes: &[u8]) -> String {
27 const HEX: &[u8; 16] = b"0123456789abcdef";
28 let mut out = String::with_capacity(bytes.len() * 2);
29 for byte in bytes {
30 out.push(HEX[(byte >> 4) as usize] as char);
31 out.push(HEX[(byte & 0x0f) as usize] as char);
32 }
33 out
34}
35
36pub use atomic::{write_atomic, write_atomic_with_mode};
37
38pub use approval::{ApprovalReplayResult, approve_and_replay, deny_approval};
39pub use checkpoint::{
40 CheckpointFile, CheckpointManifest, CheckpointOrigin, create_checkpoint,
41 create_checkpoint_for_task, gc_old_checkpoint_dirs, restore_checkpoint,
42};
43pub use daemon::{
44 DEFAULT_PAIRING_TTL_DAYS, clamp_pairing_ttl_days, daemon_socket_path, generate_pairing_token,
45 hash_pairing_token, pairing_expiry_from_now, request_daemon_json, request_daemon_text,
46 subscribe_daemon_lines,
47};
48pub use git::{GitCommand, is_work_tree};
49pub use pathguard::{
50 OpenIntent, create_dir_all_beneath, open_beneath, remove_file_beneath, write_atomic_beneath,
51};
52pub use plugin::{
53 HookDecision, HookGate, HookResponse, PluginCapabilityPreview, PluginManifest,
54 aggregate_hook_responses, install_plugin_from_path, plugin_capability_preview,
55 run_plugin_hooks, validate_plugin_manifest, write_plugin_lockfile,
56};
57pub use policy::{
58 ActionRequest, FloorLevel, PLAN_DENIAL_MARKER, PolicyDecision, PolicyEngine, PolicyOverride,
59 PolicyOverrideDecision, READ_ONLY_DENIAL_MARKER, RiskClass, SafetyMode, ToolCategory,
60 is_destructive_command, is_plan_file_only_write, is_plan_file_path, is_plan_safe_build_command,
61};
62pub use redact::{redact_json, redact_json_text, redact_secrets, sanitize_url_for_display};
63pub use sandbox::{
64 Enforcement, SandboxPolicy, enforce, fs_confinement_available, network_killswitch_available,
65};
66pub use storage::{
67 ApprovalRecord, ApprovalsRepo, CheckpointRecord, CheckpointsRepo, CompactionRecord,
68 CompactionsRepo, MessageRecord, MessagesRepo, NewApproval, NewCheckpoint, NewCompaction,
69 NewMessage, NewOutcome, NewPluginInstall, NewProcess, NewProviderProbe, NewSession, NewTask,
70 NewToolRun, OUTCOME_LABEL_ACCEPTED, OUTCOME_LABEL_FAILURE, OUTCOME_LABEL_PARTIAL,
71 OUTCOME_LABEL_REJECTED, OUTCOME_LABEL_SUCCESS, OUTCOME_LABEL_UNKNOWN, OUTCOME_SOURCE_MODEL,
72 OUTCOME_SOURCE_SYSTEM, OUTCOME_SOURCE_USER, OUTCOME_SOURCE_VERIFIER, OutcomeRecord,
73 OutcomesRepo, PairingTokenRecord, PairingTokensRepo, PluginInstallRecord, PluginsRepo,
74 ProcessRecord, ProcessStatus, ProcessesRepo, ProviderProbeRecord, ProviderProbesRepo,
75 RuntimeStore, SessionRecord, SessionsRepo, TaskPriority, TaskRecord, TaskStatus,
76 TaskTimelineEvent, TasksRepo, ToolRunRecord, ToolRunsRepo, data_dir,
77};
78pub use worktree::{AgentWorktree, MergeOutcome, gc_orphaned_worktrees};
79#[cfg(unix)]
81pub use storage::try_exclusive_lock;