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 5e0b2d1ee3038262579a8f675b60cb888d6113ef
Author: Alastair Poole <[email protected]>
AuthorDate: Thu Apr 16 18:04:17 2026 +0100
ai: make a bit safer.
This is a WIP and BETA.
---
src/bin/edi_aipanel.c | 24 +++++++++++++++++++-----
src/bin/edi_config.c | 2 +-
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/src/bin/edi_aipanel.c b/src/bin/edi_aipanel.c
index 0a3b35f..7ecdf25 100644
--- a/src/bin/edi_aipanel.c
+++ b/src/bin/edi_aipanel.c
@@ -37,6 +37,18 @@ static unsigned int _edi_ai_agent_steps = 0;
static void _edi_aipanel_append_line(const char *line);
+static Eina_Bool
+_edi_aipanel_edits_enabled_get(void)
+{
+ if (!_edi_project_config)
+ return EINA_FALSE;
+
+ if (!_edi_project_config->agent.enabled)
+ return EINA_FALSE;
+
+ return _edi_project_config->agent.edits_enabled;
+}
+
static char *
_edi_aipanel_shell_quote(const char *src)
{
@@ -254,7 +266,7 @@ _edi_aipanel_command_allowed(const char *cmd, const char **reason)
static const char *blocked[] =
{
"rm -rf", "sudo ", "git reset --hard", "git checkout --",
- "shutdown", "reboot", "mkfs", "dd if="
+ "shutdown", "reboot", "mkfs", "dd if=", "sudo", "doas"
};
const char *p;
char token[64];
@@ -495,7 +507,7 @@ _edi_aipanel_response_cb(const char *response, const char *error, void *data EIN
}
else if (response && response[0])
{
- run_cmd = _edi_project_config->agent.edits_enabled
+ 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)
@@ -631,9 +643,9 @@ _edi_aipanel_send(Evas_Object *entry)
}
free(_edi_ai_active_prompt);
- _edi_ai_active_prompt = _edi_project_config->agent.edits_enabled ? strdup(prompt) : NULL;
+ _edi_ai_active_prompt = _edi_aipanel_edits_enabled_get() ? strdup(prompt) : NULL;
_edi_ai_agent_steps = 0;
- if (_edi_project_config->agent.edits_enabled)
+ if (_edi_aipanel_edits_enabled_get())
agent_prompt = _edi_aipanel_prompt_build_initial(prompt);
else
agent_prompt = strdup(prompt);
@@ -764,6 +776,7 @@ edi_aipanel_add(Evas_Object *parent)
edi_theme_elm_code_set(widget, _edi_project_config->gui.theme);
elm_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size);
elm_code_widget_gravity_set(widget, 0.0, 1.0);
+ elm_code_widget_policy_set(widget, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_AUTO);
elm_code_widget_editable_set(widget, EINA_FALSE);
evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -777,7 +790,8 @@ edi_aipanel_add(Evas_Object *parent)
_edi_aipanel_append_line("AI panel ready.");
_edi_aipanel_append_line("Configure provider/auth in Settings -> Project -> AI Agents.");
- _edi_aipanel_append_line("Agent can request local commands with <edi-run>...</edi-run>.");
+ if (_edi_aipanel_edits_enabled_get())
+ _edi_aipanel_append_line("Agent can request local commands with <edi-run>...</edi-run>.");
_edi_aipanel_append_line("");
elm_box_pack_end(hbox, entry);
diff --git a/src/bin/edi_config.c b/src/bin/edi_config.c
index 35df771..b17dc50 100644
--- a/src/bin/edi_config.c
+++ b/src/bin/edi_config.c
@@ -587,7 +587,7 @@ _edi_project_config_load()
_edi_project_config->agent.timeout_seconds = 30.0;
IFPCFGEND;
- IFPCFG(0x0009);
+ IFPCFG(0x000a);
_edi_project_config->agent.edits_enabled = EINA_FALSE;
IFPCFGEND;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.