Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c7ada3c
transition repo to multi workspace setup; prototype watch mode --watch
Davidiusdadi Apr 4, 2024
5bc55f7
bootstrap canvas-dev-server
Davidiusdadi Apr 4, 2024
4fef30b
improve dev-server md-rendering
Davidiusdadi Apr 4, 2024
207adbe
canvas-dev-server: display arrows
Davidiusdadi Apr 4, 2024
c176755
canvas-dev-server: add coloration
Davidiusdadi Apr 4, 2024
962c4a8
start building dev-server inspection features
Davidiusdadi Apr 5, 2024
6812ca2
prototype inspection
Davidiusdadi Apr 7, 2024
3a6ceda
minor inspection related refactor
Davidiusdadi Apr 8, 2024
e9d112f
init tests and github workflow
Davidiusdadi Apr 22, 2024
0520c15
fix tests
Davidiusdadi Apr 22, 2024
52312a8
prototype / refactor
Davidiusdadi Apr 22, 2024
30a5a37
add bun run build:lib to the github workflow
Davidiusdadi Apr 23, 2024
f98b7b3
fix OPENAI_API_KEY being mandatory
Davidiusdadi Apr 23, 2024
c7a2ebc
impl. engine retuning last return_value and last_ctx
Davidiusdadi Apr 23, 2024
61ba9bb
add example.env
Davidiusdadi Apr 23, 2024
dfc360b
add some chalk nunjuck filters
Davidiusdadi Apr 25, 2024
2f08c84
impl. chart node overloading and minor changes
Davidiusdadi Apr 25, 2024
440fff0
update examples / feature-tour
Davidiusdadi Apr 25, 2024
f8d9206
add canvas-ui electron project
Davidiusdadi Apr 26, 2024
0af50d0
make canvas-dev-server support multi-view
Davidiusdadi Apr 26, 2024
894b42f
early WIP experiments
Davidiusdadi Apr 26, 2024
201a169
big update to core and build-in nodes
Davidiusdadi Apr 28, 2024
30772c7
update feature tour
Davidiusdadi Apr 28, 2024
4ee6bcf
fix question magic word node
Davidiusdadi May 1, 2024
3946287
impl. llm stop param being enforced
Davidiusdadi May 1, 2024
0fcf572
update examples
Davidiusdadi May 1, 2024
d3f58df
fix dev-server group render
Davidiusdadi May 1, 2024
d358843
update NodeCompiler compile signature
Davidiusdadi May 1, 2024
4f9772c
fix injection feature adding attributes of `onode.fn` instead of `onode`
Davidiusdadi May 1, 2024
70f9d0d
refactor and impl. hot reloading
Davidiusdadi May 3, 2024
a16e6cd
Update README and fix .env.example for smoother initial setup
claude Feb 13, 2026
49dc4e9
Merge pull request #2 from Davidiusdadi/claude/document-codebase-UXwVz
Davidiusdadi Feb 13, 2026
89490b0
Fix aggregate race condition - wait for all sibling frames
claude Feb 13, 2026
0c3c6e8
Add canvas documentation and remove test files
claude Feb 13, 2026
3b0961d
Merge pull request #3 from Davidiusdadi/claude/fix-aggregate-race-con…
Davidiusdadi Feb 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Only needed if you do not use OpenAI as a provider (optional)
LLM_PROVIDER=OPENAI

OPENAI_API_KEY=
OPENAI_API_MODEL=gpt-3.5-turbo
OPENAI_BASE_URL=https://api.openai.com/v1

OLLAMA_API_KEY=none
OLLAMA_API_MODEL=phi3
OLLAMA_BASE_URL=http://127.0.0.1:11434/v1

GROQ_API_KEY=
GROQ_API_MODEL=gemma-7b-it
GROQ_BASE_URL=https://api.groq.com/openai/v1

MISTRAL_API_KEY=
MISTRAL_API_MODEL=mistral-medium
MISTRAL_BASE_URL=https://api.mistral.ai/v1



ANTHROPIC_API_KEY=
ANTHROPIC_API_MODEL=claude-3-5-haiku-20241022
ANTHROPIC_BASE_URL=https://api.anthropic.com
27 changes: 27 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Yarn Test

