Skip to content

An open-source, faster Devin alternative

TypeScript

agent create: require --core

Igor Zalutski69d4682426df
diff --git a/cmd/oc/internal/commands/agent.go b/cmd/oc/internal/commands/agent.go
index bf94272e..c56d6b33 100644
--- a/cmd/oc/internal/commands/agent.go
+++ b/cmd/oc/internal/commands/agent.go
@@ -100,7 +100,8 @@ func formatAge(isoTime string) string {
func init() {
// Per-subcommand flags
- agentCreateCmd.Flags().String("core", "", "Managed core (e.g. hermes)")
+ agentCreateCmd.Flags().String("core", "", "Managed core (required, e.g. hermes|openclaw)")
+ _ = agentCreateCmd.MarkFlagRequired("core")
agentCreateCmd.Flags().StringSlice("secret", nil, "Secrets (KEY=VALUE)")
agentCreateCmd.Flags().Bool("no-wait", false, "Don't wait for instance provisioning; exit after agent record is created")
diff --git a/cmd/oc/internal/commands/agent_create.go b/cmd/oc/internal/commands/agent_create.go
index 9bffe362..66866a0c 100644
--- a/cmd/oc/internal/commands/agent_create.go
+++ b/cmd/oc/internal/commands/agent_create.go
@@ -13,7 +13,10 @@ import (
var agentCreateCmd = &cobra.Command{
Use: "create <id>",
Short: "Create a new managed agent",
- Args: cobra.ExactArgs(1),
+ Long: "Create a new managed agent. A core (e.g. --core hermes) is required:\n" +
+ "without one, the agent has no runtime and cannot connect channels\n" +
+ "or install packages.",
+ Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
sc, err := sessionsClient(cmd)
if err != nil {
@@ -26,10 +29,8 @@ var agentCreateCmd = &cobra.Command{
noWait, _ := cmd.Flags().GetBool("no-wait")
body := map[string]interface{}{
- "id": id,
- }
- if core != "" {
- body["core"] = core
+ "id": id,
+ "core": core,
}
// Parse --secret KEY=VAL flags into secrets map
@@ -60,12 +61,6 @@ var agentCreateCmd = &cobra.Command{
fmt.Fprintln(os.Stderr, " ✓ Agent record created")
}
- // No core means no instance to wait for — skip polling.
- if agent.Core == nil {
- printer.Print(agent, func() {})
- return nil
- }
-
// --no-wait short-circuits into Mode 3 (async fallback). Scripts
// that don't want to block use this path.
if noWait {