From fba3aa6647030de7cf64f6cead06e48109d3bce1 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 1 Oct 2026 16:50:08 +0000 Subject: [PATCH] [EPIC-D][LOU-D31] loushy dev serves agent directories, TS agents and specs with hot reload loushy dev now takes a spec file, an agent directory (loadAgentDir) or a .ts/.js module exporting a SimpleAgent or createAgent() config. It watches the directory tree or the module and its relative imports, debounces, rebuilds with a ?t= cache-busted import, readies the new agent, swaps it in and closes the previous one. A failed reload keeps the last good agent and is reported in the console, the chat page banner and GET /dev/status. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016bY29ibQgv3MDdjAbUT4YR --- CHANGELOG.md | 1 + bin/loushy.js | 4 +- docs/agent-directories.md | 17 +- docs/cli.md | 47 +++- llms-full.txt | 64 ++++- src/agentDir/importModule.ts | 17 +- src/cli/__fixtures__/dev-agent/agent.json | 1 + .../__fixtures__/dev-agent/instructions.md | 1 + src/cli/__fixtures__/dev-agent/tools/ping.ts | 9 + src/cli/__fixtures__/dev-module/agent.ts | 9 + src/cli/__fixtures__/dev-module/bad.ts | 1 + src/cli/__fixtures__/dev-module/config.ts | 1 + src/cli/__fixtures__/dev-module/greeting.ts | 1 + src/cli/dev-ui/index.html | 17 ++ src/cli/dev.test.ts | 138 ++++++++++- src/cli/dev.ts | 77 +++--- src/cli/devReload.ts | 233 ++++++++++++++++++ 17 files changed, 575 insertions(+), 63 deletions(-) create mode 100644 src/cli/__fixtures__/dev-agent/agent.json create mode 100644 src/cli/__fixtures__/dev-agent/instructions.md create mode 100644 src/cli/__fixtures__/dev-agent/tools/ping.ts create mode 100644 src/cli/__fixtures__/dev-module/agent.ts create mode 100644 src/cli/__fixtures__/dev-module/bad.ts create mode 100644 src/cli/__fixtures__/dev-module/config.ts create mode 100644 src/cli/__fixtures__/dev-module/greeting.ts create mode 100644 src/cli/devReload.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e7a77118..69d1029f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - 2026-09-28 ### Added +- `loushy dev` for agent directories and TS agents, with hot reload (LOU-D31): `loushy dev ` takes a spec file (as before), an agent directory (`loadAgentDir()`) or a `.ts`/`.js` module whose default (or `agent`) export is a `SimpleAgent` or a `createAgent()` options object, detected by path type and extension (a bad path, extension or export fails with `LOUSHY_CONFIG_INVALID` / `LOUSHY_SPEC_UNSUPPORTED_FORMAT`). It watches the directory tree, or the module and its relative imports, and rebuilds the agent about 100 ms after a change with a `?t=