on:
push:
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v4
- name: setup bun
uses: oven-sh/setup-bun@v1
- name: install dependencies
run: bun install
- name: run tests
run: |
cd packages/canvas-engine
bun test
- name: test build
run: |
cd packages/canvas-engine
bun run build:lib
180 changes: 178 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,180 @@
node_modules
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore

# Logs

logs
_.log
npm-debug.log_
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Caches

.cache

# Diagnostic reports (https://nodejs.org/api/report.html)

report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# Runtime data

pids
_.pid
_.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover

lib-cov

# Coverage directory used by tools like istanbul

coverage
*.lcov

# nyc test coverage

.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)

.grunt

# Bower dependency directory (https://bower.io/)

bower_components

# node-waf configuration

.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)

build/Release

# Dependency directories

node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)

web_modules/

# TypeScript cache

*.tsbuildinfo

# Optional npm cache directory

.npm

# Optional eslint cache

.eslintcache

# Optional stylelint cache

.stylelintcache

# Microbundle cache

.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history

.node_repl_history

# Output of 'npm pack'

*.tgz

# Yarn Integrity file

.yarn-integrity

# dotenv environment variable files

.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)

.parcel-cache

# Next.js build output

.next
out

# Nuxt.js build / generate output

.nuxt
dist

# Gatsby files

# Comment in the public line in if your project uses Gatsby and not Next.js

# https://nextjs.org/blog/next-9-1#public-directory-support

# public

# vuepress build output

.vuepress/dist

# vuepress v2.x temp and cache directory

.temp

# Docusaurus cache and generated files

.docusaurus

# Serverless directories

.serverless/

# FuseBox cache

.fusebox/

# DynamoDB Local files

.dynamodb/

# TernJS port file

.tern-port

# Stores VSCode versions used for testing VSCode extensions

.vscode-test

# yarn v2

.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# IntelliJ based IDEs
.idea

# Finder (MacOS) folder config
.DS_Store

build
local
.env
old
.obsidian
75 changes: 52 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ Example 2:

