This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository edi.

View the commit online.

commit 341c85d7fe39b3bfb89d857485e50c56d46839cf
Author: Alastair Poole <[email protected]>
AuthorDate: Thu Apr 16 21:29:30 2026 +0100

    settings: make AI steps programmable.
---
 src/bin/edi_aipanel.c          | 361 +++++++++++++++++++++++++++++++++++++++--
 src/bin/edi_config.c           |   8 +-
 src/bin/edi_config.h           |   1 +
 src/bin/screens/edi_settings.c |  33 +++-
 4 files changed, 382 insertions(+), 21 deletions(-)

diff --git a/src/bin/edi_aipanel.c b/src/bin/edi_aipanel.c
index dc440c2..2e6a553 100644
--- a/src/bin/edi_aipanel.c
+++ b/src/bin/edi_aipanel.c
@@ -25,7 +25,16 @@ static Eina_Strbuf *_edi_ai_stream_buf = NULL;
 static Edi_Agent_Request *_edi_ai_request = NULL;
 static char *_edi_ai_last_response = NULL;
 static char *_edi_ai_active_prompt = NULL;
+static char *_edi_ai_repo_inspection = NULL;
+static char *_edi_ai_last_task_prompt = NULL;
+static char *_edi_ai_last_stage_cmd = NULL;
+static char *_edi_ai_last_stage_output = NULL;
+static int _edi_ai_last_stage_exit_code = 0;
+static unsigned int _edi_ai_last_stage_index = 0;
+static Eina_Bool _edi_ai_last_stage_valid = EINA_FALSE;
 static unsigned int _edi_ai_agent_steps = 0;
+static Eina_Bool _edi_ai_agent_inspected_root = EINA_FALSE;
+static Eina_Bool _edi_ai_agent_inspected_all_files = EINA_FALSE;
 
 #define EDI_AI_TAG_USER "[user]"
 #define EDI_AI_TAG_AGENT "[agent]"
@@ -33,7 +42,7 @@ static unsigned int _edi_ai_agent_steps = 0;
 #define EDI_AI_TAG_RUN "[run]"
 #define EDI_AI_RUN_OPEN "<edi-run>"
 #define EDI_AI_RUN_CLOSE "</edi-run>"
-#define EDI_AI_RUN_MAX_STEPS 256
+#define EDI_AI_RUN_MAX_STEPS_DEFAULT 256
 #define EDI_AI_RUN_MAX_OUTPUT 120000
 
 static void _edi_aipanel_append_line(const char *line);
@@ -50,6 +59,21 @@ _edi_aipanel_edits_enabled_get(void)
    return _edi_project_config->agent.edits_enabled;
 }
 
+static unsigned int
+_edi_aipanel_steps_max_get(void)
+{
+   int configured;
+
+   if (!_edi_project_config)
+     return EDI_AI_RUN_MAX_STEPS_DEFAULT;
+
+   configured = _edi_project_config->agent.steps_max;
+   if (configured < 1)
+     return EDI_AI_RUN_MAX_STEPS_DEFAULT;
+
+   return (unsigned int) configured;
+}
+
 static char *
 _edi_aipanel_shell_quote(const char *src)
 {
@@ -121,6 +145,45 @@ _edi_aipanel_repo_state_get(void)
    return out;
 }
 
