Skip to main content

heddle_cli_args/cli/cli_args/
commands_agent.rs

1// SPDX-License-Identifier: Apache-2.0
2//! `heddle agent` — agent-loop affordances.
3//!
4//! Agent commands are one-shot repository operations. The unused local daemon
5//! daemon control surface was removed during the native hosted cutover.
6
7use clap::Subcommand;
8
9use super::commands_args::{
10    AgentApiListArgs, AgentCaptureArgs, AgentFanoutPlanArgs, AgentFanoutStartArgs,
11    AgentHeartbeatArgs, AgentPresenceCompleteArgs, AgentPresenceExplainArgs, AgentPresenceListArgs,
12    AgentPresenceShowArgs, AgentProvenanceBeginArgs, AgentProvenanceEndArgs,
13    AgentProvenanceListArgs, AgentProvenanceSegmentArgs, AgentProvenanceShowArgs, AgentReadyArgs,
14    AgentReleaseArgs, AgentReserveArgs, AgentTaskCreateArgs, AgentTaskListArgs, AgentTaskShowArgs,
15    AgentTaskUpdateArgs, TimelineCommands,
16};
17
18#[derive(Clone, Debug, Subcommand)]
19pub enum AgentCommands {
20    // --- Reservation API (orchestration surface) ----------------
21    // The variants below are the stable JSON API that orchestrators
22    // (Claude Code subagents, codex harnesses, etc.) call to
23    // coordinate parallel writers on the same repo. Distinct from
24    // the daemon-control variants above: these are one-shot CLI
25    // calls that mutate writer leases and actor presence.
26    /// Atomically reserve a thread for one writer.
27    Reserve(AgentReserveArgs),
28
29    /// Update reservation heartbeat.
30    Heartbeat(AgentHeartbeatArgs),
31
32    /// Capture under a token-authenticated writer lease.
33    Capture(AgentCaptureArgs),
34
35    /// Mark a reservation's thread ready for integration.
36    Ready(AgentReadyArgs),
37
38    /// Release a reservation (status: complete | abandoned).
39    Release(AgentReleaseArgs),
40
41    /// List agent reservations (optionally filtered to alive ones).
42    List(AgentApiListArgs),
43
44    /// Manage local agent task assignments.
45    #[command(subcommand)]
46    Task(AgentTaskCommands),
47
48    /// Plan and start native fan-out lanes.
49    #[command(subcommand)]
50    Fanout(AgentFanoutCommands),
51
52    /// Record provider, model, and policy provenance across an agent run.
53    #[command(subcommand)]
54    Provenance(AgentProvenanceCommands),
55
56    /// Inspect attribution and work context for local agents.
57    ///
58    /// Presence records explain who is acting; `agent reserve` grants
59    /// writer authority.
60    #[command(subcommand)]
61    Presence(PresenceCommands),
62
63    /// Navigate, fork, reset, and recover agent tool-call timelines.
64    #[command(subcommand)]
65    Timeline(TimelineCommands),
66}
67
68#[derive(Clone, Debug, Subcommand)]
69pub enum PresenceCommands {
70    /// List agent presence records known to this repository.
71    List(AgentPresenceListArgs),
72
73    /// Show the current or selected agent presence record.
74    Show(AgentPresenceShowArgs),
75
76    /// Explain why Heddle attached the current or selected presence record.
77    Explain(AgentPresenceExplainArgs),
78
79    /// Mark the current or selected presence record complete.
80    Complete(AgentPresenceCompleteArgs),
81}
82
83#[derive(Clone, Debug, Subcommand)]
84pub enum AgentProvenanceCommands {
85    /// Begin a provider/model provenance session.
86    Begin(AgentProvenanceBeginArgs),
87
88    /// Record a provider, model, or policy change within the current session.
89    Segment(AgentProvenanceSegmentArgs),
90
91    /// End the current or selected provenance session.
92    End(AgentProvenanceEndArgs),
93
94    /// Show the current or selected provenance session.
95    Show(AgentProvenanceShowArgs),
96
97    /// List provenance sessions.
98    List(AgentProvenanceListArgs),
99}
100
101#[derive(Clone, Debug, Subcommand)]
102pub enum AgentTaskCommands {
103    /// Create a local agent task assignment.
104    Create(AgentTaskCreateArgs),
105
106    /// List local agent task assignments.
107    List(AgentTaskListArgs),
108
109    /// Show one local agent task assignment.
110    Show(AgentTaskShowArgs),
111
112    /// Update one local agent task assignment.
113    Update(AgentTaskUpdateArgs),
114}
115
116#[derive(Clone, Debug, Subcommand)]
117pub enum AgentFanoutCommands {
118    /// Preview fan-out lane setup and return commands without writing.
119    Plan(AgentFanoutPlanArgs),
120
121    /// Create task assignments and materialized child lanes.
122    Start(AgentFanoutStartArgs),
123}