mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
refactor: remove deprecated AITaskPromptParameterName constant (#21023)
This removes the deprecated AITaskPromptParameterName constant and all backward compatibility code that was added for v2.28. - Remove AITaskPromptParameterName constant from codersdk/aitasks.go - Remove backward compatibility code in coderd/aitasks.go that populated the "AI Prompt" parameter for templates that defined it - Remove the backward compatibility test (OK AIPromptBackCompat) - Update dbfake to no longer set the AI Prompt parameter - Remove AITaskPromptParameterName from frontend TypeScript types - Remove preset prompt read-only feature from TaskPrompt component - Update docs to reflect that pre-2.28 definition is no longer supported Task prompts are now exclusively stored in the tasks.prompt database column, as introduced in the migration that added the tasks table.
This commit is contained in:
@@ -58,6 +58,8 @@ data "coder_workspace_owner" "me" {}
|
||||
|
||||
data "coder_workspace" "me" {}
|
||||
|
||||
data "coder_task" "me" {}
|
||||
|
||||
resource "coder_agent" "dev" {
|
||||
arch = "amd64"
|
||||
os = "linux"
|
||||
@@ -71,15 +73,21 @@ resource "coder_agent" "dev" {
|
||||
|
||||
# See https://registry.coder.com/modules/coder/claude-code for more information
|
||||
module "claude-code" {
|
||||
count = local.has_ai_prompt ? data.coder_workspace.me.start_count : 0
|
||||
count = data.coder_task.me.enabled ? data.coder_workspace.me.start_count : 0
|
||||
source = "dev.registry.coder.com/coder/claude-code/coder"
|
||||
version = ">= 3.4.0"
|
||||
version = ">= 4.0.0"
|
||||
agent_id = coder_agent.dev.id
|
||||
workdir = "/home/coder/project"
|
||||
claude_api_key = data.coder_workspace_owner.me.session_token # Use the Coder session token to authenticate with AI Bridge
|
||||
ai_prompt = data.coder_parameter.ai_prompt.value
|
||||
ai_prompt = data.coder_task.me.prompt
|
||||
... # other claude-code configuration
|
||||
}
|
||||
|
||||
# The coder_ai_task resource associates the task to the app.
|
||||
resource "coder_ai_task" "task" {
|
||||
count = data.coder_task.me.enabled ? data.coder_workspace.me.start_count : 0
|
||||
app_id = module.claude-code[0].task_app_id
|
||||
}
|
||||
```
|
||||
|
||||
## External and Desktop Clients
|
||||
|
||||
@@ -8,7 +8,8 @@ Prior to Coder version 2.28.0, the definition of a Coder task was different to t
|
||||
|
||||
Note that 2 and 3 were generally handled by the `coder/agentapi` Terraform module.
|
||||
|
||||
The pre-2.28.0 definition will be supported until the release of 2.29.0. You will need to update your Tasks-enabled templates to continue using Tasks after this release.
|
||||
> [!IMPORTANT]
|
||||
> The pre-2.28.0 definition is no longer supported as of Coder 2.30.0. You must update your Tasks-enabled templates to use the new format described below.
|
||||
|
||||
You can view an [example migration here](https://github.com/coder/coder/pull/20420). Alternatively, follow the steps below:
|
||||
|
||||
@@ -114,7 +115,7 @@ resource "coder_ai_task" "task" {
|
||||
|
||||
In v2.28 and above, the following changes were made:
|
||||
|
||||
- The explicitly named "AI Prompt" parameter is deprecated. The task prompt is now available in the `coder_ai_task` resource (provider version 2.12 and above) and `coder_task` data source (provider version 2.13 and above).
|
||||
- The explicitly named "AI Prompt" parameter is no longer supported. The task prompt is now available in the `coder_ai_task` resource (provider version 2.12 and above) and `coder_task` data source (provider version 2.13 and above).
|
||||
- Modules no longer define the `coder_ai_task` resource. These must be defined explicitly in the template.
|
||||
- The `sidebar_app` field of the `coder_ai_task` resource is now deprecated. In its place, use `app_id`.
|
||||
|
||||
|
||||
@@ -268,16 +268,16 @@ Coder maintains the [Tasks on Docker](https://registry.coder.com/templates/coder
|
||||
coder template push tasks-docker -d . --variable anthropic_api_key="your-api-key"
|
||||
```
|
||||
|
||||
1. **Create the new Workspace**
|
||||
1. In your Coder Deployment, click **Workspaces** in the upper left hand corner
|
||||
1. Click **New workspace** and choose **tasks-docker**
|
||||
1. Fill in the Workspace name. Add in an AI Prompt for Claude Code like "Make the background yellow". Click **Create workspace**
|
||||
1. **Create a Task**
|
||||
1. In your Coder deployment, click **Tasks** in the navigation
|
||||
1. In the "Prompt your AI agent to start a task" box, enter a prompt like "Make the background yellow"
|
||||
1. Select the **tasks-docker** template from the dropdown and click the submit button
|
||||
1. **See Tasks in action**
|
||||
1. Once your workspace is running, click **View tasks** with your workspace. This will bring you to the Tasks view where you can see Claude Code (left panel), preview the sample application, and interact with the code in code-server. You might need to wait for Claude Code to finish changing the background color of the application.
|
||||
1. Navigate to the **Tasks** tab in the upper left hand corner
|
||||
1. Your task will appear in the table below. Click on it to open the task view where you can follow the initialization
|
||||
1. Once active, you'll see Claude Code on the left panel and can preview the sample application or interact with the code in code-server on the right. You might need to wait for Claude Code to finish changing the background color of the application.
|
||||
1. Try typing in a new request to Claude Code: "make the background red"
|
||||
1. Let's exit out of this specific Task view, so we can see all the running tasks
|
||||
1. You can start a new task by prompting in the "Prompt your AI agent to start a task" box. You can select which template to run this from, so tasks-docker here, and that will spin up a new Workspace
|
||||
1. Click the back arrow to return to the task overview (you can also see all your tasks in the sidebar)
|
||||
1. You can start a new task from the prompt box at the top of the page
|
||||
|
||||

|
||||
|
||||
|
||||
Reference in New Issue
Block a user