9f6d0d2281
- Bump root AGENTS.md header: 2026-05-14 → 2026-05-15, commit5ffbe0e24→53a740636, release v4.1.1 → v4.1.2 - Update file counts: 2034 (1337+697) → 2041 (1340+701), LOC ~292k → ~294k - Fix STRUCTURE: openclaw lives at src/openclaw/ (not src/features/); list more accurate feature modules in the parenthetical - Clarify interactive_bash gate: tmux binary on PATH via isInteractiveBashEnabled() (not 'tmux enabled') - Fix docs/reference/features.md hook counts: Tool Guard 14→16, Total base 52→54, total with team-mode 59→61 - Bump 'Generated' date on all 43 subdir AGENTS.md files to 2026-05-15 - Preserve promptAsync injection cautions verbatim (per request)
2.7 KiB
2.7 KiB
src/shared/ — 278 Utility Files (170 non-test)
Generated: 2026-05-15
OVERVIEW
Cross-cutting utilities used throughout the plugin. Barrel-exported from index.ts. Logger writes to /tmp/oh-my-opencode.log. Includes runtime shims for Bun.file, Bun.write, Bun.hash, Bun.which, Bun.spawn to support non-Bun runtimes (Electron-hosted OpenCode).
CATEGORY MAP
| Category | Files | Key Exports |
|---|---|---|
| Model Resolution | ~22 | resolveModel(), checkModelAvailability(), AGENT_MODEL_REQUIREMENTS |
| Tmux Integration | 11 | createTmuxSession(), spawnPane(), closePane(), server health |
| Configuration & Paths | 10 | resolveOpenCodeConfigDir(), getDataPath(), parseJSONC() |
| Session Management | 8 | SessionCursor, trackInjectedPath(), SessionToolsStore |
| Git Worktree | 7 | parseGitStatusPorcelain(), collectGitDiffStats(), formatFileChanges() |
| Command Execution | 7 | executeCommand(), executeHookCommand(), embedded command registry |
| Migration | 6 | migrateConfigFile(), AGENT_NAME_MAP, HOOK_NAME_MAP, MODEL_VERSION_MAP |
| String & Tool Utils | 6 | toSnakeCase(), normalizeToolName(), parseFrontmatter() |
| Agent Configuration | 5 | getAgentVariant(), AGENT_DISPLAY_NAMES, AGENT_TOOL_RESTRICTIONS |
| OpenCode Integration | 5 | injectServerAuth(), detectExternalPlugins(), client accessors |
| Type Helpers | 4 | deepMerge(), DynamicTruncator, matchPattern(), isRecord() |
| Misc | 8 | log(), readFile(), extractZip(), downloadBinary(), findAvailablePort() |
MODEL RESOLUTION PIPELINE
resolveModel(input)
1. Override: UI-selected model (primary agents only)
2. Category default: From category config
3. Provider fallback: AGENT_MODEL_REQUIREMENTS chains
4. System default: Ultimate fallback
Key files: model-resolver.ts (entry), model-resolution-pipeline.ts (orchestration), model-requirements.ts (fallback chains), model-availability.ts (fuzzy matching).
MIGRATION SYSTEM
Automatically transforms legacy config on load:
agent-names.ts: Old agent names → new (e.g.,junior→sisyphus-junior)hook-names.ts: Old hook names → newmodel-versions.ts: Old model IDs → currentagent-category.ts: Legacy agent configs → category system
MOST IMPORTED
| Utility | Import Count | Purpose |
|---|---|---|
logger.ts |
62 | /tmp/oh-my-opencode.log |
data-path.ts |
11 | XDG storage resolution |
model-requirements.ts |
11 | Agent fallback chains |
system-directive.ts |
11 | System message filtering |
frontmatter.ts |
10 | YAML metadata extraction |