Skip to content

Commit 186e0c4

Browse files
feat(module/coder-labs/amp): add mode flag and disable animation (#550)
## Description 1. "mode" flag: Set the agent mode (free, rush, smart) — controls the model, system prompt, and tool selection. 2. `"amp.terminal.animation": false`: This disables the animation. 3. Update the readme <!-- Briefly describe what this PR does and why --> ## Type of Change - [ ] New module - [ ] New template - [x] Bug fix - [x] Feature/enhancement - [x] Documentation - [ ] Other ## Module Information <!-- Delete this section if not applicable --> **Path:** `registry/coder-labs/modules/amp` **New version:** `v2.1.0` **Breaking change:** [ ] Yes [X] No ## Testing & Validation - [X] Tests pass (`bun test`) - [X] Code formatted (`bun fmt`) - [x] Changes tested locally ## Related Issues <!-- Link related issues or write "None" if not applicable --> --------- Co-authored-by: DevCats <christofer@coder.com>
1 parent 69e5dc5 commit 186e0c4

File tree

4 files changed

+30
-15
lines changed

4 files changed

+30
-15
lines changed

registry/coder-labs/modules/sourcegraph-amp/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ Run [Amp CLI](https://ampcode.com/) in your workspace to access Sourcegraph's AI
1212

1313
```tf
1414
module "amp-cli" {
15-
source = "registry.coder.com/coder-labs/sourcegraph-amp/coder"
16-
version = "2.0.2"
17-
agent_id = coder_agent.example.id
18-
sourcegraph_amp_api_key = var.sourcegraph_amp_api_key
19-
install_sourcegraph_amp = true
20-
agentapi_version = "2.0.2"
15+
source = "registry.coder.com/coder-labs/sourcegraph-amp/coder"
16+
version = "2.1.0"
17+
agent_id = coder_agent.example.id
18+
amp_api_key = var.amp_api_key
19+
install_amp = true
20+
agentapi_version = "latest"
2121
}
2222
```
2323

@@ -48,7 +48,7 @@ variable "amp_api_key" {
4848
module "amp-cli" {
4949
count = data.coder_workspace.me.start_count
5050
source = "registry.coder.com/coder-labs/sourcegraph-amp/coder"
51-
amp_version = "2.0.2"
51+
amp_version = "2.1.0"
5252
agent_id = coder_agent.example.id
5353
amp_api_key = var.amp_api_key # recommended for tasks usage
5454
workdir = "/home/coder/project"

registry/coder-labs/modules/sourcegraph-amp/main.tf

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ variable "install_agentapi" {
5555
variable "agentapi_version" {
5656
type = string
5757
description = "The version of AgentAPI to install."
58-
default = "v0.10.0"
58+
default = "v0.11.1"
5959
}
6060

6161
variable "cli_app" {
@@ -160,6 +160,16 @@ variable "mcp" {
160160
default = null
161161
}
162162

163+
variable "mode" {
164+
type = string
165+
description = "Set the agent mode (free, rush, smart) — controls the model, system prompt, and tool selection. Default: smart"
166+
default = "smart"
167+
validation {
168+
condition = contains(["", "free", "rush", "smart"], var.mode)
169+
error_message = "Invalid mode. Select one from (free, rush, smart)"
170+
}
171+
}
172+
163173
data "external" "env" {
164174
program = ["sh", "-c", "echo '{\"CODER_AGENT_TOKEN\":\"'$CODER_AGENT_TOKEN'\",\"CODER_AGENT_URL\":\"'$CODER_AGENT_URL'\"}'"]
165175
}
@@ -170,6 +180,7 @@ locals {
170180
default_base_config = jsonencode({
171181
"amp.anthropic.thinking.enabled" = true
172182
"amp.todos.enabled" = true
183+
"amp.terminal.animation" = false
173184
})
174185

175186
user_config = jsondecode(var.base_amp_config != "" ? var.base_amp_config : local.default_base_config)
@@ -237,6 +248,7 @@ module "agentapi" {
237248
ARG_AMP_START_DIRECTORY='${var.workdir}' \
238249
ARG_AMP_TASK_PROMPT='${base64encode(var.ai_prompt)}' \
239250
ARG_REPORT_TASKS='${var.report_tasks}' \
251+
ARG_MODE='${var.mode}' \
240252
/tmp/start.sh
241253
EOT
242254

registry/coder-labs/modules/sourcegraph-amp/scripts/install.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
#!/bin/bash
2-
3-
if [ -f "$HOME/.bashrc" ]; then
4-
source "$HOME"/.bashrc
5-
fi
6-
72
set -euo pipefail
83

94
# ANSI colors

registry/coder-labs/modules/sourcegraph-amp/scripts/start.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ echo "--------------------------------"
2929
printf "Workspace: %s\n" "$ARG_AMP_START_DIRECTORY"
3030
printf "Task Prompt: %s\n" "$ARG_AMP_TASK_PROMPT"
3131
printf "ARG_REPORT_TASKS: %s\n" "$ARG_REPORT_TASKS"
32+
printf "ARG_MODE: %s\n" "$ARG_MODE"
3233
echo "--------------------------------"
3334

3435
ensure_command amp
@@ -50,6 +51,13 @@ else
5051
printf "amp_api_key not provided\n"
5152
fi
5253

54+
ARGS=()
55+
56+
if [ -n "$ARG_MODE" ]; then
57+
printf "Running agent in: %s mode" "$ARG_MODE"
58+
ARGS+=(--mode "$ARG_MODE")
59+
fi
60+
5361
if [ -n "$ARG_AMP_TASK_PROMPT" ]; then
5462
if [ "$ARG_REPORT_TASKS" == "true" ]; then
5563
printf "amp task prompt provided : %s" "$ARG_AMP_TASK_PROMPT\n"
@@ -58,8 +66,8 @@ if [ -n "$ARG_AMP_TASK_PROMPT" ]; then
5866
PROMPT="$ARG_AMP_TASK_PROMPT"
5967
fi
6068
# Pipe the prompt into amp, which will be run inside agentapi
61-
agentapi server --type amp --term-width=67 --term-height=1190 -- bash -c "echo \"$PROMPT\" | amp"
69+
agentapi server --type amp --term-width=67 --term-height=1190 -- bash -c "echo \"$PROMPT\" | amp" "${ARGS[@]}"
6270
else
6371
printf "No task prompt given.\n"
64-
agentapi server --type amp --term-width=67 --term-height=1190 -- amp
72+
agentapi server --type amp --term-width=67 --term-height=1190 -- amp "${ARGS[@]}"
6573
fi

0 commit comments

Comments
 (0)