2.7 KiB
2.7 KiB
Agent Repo Map
This file is an agent-facing operational map of the Flynn repo: entrypoints, key modules, conventions, config schema anchors, and debug workflows.
Entry Points
- Daemon start:
src/cli/index.ts->src/daemon/index.ts#startDaemon - One-shot send:
src/cli/send.ts - TUI:
- Minimal:
src/frontends/tui/minimal.ts - Fullscreen Ink app:
src/frontends/tui/components/App.tsx
- Minimal:
- Gateway server:
src/gateway/server.ts
Core Message Flow
- Channel ingress/gateway request ->
src/daemon/routing.ts - Session/orchestration ->
src/backends/native/orchestrator.ts - Agent loop/tool execution ->
src/backends/native/agent.ts - Model dispatch ->
src/models/router.ts+ provider clients insrc/models/*
High-Value Modules
- Config schema + defaults:
src/config/schema.tsconfig/default.yamlconfig/profiles/*.overlay.yaml(profile overlays)
- Model wiring:
src/daemon/models.tssrc/models/router.tssrc/models/openai.ts,src/models/anthropic.ts,src/models/gemini.ts,src/models/bedrock.ts,src/models/github.ts,src/models/local/*
- Tool registration chain:
- Tool impl:
src/tools/builtin/* - Export:
src/tools/builtin/index.ts - Registry/bootstrap:
src/daemon/index.ts,src/daemon/tools.ts
- Tool impl:
- Channel adapters:
src/channels/*/adapter.ts- Registration:
src/daemon/channels.ts
- Auth stores:
- OpenAI/Anthropic/etc:
src/auth/* - Google services:
src/auth/google.ts+src/google/oauth.ts
- OpenAI/Anthropic/etc:
- Observability:
- Audit logger:
src/audit/* - Doctor checks:
src/cli/doctor.ts
- Audit logger:
Conventions
- TypeScript strict mode, NodeNext modules.
- Local imports use
.jsextension. - Keep provider-specific branches localized in provider clients; prefer shared helpers for cross-service auth logic.
- Tests use Vitest (
*.test.ts).
Config Schema Anchors
- Model tiers and fallback chain:
models.*insrc/config/schema.ts - Tool policy and profiles:
tools.* - Automation integrations:
- Gmail watcher:
automation.gmail - Google tools:
automation.gcal,automation.gdocs,automation.gdrive,automation.gtasks
- Gmail watcher:
- Server/gateway behavior:
server.*
Run and Debug
pnpm dev # daemon watch mode
pnpm tui # minimal terminal UI
pnpm tui:fs # fullscreen UI
pnpm test:run # full test run once
pnpm lint
pnpm typecheck
Focused debug commands:
pnpm test:run src/models/router.test.ts src/models/openai.oauth.test.ts
pnpm test:run src/tools/builtin/gmail.test.ts src/automation/gmail.test.ts
pnpm test:run src/cli/doctor.test.ts
Config profile sync:
pnpm config:profiles:generate
pnpm config:profiles:check