MCPcopy Create free account
hub / github.com/compozy/agh / newTaskHeartbeatCommand

Function newTaskHeartbeatCommand

internal/cli/task.go:1639–1685  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

1637}
1638
1639func newTaskHeartbeatCommand(deps commandDeps) *cobra.Command {
1640 var leaseSeconds int64
1641
1642 cmd := &cobra.Command{
1643 Use: "heartbeat <run-id>",
1644 Short: "Extend a claimed task run lease for the current agent session",
1645 Args: cobra.ExactArgs(1),
1646 Example: ` # Extend the active session-bound lease
1647 agh task heartbeat run-123
1648
1649 # Request a specific lease duration
1650 agh task heartbeat run-123 --lease-seconds 300`,
1651 RunE: func(cmd *cobra.Command, args []string) error {
1652 runID, err := requiredAgentTaskRunID(args[0])
1653 if err != nil {
1654 return err
1655 }
1656 if err := validateAgentTaskLeaseSeconds(leaseSeconds); err != nil {
1657 return err
1658 }
1659 request := AgentTaskHeartbeatRequest{
1660 LeaseSeconds: leaseSeconds,
1661 }
1662
1663 client, err := clientFromDeps(deps)
1664 if err != nil {
1665 return err
1666 }
1667 credentials, err := requireAgentCommandIdentity(
1668 cmd.Context(),
1669 deps,
1670 client,
1671 agentActionCLI("task.heartbeat"),
1672 )
1673 if err != nil {
1674 return err
1675 }
1676 record, err := client.AgentTaskHeartbeat(cmd.Context(), runID, request, credentials)
1677 if err != nil {
1678 return err
1679 }
1680 return writeCommandOutput(cmd, agentTaskLeaseBundle(record))
1681 },
1682 }
1683 cmd.Flags().Int64Var(&leaseSeconds, "lease-seconds", 0, "Lease duration in seconds")
1684 return cmd
1685}
1686
1687func newTaskCompleteCommand(deps commandDeps) *cobra.Command {
1688 var resultRaw string

Callers 1

newTaskCommandFunction · 0.85

Calls 8

requiredAgentTaskRunIDFunction · 0.85
clientFromDepsFunction · 0.85
agentActionCLIFunction · 0.85
writeCommandOutputFunction · 0.85
agentTaskLeaseBundleFunction · 0.85
AgentTaskHeartbeatMethod · 0.65

Tested by

no test coverage detected