MCPcopy
hub / github.com/docker/docker-agent / handleExecMode

Method handleExecMode

cmd/root/run.go:865–887  ·  view source on GitHub ↗
(ctx context.Context, out *cli.Printer, rt runtime.Runtime, sess *session.Session, args []string)

Source from the content-addressed store, hash-verified

863}
864
865func (f *runExecFlags) handleExecMode(ctx context.Context, out *cli.Printer, rt runtime.Runtime, sess *session.Session, args []string) error {
866 if f.sessionReadOnly {
867 return errors.New("--session-read-only cannot be used with --exec: there is nothing to display without a TUI")
868 }
869
870 // args[0] is the agent file; args[1:] are user messages for multi-turn conversation
871 var userMessages []string
872 if len(args) > 1 {
873 userMessages = args[1:]
874 }
875
876 err := cli.Run(ctx, out, cli.Config{
877 AppName: AppName,
878 AttachmentPath: f.attachmentPath,
879 HideToolCalls: f.hideToolCalls,
880 OutputJSON: f.outputJSON,
881 AutoApprove: f.autoApprove,
882 }, rt, sess, userMessages)
883 if cliErr, ok := errors.AsType[cli.RuntimeError](err); ok {
884 return RuntimeError{Err: cliErr.Err}
885 }
886 return err
887}
888
889func readInitialMessage(args []string) (*string, error) {
890 if len(args) < 2 {

Callers 1

runOrExecMethod · 0.95

Calls 2

RunFunction · 0.92
NewMethod · 0.45

Tested by

no test coverage detected