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,
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
57#[derive(Clone, Debug, Subcommand)]
58pub enum PresenceCommands {
59    /// List agent presence records known to this repository.
60    List(AgentPresenceListArgs),
61
62    /// Show the current or selected agent presence record.
63    Show(AgentPresenceShowArgs),
64
65    /// Explain why Heddle attached the current or selected presence record.
66    Explain(AgentPresenceExplainArgs),
67
68    /// Mark the current or selected presence record complete.
69    Complete(AgentPresenceCompleteArgs),
70}
71
72#[derive(Clone, Debug, Subcommand)]
73pub enum AgentProvenanceCommands {
74    /// Begin a provider/model provenance session.
75    Begin(AgentProvenanceBeginArgs),
76
77    /// Record a provider, model, or policy change within the current session.
78    Segment(AgentProvenanceSegmentArgs),
79
80    /// End the current or selected provenance session.
81    End(AgentProvenanceEndArgs),
82
83    /// Show the current or selected provenance session.
84    Show(AgentProvenanceShowArgs),
85
86    /// List provenance sessions.
87    List(AgentProvenanceListArgs),
88}
89
90#[derive(Clone, Debug, Subcommand)]
91pub enum AgentTaskCommands {
92    /// Create a local agent task assignment.
93    Create(AgentTaskCreateArgs),
94
95    /// List local agent task assignments.
96    List(AgentTaskListArgs),
97
98    /// Show one local agent task assignment.
99    Show(AgentTaskShowArgs),
100
101    /// Update one local agent task assignment.
102    Update(AgentTaskUpdateArgs),
103}
104
105#[derive(Clone, Debug, Subcommand)]
106pub enum AgentFanoutCommands {
107    /// Preview fan-out lane setup and return commands without writing.
108    Plan(AgentFanoutPlanArgs),
109
110    /// Create task assignments and materialized child lanes.
111    Start(AgentFanoutStartArgs),
112}