feat: add allow_all variable to enable all tools without prompting

This commit is contained in:
35C4n0r 2026-03-12 22:11:54 +05:30
parent 45d3d8ee19
commit b5e79685e6
No known key found for this signature in database
GPG Key ID: 5B71E5C9D18D5675
2 changed files with 19 additions and 13 deletions

View File

@ -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}' \

View File

@ -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
}