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