Repository navigation
[EPIC-D][LOU-D31] loushy dev serves agent directories, TS agents and specs with hot reload - #110
Merged
Merged
Conversation
…specs with hot reload loushy dev <path> 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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016bY29ibQgv3MDdjAbUT4YR
…reload # Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
loushy dev <path>now accepts a spec file (as before), an agent directory (loadAgentDir) or a.ts/.jsmodule whose default (oragent) export is aSimpleAgentor acreateAgent()options object. Newsrc/cli/devReload.tsholds target detection, the watcher and the reload swap;dev.tsuses it and gainsGET /dev/status; the chat page shows a banner when the last reload failed.importModule()gains an AsyncLocalStorage-basedwithFreshImports()so directory tool/config files are imported with?t=<token>.Why
Matrix rows "Hot reload" and "Dev TUI / REPL" were partial: dev only watched one spec file. eve's
eve devhot-reloads instructions and config; this brings directories and TS agents to parity.Acceptance criteria
loushy dev <path>accepts a spec file, an agent directory or a.ts/.jsmodule (default oragentexport:SimpleAgentorcreateAgentconfig); detection by path type and extension; errors use LOU-D2 codes/hints (LOUSHY_CONFIG_INVALID,LOUSHY_SPEC_UNSUPPORTED_FORMAT)?t=import so edited tools reload; new agent is built andready()first, swapped in, then the previous agent isclose()d; logs what reloaded; a failed reload keeps the last good agent and reports the error in the console, the chat UI banner and/dev/statussrc/cli/dev.test.ts: dir mode (fixture), TS module mode (fixture),instructions.mdand tool edits trigger a reload (real watcher, 20 ms debounce, temp copy), failed reload keeps the previous agent and recoversdevsection, docs/agent-directories.md "Run it withloushy dev", llms files regenerated, CHANGELOG (Added)Notes: a module imported by a reloaded file (shared helper) stays cached by Node, so it needs a restart (documented); changes to it still trigger a reload. The new agent is readied before the old one is closed (rather than closing first) so a failing reload never leaves a closed agent in service.
How verified
npx tsc --noEmit: passnpm run lint: 0 errors, 402 warnings (main: 404)npm run test:types: 6 files, 30 tests passednpx vitest run: 157 files passed, 2287 passed, 3 skippednpm run build && npm run build --workspace=packages/create-loushy-agent: successnpm run docs:verify-snippets -- --skip-build: all 120 snippets type-check, 6 run cleanlynpm run docs:llms:check: passnpm run test:coverage: 157 files passed, 2287 passed; All files 90.42% statementsnpm run fallow: No issues foundnode bin/loushy.js dev agent.ts, edited the file, the next/chatanswered from the new version and/dev/statusreportedreloads: 1🤖 Generated with Claude Code
https://claude.ai/code/session_016bY29ibQgv3MDdjAbUT4YR
Generated by Claude Code