mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 10:39:32 +01:00
The types, the module skeletons and the test fake that let the runtime, the install job and the window be built at the same time. Types: - src/types/local-model-install.ts (new): the runtime pin, the install states, steps and error codes with one sentence and one next step each, the progress, the `install` object of GET /api/local-model, the bodies and 409 answers of the install verbs, the state file. `LocalModelStatus` moves here; `install` is optional until the route emits it. - src/types/local-model.ts: the catalogue row's Mac memory figures, the measured speed of a tested entry, the `measured` budget source, `RecommendOptions`, and the row tag, the coding agents and the install total of a candidate. All optional until the catalogue and `recommend()` carry them, so the read-only stage keeps compiling and its tests stay green. Modules with final signatures and bodies that throw: runtime.ts (the compiled pin is final), ollama-client.ts, developer-tools.ts, state-store.ts, install-job.ts (the state, step and transition tables are final), connect.ts, custom-model-hosts-writer.ts, cli-install-runner.ts. Nothing imports them yet, so the server is unchanged. Implemented: paths.ts (every folder of the feature, from dataPath()), and `modelFitsBudget()` in recommend.ts, the judgement the job makes with the measured budget before it downloads a model. `recommend()` takes the options parameter and does not read it yet. Test fake: test/fixtures/fake-ollama.ts, a runtime on a port the system picks, in the shapes measured on a Mac: version, tags, ps, the pull stream (MLX and GGUF lines, an error line, a cut stream, a resumed pull), chat with and without a tool call, the model list, a runtime archive with Range support, and a fake child process that logs the device total. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
84 lines
5.4 KiB
TypeScript
84 lines
5.4 KiB
TypeScript
/**
|
|
* @fileoverview Barrel re-export for all Codeman type definitions.
|
|
*
|
|
* The type system is split into 13 domain modules for maintainability.
|
|
* Import from `'./types'` (or `'./types/index.js'`) to access any type:
|
|
*
|
|
* ```ts
|
|
* import type { SessionState, AppState, RespawnConfig } from './types';
|
|
* import { createErrorResponse, ApiErrorCode } from './types';
|
|
* ```
|
|
*
|
|
* ## Domain modules
|
|
*
|
|
* | Module | Key exports | Persistence / API |
|
|
* |--------------|-----------------------------------------------------------------------|-------------------------------------------------|
|
|
* | common | Disposable, BufferConfig, CleanupRegistration, NiceConfig, ProcessStats | In-memory only |
|
|
* | session | SessionState, SessionConfig, SessionStatus, SessionMode, ClaudeMode, OpenCodeConfig | `~/.codeman/state.json` → `GET /api/sessions` |
|
|
* | task | TaskDefinition, TaskState, TaskStatus | `~/.codeman/state.json` → `GET /api/tasks` |
|
|
* | app-state | AppState, AppConfig, GlobalStats, TokenStats, DEFAULT_CONFIG | `~/.codeman/state.json` → `GET /api/status` |
|
|
* | respawn | RespawnConfig, RespawnPreset, RespawnCycleMetrics, RalphLoopHealthScore, TimingHistory | Per-session in state.json → `GET /api/sessions/:id/respawn` |
|
|
* | ralph | RalphTrackerState, RalphTodoItem, CircuitBreakerStatus, RalphStatusBlock, RalphSessionState | Per-session → `GET /api/sessions/:id/ralph-state` |
|
|
* | api | ApiResponse, ApiErrorCode, HookEventType, CaseInfo, createErrorResponse, getErrorMessage | Used by all route handlers |
|
|
* | lifecycle | LifecycleEntry, LifecycleEventType | `~/.codeman/session-lifecycle.jsonl` (append-only) |
|
|
* | run-summary | RunSummary, RunSummaryEvent, RunSummaryStats | In-memory → `GET /api/sessions/:id/run-summary` |
|
|
* | tools | ActiveBashTool, ImageDetectedEvent | In-memory, broadcast via SSE |
|
|
* | teams | TeamConfig, TeamMember, TeamTask, InboxMessage, PaneInfo | `~/.claude/teams/`, `~/.claude/tasks/` → `GET /api/teams` |
|
|
* | push | PushSubscriptionRecord, VapidKeys, WebhookConfig, WebhookStatus, WebhookResult | `~/.codeman/push-keys.json`, `~/.codeman/push-subscriptions.json`, `~/.codeman/webhook.json` |
|
|
* | discord | DiscordConfig, DiscordResult, DiscordStatus, DiscordGatewayState | `~/.codeman/discord.json` → `GET`/`PUT /api/discord` |
|
|
* | plan | PlanItem, PlanTaskStatus, TddPhase | In-memory → `GET /api/sessions/:id/plan/tasks` |
|
|
* | orchestrator | OrchestratorState, OrchestratorPlan, OrchestratorConfig, OrchestratorPersistState | `~/.codeman/state.json` → `GET /api/orchestrator/status` |
|
|
* | mcp-sync | McpSyncResult, McpSyncTargetResult | Other CLIs' own config files → `GET`/`POST /api/mcp-sync` |
|
|
* | local-model | HardwareFacts, LocalModelCatalog, Candidate, Recommendation, RecommendOptions, LOCAL_MODEL_LABELS | In-memory only (nothing persisted) → `GET /api/local-model` |
|
|
* | local-model-install | LocalModelStatus, LocalModelInstallView, LocalModelStateFile, LocalModelRuntimePin, LOCAL_MODEL_INSTALL_LABELS | `~/.codeman/local-model.json` → `GET /api/local-model` and its install verbs |
|
|
*
|
|
* ## Cross-domain relationship map
|
|
*
|
|
* ```
|
|
* AppState (app-state)
|
|
* ├── sessions: Record<id, SessionState> ← session domain
|
|
* │ ├── respawnConfig?: RespawnConfig ← respawn domain (per-session settings)
|
|
* │ ├── ralphEnabled?: boolean ← toggles ralph tracking
|
|
* │ └── id ← referenced by:
|
|
* │ ├── RalphSessionState.sessionId ← ralph domain
|
|
* │ ├── RunSummary.sessionId ← run-summary domain
|
|
* │ ├── ActiveBashTool.sessionId ← tools domain
|
|
* │ ├── RespawnCycleMetrics.sessionId ← respawn domain
|
|
* │ └── TeamConfig.leadSessionId ← teams domain
|
|
* ├── tasks: Record<id, TaskState> ← task domain
|
|
* │ └── assignedSessionId → SessionState.id
|
|
* ├── ralphLoop: RalphLoopState ← ralph domain (global loop state)
|
|
* └── config: AppConfig
|
|
* └── respawn: RespawnConfig ← respawn domain (global defaults)
|
|
*
|
|
* RalphLoopHealthScore (respawn)
|
|
* └── components.circuitBreaker ← derived from CircuitBreakerStatus (ralph)
|
|
* ```
|
|
*/
|
|
|
|
export * from './common.js';
|
|
export * from './session.js';
|
|
export * from './task.js';
|
|
export * from './app-state.js';
|
|
export * from './respawn.js';
|
|
export * from './ralph.js';
|
|
export * from './api.js';
|
|
export * from './lifecycle.js';
|
|
export * from './run-summary.js';
|
|
export * from './tools.js';
|
|
export * from './teams.js';
|
|
export * from './push.js';
|
|
export * from './discord.js';
|
|
export * from './plan.js';
|
|
export * from './orchestrator.js';
|
|
export * from './update.js';
|
|
export * from './workflow-run.js';
|
|
export * from './search.js';
|
|
export * from './user.js';
|
|
export * from './webview.js';
|
|
export * from './intent.js';
|
|
export * from './foreign-tmux.js';
|
|
export * from './mcp-sync.js';
|
|
export * from './local-model.js';
|
|
export * from './local-model-install.js';
|