From b5e79685e61d153aea452b778e9229ff57e2ae22 Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Thu, 12 Mar 2026 22:11:54 +0530 Subject: [PATCH] feat: add allow_all variable to enable all tools without prompting --- registry/coder-labs/modules/copilot/main.tf | 7 ++++++ .../modules/copilot/scripts/start.sh | 25 +++++++++---------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/registry/coder-labs/modules/copilot/main.tf b/registry/coder-labs/modules/copilot/main.tf index c2ff48ac..4604f11a 100644 --- a/registry/coder-labs/modules/copilot/main.tf +++ b/registry/coder-labs/modules/copilot/main.tf @@ -155,6 +155,12 @@ variable "cli_app_display_name" { default = "Copilot" } +variable "allow_all" { + type = bool + description = "Allow all tools without prompting (equivalent to --allow-all)." + default = true +} + variable "resume_session" { type = bool description = "Whether to automatically resume the latest Copilot session on workspace restart." @@ -299,6 +305,7 @@ module "agentapi" { chmod +x /tmp/start.sh ARG_WORKDIR='${local.workdir}' \ + ARG_ALLOW_ALL='${var.allow_all}' \ ARG_AI_PROMPT='${base64encode(var.ai_prompt)}' \ ARG_SYSTEM_PROMPT='${base64encode(local.final_system_prompt)}' \ ARG_COPILOT_MODEL='${var.copilot_model}' \ diff --git a/registry/coder-labs/modules/copilot/scripts/start.sh b/registry/coder-labs/modules/copilot/scripts/start.sh index c7954f75..792a8ce2 100644 --- a/registry/coder-labs/modules/copilot/scripts/start.sh +++ b/registry/coder-labs/modules/copilot/scripts/start.sh @@ -13,6 +13,7 @@ command_exists() { } ARG_WORKDIR=${ARG_WORKDIR:-"$HOME"} +ARG_ALLOW_ALL=${ARG_ALLOW_ALL:-true} ARG_AI_PROMPT=$(echo -n "${ARG_AI_PROMPT:-}" | base64 -d 2> /dev/null || echo "") ARG_SYSTEM_PROMPT=$(echo -n "${ARG_SYSTEM_PROMPT:-}" | base64 -d 2> /dev/null || echo "") ARG_COPILOT_MODEL=${ARG_COPILOT_MODEL:-} @@ -73,6 +74,10 @@ build_copilot_args() { fi done fi + + if [ "$ARG_ALLOW_ALL" = "true" ]; then + COPILOT_ARGS+=(--allow-all) + fi } check_existing_session() { @@ -183,20 +188,14 @@ start_agentapi() { initial_prompt=$(build_initial_prompt) if [ -n "$initial_prompt" ]; then - echo "Using initial prompt with system context" - if [ ${#COPILOT_ARGS[@]} -gt 0 ]; then - echo "Copilot arguments: ${COPILOT_ARGS[*]}" - agentapi server -I="$initial_prompt" --type copilot --term-width 67 --term-height 1190 -- copilot "${COPILOT_ARGS[@]}" - else - agentapi server -I="$initial_prompt" --type copilot --term-width 67 --term-height 1190 -- copilot - fi + COPILOT_ARGS+=(-i "$initial_prompt") + fi + + if [ ${#COPILOT_ARGS[@]} -gt 0 ]; then + echo "Copilot arguments: ${COPILOT_ARGS[*]}" + agentapi server --type copilot --term-width 67 --term-height 1190 -- copilot "${COPILOT_ARGS[@]}" else - if [ ${#COPILOT_ARGS[@]} -gt 0 ]; then - echo "Copilot arguments: ${COPILOT_ARGS[*]}" - agentapi server --type copilot --term-width 67 --term-height 1190 -- copilot "${COPILOT_ARGS[@]}" - else - agentapi server --type copilot --term-width 67 --term-height 1190 -- copilot - fi + agentapi server --type copilot --term-width 67 --term-height 1190 -- copilot fi fi }