summaryrefslogtreecommitdiffhomepage
path: root/packages/api/src/routes
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-05-23 05:25:03 +0900
committerAdam Malczewski <[email protected]>2026-05-23 05:25:03 +0900
commit225d3ea65cfc35d211fc66e30cf05cbc693d37e4 (patch)
tree1d765743942eb8c5d519fea37763ed6a36b90eec /packages/api/src/routes
parent9287cccb29d135ea19f2612c26f3090c94820d8c (diff)
downloaddispatch-225d3ea65cfc35d211fc66e30cf05cbc693d37e4.tar.gz
dispatch-225d3ea65cfc35d211fc66e30cf05cbc693d37e4.zip
feat: relative working directory support and subagent tab cwd propagation
- Resolve relative cwd paths (e.g. ./subtask) against parent's working directory at runtime - check-dir endpoint resolves relative paths and returns the resolved absolute path - AgentBuilder shows resolved path below input for relative paths, updated helper text - tab-created event now includes workingDirectory so subagent tabs display their cwd in sidebar - Add workingDirectory to tab-created AgentEvent type definition - spawnChildAgent stores resolved absolute path instead of raw relative path
Diffstat (limited to 'packages/api/src/routes')
-rw-r--r--packages/api/src/routes/agents.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/packages/api/src/routes/agents.ts b/packages/api/src/routes/agents.ts
index d3ca23f..1627674 100644
--- a/packages/api/src/routes/agents.ts
+++ b/packages/api/src/routes/agents.ts
@@ -99,11 +99,16 @@ agentsRoutes.get("/check-dir", (c) => {
if (dirPath === "~" || dirPath.startsWith("~/")) {
dirPath = path.join(os.homedir(), dirPath.slice(1));
}
+ // Resolve relative paths against the project root
+ if (!path.isAbsolute(dirPath)) {
+ const projectDir = process.env.DISPATCH_WORKING_DIR || process.cwd();
+ dirPath = path.resolve(projectDir, dirPath);
+ }
try {
const stat = fs.statSync(dirPath);
- return c.json({ exists: stat.isDirectory() });
+ return c.json({ exists: stat.isDirectory(), resolved: dirPath });
} catch {
- return c.json({ exists: false });
+ return c.json({ exists: false, resolved: dirPath });
}
});