Cuttlefish is a modular browser computing system and a member of [the squidworks project](https://gitlab.cba.mit.edu/squidworks/squidworks), an effort to develop a distributed dataflow computing protocol. Here, modular code is wrapped in dataflow descriptors and handles that allow rapid assembly of computing applications (programs!). Cuttlefish also serves as the eyes into remote dataflow sytems - meaning we can use it as a tool to assemble big networks of computers, all using the same dataflow assumptions - to build, use, update, and discover distributed programs.
Cuttlefish is a modular browser computing system and a member of [the squidworks project](https://gitlab.cba.mit.edu/squidworks/squidworks), an effort to develop a distributed dataflow computing protocol.
Here, modular code is wrapped in dataflow descriptors and handles that allow rapid assembly of computing applications (programs!).
Cuttlefish also serves as the eyes into remote dataflow systems - meaning we can use it as a tool to assemble networks of computers to build, use, modify, and discover distributed programs.

...
...
@@ -14,17 +18,17 @@ Cuttlefish runs programs that are made of 'hunks' - each hunk is a small block o
Hunks interface with the rest of the world through data ports - inputs and outputs - and their state variables. Each of these interfaces *is typed* - this helps us when we serialize messages (Cuttlefish is made for networks) - and helps everyone understand what hunks are meant to do.
Typing is rendered in `/typeset.js` - we can only connect outputs to inputs when a function exists here to copy data from the output-type to the input-type. These functions are directional!
Typing is rendered in `/typeset.js` - we can only connect outputs to inputs when a function exists here to copy (and convert) data from the output-type to the input-type. These functions are directional!
### Flowcontrolled Runtime
When Cuttlefish is running, it ferries data between hunk outputs and outputs, and gives each hunk some time to operate on those inputs, producing outputs. By connecting different hunks in graphs, we can develop programs.
When Cuttlefish is running, it ferries data between hunk outputs to inputs, and gives each hunk some time to operate on those inputs, producing new outputs. By connecting different hunks in graphs, we can develop programs.
Data ferrying takes place according to a set of flowcontrol rules: data must be explicitly taken off of an input port before an output can push more data towards it. This means that processes which take time - and messages that have to traverse a network - don't overrun one another.
Data ferrying takes place according to a set of flowcontrol rules: data must be explicitly taken off of an input port before an output can push more data towards it. This means that processes which take time - and messages that have to traverse a network - don't overrun one another. It also means that cuttlefish is *buffer free* - this is a big win for systems where order of execution should be maintained, and where responsiveness is desired.
### Polymorphic Hunks
To handle some complexity - particularely with typing - we can write hunks whose inputs and outputs change based on some of their state variables.
To handle some complexity - particularly with typing - we can write hunks whose inputs and outputs change based on some of their state variables. For an example of this, see `hunks/flowcontrol/syncpressure.js`.
# Usage
...
...
@@ -36,9 +40,33 @@ To connect an output to an input, we just drag that output onto an input. To dis
To delete hunks, right click on their title bar. We can also copy hunks, or reload them from source (which works *pretty well* but isn't bulletproof: careful of leftover DOM elements).
# Running Locally
Cuttlefish emerges from a small node.js server, and the best way to develop / use it is still to run a local copy of this on your machine.
First, you should [install node.js](https://nodejs.org), if you're on a Mac / Unix (Raspberry Pi!), I would highly recommend [NVM](https://github.com/nvm-sh/nvm), and windows has [an installer](https://nodejs.org) that works brilliantly.
Then, we need to install a few packages. Clone this repo wherever you'd like in your machine, ``cd`` to that directory, and run:
``npm install express``
If you just want to run the browser tools, you're now done. If you want to use CF to connect to hardware, do:
``npm install ws``
and
``npm install serialport``
You can now run Cuttlefish by doing:
``node cf``
It should then report an IP and port. One is your local address, if the browser you are using is on the same machine as the node process, and the other is the machine's outward facing IP. You should be able to point the browser to one of these IPs, and you're off and cuttling.
# Development
Example hunks are below, commented. To add a new component, simply copy one of these files into a new location and modify it - (hunks are named by their file location) - the system should automatically pick it up when you hit 'add a hunk' in the environment.
Example hunks are below, commented. **To add a new hunk, simply copy an existing hunk, or the `hunks/template.js` file into a new location and modify it - (hunks are named by their file location)** - cuttlefish will automatically pick it up when you hit 'add a hunk' in the environment.
In the browser, the development tools are a great friend. Uncaught exceptions can shutdown the runtime loop, so keep an eye on the console.
...
...
@@ -172,27 +200,3 @@ export default function ReferenceLogger() {
```
For a more involved example, see [the linechart](hunks/data/linechart.js).
# Running Locally
Cuttlefish emerges from a small node.js server, and the best way to develop / use it is still to run a local copy of this on your machine.
First, you should [install node.js](https://nodejs.org), if you're on a Mac / Unix (Raspberry Pi!), I would highly recommend [NVM](https://github.com/nvm-sh/nvm), and windows has [an installer](https://nodejs.org) that works brilliantly.
Then, we need to install a few packages. Clone this repo wherever you'd like in your machine, ``cd`` to that directory, and run:
``npm install express``
If you just want to run the browser tools, you're now done. If you want to use CF to connect to hardware, do:
``npm install ws``
and
``npm install serialport``
You can now run Cuttlefish by doing:
``node cf``
It should then report an IP and port. One is your local address, if the browser you are using is on the same machine as the node process, and the other is the machine's outward facing IP. You should be able to point the browser to one of these IPs, and you're off and cuttling.