This document describes the current code organization of the project after the multi-runtime refactor.
The project supports multiple runtimes that all share one application core:
The guiding rule is:
all runtime inputs -> PipelineAppService -> shared job orchestration -> consistent output
No runtime should implement its own pipeline lifecycle.
src/
adapters/
cli/
cli-runner.ts
batch-queue.ts
http/
agentic-controller.ts
ai-controller.ts
api-helpers.ts
api-routes.ts
file-routes.ts
files-controller.ts
free-video-controller.ts
jobs-controller.ts
scenes-controller.ts
server-bootstrap.ts
setup-controller.ts
social-download-controller.ts
video-download-controller.ts
videos-controller.ts
view-controller.ts
view-routes.ts
mcp/
driver-llm.ts
env-tools.ts
input-store.ts
output-store.ts
pipeline-commands.ts
register-admin-tools.ts
register-agentic-tools.ts
register-free-video-tools.ts
register-input-tools.ts
register-job-tools.ts
register-operations-tools.ts
register-output-tools.ts
responses.ts
application/
ai-app.service.ts
diagnostics.service.ts
filesystem-app.service.ts
free-video-app.service.ts
media-app.service.ts
pipeline-app.service.ts
portal-app.service.ts
scene-app.service.ts
setup.service.ts
social-download-app.service.ts
video-download-app.service.ts
infrastructure/
filesystem/
local-filesystem.ts
persistence/
job-store.ts
pipeline/
scene-editor.ts
shared/
capabilities.ts
contracts/
job.contract.ts
http/
public-url.ts
logging/
runtime-logging.ts
runtime/
paths.ts
services/
ai.service.ts
env.service.ts
health.service.ts
job.service.ts
video.service.ts
app.ts
cli.ts
mcp-env-init.ts
mcp-prompts.ts
mcp-resources.ts
mcp-server.ts
pipeline-workspace.ts
render.ts
runtime-safety.test.ts
runtime.ts
server.ts
video-generator.ts
electron/
dependency-service.ts
electron-main.ts
electron-preload.ts
ipc.ts
server-manager.ts
window-manager.ts
application/This is the shared application layer.
adapters/These modules translate runtime-specific inputs and outputs.
Adapters should validate input, call shared services, and format output. They should not own business logic.
infrastructure/This contains runtime-independent implementation details that back the application layer.
shared/This is the cross-runtime foundation.
The central application facade is src/application/pipeline-app.service.ts.
Current core operations:
createJob(request)createRenderReadyJob(request)continueJobToRender(jobId)cancelJob(jobId)retryJob(jobId)getJob(jobId)listJobs()waitForJobCompletion(jobId)getSetupStatus()getDiagnostics()repairRuntimeDependencies()src/shared/contracts/.src/shared/runtime/.src/runtime.ts remains only as a compatibility barrel and should not be the preferred import target for new code.These major cleanup steps have already happened:
src/adapters/http/ with feature-specific controllers instead of a monolithic API controller.src/server.ts is now a thin executable entry.src/shared/http/public-url.ts.src/infrastructure/.The architecture is now stable. Remaining cleanup is optional and lower priority:
src/services/* modules into application/ or infrastructure/ based on responsibilitysrc/runtime.ts further until it can eventually be retiredsrc/application/* into feature subfolders when the current flat service list grows furtherPrefer:
src/shared/contracts/* for shared typessrc/shared/runtime/* for path/runtime helperssrc/shared/logging/* for runtime-aware loggingsrc/infrastructure/persistence/* for job persistencesrc/application/* for cross-runtime orchestrationAvoid adding new logic to:
src/runtime.tssrc/server.tssrc/mcp-server.tselectron/electron-main.tsThose should stay as thin composition or compatibility layers.