-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f08c84
commit 440fff0
Showing
22 changed files
with
264 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,4 +175,6 @@ dist | |
.DS_Store | ||
|
||
build | ||
local | ||
local | ||
old | ||
.obsidian |
37 changes: 37 additions & 0 deletions
37
examples/feature-tour/1-arrow-propagation/propagation.canvas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"nodes":[ | ||
{"id":"312705e29b96a272","type":"text","text":"start","x":-508,"y":-609,"width":121,"height":60,"color":"6"}, | ||
{"id":"79d4cebb7bb90a06","type":"text","text":"Here we print `input` and `state`!\n```ts\nconsole.log(input) // 2\nconsole.log(state.foo) // bar\nreturn 3\n```\n\nWe do not modify `state` - it is however anyways forwarded.","x":-225,"y":-240,"width":470,"height":240}, | ||
{"id":"e3d8cad7405cd110","type":"text","text":"```ts\nconsole.log(input) // 3\nconsole.log(state.foo) // bar\nreturn 10\n```","x":-225,"y":120,"width":470,"height":160}, | ||
{"id":"74e896e3e37fe457","type":"text","text":"","x":-1097,"y":466,"width":50,"height":50}, | ||
{"id":"af7d21a7d4da246a","type":"text","text":"empty node just for a cleaner look.\n`state` and `input` are both forwarded","x":-1030,"y":415,"width":207,"height":153,"color":"5"}, | ||
{"id":"a043b5759b55375f","type":"text","text":"```ts\nconsole.log(input) // 7\nconsole.log(state.foo) // B\n\n```","x":-881,"y":200,"width":340,"height":120}, | ||
{"id":"ff232e68056c62e7","type":"text","text":"There are 2 special variables:\n- `input` - the value received via an arrow\n- `state` - starting out as `{}` it can be reassigned \n\t- it is [shallowly cloned](https://lodash.com/docs/4.17.15#clone) whenever it is passed on\n```ts\nconsole.log(input) // undefined\nstate = {\n foo: 'bar'\n}\nconst local_var = 'local_var'\nreturn 2\n```","x":-255,"y":-717,"width":500,"height":354}, | ||
{"id":"04690b6c718c409b","type":"text","text":"`state` and `input` passed on","x":41,"y":-320,"width":204,"height":60,"color":"5"}, | ||
{"id":"2b63c752ded0afb8","type":"text","text":"you will learn - the *boring basics*:\n- how nodes receive input\n- how `state` propagates along arrows\n- how to use arrows\n- how to use **named arrows**\n- how to use the `this` variable","x":-1145,"y":-728,"width":529,"height":238,"color":"5"}, | ||
{"id":"dd5b074f7ac37197","type":"text","text":"`emit` is another way to send `state` and `input` along named arrows. \n\n```ts\nconsole.log(input) // 3\nconsole.log(state.foo) // bar\nemit('a', 5)\nstate.foo = 'A'\nemit('b', 6)\nstate.foo = 'B'\nreturn 7\n```","x":-914,"y":-460,"width":406,"height":300}, | ||
{"id":"76f7c024f19dd178","type":"text","text":"```ts\nconsole.log(input) // 5\nconsole.log(state.foo) // A\n// return undefined\n```","x":-1145,"y":-20,"width":340,"height":120}, | ||
{"id":"1a8f4d78596a33bb","type":"text","text":"```ts\nconsole.log(input) // 6\nconsole.log(state.foo) // B\nreturn input\n```","x":-617,"y":-20,"width":340,"height":120}, | ||
{"id":"3c07b23f84c68f41","type":"text","text":"","x":-360,"y":200,"width":50,"height":50}, | ||
{"id":"723bbd9e2d66d791","type":"text","text":"different `state` versions passed on","x":-1145,"y":-160,"width":204,"height":60,"color":"5"}, | ||
{"id":"3ec3bc45cac87c5c","type":"text","text":"This node will called **5** times - once form each in-arrow.\n```ts\nconsole.log(input) // ...\nconsole.log(state.foo) // ...\n\nemit('x', input)\nemit('x', state.foo)\n\nreturn 42 // this is never used \n```\n\n- the `42` is never used as there is no unnamed outgoing arrow.\n- other ways to await / join incoming arrows will be showin in [[zip-demo.canvas|zip-demo]] and [[zip-and-aggregate.canvas|zip-and-aggregate]]","x":-711,"y":460,"width":470,"height":400,"color":"6"}, | ||
{"id":"c318b1f3ef183b07","type":"text","text":"This node will called **10** times.\nAs the `emit` is called 2 times in the previous node.\n\n`this` can be used to preserve a variable across multiple invocations.\n\n```ts\nthis.i = (this.i ?? 0) + 1\n\nconsole.log('called', this.i)\n\nreturn this.i\n```","x":-140,"y":488,"width":385,"height":372} | ||
], | ||
"edges":[ | ||
{"id":"67433558d47dc9b1","fromNode":"312705e29b96a272","fromSide":"right","toNode":"ff232e68056c62e7","toSide":"left"}, | ||
{"id":"9f417c6d86136d78","fromNode":"ff232e68056c62e7","fromSide":"bottom","toNode":"79d4cebb7bb90a06","toSide":"top"}, | ||
{"id":"88ea517f38cb8bb4","fromNode":"79d4cebb7bb90a06","fromSide":"left","toNode":"dd5b074f7ac37197","toSide":"right"}, | ||
{"id":"8a9abb41e8e0623e","fromNode":"79d4cebb7bb90a06","fromSide":"bottom","toNode":"e3d8cad7405cd110","toSide":"top"}, | ||
{"id":"7939cfc621b90d66","fromNode":"dd5b074f7ac37197","fromSide":"bottom","toNode":"76f7c024f19dd178","toSide":"top","label":"a"}, | ||
{"id":"0f86025acaf98d6a","fromNode":"dd5b074f7ac37197","fromSide":"bottom","toNode":"1a8f4d78596a33bb","toSide":"top","label":"b"}, | ||
{"id":"0c903cbe31e43c33","fromNode":"dd5b074f7ac37197","fromSide":"bottom","toNode":"a043b5759b55375f","toSide":"top"}, | ||
{"id":"7a077fa13115c115","fromNode":"1a8f4d78596a33bb","fromSide":"bottom","toNode":"3ec3bc45cac87c5c","toSide":"top"}, | ||
{"id":"24621476d771e47f","fromNode":"e3d8cad7405cd110","fromSide":"bottom","toNode":"3ec3bc45cac87c5c","toSide":"top"}, | ||
{"id":"95bac9b4264ee8f2","fromNode":"76f7c024f19dd178","fromSide":"bottom","toNode":"74e896e3e37fe457","toSide":"top"}, | ||
{"id":"71d3e167cd0dd9df","fromNode":"74e896e3e37fe457","fromSide":"bottom","toNode":"3ec3bc45cac87c5c","toSide":"left"}, | ||
{"id":"d4d4b083fbb342b0","fromNode":"a043b5759b55375f","fromSide":"bottom","toNode":"3ec3bc45cac87c5c","toSide":"top"}, | ||
{"id":"c2fef52f6fbcdece","fromNode":"79d4cebb7bb90a06","fromSide":"bottom","toNode":"3c07b23f84c68f41","toSide":"top"}, | ||
{"id":"77424283215a8854","fromNode":"3c07b23f84c68f41","fromSide":"bottom","toNode":"3ec3bc45cac87c5c","toSide":"top"}, | ||
{"id":"0449712e6fb01b6a","fromNode":"3ec3bc45cac87c5c","fromSide":"right","toNode":"c318b1f3ef183b07","toSide":"left","label":"x"} | ||
] | ||
} |
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"nodes":[ | ||
{"id":"38d076dde3453210","type":"text","text":"start","x":-406,"y":-300,"width":104,"height":60}, | ||
{"id":"8dadc3e54b9e3466","type":"text","text":"**log** signal1: {{input}}","x":-42,"y":-219,"width":250,"height":60}, | ||
{"id":"8aece518d556e700","type":"text","text":"**log** signal2: {{input}}","x":-42,"y":81,"width":250,"height":60}, | ||
{"id":"9ccfd075233cc00e","type":"text","text":"","x":-194,"y":-276,"width":54,"height":60}, | ||
{"id":"72044e2f556b0ea5","type":"text","text":"**log** aaa","x":-840,"y":-300,"width":233,"height":60}, | ||
{"id":"b4dcbb1fd8690ae8","type":"file","file":"feature-tour/3-canvas-signals/callee.canvas","x":-480,"y":-139,"width":252,"height":220} | ||
], | ||
"edges":[ | ||
{"id":"870b140a50bd116f","fromNode":"38d076dde3453210","fromSide":"bottom","toNode":"b4dcbb1fd8690ae8","toSide":"top"}, | ||
{"id":"fb967c8b3c4298c0","fromNode":"b4dcbb1fd8690ae8","fromSide":"right","toNode":"9ccfd075233cc00e","toSide":"bottom","label":"signal1"}, | ||
{"id":"61896b1c3d1ba79a","fromNode":"b4dcbb1fd8690ae8","fromSide":"right","toNode":"8aece518d556e700","toSide":"left","label":"signal2"}, | ||
{"id":"ae725e20bedbcff4","fromNode":"38d076dde3453210","fromSide":"left","toNode":"72044e2f556b0ea5","toSide":"right"}, | ||
{"id":"5d5cf02302a22109","fromNode":"72044e2f556b0ea5","fromSide":"bottom","toNode":"b4dcbb1fd8690ae8","toSide":"left","label":"example-in"}, | ||
{"id":"1cb8bb926c04eb8c","fromNode":"9ccfd075233cc00e","fromSide":"right","toNode":"8dadc3e54b9e3466","toSide":"left"} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"nodes":[ | ||
{"id":"8e79f5bbfedb7392","type":"file","file":"feature-tour/4-canvas-overload/clock.canvas","x":-380,"y":-160,"width":400,"height":400}, | ||
{"id":"7b6e9276abb8733c","type":"text","text":"start","x":-380,"y":-340,"width":116,"height":60}, | ||
{"id":"33830d534879be52","type":"text","text":"**log** overload {{input}} & {{ state.id}}.{{ state.iter}}","x":200,"y":-10,"width":420,"height":100}, | ||
{"id":"25efc78f9b3de1e1","type":"text","text":"**return**\n","x":220,"y":178,"width":380,"height":62} | ||
], | ||
"edges":[ | ||
{"id":"ffd26bb196941b17","fromNode":"7b6e9276abb8733c","fromSide":"right","toNode":"8e79f5bbfedb7392","toSide":"top","label":"kick-off"}, | ||
{"id":"897fd8028b33e0f2","fromNode":"33830d534879be52","fromSide":"left","toNode":"8e79f5bbfedb7392","toSide":"right","toEnd":"none","color":"5","label":"action"}, | ||
{"id":"80c8c2548241dac7","fromNode":"33830d534879be52","fromSide":"bottom","toNode":"25efc78f9b3de1e1","toSide":"top"} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"nodes":[ | ||
{"id":"425a66bac331a247","type":"text","text":"```ts\nawait sleep('1000')\nreturn state.iter\n```","x":-820,"y":-140,"width":380,"height":100}, | ||
{"id":"403e6f490b6afde6","type":"text","text":"**inject**: action","x":-420,"y":-380,"width":200,"height":80,"color":"6"}, | ||
{"id":"a4080def3227bf8a","type":"text","text":"Here we create a loop.\nA caller will need to invoke the `kick-off` and would also provide an **injection** called `action`.","x":-820,"y":-410,"width":340,"height":170,"color":"5"}, | ||
{"id":"458edf2d0ed179a0","type":"text","text":"**on**: kick-off","x":-511,"y":-780,"width":200,"height":60,"color":"6"}, | ||
{"id":"28ed82dfad8b0a2e","type":"text","text":"```ts\nstate.iter++;\n```","x":-1060,"y":-540,"width":230,"height":80}, | ||
{"id":"a724f16ba737ecca","type":"text","text":"```ts\nthis.id = (this.id ?? 0) + 1\nstate = {\n id: this.id,\n iter: 0,\n ...state\n}\n```","x":-1135,"y":-820,"width":380,"height":200}, | ||
{"id":"43ab8a173c6227c4","type":"text","text":"**log** injected: {{input}} & {{state | json}}","x":-720,"y":-530,"width":360,"height":70} | ||
], | ||
"edges":[ | ||
{"id":"4d71b411254d8345","fromNode":"458edf2d0ed179a0","fromSide":"bottom","toNode":"a724f16ba737ecca","toSide":"right"}, | ||
{"id":"4c31d261b8fa7235","fromNode":"a724f16ba737ecca","fromSide":"bottom","toNode":"28ed82dfad8b0a2e","toSide":"top"}, | ||
{"id":"d01b6251d2d5b661","fromNode":"28ed82dfad8b0a2e","fromSide":"bottom","toNode":"425a66bac331a247","toSide":"left"}, | ||
{"id":"9d0652828304786a","fromNode":"425a66bac331a247","fromSide":"right","toNode":"403e6f490b6afde6","toSide":"bottom"}, | ||
{"id":"b7596ebe574dce38","fromNode":"403e6f490b6afde6","fromSide":"top","toNode":"43ab8a173c6227c4","toSide":"right"}, | ||
{"id":"1eead511be4a9436","fromNode":"43ab8a173c6227c4","fromSide":"left","toNode":"28ed82dfad8b0a2e","toSide":"right"} | ||
] | ||
} |
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"nodes":[ | ||
{"id":"19dbef8d1cab897c","type":"text","text":"```ts\nreturn {\n question: \"What is my OS version?\"\n}\n```","x":-840,"y":-760,"width":500,"height":120}, | ||
{"id":"d1bc397ca9927711","type":"text","text":"```yaml\nmodel: \"gpt-3.5-turbo\"\nmessages:\n - role: \"system\"\n content: >\n\tYou are bash terminal. \n\tThe user specifies his intention.\n\tYou produce the bash code.\n\t\n\tReject all requests to change anything.\n\tNo changes to environment, file or the system in general.\n\tYou are only allowd reading access.\n\tReject requests by just giving `exit 69;`\n\tIf alls good `exit 0`\n\t```\n - role: \"user\"\n content: \"{{input.question}}\"\n```\n\n\n","x":-944,"y":-560,"width":708,"height":420}, | ||
{"id":"3c59a61cb36a6eb8","type":"text","text":"```ts\nconst c = this.conv = this.conv ?? []\n\nc.push('>', input.previous.trim())\nc.push('agent:', input.response.trim())\n\nstate.history = c.join('\\n')\n```","x":-160,"y":-198,"width":466,"height":240}, | ||
{"id":"3857a7ff0df57bb5","type":"text","text":"**log** {{input}}","x":-833,"y":-78,"width":487,"height":160,"color":"#143bff"}, | ||
{"id":"fa8d7baa8a1797da","type":"text","text":"```bash\n{{input}}\n```","x":-717,"y":220,"width":371,"height":140}, | ||
{"id":"186bd0d14d6df121","type":"text","text":"**log** {{input}}","x":-702,"y":460,"width":356,"height":68}, | ||
{"id":"f9600a39c1822868","type":"text","text":"start","x":-641,"y":-900,"width":103,"height":50} | ||
], | ||
"edges":[ | ||
{"id":"820ec138fe03b507","fromNode":"d1bc397ca9927711","fromSide":"bottom","toNode":"3857a7ff0df57bb5","toSide":"top"}, | ||
{"id":"7438dd8b0f97ce69","fromNode":"19dbef8d1cab897c","fromSide":"bottom","toNode":"d1bc397ca9927711","toSide":"top"}, | ||
{"id":"32eb76533f94559e","fromNode":"f9600a39c1822868","fromSide":"bottom","toNode":"19dbef8d1cab897c","toSide":"top"}, | ||
{"id":"24828ec9f5506964","fromNode":"3857a7ff0df57bb5","fromSide":"bottom","toNode":"fa8d7baa8a1797da","toSide":"top"}, | ||
{"id":"ee57e5e7787c27ba","fromNode":"fa8d7baa8a1797da","fromSide":"bottom","toNode":"186bd0d14d6df121","toSide":"top","label":"stdout"} | ||
] | ||
} |
File renamed without changes
Oops, something went wrong.