> To be sure to only see what was created **during the hackaton** see [branch: during-hackathon](https://github.com/Davidiusdadi/obsidian-node-canvas/tree/during-hackathon). Right now [master](https://github.com/Davidiusdadi/obsidian-node-canvas/tree/master)-branch and [during-hackathon](https://github.com/Davidiusdadi/obsidian-node-canvas/tree/during-hackathon)-branch should be almost identical.

**Obsidan-Node-Canvas** is a `javascript`-based workflow/scripting engine build on top of [obsidian](https://obsidian.md/) (the popular and powerful journaling, knowledge bases, and project management tool ) - and specifically https://obsidian.md/canvas.
**Obsidian-Node-Canvas** is a `javascript`-based workflow/scripting engine build on top of [obsidian](https://obsidian.md/) (the popular and powerful journaling, knowledge bases, and project management tool ) - and specifically https://obsidian.md/canvas.

Using Obsidan-Node-Canvas requires at least basic understanding `javascript`-programming.
Using Obsidian-Node-Canvas requires at least basic understanding of `javascript` programming.

You could use it to automate things in your obsidian-vault - but the main obsidian connection is that obsidian acts as a frontend - what you build is up to you.

**Obsidan-Node-Canvas** makes it possible to:
**Obsidian-Node-Canvas** makes it possible to:

- ✅ visually _compose_ "function"-blocks (nodes on a canvas) and **execute** them
- intuitively combine:
Expand All @@ -41,7 +41,7 @@ You could use it to automate things in your obsidian-vault - but the main obsidi

## Conception

**Obsidan-Node-Canvas** has been _**conceived**_ 💥 and _**prototyped**_ 🚀 during the **[Code 2 Community - The Y Berlin x ICP](https://lu.ma/zwblit5f) hackathon**.
**Obsidian-Node-Canvas** has been _**conceived**_ 💥 and _**prototyped**_ 🚀 during the **[Code 2 Community - The Y Berlin x ICP](https://lu.ma/zwblit5f) hackathon**.

This project has been submitted [here](https://dacade.org/communities/icp/challenges/b35bd8af-51d3-437a-af13-4e649529c7e5/submissions/5605d208-bb84-4551-9697-e89f75901ce0).

Expand All @@ -56,14 +56,14 @@ Here a rough overview:

- only one node is active at a time
- the first code block of each node will be executed
- execution starts at a with just the content: 'start'
- execution starts at a node with just the content: 'start'
- there are nodes that do not use code-blocks but special syntax (see below)
- only directed arrows matter as of now
- currently all invocations are stored until the canvas complete
- aka. circular constructs will leak memory
- this will be fixed when aggregations get an update
- these are the special variables
- `input` - can be anyting
- `input` - can be anything
- `state` - can be anything - is cloned whenever it passed through an arrow
- `this` - is persistant during a node's invocations
- holds special `join` object used for flow control (see below)
Expand All @@ -90,8 +90,8 @@ Here a rough overview:
- supports nunjucks templating
- "prompt gpt" (specific format required)
- supports nunjucks templating
- magic fist word node:
- `decide` promptes gpt-3 (will be reworked soon)
- magic first word node:
- `decide` prompts gpt-3 (will be reworked soon)
- _identity_ - anything that cant be parsed yet is not specifically wrong (e.g. bad js syntax) will be treated as and identity function `(input) => input`
- an empty node will also be and identity node

Expand Down Expand Up @@ -137,35 +137,64 @@ Analogous there is also `const list = zipOnState('name').list()` and `const list

##### zip merge example 1:

![img.png](examples/tutorial/flow-control/images/example-zip-simple-success.png)
![img.png](examples/feature-tour/2-flow-control/images/example-zip-simple-success.png)

##### zip merge example 2:

![img_1.png](examples/tutorial/flow-control/images/example-zip-partial-success.png)
![img_1.png](examples/feature-tour/2-flow-control/images/example-zip-partial-success.png)

## how to run

> Warning: install run at your own risk. Do not execute `.canvas` that you do not understand.

- clone this repo
- be sure you have a recent `node` version installed. I used v20.10.0
- install via [yarn](https://yarnpkg.com/)
### Initial Setup

- create a `.env` file
- containing `OPENAI_API_KEY=<YOURKEYHERE>`
- this is needed as the tutorial.canvas uses LLM-nodes
1. **Clone this repo**
2. **Install Node.js** - Recent version required (tested with v20.10.0, works with v22+)
3. **Install dependencies** via [yarn](https://yarnpkg.com/):

- then:
```bash
# from the checkout root call:
yarn install
```

> **Note:** You may see a build warning about the `canvas` package (missing `pangocairo` system dependencies). This is harmless and won't affect basic functionality.

4. **(Optional)** Create a `.env` file for LLM features:
- Only needed if you want to use LLM/GPT nodes
- Add: `OPENAI_API_KEY=<YOURKEYHERE>`
- Not required for basic canvas execution

### Running Examples

All examples should be run from the repository root:

#### Core Features (No API Key Required) ✅

```bash
# Basic arrow propagation and data flow
yarn dev --vault examples --canvas feature-tour/1-arrow-propagation/propagation.canvas

# Flow control: aggregation
yarn dev --vault examples --canvas feature-tour/2-flow-control/aggregate.canvas

yarn install # install dependencies
# Flow control: zip and aggregate
yarn dev --vault examples --canvas feature-tour/2-flow-control/zip-and-aggregate.canvas

yarn dev --vault examples --canvas tutorial/tutorial.canvas
yarn dev --vault examples --canvas tutorial/read-eval-loop/sly-llm-agent.canvas
yarn dev --vault examples --canvas tutorial/flow-control/zip-and-aggregate.canvas
yarn dev --vault examples --canvas tutorial/reference-file/hello.canvas
# Canvas composition and signals
yarn dev --vault examples --canvas feature-tour/3-canvas-signals/caller.canvas

# Canvas overload patterns
yarn dev --vault examples --canvas feature-tour/4-canvas-overload/caller.canvas
```

#### Advanced Examples (Require OpenAI API Key) 🔑

```bash
# LLM-powered tutorial
yarn dev --vault examples --canvas feature-tour/tutorial.canvas

# Shell automation with LLM
yarn dev --vault examples --canvas feature-tour/shell/bash.canvas
```

Off you go with your own canvas 🕊️
Expand Down
Binary file added bun.lockb
Binary file not shown.
Loading