feat(coder/modules/claude-code): migrate claude-code to agentapi v3
This commit is contained in:
parent
7e3e842aaa
commit
9be5edb005
@ -354,27 +354,12 @@ locals {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
module "agentapi" {
|
|
||||||
source = "registry.coder.com/coder/agentapi/coder"
|
|
||||||
version = "2.0.0"
|
|
||||||
|
|
||||||
agent_id = var.agent_id
|
module "agent-helper" {
|
||||||
web_app_slug = local.app_slug
|
source = "git::https://github.com/coder/registry.git//registry/coder/modules/agent-helper?ref=35C4n0r/feat-agent-helper-module"
|
||||||
web_app_order = var.order
|
pre_install_script = var.pre_install_script
|
||||||
web_app_group = var.group
|
post_install_script = var.post_install_script
|
||||||
web_app_icon = var.icon
|
start_script = <<-EOT
|
||||||
web_app_display_name = var.web_app_display_name
|
|
||||||
folder = local.workdir
|
|
||||||
cli_app = var.cli_app
|
|
||||||
cli_app_slug = var.cli_app ? "${local.app_slug}-cli" : null
|
|
||||||
cli_app_display_name = var.cli_app ? var.cli_app_display_name : null
|
|
||||||
agentapi_subdomain = var.subdomain
|
|
||||||
module_dir_name = local.module_dir_name
|
|
||||||
install_agentapi = var.install_agentapi
|
|
||||||
agentapi_version = var.agentapi_version
|
|
||||||
pre_install_script = var.pre_install_script
|
|
||||||
post_install_script = var.post_install_script
|
|
||||||
start_script = <<-EOT
|
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
@ -397,7 +382,7 @@ module "agentapi" {
|
|||||||
/tmp/start.sh
|
/tmp/start.sh
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
install_script = <<-EOT
|
install_script = <<-EOT
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
@ -418,6 +403,30 @@ module "agentapi" {
|
|||||||
ARG_ENABLE_AIBRIDGE='${var.enable_aibridge}' \
|
ARG_ENABLE_AIBRIDGE='${var.enable_aibridge}' \
|
||||||
/tmp/install.sh
|
/tmp/install.sh
|
||||||
EOT
|
EOT
|
||||||
|
agent_id = var.agent_id
|
||||||
|
agent_name = local.app_slug
|
||||||
|
module_dir_name = local.module_dir_name
|
||||||
|
}
|
||||||
|
|
||||||
|
module "agentapi" {
|
||||||
|
source = "git::https://github.com/coder/registry.git//registry/coder/modules/agentapi?ref=35C4n0r/feat-agentapi-architecture-improv"
|
||||||
|
# version = "2.0.0"
|
||||||
|
|
||||||
|
agent_id = var.agent_id
|
||||||
|
web_app_slug = local.app_slug
|
||||||
|
web_app_order = var.order
|
||||||
|
web_app_group = var.group
|
||||||
|
web_app_icon = var.icon
|
||||||
|
web_app_display_name = var.web_app_display_name
|
||||||
|
folder = local.workdir
|
||||||
|
cli_app = var.cli_app
|
||||||
|
cli_app_slug = var.cli_app ? "${local.app_slug}-cli" : null
|
||||||
|
cli_app_display_name = var.cli_app ? var.cli_app_display_name : null
|
||||||
|
agentapi_subdomain = var.subdomain
|
||||||
|
module_dir_name = local.module_dir_name
|
||||||
|
agentapi_server_type = "claude"
|
||||||
|
install_agentapi = var.install_agentapi
|
||||||
|
agentapi_version = var.agentapi_version
|
||||||
}
|
}
|
||||||
|
|
||||||
output "task_app_id" {
|
output "task_app_id" {
|
||||||
|
|||||||
@ -11,6 +11,7 @@ command_exists() {
|
|||||||
command -v "$1" > /dev/null 2>&1
|
command -v "$1" > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MODULE_PATH="$HOME/.claude-module"
|
||||||
ARG_RESUME_SESSION_ID=${ARG_RESUME_SESSION_ID:-}
|
ARG_RESUME_SESSION_ID=${ARG_RESUME_SESSION_ID:-}
|
||||||
ARG_CONTINUE=${ARG_CONTINUE:-false}
|
ARG_CONTINUE=${ARG_CONTINUE:-false}
|
||||||
ARG_DANGEROUSLY_SKIP_PERMISSIONS=${ARG_DANGEROUSLY_SKIP_PERMISSIONS:-}
|
ARG_DANGEROUSLY_SKIP_PERMISSIONS=${ARG_DANGEROUSLY_SKIP_PERMISSIONS:-}
|
||||||
@ -243,12 +244,28 @@ function start_agentapi() {
|
|||||||
BOUNDARY_CMD=("$CODER_NO_CAPS" "boundary")
|
BOUNDARY_CMD=("$CODER_NO_CAPS" "boundary")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
agentapi server --type claude --term-width 67 --term-height 1190 -- \
|
# Build properly quoted command arguments
|
||||||
"${BOUNDARY_CMD[@]}" "${BOUNDARY_ARGS[@]}" -- \
|
boundary_cmd=$(printf '%q ' "${BOUNDARY_CMD[@]}" "${BOUNDARY_ARGS[@]}")
|
||||||
claude "${ARGS[@]}"
|
claude_args=$(printf '%q ' "${ARGS[@]}")
|
||||||
|
|
||||||
|
# Write command to agent-command.sh with boundary
|
||||||
|
cat > "$MODULE_PATH/agent-command.sh" << EOF
|
||||||
|
#!/bin/bash
|
||||||
|
${BOUNDARY_CMD[@]} -- claude ${ARGS[@]}
|
||||||
|
EOF
|
||||||
else
|
else
|
||||||
agentapi server --type claude --term-width 67 --term-height 1190 -- claude "${ARGS[@]}"
|
# Build properly quoted command arguments
|
||||||
|
claude_args=$(printf '%q ' "${ARGS[@]}")
|
||||||
|
|
||||||
|
# Write command to agent-command.sh without boundary
|
||||||
|
cat > "$MODULE_PATH/agent-command.sh" << EOF
|
||||||
|
#!/bin/bash
|
||||||
|
claude ${ARGS[@]}
|
||||||
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
chmod +x "$MODULE_PATH/agent-command.sh"
|
||||||
|
printf "Agent command written to %s\n" "$MODULE_PATH/agent-command.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
validate_claude_installation
|
validate_claude_installation
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user