diff --git a/registry/coder-labs/modules/sourcegraph-amp/README.md b/registry/coder-labs/modules/sourcegraph-amp/README.md index 608defd60..6ba0576fa 100644 --- a/registry/coder-labs/modules/sourcegraph-amp/README.md +++ b/registry/coder-labs/modules/sourcegraph-amp/README.md @@ -12,12 +12,12 @@ Run [Amp CLI](https://ampcode.com/) in your workspace to access Sourcegraph's AI ```tf module "amp-cli" { - source = "registry.coder.com/coder-labs/sourcegraph-amp/coder" - version = "2.0.1" - agent_id = coder_agent.example.id - sourcegraph_amp_api_key = var.sourcegraph_amp_api_key - install_sourcegraph_amp = true - agentapi_version = "latest" + source = "registry.coder.com/coder-labs/sourcegraph-amp/coder" + version = "2.1.0" + agent_id = coder_agent.example.id + amp_api_key = var.amp_api_key + install_amp = true + agentapi_version = "latest" } ``` @@ -48,7 +48,7 @@ variable "amp_api_key" { module "amp-cli" { count = data.coder_workspace.me.start_count source = "registry.coder.com/coder-labs/sourcegraph-amp/coder" - amp_version = "2.0.1" + amp_version = "2.1.0" agent_id = coder_agent.example.id amp_api_key = var.amp_api_key # recommended for tasks usage workdir = "/home/coder/project" diff --git a/registry/coder-labs/modules/sourcegraph-amp/main.tf b/registry/coder-labs/modules/sourcegraph-amp/main.tf index fc36ea8d3..c61e276de 100644 --- a/registry/coder-labs/modules/sourcegraph-amp/main.tf +++ b/registry/coder-labs/modules/sourcegraph-amp/main.tf @@ -55,7 +55,7 @@ variable "install_agentapi" { variable "agentapi_version" { type = string description = "The version of AgentAPI to install." - default = "v0.10.0" + default = "v0.11.1" } variable "cli_app" { @@ -160,6 +160,16 @@ variable "mcp" { default = null } +variable "mode" { + type = string + description = "Set the agent mode (free, rush, smart) — controls the model, system prompt, and tool selection. Default: smart" + default = "" + validation { + condition = contains(["", "free", "rush", "smart"], var.mode) + error_message = "Invalid mode. Select one from (free, rush, smart)" + } +} + data "external" "env" { program = ["sh", "-c", "echo '{\"CODER_AGENT_TOKEN\":\"'$CODER_AGENT_TOKEN'\",\"CODER_AGENT_URL\":\"'$CODER_AGENT_URL'\"}'"] } @@ -170,6 +180,7 @@ locals { default_base_config = jsonencode({ "amp.anthropic.thinking.enabled" = true "amp.todos.enabled" = true + "amp.terminal.animation" = false }) user_config = jsondecode(var.base_amp_config != "" ? var.base_amp_config : local.default_base_config) @@ -237,6 +248,7 @@ module "agentapi" { ARG_AMP_START_DIRECTORY='${var.workdir}' \ ARG_AMP_TASK_PROMPT='${base64encode(var.ai_prompt)}' \ ARG_REPORT_TASKS='${var.report_tasks}' \ + ARG_MODE='${var.mode}' \ /tmp/start.sh EOT diff --git a/registry/coder-labs/modules/sourcegraph-amp/scripts/install.sh b/registry/coder-labs/modules/sourcegraph-amp/scripts/install.sh index 0af54e5e8..6b4e66493 100644 --- a/registry/coder-labs/modules/sourcegraph-amp/scripts/install.sh +++ b/registry/coder-labs/modules/sourcegraph-amp/scripts/install.sh @@ -1,8 +1,6 @@ #!/bin/bash set -euo pipefail -source "$HOME"/.bashrc - # ANSI colors BOLD='\033[1m' GREEN='\033[0;32m' diff --git a/registry/coder-labs/modules/sourcegraph-amp/scripts/start.sh b/registry/coder-labs/modules/sourcegraph-amp/scripts/start.sh index 46dc2d761..d8dcb80d1 100644 --- a/registry/coder-labs/modules/sourcegraph-amp/scripts/start.sh +++ b/registry/coder-labs/modules/sourcegraph-amp/scripts/start.sh @@ -27,6 +27,7 @@ echo "--------------------------------" printf "Workspace: %s\n" "$ARG_AMP_START_DIRECTORY" printf "Task Prompt: %s\n" "$ARG_AMP_TASK_PROMPT" printf "ARG_REPORT_TASKS: %s\n" "$ARG_REPORT_TASKS" +printf "ARG_MODE: %s\n" "$ARG_MODE" echo "--------------------------------" ensure_command amp @@ -48,6 +49,13 @@ else printf "amp_api_key not provided\n" fi +ARGS=() + +if [ -n "$ARG_MODE" ]; then + printf "Running agent in: %s mode" "$ARG_MODE" + ARGS+=(--mode "$ARG_MODE") +fi + if [ -n "$ARG_AMP_TASK_PROMPT" ]; then if [ "$ARG_REPORT_TASKS" == "true" ]; then printf "amp task prompt provided : %s" "$ARG_AMP_TASK_PROMPT\n" @@ -56,8 +64,8 @@ if [ -n "$ARG_AMP_TASK_PROMPT" ]; then PROMPT="$ARG_AMP_TASK_PROMPT" fi # Pipe the prompt into amp, which will be run inside agentapi - agentapi server --type amp --term-width=67 --term-height=1190 -- bash -c "echo \"$PROMPT\" | amp" + agentapi server --type amp --term-width=67 --term-height=1190 -- bash -c "echo \"$PROMPT\" | amp" "${ARGS[@]}" else printf "No task prompt given.\n" - agentapi server --type amp --term-width=67 --term-height=1190 -- amp + agentapi server --type amp --term-width=67 --term-height=1190 -- amp "${ARGS[@]}" fi