+static char *
+_edi_aipanel_repo_inspection_get(void)
+{
+   const char *project;
+   char *project_quoted;
+   const char *script;
+   char *script_quoted;
+   const char *cmd;
+   char *out;
+
+   project = edi_project_get();
+   if (!project || !project[0])
+     return NULL;
+
+   project_quoted = _edi_aipanel_shell_quote(project);
+   script = eina_slstr_printf("cd %s && pwd && echo && ls -la && echo && "
+                              "find . -type f | sed 's#^\\./##' | sort",
+                              project_quoted);
+   script_quoted = _edi_aipanel_shell_quote(script);
+   cmd = eina_slstr_printf("/bin/sh -lc %s", script_quoted);
+   out = edi_exe_response(cmd);
+   free(script_quoted);
+   free(project_quoted);
+
+   if (!out || !out[0])
+     {
+        free(out);
+        return NULL;
+     }
+
+   if (strncmp(out, project, strlen(project)) != 0)
+     {
+        free(out);
+        return NULL;
+     }
+
+   return out;
+}
+
 static char *
 _edi_aipanel_prompt_build_initial(const char *user_prompt)
 {
@@ -139,6 +202,21 @@ _edi_aipanel_prompt_build_initial(const char *user_prompt)
    eina_strbuf_append(buf, " and no other text.\n");
    eina_strbuf_append(buf, "Run one command at a time.\n");
    eina_strbuf_append(buf, "Avoid destructive actions.\n\n");
+   eina_strbuf_append(buf, "Allowed command starters: ");
+   eina_strbuf_append(buf, "pwd ls find grep sed awk cat head tail wc cut sort uniq tr ");
+   eina_strbuf_append(buf, "xargs mkdir touch cp mv git printf echo meson ninja make ");
+   eina_strbuf_append(buf, "cmake sh set cd tee chmod test.\n");
+   eina_strbuf_append(buf, "Before creating or modifying code, first inspect repo root ");
+   eina_strbuf_append(buf, "and all files to learn naming conventions.\n");
+   eina_strbuf_append(buf, "Required before edits: run root inspection (pwd and/or ls) ");
+   eina_strbuf_append(buf, "and run a full file listing command (find . -type f).\n");
+   eina_strbuf_append(buf, "Do not claim success unless command output confirms it.\n\n");
+   eina_strbuf_append(buf, "Mandatory repo inspection output:\n");
+   if (_edi_ai_repo_inspection && _edi_ai_repo_inspection[0])
+     eina_strbuf_append(buf, _edi_ai_repo_inspection);
+   else
+     eina_strbuf_append(buf, "(inspection unavailable)");
+   eina_strbuf_append(buf, "\n\n");
    eina_strbuf_append(buf, "Current state:\n");
    eina_strbuf_append(buf, state);
    eina_strbuf_append(buf, "\n\nUser request:\n");
@@ -169,6 +247,8 @@ _edi_aipanel_prompt_build_followup(const char *executed_cmd, int exit_code,
    eina_strbuf_append(buf, EDI_AI_RUN_CLOSE);
    eina_strbuf_append(buf, ".\n");
    eina_strbuf_append(buf, "Otherwise provide the final answer.\n\n");
+   eina_strbuf_append(buf, "If the previous command failed (non-zero exit code), ");
+   eina_strbuf_append(buf, "do not claim success.\n\n");
    eina_strbuf_append_printf(buf, "Original user request:\n%s\n\n",
                              _edi_ai_active_prompt ?: "");
    eina_strbuf_append_printf(buf, "Executed command:\n%s\n\n", executed_cmd ?: "");
@@ -183,6 +263,81 @@ _edi_aipanel_prompt_build_followup(const char *executed_cmd, int exit_code,
    return out;
 }
 
+static char *
+_edi_aipanel_prompt_build_resume(const char *user_prompt)
+{
+   char *state;
+   Eina_Strbuf *buf;
+   char *out;
+
+   state = _edi_aipanel_repo_state_get();
+   buf = eina_strbuf_new();
+   eina_strbuf_append(buf, "Resume the previous staged task.\n");
+   eina_strbuf_append(buf, "If another command is needed, reply only with ");
+   eina_strbuf_append(buf, EDI_AI_RUN_OPEN);
+   eina_strbuf_append(buf, "COMMAND");
+   eina_strbuf_append(buf, EDI_AI_RUN_CLOSE);
+   eina_strbuf_append(buf, ".\n");
+   eina_strbuf_append(buf, "Do not restart from scratch.\n\n");
+   eina_strbuf_append_printf(buf, "Original user request:\n%s\n\n",
+                             _edi_ai_last_task_prompt ?: "");
+   eina_strbuf_append_printf(buf, "Last completed stage: %u\n\n",
+                             _edi_ai_last_stage_index);
+   eina_strbuf_append_printf(buf, "Last command:\n%s\n\n",
+                             _edi_ai_last_stage_cmd ?: "");
+   eina_strbuf_append_printf(buf, "Last exit code: %d\n\n",
+                             _edi_ai_last_stage_exit_code);
+   eina_strbuf_append_printf(buf, "Last command output:\n%s\n\n",
+                             _edi_ai_last_stage_output ?: "");
+   eina_strbuf_append_printf(buf, "Updated state:\n%s\n\n", state ?: "");
+   eina_strbuf_append_printf(buf, "Resume request:\n%s\n", user_prompt ?: "");
+
+   out = eina_strbuf_string_steal(buf);
+   eina_strbuf_free(buf);
+   free(state);
+   return out;
+}
+
+static void
+_edi_aipanel_stage_memory_clear(void)
+{
+   free(_edi_ai_last_task_prompt);
+   _edi_ai_last_task_prompt = NULL;
+   free(_edi_ai_last_stage_cmd);
+   _edi_ai_last_stage_cmd = NULL;
+   free(_edi_ai_last_stage_output);
+   _edi_ai_last_stage_output = NULL;
+   _edi_ai_last_stage_exit_code = 0;
+   _edi_ai_last_stage_index = 0;
+   _edi_ai_last_stage_valid = EINA_FALSE;
+}
+
+static Eina_Bool
+_edi_aipanel_prompt_is_continue_request(const char *prompt)
+{
+   char *lower;
+   char *p;
+   Eina_Bool out = EINA_FALSE;
+
+   if (!prompt || !prompt[0])
+     return EINA_FALSE;
+
+   lower = strdup(prompt);
+   if (!lower)
+     return EINA_FALSE;
+
+   for (p = lower; *p; p++)
+     *p = tolower((unsigned char)*p);
+
+   if (strstr(lower, "continue") || strstr(lower, "resume") ||
+       strstr(lower, "carry on") || strstr(lower, "keep going") ||
+       strstr(lower, "proceed"))
+     out = EINA_TRUE;
+
+   free(lower);
+   return out;
+}
+
 static char *
 _edi_aipanel_response_command_extract(const char *response)
 {
@@ -226,6 +381,96 @@ _edi_aipanel_response_command_extract(const char *response)
    return cmd;
 }
 
+static Eina_Bool
+_edi_aipanel_command_token_get(const char *cmd, char *token, size_t token_len)
+{
+   const char *p;
+   size_t i = 0;
+
+   if (!cmd || !token || token_len < 2)
+     return EINA_FALSE;
+
+   p = cmd;
+   while (*p && isspace((unsigned char)*p))
+     p++;
+
+   while (*p && !isspace((unsigned char)*p) && i < token_len - 1)
+     token[i++] = *p++;
+   token[i] = '\0';
+
+   return token[0] != '\0';
+}
+
+static Eina_Bool
+_edi_aipanel_command_is_inspection(const char *cmd)
+{
+   char token[64];
+
+   if (!_edi_aipanel_command_token_get(cmd, token, sizeof(token)))
+     return EINA_FALSE;
+
+   if (!strcmp(token, "pwd") || !strcmp(token, "ls") || !strcmp(token, "find") ||
+       !strcmp(token, "grep") || !strcmp(token, "sed") || !strcmp(token, "awk") ||
+       !strcmp(token, "cat") || !strcmp(token, "head") || !strcmp(token, "tail") ||
+       !strcmp(token, "wc") || !strcmp(token, "cut") || !strcmp(token, "sort") ||
+       !strcmp(token, "uniq") || !strcmp(token, "tr") || !strcmp(token, "test"))
+     return EINA_TRUE;
+
+   if (!strcmp(token, "git"))
+     {
+        if (strstr(cmd, "git status") || strstr(cmd, "git diff") ||
+            strstr(cmd, "git show") || strstr(cmd, "git log"))
+          return EINA_TRUE;
+     }
+
+   return EINA_FALSE;
+}
+
+static Eina_Bool
+_edi_aipanel_command_is_mutating(const char *cmd)
+{
+   char token[64];
+
+   if (!_edi_aipanel_command_token_get(cmd, token, sizeof(token)))
+     return EINA_FALSE;
+
+   if (!strcmp(token, "mkdir") || !strcmp(token, "touch") || !strcmp(token, "cp") ||
+       !strcmp(token, "mv") || !strcmp(token, "tee") || !strcmp(token, "chmod") ||
+       !strcmp(token, "make") || !strcmp(token, "ninja") || !strcmp(token, "cmake") ||
+       !strcmp(token, "meson") || !strcmp(token, "sh") || !strcmp(token, "set"))
+     return EINA_TRUE;
+
+   if (!strcmp(token, "git"))
+     {
+        if (strstr(cmd, "git add") || strstr(cmd, "git rm") || strstr(cmd, "git mv") ||
+            strstr(cmd, "git commit") || strstr(cmd, "git checkout ") || strstr(cmd, "git restore"))
+          return EINA_TRUE;
+     }
+
+   return EINA_FALSE;
+}
+
+static void
+_edi_aipanel_inspection_state_update(const char *cmd, int exit_code)
+{
+   char token[64];
+
+   if (!cmd || exit_code != 0)
+     return;
+
+   if (strstr(cmd, "pwd"))
+     _edi_ai_agent_inspected_root = EINA_TRUE;
+
+   if (_edi_aipanel_command_token_get(cmd, token, sizeof(token)))
+     {
+        if (!strcmp(token, "ls"))
+          _edi_ai_agent_inspected_root = EINA_TRUE;
+        if (!strcmp(token, "find") && strstr(cmd, "-type f") &&
+            (strstr(cmd, "find .") || strstr(cmd, "find ./")))
+          _edi_ai_agent_inspected_all_files = EINA_TRUE;
+     }
+}
+
 static Eina_Bool
 _edi_aipanel_command_allowed(const char *cmd, const char **reason)
 {
@@ -233,14 +478,14 @@ _edi_aipanel_command_allowed(const char *cmd, const char **reason)
    {
       "pwd", "ls", "find", "grep", "sed", "awk", "cat", "head", "tail", "wc",
       "cut", "sort", "uniq", "tr", "xargs", "mkdir", "touch", "cp", "mv",
-      "git", "printf", "echo", "meson", "ninja", "make", "cmake", "sh", "set"
+      "git", "printf", "echo", "meson", "ninja", "make", "cmake", "sh", "set",
+      "cd", "tee", "chmod", "test"
    };
    static const char *blocked[] =
    {
       "rm -rf", "sudo ", "git reset --hard", "git checkout --",
       "shutdown", "reboot", "mkfs", "dd if=", "sudo", "doas"
    };
-   const char *p;
    char token[64];
    unsigned int i;
 
@@ -259,16 +504,7 @@ _edi_aipanel_command_allowed(const char *cmd, const char **reason)
           }
      }
 
-   p = cmd;
-   while (*p && isspace((unsigned char)*p))
-     p++;
-
-   i = 0;
-   while (*p && !isspace((unsigned char)*p) && i < sizeof(token) - 1)
-     token[i++] = *p++;
-   token[i] = '\0';
-
-   if (!token[0])
+   if (!_edi_aipanel_command_token_get(cmd, token, sizeof(token)))
      {
         *reason = "Missing command token.";
         return EINA_FALSE;
@@ -458,6 +694,7 @@ _edi_aipanel_response_cb(const char *response, const char *error, void *data EIN
 {
    Elm_Code_Line *line;
    char *run_cmd = NULL;
+   Eina_Bool apply_response = EINA_TRUE;
 
    if (error && error[0])
      {
@@ -482,7 +719,7 @@ _edi_aipanel_response_cb(const char *response, const char *error, void *data EIN
         run_cmd = _edi_aipanel_edits_enabled_get()
                   ? _edi_aipanel_response_command_extract(response)
                   : NULL;
-        if (run_cmd && _edi_ai_agent_steps < EDI_AI_RUN_MAX_STEPS)
+        if (run_cmd && _edi_ai_agent_steps < _edi_aipanel_steps_max_get())
           {
              const char *deny_reason = NULL;
              char *output;
@@ -505,13 +742,54 @@ _edi_aipanel_response_cb(const char *response, const char *error, void *data EIN
                     }
                   else
                     _edi_aipanel_append_line(eina_slstr_printf("Error: %s", deny_reason));
+                  apply_response = EINA_FALSE;
                   free(run_cmd);
                   run_cmd = NULL;
                }
              else
                {
+                  Eina_Bool inspect_cmd = _edi_aipanel_command_is_inspection(run_cmd);
+                  Eina_Bool mutating_cmd = _edi_aipanel_command_is_mutating(run_cmd);
+
+                  if (mutating_cmd &&
+                      (!_edi_ai_agent_inspected_root || !_edi_ai_agent_inspected_all_files))
+                    {
+                       const char *msg = NULL;
+                       if (!_edi_ai_agent_inspected_root && !_edi_ai_agent_inspected_all_files)
+                         msg = "Error: Inspect repo root and run find . -type f before edits.";
+                       else if (!_edi_ai_agent_inspected_root)
+                         msg = "Error: Inspect repo root (pwd/ls) before edits.";
+                       else
+                         msg = "Error: Run find . -type f before edits.";
+
+                       if (_edi_ai_stream_row)
+                         {
+                            line = elm_code_file_line_get(_edi_ai_code->file, _edi_ai_stream_row);
+                            if (line)
+                              {
+                                 elm_code_line_text_set(line, msg, strlen(msg));
+                                 elm_code_widget_line_refresh(_edi_ai_widget, line);
+                              }
+                         }
+                       else
+                         _edi_aipanel_append_line(msg);
+                       apply_response = EINA_FALSE;
+                       free(run_cmd);
+                       run_cmd = NULL;
+                    }
+                  else
+                    {
                   _edi_ai_agent_steps++;
                   output = _edi_aipanel_command_run(run_cmd, &exit_code);
+                  free(_edi_ai_last_stage_cmd);
+                  _edi_ai_last_stage_cmd = strdup(run_cmd ?: "");
+                  free(_edi_ai_last_stage_output);
+                  _edi_ai_last_stage_output = strdup(output ?: "");
+                  _edi_ai_last_stage_exit_code = exit_code;
+                  _edi_ai_last_stage_index = _edi_ai_agent_steps;
+                  _edi_ai_last_stage_valid = EINA_TRUE;
+                  if (inspect_cmd)
+                    _edi_aipanel_inspection_state_update(run_cmd, exit_code);
 
                   followup_prompt = _edi_aipanel_prompt_build_followup(run_cmd, exit_code, output ?: "");
                   free(output);
@@ -535,6 +813,8 @@ _edi_aipanel_response_cb(const char *response, const char *error, void *data EIN
                     }
                   else
                     _edi_aipanel_append_line("Error: Failed to continue agent request.");
+                  apply_response = EINA_FALSE;
+               }
                }
           }
         else if (run_cmd)
@@ -551,14 +831,15 @@ _edi_aipanel_response_cb(const char *response, const char *error, void *data EIN
                }
              else
                _edi_aipanel_append_line("Error: AI edits step limit reached.");
+             apply_response = EINA_FALSE;
              free(run_cmd);
              run_cmd = NULL;
           }
 
         free(_edi_ai_last_response);
-        _edi_ai_last_response = strdup(response);
+        _edi_ai_last_response = apply_response ? strdup(response) : NULL;
 
-        if (_edi_ai_stream_row)
+        if (apply_response && _edi_ai_stream_row)
           {
              _edi_aipanel_agent_text_apply(_edi_ai_stream_row, response);
           }
@@ -582,6 +863,10 @@ _edi_aipanel_response_cb(const char *response, const char *error, void *data EIN
    _edi_ai_stream_row = 0;
    _edi_ai_request = NULL;
    _edi_ai_agent_steps = 0;
+   _edi_ai_agent_inspected_root = EINA_FALSE;
+   _edi_ai_agent_inspected_all_files = EINA_FALSE;
+   free(_edi_ai_repo_inspection);
+   _edi_ai_repo_inspection = NULL;
    free(_edi_ai_active_prompt);
    _edi_ai_active_prompt = NULL;
    if (_edi_ai_stream_buf)
@@ -599,6 +884,7 @@ _edi_aipanel_send(Evas_Object *entry)
    const char *text_markup;
    char *text, *prompt, *agent_prompt;
    Eina_Bool edits_enabled;
+   Eina_Bool continue_mode = EINA_FALSE;
 
    if (_edi_ai_busy)
      return;
@@ -638,10 +924,49 @@ _edi_aipanel_send(Evas_Object *entry)
         _edi_ai_stream_buf = NULL;
      }
 
+   continue_mode = edits_enabled &&
+                   _edi_ai_last_stage_valid &&
+                   _edi_aipanel_prompt_is_continue_request(prompt);
+
    free(_edi_ai_active_prompt);
-   _edi_ai_active_prompt = edits_enabled ? strdup(prompt) : NULL;
-   _edi_ai_agent_steps = 0;
    if (edits_enabled)
+     _edi_ai_active_prompt = continue_mode
+                           ? strdup(_edi_ai_last_task_prompt ?: prompt)
+                           : strdup(prompt);
+   else
+     _edi_ai_active_prompt = NULL;
+
+   _edi_ai_agent_steps = continue_mode ? _edi_ai_last_stage_index : 0;
+   if (edits_enabled && !continue_mode)
+     _edi_aipanel_stage_memory_clear();
+   if (edits_enabled && !continue_mode)
+     _edi_ai_last_task_prompt = strdup(prompt);
+
+   _edi_ai_agent_inspected_root = EINA_FALSE;
+   _edi_ai_agent_inspected_all_files = EINA_FALSE;
+   free(_edi_ai_repo_inspection);
+   _edi_ai_repo_inspection = NULL;
+   if (edits_enabled)
+     {
+        _edi_ai_repo_inspection = _edi_aipanel_repo_inspection_get();
+        if (!_edi_ai_repo_inspection)
+          {
+             _edi_aipanel_append_line("Error: Mandatory repository inspection failed.");
+             _edi_ai_follow_tail = EINA_FALSE;
+             _edi_ai_stream_row = 0;
+             _edi_ai_agent_steps = 0;
+             free(_edi_ai_active_prompt);
+             _edi_ai_active_prompt = NULL;
+             free(text);
+             free(prompt);
+             return;
+          }
+        _edi_ai_agent_inspected_root = EINA_TRUE;
+        _edi_ai_agent_inspected_all_files = EINA_TRUE;
+     }
+   if (edits_enabled && continue_mode)
+     agent_prompt = _edi_aipanel_prompt_build_resume(prompt);
+   else if (edits_enabled)
      agent_prompt = _edi_aipanel_prompt_build_initial(prompt);
    else
      agent_prompt = strdup(prompt);
diff --git a/src/bin/edi_config.c b/src/bin/edi_config.c
index b17dc50..456ad7d 100644
--- a/src/bin/edi_config.c
+++ b/src/bin/edi_config.c
@@ -41,7 +41,7 @@
    ((EDI_CONFIG_FILE_EPOCH << 16) | EDI_CONFIG_FILE_GENERATION)
 
 #  define EDI_PROJECT_CONFIG_FILE_EPOCH 0x0002
-#  define EDI_PROJECT_CONFIG_FILE_GENERATION 0x000a
+#  define EDI_PROJECT_CONFIG_FILE_GENERATION 0x000b
 #  define EDI_PROJECT_CONFIG_FILE_VERSION \
    ((EDI_PROJECT_CONFIG_FILE_EPOCH << 16) | EDI_PROJECT_CONFIG_FILE_GENERATION)
 
@@ -314,6 +314,7 @@ _edi_config_init(void)
    EDI_CONFIG_VAL(D, T, agent.api_key, EET_T_STRING);
    EDI_CONFIG_VAL(D, T, agent.project_id, EET_T_STRING);
    EDI_CONFIG_VAL(D, T, agent.timeout_seconds, EET_T_DOUBLE);
+   EDI_CONFIG_VAL(D, T, agent.steps_max, EET_T_INT);
 
    EDI_CONFIG_LIST(D, T, panels, _edi_proj_cfg_panel_edd);
    EDI_CONFIG_LIST(D, T, windows, _edi_proj_cfg_tab_edd);
@@ -591,6 +592,10 @@ _edi_project_config_load()
    _edi_project_config->agent.edits_enabled = EINA_FALSE;
    IFPCFGEND;
 
+   IFPCFG(0x000b);
+   _edi_project_config->agent.steps_max = 256;
+   IFPCFGEND;
+
    /* limit config values so they are sane */
    EDI_CONFIG_LIMIT(_edi_project_config->font.size, EDI_FONT_MIN, EDI_FONT_MAX);
    EDI_CONFIG_LIMIT(_edi_project_config->gui.width, 150, 10000);
@@ -598,6 +603,7 @@ _edi_project_config_load()
    EDI_CONFIG_LIMIT(_edi_project_config->gui.leftsize, 0.0, 1.0);
    EDI_CONFIG_LIMIT(_edi_project_config->gui.bottomsize, 0.0, 1.0);
    EDI_CONFIG_LIMIT(_edi_project_config->gui.tabstop, 1, 32);
+   EDI_CONFIG_LIMIT(_edi_project_config->agent.steps_max, 1, 4096);
 
    _edi_project_config->version = EDI_PROJECT_CONFIG_FILE_VERSION;
 
diff --git a/src/bin/edi_config.h b/src/bin/edi_config.h
index 7d5b2b9..326c2b7 100644
--- a/src/bin/edi_config.h
+++ b/src/bin/edi_config.h
@@ -111,6 +111,7 @@ struct _Edi_Project_Config
         Eina_Stringshare *api_key;
         Eina_Stringshare *project_id;
         double timeout_seconds;
+        int steps_max;
      } agent;
 
    Eina_List *panels;
diff --git a/src/bin/screens/edi_settings.c b/src/bin/screens/edi_settings.c
index fc93ec5..af83818 100644
--- a/src/bin/screens/edi_settings.c
+++ b/src/bin/screens/edi_settings.c
@@ -1012,6 +1012,14 @@ _edi_settings_project_agent_timeout_cb(void *data EINA_UNUSED, Evas_Object *obj,
    _edi_project_config_save();
 }
 
+static void
+_edi_settings_project_agent_steps_max_cb(void *data EINA_UNUSED, Evas_Object *obj,
+                                         void *event EINA_UNUSED)
+{
+   _edi_project_config->agent.steps_max = (int) elm_spinner_value_get(obj);
+   _edi_project_config_save();
+}
+
 static void
 _edi_settings_project_agent_test_done_cb(const char *response, const char *error, void *data)
 {
@@ -1472,11 +1480,32 @@ _edi_settings_project_create(Evas_Object *parent)
    evas_object_smart_callback_add(spinner, "changed",
                                   _edi_settings_project_agent_timeout_cb, NULL);
 
+   label = elm_label_add(table);
+   elm_object_text_set(label, _("Max AI edit steps"));
+   evas_object_size_hint_weight_set(label, 0.0, 0.0);
+   evas_object_size_hint_align_set(label, 0.0, EVAS_HINT_FILL);
+   elm_table_pack(table, label, 0, 7, 1, 1);
+   evas_object_show(label);
+
+   spinner = elm_spinner_add(table);
+   elm_spinner_min_max_set(spinner, 1.0, 4096.0);
+   elm_spinner_step_set(spinner, 1.0);
+   elm_spinner_editable_set(spinner, EINA_TRUE);
+   elm_spinner_wrap_set(spinner, EINA_FALSE);
+   elm_spinner_value_set(spinner, _edi_project_config->agent.steps_max > 0 ?
+                                  _edi_project_config->agent.steps_max : 256);
+   evas_object_size_hint_weight_set(spinner, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(spinner, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_table_pack(table, spinner, 1, 7, 1, 1);
+   evas_object_show(spinner);
+   evas_object_smart_callback_add(spinner, "changed",
+                                  _edi_settings_project_agent_steps_max_cb, NULL);
+
    button = elm_button_add(table);
    elm_object_text_set(button, _("Test Connection"));
    evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0.0);
    evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
-   elm_table_pack(table, button, 1, 7, 1, 1);
+   elm_table_pack(table, button, 1, 8, 1, 1);
    evas_object_show(button);
    evas_object_smart_callback_add(button, "clicked",
                                   _edi_settings_project_agent_test_cb, button);
@@ -1676,7 +1705,7 @@ edi_settings_show(Evas_Object *mainwin, Edi_Settings_Tab type)
      }
 
    evas_object_show(naviframe);
-   evas_object_resize(win, 528 * elm_config_scale_get(), 396 * elm_config_scale_get());
+   evas_object_resize(win, 581 * elm_config_scale_get(), 436 * elm_config_scale_get());
    evas_object_show(win);
 
    return win;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to