Skip to content

Commit 58d2963

Browse files
feat: add task_id, prompt and app_id fields to coder_ai_task
Closes coder/internal#977 Adds one required field `app_id`, two read-only computed fields `task_id` and `prompt`, as well as deprecates the `sidebar_app` field.
1 parent 71c6d7d commit 58d2963

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

‎docs/resources/ai_task.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@ Use this resource to define Coder tasks.
1717

1818
### Required
1919

20-
- `sidebar_app` (Block Set, Min: 1, Max: 1) The coder_app to display in the sidebar. Usually a chat interface with the AI agent running in the workspace, like https://github.com/coder/agentapi. (see [below for nested schema](#nestedblock--sidebar_app))
20+
- `app_id` (String) The ID of the coder_app resource that provides the AI interface for this task.
21+
- `sidebar_app` (Block Set, Min: 1, Max: 1, Deprecated) The coder_app to display in the sidebar. Usually a chat interface with the AI agent running in the workspace, like https://github.com/coder/agentapi. (see [below for nested schema](#nestedblock--sidebar_app))
2122

2223
### Read-Only
2324

2425
- `id` (String) A unique identifier for this resource.
26+
- `prompt` (String) The prompt text provided to the task by Coder.
27+
- `task_id` (String) A unique identifier for the Coder Task resource.
2528

2629
<a id="nestedblock--sidebar_app"></a>
2730
### Nested Schema for `sidebar_app`

‎provider/ai_task.go‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type AITaskSidebarApp struct {
2121
// TaskPromptParameterName is the name of the parameter which is *required* to be defined when a coder_ai_task is used.
2222
const TaskPromptParameterName = "AI Prompt"
2323

24-
func aiTask() *schema.Resource {
24+
func aiTaskResource() *schema.Resource {
2525
return &schema.Resource{
2626
SchemaVersion: 1,
2727

@@ -41,6 +41,7 @@ func aiTask() *schema.Resource {
4141
"sidebar_app": {
4242
Type: schema.TypeSet,
4343
Description: "The coder_app to display in the sidebar. Usually a chat interface with the AI agent running in the workspace, like https://github.com/coder/agentapi.",
44+
Deprecated: "This field has been deprecated in favor of the `app_id` field.",
4445
ForceNew: true,
4546
Required: true,
4647
MaxItems: 1,
@@ -56,6 +57,21 @@ func aiTask() *schema.Resource {
5657
},
5758
},
5859
},
60+
"task_id": {
61+
Type: schema.TypeString,
62+
Description: "A unique identifier for the Coder Task resource.",
63+
Computed: true,
64+
},
65+
"prompt": {
66+
Type: schema.TypeString,
67+
Description: "The prompt text provided to the task by Coder.",
68+
Computed: true,
69+
},
70+
"app_id": {
71+
Type: schema.TypeString,
72+
Description: "The ID of the coder_app resource that provides the AI interface for this task.",
73+
Required: true,
74+
},
5975
},
6076
}
6177
}

‎provider/provider.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func New() *schema.Provider {
6868
ResourcesMap: map[string]*schema.Resource{
6969
"coder_agent": agentResource(),
7070
"coder_agent_instance": agentInstanceResource(),
71-
"coder_ai_task": aiTask(),
71+
"coder_ai_task": aiTaskResource(),
7272
"coder_app": appResource(),
7373
"coder_metadata": metadataResource(),
7474
"coder_script": scriptResource(),

0 commit comments

Comments
 (0)