Open source AI coding agent. Designed for large projects and real world tasks.
Go aiai-agentsai-developer-toolsai-toolsclicommand-linedeveloper-toolsgitgolanggpt-4llmopenaipolyglot-programmingterminalterminal-basedterminal-ui
bunch of fixes, infra
Dane Schneider22c72cb6ff70
diff --git a/app/cli/api/clients.go b/app/cli/api/clients.goindex fd71e507..0167a4d5 100644--- a/app/cli/api/clients.go+++ b/app/cli/api/clients.go@@ -3,6 +3,7 @@ package apiimport ("net""net/http"+ "os""plandex/auth""plandex/types""time"@@ -19,8 +20,11 @@ var cloudApiHost stringvar Client types.ApiClient = (*Api)(nil)func init() {- // TODO: set this to the actual cloud api host in production- cloudApiHost = "http://localhost:8088"+ if os.Getenv("PLANDEX_ENV") == "development" {+ cloudApiHost = "http://localhost:8088"+ } else {+ cloudApiHost = "https://api.plandex.ai"+ }}func getApiHost() string {diff --git a/app/cli/api/methods.go b/app/cli/api/methods.goindex c6c7df5b..59b7ffd5 100644--- a/app/cli/api/methods.go+++ b/app/cli/api/methods.go@@ -15,6 +15,8 @@ import (func (a *Api) StartTrial() (*shared.StartTrialResponse, *shared.ApiError) {serverUrl := cloudApiHost + "/accounts/start_trial"+ log.Println("Sending request to", serverUrl)+resp, err := unauthenticatedClient.Post(serverUrl, "application/json", nil)if err != nil {return nil, &shared.ApiError{Type: shared.ApiErrorTypeOther, Msg: fmt.Sprintf("error sending request: %v", err)}diff --git a/app/cli/lib/current.go b/app/cli/lib/current.goindex c1f55537..014fbc72 100644--- a/app/cli/lib/current.go+++ b/app/cli/lib/current.go@@ -3,6 +3,7 @@ package libimport ("encoding/json""fmt"+ "log""os""path/filepath""plandex/api"@@ -30,11 +31,15 @@ func MustResolveProject() {panic(fmt.Errorf("could not find or create plandex directory"))}+ log.Println("PlandexDir: ", fs.PlandexDir)+// check if project.json exists in PlandexDirpath := filepath.Join(fs.PlandexDir, "project.json")_, err := os.Stat(path)if os.IsNotExist(err) {+ log.Println("project.json does not exist")+ log.Println("Initializing project")mustInitProject()} else if err != nil {panic(fmt.Errorf("error checking if project.json exists: %v", err))@@ -147,12 +152,15 @@ func loadCurrentBranch() error {}func mustInitProject() {+ log.Println("Calling api.CreateProject()")res, apiErr := api.Client.CreateProject(shared.CreateProjectRequest{Name: filepath.Base(fs.ProjectRoot)})if apiErr != nil {panic(fmt.Errorf("error creating project: %v", apiErr.Msg))}+ log.Println("Project created:", res.Id)+CurrentProjectId = res.Id// write project.json@@ -171,6 +179,8 @@ func mustInitProject() {panic(fmt.Errorf("error writing project.json: %v", err))}+ log.Println("Wrote project.json")+// write current_plan.json to PlandexHomeDir/[projectId]/current_plan.jsondir := filepath.Join(fs.HomePlandexDir, CurrentProjectId)err = os.MkdirAll(dir, os.ModePerm)@@ -193,4 +203,6 @@ func mustInitProject() {if err != nil {panic(fmt.Errorf("error writing current_plan.json: %v", err))}++ log.Println("Wrote current_plan.json")}diff --git a/app/server/db/plan_helpers.go b/app/server/db/plan_helpers.goindex e35b65b2..4fc9ee07 100644--- a/app/server/db/plan_helpers.go+++ b/app/server/db/plan_helpers.go@@ -65,12 +65,16 @@ func CreatePlan(orgId, projectId, userId, name string) (*Plan, error) {return nil, fmt.Errorf("error creating main branch: %v", err)}+ log.Println("Created branch main")+err = InitPlan(orgId, plan.Id)if err != nil {return nil, fmt.Errorf("error initializing plan dir: %v", err)}+ log.Println("Initialized plan dir")+// commit the transactionif err := tx.Commit(); err != nil {return nil, fmt.Errorf("error committing transaction: %v", err)diff --git a/app/server/email/email.go b/app/server/email/email.goindex f098e7aa..93403543 100644--- a/app/server/email/email.go+++ b/app/server/email/email.go@@ -3,10 +3,11 @@ package emailimport ("fmt""os"++ "github.com/atotto/clipboard""github.com/aws/aws-sdk-go/aws""github.com/aws/aws-sdk-go/aws/session""github.com/aws/aws-sdk-go/service/ses"- "github.com/atotto/clipboard""github.com/gen2brain/beeep")@@ -40,11 +41,7 @@ func SendVerificationEmail(email string, pin string) error {// sendEmailViaSES sends an email using AWS SESfunc sendEmailViaSES(recipient, subject, htmlBody, textBody string) error {- // Create a new session in the us-west-2 region.- // Replace us-west-2 with the AWS Region you're working with.- sess, err := session.NewSession(&aws.Config{- Region: aws.String("us-west-2"),- })+ sess, err := session.NewSession()if err != nil {return fmt.Errorf("error creating AWS session: %v", err)}@@ -75,7 +72,7 @@ func sendEmailViaSES(recipient, subject, htmlBody, textBody string) error {Data: aws.String(subject),},},- Source: aws.String("[email protected]"), // Replace with your "From" address+ Source: aws.String("[email protected]"),}// Attempt to send the email.diff --git a/app/server/go.mod b/app/server/go.modindex 191ad31b..799471fb 100644--- a/app/server/go.mod+++ b/app/server/go.mod@@ -17,6 +17,7 @@ require (github.com/godbus/dbus/v5 v5.1.0 // indirectgithub.com/hashicorp/errwrap v1.1.0 // indirectgithub.com/hashicorp/go-multierror v1.1.1 // indirect+ github.com/jmespath/go-jmespath v0.4.0 // indirectgithub.com/mattn/go-colorable v0.1.13 // indirectgithub.com/mattn/go-isatty v0.0.20 // indirectgithub.com/mattn/go-runewidth v0.0.9 // indirect@@ -30,6 +31,7 @@ require (require (github.com/atotto/clipboard v0.1.4+ github.com/aws/aws-sdk-go v1.50.9github.com/fatih/color v1.16.0github.com/gen2brain/beeep v0.0.0-20230907135156-1a38885a97fcgithub.com/golang-migrate/migrate/v4 v4.16.2diff --git a/app/server/go.sum b/app/server/go.sumindex 5a104c84..197fc434 100644--- a/app/server/go.sum+++ b/app/server/go.sum@@ -4,6 +4,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migcgithub.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=+github.com/aws/aws-sdk-go v1.50.9 h1:yX66aKnEtRc/uNV/1EH8CudRT5aLwVwcSwTBphuVPt8=+github.com/aws/aws-sdk-go v1.50.9/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=@@ -42,6 +44,9 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDYgithub.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=+github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=+github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=+github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g=github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ=github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=@@ -91,11 +96,14 @@ golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=+golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo=golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=diff --git a/app/server/model/plan/exec_status.go b/app/server/model/plan/exec_status.goindex 6385c94c..c8acc466 100644--- a/app/server/model/plan/exec_status.go+++ b/app/server/model/plan/exec_status.go@@ -6,51 +6,15 @@ import ("fmt""plandex-server/model""plandex-server/model/prompts"- "plandex-server/types""github.com/sashabaranov/go-openai")-func ExecStatus(client *openai.Client, message string, ctx context.Context) (*types.PlanExecStatus, error) {- var res types.PlanExecStatus-- errCh := make(chan error, 2)-- go func() {- needsInput, err := ExecStatusNeedsInput(client, message, ctx)- if err != nil {- errCh <- err- return- }- res.NeedsInput = needsInput- errCh <- nil- }()-- go func() {- finished, err := ExecStatusIsFinished(client, message, ctx)- if err != nil {- errCh <- err- return- }- res.Finished = finished- errCh <- nil- }()-- for i := 0; i < 2; i++ {- err := <-errCh- if err != nil {- return nil, err- }- }-- return &res, nil-}--func ExecStatusIsFinished(client *openai.Client, message string, ctx context.Context) (bool, error) {+func ExecStatusShouldContinue(client *openai.Client, message string, ctx context.Context) (bool, error) {messages := []openai.ChatCompletionMessage{{Role: openai.ChatMessageRoleSystem,- Content: prompts.GetExecStatusIsFinishedPrompt(message),+ Content: prompts.GetExecStatusShouldContinue(message), // Ensure this function is correctly defined in your package},}@@ -58,7 +22,7 @@ func ExecStatusIsFinished(client *openai.Client, message string, ctx context.Conctx,openai.ChatCompletionRequest{Model: model.PlanExecStatusModel,- Functions: []openai.FunctionDefinition{prompts.PlanIsFinishedFn},+ Functions: []openai.FunctionDefinition{prompts.ShouldAutoContinueFn},Messages: messages,ResponseFormat: &openai.ChatCompletionResponseFormat{Type: "json_object"},},@@ -70,80 +34,29 @@ func ExecStatusIsFinished(client *openai.Client, message string, ctx context.Con}var strRes string- var res types.PlanExecStatus-- for _, choice := range resp.Choices {- if choice.FinishReason == "function_call" &&- choice.Message.FunctionCall != nil &&- choice.Message.FunctionCall.Name == "planIsFinished" {- fnCall := choice.Message.FunctionCall- strRes = fnCall.Arguments- }- }-- if strRes == "" {- fmt.Println("no planIsFinished function call found in response")- return false, err- }-- byteRes := []byte(strRes)-- err = json.Unmarshal(byteRes, &res)- if err != nil {- fmt.Printf("Error unmarshalling plan exec status response: %v\n", err)- return false, err- }-- return res.Finished, nil-}--func ExecStatusNeedsInput(client *openai.Client, message string, ctx context.Context) (bool, error) {- messages := []openai.ChatCompletionMessage{- {- Role: openai.ChatMessageRoleSystem,- Content: prompts.GetExecStatusNeedsInputPrompt(message),- },+ var res struct {+ ShouldContinue bool `json:"shouldContinue"`}- resp, err := client.CreateChatCompletion(- ctx,- openai.ChatCompletionRequest{- Model: model.PlanExecStatusModel,- Functions: []openai.FunctionDefinition{prompts.PlanNeedsInputFn},- Messages: messages,- ResponseFormat: &openai.ChatCompletionResponseFormat{Type: "json_object"},- },- )-- if err != nil {- fmt.Printf("Error during plan exec status check model call: %v\n", err)- return false, err- }-- var strRes string- var res types.PlanExecStatus-for _, choice := range resp.Choices {if choice.FinishReason == "function_call" &&choice.Message.FunctionCall != nil &&- choice.Message.FunctionCall.Name == "planNeedsInput" {+ choice.Message.FunctionCall.Name == "shouldAutoContinue" {fnCall := choice.Message.FunctionCallstrRes = fnCall.Arguments}}if strRes == "" {- fmt.Println("no planNeedsInput function call found in response")- return false, err+ fmt.Println("No shouldAutoContinue function call found in response")+ return false, fmt.Errorf("no shouldAutoContinue function call found in response")}- byteRes := []byte(strRes)-- err = json.Unmarshal(byteRes, &res)+ err = json.Unmarshal([]byte(strRes), &res)if err != nil {fmt.Printf("Error unmarshalling plan exec status response: %v\n", err)return false, err}- return res.NeedsInput, nil+ return res.ShouldContinue, nil}diff --git a/app/server/model/plan/tell.go b/app/server/model/plan/tell.goindex 8194e0e2..408668f5 100644--- a/app/server/model/plan/tell.go+++ b/app/server/model/plan/tell.go@@ -664,7 +664,7 @@ func execTellPlan(client *openai.Client, plan *db.Plan, branch string, auth *typrepoLockId, err := db.LockRepo(auth.OrgId, auth.User.Id, planId, branch, db.LockScopeWrite)- var execStatus *types.PlanExecStatus+ var shouldContinue boolerr = func() error {defer func() {err = db.UnlockRepo(repoLockId)@@ -725,7 +725,7 @@ func execTellPlan(client *openai.Client, plan *db.Plan, branch string, auth *typgo func() {- execStatus, err = ExecStatus(client, assistantMsg.Message, active.Ctx)+ shouldContinue, err = ExecStatusShouldContinue(client, assistantMsg.Message, active.Ctx)if err != nil {onError(fmt.Errorf("failed to get exec status: %v", err), false, assistantMsg.Id, convoCommitMsg)errCh <- err@@ -755,7 +755,10 @@ func execTellPlan(client *openai.Client, plan *db.Plan, branch string, auth *typreturn}- if !req.AutoContinue || execStatus.Finished || execStatus.NeedsInput {+ if req.AutoContinue && shouldContinue {+ // continue plan+ execTellPlan(client, plan, branch, auth, req, active, iteration+1)+ } else {if GetActivePlan(planId, branch).BuildFinished() {active.Stream(shared.StreamMessage{Type: shared.StreamMessageFinished,@@ -765,10 +768,6 @@ func execTellPlan(client *openai.Client, plan *db.Plan, branch string, auth *typactive.RepliesFinished = true})}-- } else {- // continue plan- execTellPlan(client, plan, branch, auth, req, active, iteration+1)}returndiff --git a/app/server/model/prompts/create.go b/app/server/model/prompts/create.goindex 335b5807..0509fbb4 100644--- a/app/server/model/prompts/create.go+++ b/app/server/model/prompts/create.go@@ -49,13 +49,25 @@ const SysCreate = Identity + ` A plan is a set of files with an attached contextDon't try to do too much in a single response. The code you include in file blocks will be parsed into replacements by an AI, and then applied to the file. If you include too much code, it may not be parsed correctly or the changes may be difficult to apply.- If plan requires a number of small changes, then multiple changes can be included single response, but they should be broken up into separate file blocks.+ If a plan requires a number of small changes, then multiple changes can be included single response, but they should be broken up into separate file blocks.For changes that are larger or more complex, only include one change per response.**Don't ask the user to take an action that you are able to do.** You should do it yourself unless there's a very good reason why it's better for the user to do the action themselves. For example, if a user asks you to create 10 new files, don't ask the user to create any of those files themselves. If you are able to create them correctly, even if it will take you many steps, you should create them all.- At the end of your response, you can suggest additional iterations to make the plan better. You can also ask the user to load more files into context or give you more information if it would help you make a better plan. **If all tasks and subtasks have been completed, explicitly say "All tasks have been completed."**+ At the end of your response, you can suggest additional iterations to make the plan better. You can also ask the user to load more files into context or give you more information if it would help you make a better plan.++ At the *very* end of your response, you *must* decide whether the plan is completed and if not, whether it should be automatically continued.+ - If all the steps in a plan are completed (even if there is only one step), you must explictly say "All tasks have been completed."+ Otherwise:+ - If there is a clear next step that definitely needs to be done to finish the plan (and has not already been completed), output a sentence starting with "Next, " and then give a brief description of the next step.+ - If there is no clear next step, or the user needs to take some action before you can continue, finish with a brief description of what the user needs to do for the plan to proceed.++ You should lean toward considering the plan complete if all the subtasks are completed to a decent standard. Even if there are additional steps that *could* be taken, if you have completed the tasks you were asked to do, you should consider the plan complete. Be cautious about suggesting additional steps (with the "Next, " syntax) that are not strictly necessary to complete the task at hand. Only suggest additional steps if the next step is clear and has already been well established in the conversation.++ Don't consider the user verifying or testing the code as a next step. If all that's left is for the user to verify or test the code, consider the plan complete. Unless *you* can make clear progress on the plan *yourself* without the user's input, the plan should be considered complete.++ Remember that when you suggest a next step, the plan will continue automatically. Being over-eager to continue can cause infinite loops and other problems.Be aware that since the plan started, the context may have been updated. It may have been updated by the user implementing your suggestions, by the user implementing their own work, or by the user adding more files or information to context. Be sure to consider the current state of the context when continuing with the plan, and whether the plan needs to be updated to reflect the latest context. For example, if you are working on a plan that has been broken up into subtasks, and you've reached the point of implementing a particular subtask, first consider whether the subtask is still necessary looking at the files in context. If it has already been implemented or is no longer necessary, say so, revise the plan if needed, and move on. Otherwise, implement the subtask.` +diff --git a/app/server/model/prompts/exec_status.go b/app/server/model/prompts/exec_status.goindex 23005b12..117ebb2a 100644--- a/app/server/model/prompts/exec_status.go+++ b/app/server/model/prompts/exec_status.go@@ -5,58 +5,41 @@ import ("github.com/sashabaranov/go-openai/jsonschema")-const SysExecStatusIsFinished = `You are an AI assistant that determines the execution status of a coding AI's plan for a programming task. Analyze the AI's latest message to determine whether the plan is finished.+const SysExecStatusShouldContinue = `You are tasked with evaluating a response generated by another AI (AI 1).-The plan *is finished* if all the plan's tasks and subtasks have been completed.+Here is the prompt of AI 1:-The plan *is finished* if no tasks or subtasks are mentioned or moved forward in the response. This can happen when the user doesn't have a task for the coding AI and is just asking a question or chatting.+[START OF PROMPT OF AI 1]+` + SysCreate + `[END OF PROMPT OF AI 1]-The plan *is finished* if the response contains a sentence similar to "All tasks have been completed." near the end.+Your goal is to determine whether the plan created by AI 1 should automatically continue or if it is considered complete. To do this, you need to analyze the latest message of the plan from AI 1 carefully and decide based on the following criteria:-If the response is a list of tasks, then the plan *is not finished*.+Completion of Tasks: Assess whether AI 1 has indicated that all tasks and subtasks within the plan have been completed. AI 1 should explicitly state "All tasks have been completed" if this is the case. If such a statement is present, the plan is considered complete.-If the next task or subtask is mentioned at the end of the response, then the plan *is not finished*.+Next Steps Identified: If AI 1 has outlined a clear next step necessary to finish the plan but has not executed it, the plan should likely continue. Look for sentences starting with "Next, " followed by a brief description of what should be done. This suggests that AI 1 has identified a subsequent action that needs to be taken, implying the plan is not yet complete.-Return a JSON object with the 'finished' key set to true or false. You must ALWAYS call the 'planIsFinished' function. Don't call any other function.`+User Actions Required: Determine if AI 1 has concluded with a statement that indicates the user needs to take specific actions before the plan can proceed. This might involve loading more files into the context, providing additional information, or implementing suggestions. If AI 1 specifies actions for the user, the plan's automatic continuation depends on those user actions being completed.-func GetExecStatusIsFinishedPrompt(message string) string {- return SysExecStatusIsFinished + "\n\nLatest message from coding AI:\n" + message-}--var PlanIsFinishedFn = openai.FunctionDefinition{- Name: "planIsFinished",- Parameters: &jsonschema.Definition{- Type: jsonschema.Object,- Properties: map[string]jsonschema.Definition{- "finished": {- Type: jsonschema.Boolean,- Description: "Whether the plan is finished.",- },- },- Required: []string{"finished"},- },-}--const SysExecStatusNeedsInput = `You are an AI assistant that determines the execution status of a coding AI's plan for a programming task. Analyze the AI's latest message to determine whether the plan needs more input. The plan needs more input if the coding AI requires the user to add more context, provide information, or answer questions the AI has asked.+Avoidance of Infinite Loops: Be cautious of suggesting the plan continue if the next steps are not clear or if continuation could lead to repetitive or circular tasking. Ensuring that the plan moves forward constructively without causing confusion or redundancy is crucial.-When the coding AI needs more input, it will say something like "I need more information or context to make a plan for this task."+Based on your analysis, you will call the shouldAutoContinue function with a JSON object containing the key 'shouldContinue'. Set 'shouldContinue' to true if the plan should automatically continue based on the outlined criteria or false if the plan is complete or cannot proceed without user intervention.-If the coding AI says or implies that additional information would be helpful or useful, but that information isn't *required* to continue the plan, then the plan *does not* need more input. It only needs more input if the AI says or implies that more information is necessary and required to continue. Return a JSON object with the 'needsInput' key set to true or false. You must ALWAYS call the 'planNeedsInput' function in your response. Don't call any other function.`+You must always call 'shouldAutoContinue' in your response. Don't call any other function.`-func GetExecStatusNeedsInputPrompt(message string) string {- return SysExecStatusNeedsInput + "\nLatest message from coding AI:\n" + message+func GetExecStatusShouldContinue(message string) string {+ return SysExecStatusShouldContinue + "\n\n**Here is the latest message of the plan from AI 1:**\n" + message}-var PlanNeedsInputFn = openai.FunctionDefinition{- Name: "planNeedsInput",+var ShouldAutoContinueFn = openai.FunctionDefinition{+ Name: "shouldAutoContinue",Parameters: &jsonschema.Definition{Type: jsonschema.Object,Properties: map[string]jsonschema.Definition{- "needsInput": {+ "shouldContinue": {Type: jsonschema.Boolean,- Description: "Whether the plan needs more input. If ambiguous or unclear, assume the plan does not need more input.",+ Description: "Whether the plan should automatically continue.",},},- Required: []string{"needsInput"},+ Required: []string{"shouldContinue"},},}diff --git a/app/server/types/exec_status.go b/app/server/types/exec_status.godeleted file mode 100644index eefd66a1..00000000--- a/app/server/types/exec_status.go+++ /dev/null@@ -1,6 +0,0 @@-package types--type PlanExecStatus struct {- NeedsInput bool `json:"needsInput"`- Finished bool `json:"finished"`-}diff --git a/infra/deploy.sh b/infra/deploy.shindex ce353e7a..0f5c4230 100755--- a/infra/deploy.sh+++ b/infra/deploy.sh@@ -154,7 +154,7 @@ update_ecs_service() {# Update the container image URI in the task definition JSONUPDATED_TASK_DEF_JSON=$(echo $TASK_DEF_JSON | jq -c --arg IMAGE_URI "$ECR_REPOSITORY:$IMAGE_TAG" '.containerDefinitions[0].image = $IMAGE_URI')- log "UPDATED_TASK_DEF_JSON: $UPDATED_TASK_DEF_JSON"+ # log "UPDATED_TASK_DEF_JSON: $UPDATED_TASK_DEF_JSON"# Register the new task definition revision with the updated imageTMP_FILE=$(mktemp)@@ -163,7 +163,7 @@ update_ecs_service() {REGISTERED_TASK_DEF=$(aws ecs register-task-definition --cli-input-json file://$TMP_FILE)NEW_TASK_DEF_ARN=$(echo $REGISTERED_TASK_DEF | jq -r '.taskDefinition.taskDefinitionArn')- log "New task definition registered: $NEW_TASK_DEF_ARN"+ log "New task definition registered"# Update the ECS service to use the new task definition revisionaws ecs update-service --cluster "$CLUSTER_NAME" --service "$SERVICE_NAME" --task-definition "$NEW_TASK_DEF_ARN"