File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ type Options struct {
8989 ServiceBannerRefreshInterval time.Duration
9090 BlockFileTransfer bool
9191 Execer agentexec.Execer
92+ SubAgent bool
9293
9394 ExperimentalDevcontainersEnabled bool
9495 ContainerAPIOptions []agentcontainers.Option // Enable ExperimentalDevcontainersEnabled for these to be effective.
@@ -190,6 +191,8 @@ func New(options Options) Agent {
190191 metrics : newAgentMetrics (prometheusRegistry ),
191192 execer : options .Execer ,
192193
194+ subAgent : options .SubAgent ,
195+
193196 experimentalDevcontainersEnabled : options .ExperimentalDevcontainersEnabled ,
194197 containerAPIOptions : options .ContainerAPIOptions ,
195198 }
@@ -272,6 +275,8 @@ type agent struct {
272275 metrics * agentMetrics
273276 execer agentexec.Execer
274277
278+ subAgent bool
279+
275280 experimentalDevcontainersEnabled bool
276281 containerAPIOptions []agentcontainers.Option
277282 containerAPI atomic.Pointer [agentcontainers.API ] // Set by apiHandler.
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
5454 blockFileTransfer bool
5555 agentHeaderCommand string
5656 agentHeader []string
57+ subAgent bool
5758
5859 experimentalDevcontainersEnabled bool
5960 )
@@ -361,6 +362,7 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
361362 PrometheusRegistry : prometheusRegistry ,
362363 BlockFileTransfer : blockFileTransfer ,
363364 Execer : execer ,
365+ SubAgent : subAgent ,
364366 ExperimentalDevcontainersEnabled : experimentalDevcontainersEnabled ,
365367 })
366368
@@ -507,6 +509,17 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
507509 Description : "Allow the agent to automatically detect running devcontainers." ,
508510 Value : serpent .BoolOf (& experimentalDevcontainersEnabled ),
509511 },
512+ {
513+ Flag : "is-sub-agent" ,
514+ Default : "false" ,
515+ Env : "CODER_AGENT_IS_SUB_AGENT" ,
516+ Description : "Specify whether this is a sub agent or not." ,
517+ Value : serpent .BoolOf (& subAgent ),
518+ // As `coderd` handles the creation of sub-agents, it does not make
519+ // sense for this to be exposed. We do not want people setting an
520+ // agent as a sub-agent if it is not.
521+ Hidden : true ,
522+ },
510523 }
511524
512525 return cmd
You can’t perform that action at this time.
0 commit comments