docs(agents): regenerate hierarchical AGENTS.md for 2026-05-20
Sync the AGENTS.md hierarchy to current code state:
Drift fixes in 11 existing files
- Root: 2026-05-20 commit 39aadbf9f, ~2167 TS files, 120 barrel index.ts,
57 src/hooks dirs, 297 (179 non-test) src/shared files, 11 OpenCode hook
handlers in plugin-interface.ts, packages list adds ast-grep-mcp + rules-core,
first-prompt-watchdog 206 LOC, parent-wake-notifier 587 LOC
- src/AGENTS.md: file counts, plugin-interface handler count
- src/shared/AGENTS.md: title + counts 278/170 -> 297/179
- src/hooks/AGENTS.md: 57 dirs, note unwired WIP (task-reminder,
hashline-edit-diff-enhancer)
- src/features/AGENTS.md: module map with NON-TEST counts + sub-AGENTS.md
column, 7 modules without sub-doc
- src/features/background-agent/AGENTS.md: add 12 newer files (parent-wake-
notifier 587 LOC, loop-detector, error-classifier, fallback-retry-handler,
process-cleanup, subagent-spawn-limits, session-status-classifier,
compaction-aware-message-resolver, etc.)
- src/plugin/AGENTS.md: 11 handlers, add system-transform.ts + command-
execute-before.ts + build-team-idle-wake-hint-client.ts
- src/config/AGENTS.md: note schema/internal/permission.ts
- src/cli/AGENTS.md: 8 commands including 'version'
- src/plugin-handlers/AGENTS.md, packages/web/AGENTS.md: date bump
New AGENTS.md in 4 directories
- packages/AGENTS.md: index of 15 packages (11 platform binaries + 2 MCP
packages + rules-core + web), role map, conventions
- docs/AGENTS.md: WHERE TO LOOK table for 19 docs across 6 subdirs
- .opencode/AGENTS.md: 5 skills + 4 slash commands + relationship to .agents/
- .agents/AGENTS.md: superset migration target (9 skills + 4 commands)
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
# src/features/background-agent/ — Core Orchestration Engine
|
||||
|
||||
**Generated:** 2026-05-15
|
||||
**Generated:** 2026-05-20
|
||||
|
||||
## OVERVIEW
|
||||
|
||||
30 files (~10k LOC). Manages async task lifecycle: launch → queue → run → poll → complete/error. Concurrency limited per model/provider (default 5). Central to multi-agent orchestration.
|
||||
30 non-test files (62 entries total including tests + spawner/ subdir). Manages async task lifecycle: launch → queue → run → poll → complete/error. Concurrency limited per model/provider (default 5). Central to multi-agent orchestration.
|
||||
|
||||
## TASK LIFECYCLE
|
||||
|
||||
@@ -20,11 +20,25 @@ LaunchInput → pending → [ConcurrencyManager queue] → running → polling
|
||||
| `spawner.ts` | Task spawning: create session → inject prompt → start polling |
|
||||
| `concurrency.ts` | `ConcurrencyManager` — FIFO queue per concurrency key, slot acquisition/release |
|
||||
| `task-poller.ts` | 3s interval polling, completion via idle events + stability detection (10s unchanged) |
|
||||
| `result-handler.ts` | Process completed tasks: extract result, notify parent, cleanup |
|
||||
| `state.ts` | In-memory task store (Map-based) |
|
||||
| `types.ts` | `BackgroundTask`, `LaunchInput`, `ResumeInput`, `BackgroundTaskStatus` |
|
||||
| `parent-wake-notifier.ts` | 587 LOC. Dependency-injected client + enqueue callback. Notifies parent session when a background task wants attention. |
|
||||
| `loop-detector.ts` | Detects polling/event loops that would otherwise burn budget. |
|
||||
| `error-classifier.ts` | Maps raw provider errors → `BackgroundTaskError` categories. |
|
||||
| `fallback-retry-handler.ts` | Coordinates retries with the runtime-fallback system. |
|
||||
| `process-cleanup.ts` | Best-effort cleanup on parent exit. `OMO_DISABLE_PROCESS_CLEANUP=1` opts out entirely. |
|
||||
| `subagent-spawn-limits.ts` | Enforces per-parent subagent spawn caps. |
|
||||
| `session-status-classifier.ts` | Normalizes OpenCode session status across versions. |
|
||||
| `compaction-aware-message-resolver.ts` | Resolves task result content even across mid-task compaction. |
|
||||
| `attempt-lifecycle.ts` | Tracks retry attempts on a single task. |
|
||||
| `task-history.ts` | Append-only history for completed tasks. |
|
||||
| `session-idle-event-handler.ts` | Bridges OpenCode `session.idle` → task-poller completion signal. |
|
||||
| `session-existence.ts` | Cheap existence check used by recovery code. |
|
||||
| `abort-with-timeout.ts` | Force-abort tasks past `syncPollTimeoutMs`. |
|
||||
| `remove-task-toast-tracking.ts` | Strips lingering toast tracker entries on task end. |
|
||||
| `background-task-notification-template.ts` | Template for parent-session result injection. |
|
||||
|
||||
## SPAWNER SUBDIRECTORY (6 files)
|
||||
## SPAWNER SUBDIRECTORY
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
|
||||
Reference in New Issue
Block a user