Skip to content

Commit 74c8698

Browse files
authored
feat: goose: add support for subdomain=false (#299)
Updates coder/coder#18779 Builds on #297 ## Description Adds support for specifying `subdomain = false` in the agentapi module. Change added in #297 NOTE: `AGENTAPI_CHAT_BASE_PATH` is exported before running `main.sh` in agentapi, so this environment variable is available to calling modules if `var.subdomain = false`. ## Type of Change - [ ] New module - [ ] Bug fix - [X] Feature/enhancement - [ ] Documentation - [ ] Other ## Testing & Validation - [X] Tests pass (`bun test`) - [X] Code formatted (`bun run fmt`) - [X] Changes tested locally ## Related Issues coder/coder#18779
1 parent 0333399 commit 74c8698

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

registry/coder/modules/goose/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Run the [Goose](https://block.github.io/goose/) agent in your workspace to gener
1313
```tf
1414
module "goose" {
1515
source = "registry.coder.com/coder/goose/coder"
16-
version = "2.0.1"
16+
version = "2.1.0"
1717
agent_id = coder_agent.example.id
1818
folder = "/home/coder"
1919
install_goose = true
@@ -79,7 +79,7 @@ resource "coder_agent" "main" {
7979
module "goose" {
8080
count = data.coder_workspace.me.start_count
8181
source = "registry.coder.com/coder/goose/coder"
82-
version = "2.0.1"
82+
version = "2.1.0"
8383
agent_id = coder_agent.example.id
8484
folder = "/home/coder"
8585
install_goose = true

registry/coder/modules/goose/main.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,4 +251,21 @@ describe("goose", async () => {
251251
expect(prompt.exitCode).not.toBe(0);
252252
expect(prompt.stderr).toContain("No such file or directory");
253253
});
254+
255+
test("subdomain-false", async () => {
256+
const { id } = await setup({
257+
agentapiMockScript: await loadTestFile(
258+
import.meta.dir,
259+
"agentapi-mock-print-args.js",
260+
),
261+
moduleVariables: {
262+
subdomain: "false",
263+
},
264+
});
265+
266+
await execModuleScript(id);
267+
268+
const agentapiMockOutput = await readFileContainer(id, agentapiStartLog);
269+
expect(agentapiMockOutput).toContain("AGENTAPI_CHAT_BASE_PATH=/@default/default.foo/apps/goose/chat");
270+
});
254271
});

registry/coder/modules/goose/main.tf

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,13 @@ variable "install_agentapi" {
6363
variable "agentapi_version" {
6464
type = string
6565
description = "The version of AgentAPI to install."
66-
default = "v0.2.3"
66+
default = "v0.3.3"
67+
}
68+
69+
variable "subdomain" {
70+
type = bool
71+
description = "Whether to use a subdomain for AgentAPI."
72+
default = true
6773
}
6874

6975
variable "goose_provider" {
@@ -133,7 +139,7 @@ EOT
133139

134140
module "agentapi" {
135141
source = "registry.coder.com/coder/agentapi/coder"
136-
version = "1.0.0"
142+
version = "1.1.0"
137143

138144
agent_id = var.agent_id
139145
web_app_slug = local.app_slug
@@ -146,6 +152,7 @@ module "agentapi" {
146152
module_dir_name = local.module_dir_name
147153
install_agentapi = var.install_agentapi
148154
agentapi_version = var.agentapi_version
155+
agentapi_subdomain = var.subdomain
149156
pre_install_script = var.pre_install_script
150157
post_install_script = var.post_install_script
151158
start_script = local.start_script

registry/coder/modules/goose/testdata/agentapi-mock-print-args.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const http = require("http");
44
const args = process.argv.slice(2);
55
console.log(args);
6+
console.log(`AGENTAPI_CHAT_BASE_PATH=${process.env["AGENTAPI_CHAT_BASE_PATH"]}`);
67
const port = 3284;
78

89
console.log(`starting server on port ${port}`);

0 commit comments

Comments
 (0)