# gochan562/poliac architecture

> Architecture diagram of the GitHub repository gochan562/poliac, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gochan562/poliac
- Repository: https://github.com/gochan562/poliac

## Overview

POLIAC is a browser-based visual programming computer: users create and wire shape-node programs, execute them, and inspect outputs and machine state. The editor is the primary entry point; programs are evaluated through a runtime that owns execution state and coordinates input, graphics, and the virtual disk. Users can also open built-in examples or save and exchange editable .pol programs. The graph includes documented capabilities whose implementation details were not sampled; those relationships are omitted where no caller evidence was available.

Main entry points: [`src/shape-computer/runtime.ts`](https://github.com/gochan562/poliac/blob/main/src/shape-computer/runtime.ts) (Execution Runtime), [`src/shape-computer/Machine.tsx`](https://github.com/gochan562/poliac/blob/main/src/shape-computer/Machine.tsx) (Node Editor), [`src/shape-computer/evaluator.ts`](https://github.com/gochan562/poliac/blob/main/src/shape-computer/evaluator.ts) (Program Evaluator), [`src/shape-computer/apps.ts`](https://github.com/gochan562/poliac/blob/main/src/shape-computer/apps.ts) (Example Library)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Program Authoring"]
  node_app["App Shell<br/>[page.tsx]"]
  node_editor["Node Editor<br/>[Machine.tsx]"]
  node_computer["Computer View<br/>[Computer.tsx]"]
end

subgraph group_execution["Execution Engine"]
  node_binding["Runtime Binding<br/>[useRuntime.tsx]"]
  node_runtime["Execution Runtime<br/>[runtime.ts]"]
  node_evaluator["Program Evaluator<br/>[evaluator.ts]"]
  node_isa["Instruction Set<br/>[isa.ts]"]
  node_types["Program Model<br/>[types.ts]"]
end

subgraph group_machine["Machine I/O"]
  node_vfs[("Virtual Filesystem<br/>[fs.ts]")]
  node_screen["Framebuffer<br/>[screen.ts]"]
  node_input["Input Channels<br/>[input.ts]"]
  node_capture["Input Capture<br/>[input-capture.ts]"]
  node_canvas["Screen Canvas<br/>[ScreenCanvas.tsx]"]
end

subgraph group_programs["Programs and Storage"]
  node_serializer["POL Serializer<br/>[scs.ts]"]
  node_library["Example Library<br/>[apps.ts]"]
  node_examples["Built-in Programs"]
  node_saved[("Local Programs<br/>[store.ts]")]
  node_demos["Demo Sources<br/>[demos.ts]"]
  node_minsky["Minsky Programs<br/>[minsky.ts]"]
  node_pong["Pong Program<br/>[pong.ts]"]
end

node_user(("Programmer"))

node_user -->|"opens"| node_app
node_app -->|"renders"| node_editor
node_editor -->|"uses runtime"| node_binding
node_computer -->|"observes runtime"| node_binding
node_binding -->|"creates"| node_runtime
node_runtime -->|"evaluates ticks"| node_evaluator
node_evaluator -->|"checks instructions"| node_isa
node_evaluator -->|"evaluates file ops"| node_vfs
node_runtime -->|"commits disk ops"| node_vfs
node_runtime -->|"rasterizes graphics"| node_screen
node_runtime -->|"reads channels"| node_input
node_capture -->|"updates devices"| node_input
node_capture -->|"feeds input"| node_runtime
node_computer -->|"renders screen"| node_canvas
node_canvas -->|"reads framebuffer"| node_screen
node_editor -->|"encodes programs"| node_serializer
node_editor -->|"opens examples"| node_library
node_library -->|"decodes programs"| node_serializer
node_library -->|"fetches files"| node_examples
node_editor -->|"lists saved"| node_saved
node_user -->|"saves locally"| node_saved
node_demos -->|"compiles examples"| node_minsky
node_demos -->|"includes game"| node_pong

click node_app "https://github.com/gochan562/poliac/blob/main/src/app/page.tsx"
click node_editor "https://github.com/gochan562/poliac/blob/main/src/shape-computer/Machine.tsx"
click node_computer "https://github.com/gochan562/poliac/blob/main/src/shape-computer/Computer.tsx"
click node_binding "https://github.com/gochan562/poliac/blob/main/src/shape-computer/useRuntime.tsx"
click node_runtime "https://github.com/gochan562/poliac/blob/main/src/shape-computer/runtime.ts"
click node_evaluator "https://github.com/gochan562/poliac/blob/main/src/shape-computer/evaluator.ts"
click node_isa "https://github.com/gochan562/poliac/blob/main/src/shape-computer/isa.ts"
click node_types "https://github.com/gochan562/poliac/blob/main/src/shape-computer/types.ts"
click node_vfs "https://github.com/gochan562/poliac/blob/main/src/shape-computer/fs.ts"
click node_screen "https://github.com/gochan562/poliac/blob/main/src/shape-computer/screen.ts"
click node_input "https://github.com/gochan562/poliac/blob/main/src/shape-computer/input.ts"
click node_capture "https://github.com/gochan562/poliac/blob/main/src/shape-computer/input-capture.ts"
click node_canvas "https://github.com/gochan562/poliac/blob/main/src/shape-computer/ScreenCanvas.tsx"
click node_serializer "https://github.com/gochan562/poliac/blob/main/src/shape-computer/scs.ts"
click node_library "https://github.com/gochan562/poliac/blob/main/src/shape-computer/apps.ts"
click node_examples "https://github.com/gochan562/poliac/tree/main/public/pol"
click node_saved "https://github.com/gochan562/poliac/blob/main/src/shape-computer/store.ts"
click node_demos "https://github.com/gochan562/poliac/blob/main/src/shape-computer/demos.ts"
click node_minsky "https://github.com/gochan562/poliac/blob/main/src/shape-computer/minsky.ts"
click node_pong "https://github.com/gochan562/poliac/blob/main/src/shape-computer/pong.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_editor,node_computer toneBlue
class node_binding,node_runtime,node_evaluator,node_isa,node_types toneAmber
class node_vfs,node_screen,node_input,node_capture,node_canvas toneMint
class node_serializer,node_library,node_examples,node_saved,node_demos,node_minsky,node_pong toneRose
class node_user toneIndigo
```

## Components

### Program Authoring

- [App Shell](https://github.com/gochan562/poliac/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Node Editor](https://github.com/gochan562/poliac/blob/main/src/shape-computer/Machine.tsx): `src/shape-computer/Machine.tsx`
- [Computer View](https://github.com/gochan562/poliac/blob/main/src/shape-computer/Computer.tsx): `src/shape-computer/Computer.tsx`

### Execution Engine

- [Runtime Binding](https://github.com/gochan562/poliac/blob/main/src/shape-computer/useRuntime.tsx): `src/shape-computer/useRuntime.tsx`
- [Execution Runtime](https://github.com/gochan562/poliac/blob/main/src/shape-computer/runtime.ts): `src/shape-computer/runtime.ts`
- [Program Evaluator](https://github.com/gochan562/poliac/blob/main/src/shape-computer/evaluator.ts): `src/shape-computer/evaluator.ts`
- [Instruction Set](https://github.com/gochan562/poliac/blob/main/src/shape-computer/isa.ts): `src/shape-computer/isa.ts`
- [Program Model](https://github.com/gochan562/poliac/blob/main/src/shape-computer/types.ts): `src/shape-computer/types.ts`

### Machine I/O

- [Virtual Filesystem](https://github.com/gochan562/poliac/blob/main/src/shape-computer/fs.ts): `src/shape-computer/fs.ts`
- [Framebuffer](https://github.com/gochan562/poliac/blob/main/src/shape-computer/screen.ts): `src/shape-computer/screen.ts`
- [Input Channels](https://github.com/gochan562/poliac/blob/main/src/shape-computer/input.ts): `src/shape-computer/input.ts`
- [Input Capture](https://github.com/gochan562/poliac/blob/main/src/shape-computer/input-capture.ts): `src/shape-computer/input-capture.ts`
- [Screen Canvas](https://github.com/gochan562/poliac/blob/main/src/shape-computer/ScreenCanvas.tsx): `src/shape-computer/ScreenCanvas.tsx`

### Programs and Storage

- [POL Serializer](https://github.com/gochan562/poliac/blob/main/src/shape-computer/scs.ts): `src/shape-computer/scs.ts`
- [Example Library](https://github.com/gochan562/poliac/blob/main/src/shape-computer/apps.ts): `src/shape-computer/apps.ts`
- [Built-in Programs](https://github.com/gochan562/poliac/tree/main/public/pol): `public/pol`
- [Local Programs](https://github.com/gochan562/poliac/blob/main/src/shape-computer/store.ts): `src/shape-computer/store.ts`
- [Demo Sources](https://github.com/gochan562/poliac/blob/main/src/shape-computer/demos.ts): `src/shape-computer/demos.ts`
- [Minsky Programs](https://github.com/gochan562/poliac/blob/main/src/shape-computer/minsky.ts): `src/shape-computer/minsky.ts`
- [Pong Program](https://github.com/gochan562/poliac/blob/main/src/shape-computer/pong.ts): `src/shape-computer/pong.ts`

### Other components

- **Programmer**

## Connections

- Programmer → App Shell: opens (evidence: `README.md`)
- App Shell → Node Editor: renders (evidence: `src/app/page.tsx`)
- Node Editor → Runtime Binding: uses runtime (evidence: `src/shape-computer/Machine.tsx`)
- Computer View → Runtime Binding: observes runtime (evidence: `src/shape-computer/Computer.tsx`)
- Runtime Binding → Execution Runtime: creates (evidence: `src/shape-computer/useRuntime.tsx`)
- Execution Runtime → Program Evaluator: evaluates ticks (evidence: `src/shape-computer/runtime.ts`)
- Program Evaluator → Instruction Set: checks instructions (evidence: `src/shape-computer/evaluator.ts`)
- Program Evaluator → Virtual Filesystem: evaluates file ops (evidence: `src/shape-computer/evaluator.ts`)
- Execution Runtime → Virtual Filesystem: commits disk ops (evidence: `src/shape-computer/fs.ts`)
- Execution Runtime → Framebuffer: rasterizes graphics (evidence: `src/shape-computer/screen.ts`)
- Execution Runtime → Input Channels: reads channels (evidence: `src/shape-computer/runtime.ts`)
- Input Capture → Input Channels: updates devices (evidence: `src/shape-computer/input-capture.ts`)
- Input Capture → Execution Runtime: feeds input (evidence: `src/shape-computer/input-capture.ts`)
- Computer View → Screen Canvas: renders screen (evidence: `src/shape-computer/Computer.tsx`)
- Screen Canvas → Framebuffer: reads framebuffer (evidence: `src/shape-computer/ScreenCanvas.tsx`)
- Node Editor → POL Serializer: encodes programs (evidence: `src/shape-computer/Machine.tsx`)
- Node Editor → Example Library: opens examples (evidence: `src/shape-computer/Machine.tsx`)
- Example Library → POL Serializer: decodes programs (evidence: `src/shape-computer/apps.ts`)
- Example Library → Built-in Programs: fetches files (evidence: `src/shape-computer/apps.ts`)
- Node Editor → Local Programs: lists saved (evidence: `src/shape-computer/Machine.tsx`)
- Programmer → Local Programs: saves locally (evidence: `README.md`)
- Demo Sources → Minsky Programs: compiles examples (evidence: `src/shape-computer/demos.ts`)
- Demo Sources → Pong Program: includes game (evidence: `src/shape-computer/demos.ts`)
