From 538b9cb1e018ad10a4748f5e90a6738e3343695b Mon Sep 17 00:00:00 2001 From: Ben Follington <5009316+bfollington@users.noreply.github.com> Date: Wed, 29 May 2024 14:30:21 -0700 Subject: [PATCH 1/2] WIP interpreted graph --- static/interpreted-graph/graph.js | 300 ++++++++++++++++++++++++++++ static/interpreted-graph/index.html | 46 +++++ 2 files changed, 346 insertions(+) create mode 100644 static/interpreted-graph/graph.js create mode 100644 static/interpreted-graph/index.html diff --git a/static/interpreted-graph/graph.js b/static/interpreted-graph/graph.js new file mode 100644 index 000000000..58e48e007 --- /dev/null +++ b/static/interpreted-graph/graph.js @@ -0,0 +1,300 @@ +import { BehaviorSubject, combineLatest } from 'https://cdn.jsdelivr.net/npm/rxjs@7.8.1/+esm'; +import Ajv from 'https://cdn.jsdelivr.net/npm/ajv@8.14.0/+esm' +import Mustache from 'https://cdn.jsdelivr.net/npm/mustache@4.2.0/+esm' + +export function start() { } + +function coerce(val) { + if (val == 'true') return true; + if (val == 'false') return false; + if (!isNaN(val)) return parseFloat(val); + return val; +} + +// Function to create the RxJS network from JSON document +function createRxJSNetworkFromJson(jsonDocument) { + const ajv = new Ajv(); + const cells = {}; + const validators = {}; + + + const system = { + get: (key) => { + if (key == 'todos') { + return [ + { label: 'Buy groceries', checked: false }, + { label: 'Vacuum house', checked: true }, + { label: 'Learn RxJS', checked: false } + ] + } + } + }; + + // Create subjects and validators for each cell + jsonDocument.conversation.forEach(conversation => { + conversation.messages.forEach(message => { + if (message.role === 'assistant') { + const cellName = message.name || generateUniqueId(); + + cells[cellName] = new BehaviorSubject(null); + + // if (message.inputs) { + + // for (const [key, schema] of Object.entries(message.inputs)) { + // const inputName = key; + // validators[inputName] = ajv.compile(message.input); + // } + + // if schema has not been compiled, compile it + + // } + + // // If there is an output schema, validate the output + // if (message.output && message.output.schema) { + // validators[`${cellName}_output`] = ajv.compile(message.output.schema); + // } + } + }); + }); + + // Define a unique ID generator + function generateUniqueId() { + return '_' + Math.random().toString(36).substr(2, 9); + } + + // Process messages and set up reactive bindings + jsonDocument.conversation.forEach(conversation => { + conversation.messages.forEach(message => { + if (message.role === 'assistant') { + const cellName = message.name || generateUniqueId(); + + if (message.contentType === 'text/javascript') { + // Evaluate the JavaScript content and bind it to the subject + const func = new Function('system', ...message.content.args, message.content.body); + const result = func(system, { + get: (key) => cells[key].getValue(), + set: (key, value) => cells[key].next(value) + }); + + // Validate the result against the output schema + if (validators[`${cellName}_output`] && !validators[`${cellName}_output`](result)) { + console.error(`Output validation failed for cell ${cellName}`, validators[`${cellName}_output`].errors); + } else { + cells[cellName].next(result); + } + } else if (message.contentType === 'text/vnd.common.template') { + // Set up template rendering + const { inputs } = message; + const inputObservables = []; + + for (const [key, schema] of Object.entries(inputs)) { + const inputName = key; + if (cells[inputName]) { + inputObservables.push(cells[inputName]); + } + } + + if (message.tag) { + // register as web component + customElements.define(message.tag, class extends HTMLElement { + constructor() { + super(); + this.attachShadow({ mode: 'open' }); + } + + connectedCallback() { + const attrs = Object.fromEntries(Object.entries(this.attributes).map(([key, attr]) => ([attr.name, coerce(attr.value)]))); + + attrs.alert = () => { + alert('clicked'); + }; + + const renderedTemplate = Mustache.render(message.content, attrs); + this.shadowRoot.innerHTML = renderedTemplate; + } + }); + } else { + combineLatest(inputObservables).subscribe(values => { + const inputValues = values.reduce((acc, value, index) => { + const key = Object.keys(inputs)[index]; + acc[key] = value; + return acc; + }, {}); + + const renderedTemplate = Mustache.render(message.content, inputValues); + cells[cellName]?.next(renderedTemplate); + }); + } + } + } + }); + }); + + return cells; +} + +// Example JSON document +const jsonDocument = { + "conversation": [ + { + "id": "", + "messages": [ + { + "role": "user", + "content": "Write a title" + }, + { + "role": "assistant", + "contentType": "text/javascript", + "name": "title", + "inputs": {}, + "output": { + "schema": { + "type": "string", + } + }, + "content": { + args: [], + body: "return 'hello'" + } + } + ] + }, + { + "id": "", + "messages": [ + { + "role": "user", + "content": "Get my todos" + }, + { + "role": "assistant", + "contentType": "text/javascript", + "name": "todos", + "inputs": {}, + "output": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "checked": { + "type": "boolean", + "default": false + } + }, + "required": ["label"] + } + } + }, + "content": { + args: [], + body: "return system.get('todos')" + } + } + ] + }, + { + "id": "", + "messages": [ + { + "role": "user", + "content": "I would like a todo item component, e.g. vacuum house" + }, + { + "role": "assistant", + "contentType": "text/vnd.common.template", + "tag": "todo-item", + "imports": { + "label": "common:ui/label.component.json", + "checkbox": "common:ui/checkbox.component.json" + }, + "inputs": { + "checked": { + "type": "boolean", + "default": false + }, + "label": { + "type": "string" + } + }, + "output": { + "schema": { + "type": "template" + } + }, + "content": "" + } + ] + }, + { + "id": "", + "messages": [ + { + "role": "user", + "content": "Ok, now make a task list using that todo item." + }, + { + "role": "assistant", + "contentType": "text/vnd.common.template", + "name": "ui", + "inputs": { + "title": { + "type": "string", + }, + "todos": { + "type": "array", + "items": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "checked": { + "type": "boolean", + "default": false + } + }, + "required": ["label"] + }, + "default": [] + } + }, + "output": { + "schema": { + "type": "template" + } + }, + "imports": { + "task": "todo-item" + }, + "content": "

{{title}}

" + } + ] + } + ] +}; + +// Create the RxJS network +const subjects = createRxJSNetworkFromJson(jsonDocument); + +// Example usage: Adding a new todo item +// subjects['todos'].next([ +// { label: 'Buy groceries', checked: false }, +// { label: 'Vacuum house', checked: true }, +// { label: 'Learn RxJS', checked: false } +// ]); + +// Example usage: Updating the title +subjects['title'].next('My Updated Task List'); + +console.log(subjects) + +// subjects['ui'].subscribe(console.log); +subjects['todos'].subscribe(console.log); +subjects['ui'].subscribe(html => { + document.getElementById('app').innerHTML = html; +}); diff --git a/static/interpreted-graph/index.html b/static/interpreted-graph/index.html new file mode 100644 index 000000000..f2349674d --- /dev/null +++ b/static/interpreted-graph/index.html @@ -0,0 +1,46 @@ + + + + rxjs + + + + +
+
+ + + + From c7393a69598ea40a048de34a7ad7180f62850a9c Mon Sep 17 00:00:00 2001 From: Ben Follington <5009316+bfollington@users.noreply.github.com> Date: Thu, 30 May 2024 11:26:16 -0700 Subject: [PATCH 2/2] Re-organize and update experiments --- .../access.js | 0 .../arena.js | 0 .../index.html | 0 .../llm.js | 0 .../access.js | 0 .../arena.js | 0 .../index.html | 0 .../llm.js | 0 .../viewer.html | 0 .../graph.js | 0 .../index.html | 0 .../graph.js | 0 .../index.html | 0 .../analysis-card.js | 0 .../app.js | 0 .../index.html | 0 .../styles.css | 0 .../index.html | 0 .../apiKey.js | 0 .../connect.js | 0 .../graph.js | 0 .../imagine.js | 0 .../index.html | 0 .../llm.js | 0 .../nodes/BehaviourNode.js | 0 .../nodes/CombinedDataUI.js | 0 .../nodes/Cursor.js | 0 .../nodes/DangerousUI.js | 0 .../nodes/GeneratedBackstoryUI.js | 0 .../nodes/GeneratedNameTagUI.js | 0 .../nodes/GeneratedNameUI.js | 0 .../nodes/NameTagUI.js | 0 .../nodes/NameUI.js | 0 .../policy.js | 0 .../render.js | 0 .../state.js | 0 .../apiKey.js | 0 .../connect.js | 0 .../demo.js | 0 .../graph.js | 0 .../imagine.js | 0 .../index.html | 0 .../llm.js | 0 .../nodes/BehaviourNode.js | 0 .../nodes/CombinedDataUI.js | 0 .../nodes/Cursor.js | 0 .../nodes/DangerousUI.js | 0 .../nodes/GeneratedBackstoryUI.js | 0 .../nodes/GeneratedNameTagUI.js | 0 .../nodes/GeneratedNameUI.js | 0 .../nodes/GeneratedStatsUI.js | 0 .../nodes/NameTagUI.js | 0 .../nodes/NameUI.js | 0 .../nodes/PortraitUI.js | 0 .../policy.js | 0 .../render.js | 0 .../state.js | 0 .../apiKey.js | 0 .../connect.js | 0 .../graph.js | 0 .../imagine.js | 0 .../index.html | 0 .../llm.js | 0 .../nodes/BehaviourNode.js | 0 .../nodes/CombinedDataUI.js | 0 .../nodes/Cursor.js | 0 .../nodes/DangerousUI.js | 0 .../nodes/GeneratedBackstoryUI.js | 0 .../nodes/GeneratedNameTagUI.js | 0 .../nodes/GeneratedNameUI.js | 0 .../nodes/GeneratedStatsUI.js | 0 .../nodes/GeneratedUI.js | 0 .../nodes/NameTagUI.js | 0 .../nodes/NameUI.js | 0 .../nodes/PortraitUI.js | 0 .../policy.js | 0 .../render.js | 0 .../state.js | 0 .../apiKey.js | 0 .../connect.js | 0 .../graph.js | 0 .../imagine.js | 0 .../index.html | 0 .../llm.js | 0 .../nodes/BehaviourNode.js | 0 .../nodes/CombinedDataUI.js | 0 .../nodes/Cursor.js | 0 .../nodes/DangerousUI.js | 0 .../nodes/GeneratedBackstoryUI.js | 0 .../nodes/GeneratedNameTagUI.js | 0 .../nodes/GeneratedNameUI.js | 0 .../nodes/GeneratedStatsUI.js | 0 .../nodes/GeneratedUI.js | 0 .../nodes/NameTagUI.js | 0 .../nodes/NameUI.js | 0 .../nodes/PortraitUI.js | 0 .../nodes/SerializedGeneratedUI.js | 0 .../nodes/SerializedLLMNode.js | 0 .../policy.js | 0 .../render.js | 0 .../state.js | 0 .../apiKey.js | 0 .../connect.js | 0 .../graph.js | 0 .../imagine.js | 0 .../index.html | 0 .../llm.js | 0 .../nodes/BehaviourNode.js | 0 .../nodes/CombinedDataUI.js | 0 .../nodes/Cursor.js | 0 .../nodes/DangerousUI.js | 0 .../nodes/GeneratedBackstoryUI.js | 0 .../nodes/GeneratedNameTagUI.js | 0 .../nodes/GeneratedNameUI.js | 0 .../nodes/GeneratedStatsUI.js | 0 .../nodes/GeneratedUI.js | 0 .../nodes/NameTagUI.js | 0 .../nodes/NameUI.js | 0 .../nodes/PortraitUI.js | 0 .../nodes/SerializedGeneratedUI.js | 0 .../nodes/SerializedLLMNode.js | 0 .../policy.js | 0 .../render.js | 0 .../state.js | 0 .../apiKey.js | 0 .../connect.js | 0 .../graph.js | 0 .../imagine.js | 0 .../index.html | 0 .../llm.js | 0 .../nodes/BehaviourNode.js | 0 .../nodes/CodeNode.js | 0 .../nodes/CombinedDataUI.js | 0 .../nodes/Cursor.js | 0 .../nodes/DangerousUI.js | 0 .../nodes/GeneratedBackstoryUI.js | 0 .../nodes/GeneratedNameTagUI.js | 0 .../nodes/GeneratedNameUI.js | 0 .../nodes/GeneratedStatsUI.js | 0 .../nodes/GeneratedUI.js | 0 .../nodes/NameTagUI.js | 0 .../nodes/NameUI.js | 0 .../nodes/PortraitUI.js | 0 .../nodes/SerializedGeneratedUI.js | 0 .../nodes/SerializedLLMNode.js | 0 .../policy.js | 0 .../render.js | 0 .../state.js | 0 .../apiKey.js | 0 .../connect.js | 0 .../graph copy 2.js | 0 .../graph copy.js | 0 .../graph.js | 0 .../imagine.js | 0 .../index.html | 0 .../llm.js | 0 .../nodes/BehaviourNode.js | 0 .../nodes/CodeNode.js | 0 .../nodes/GeneratedUI.js | 0 .../nodes/JSONLLMNode.js | 0 .../nodes/NameTagUI.js | 0 .../nodes/NameUI.js | 0 .../nodes/SerializedGeneratedUI.js | 0 .../nodes/SerializedLLMNode.js | 0 .../nodes/TextLLMNode.js | 0 .../policy.js | 0 .../render.js | 0 .../state.js | 0 static/2024-05-29-interpreted-graph/graph.js | 403 ++++++++++++++++++ .../index.html | 2 + .../json-ui-tree-sketch-bindings.js | 102 +++++ static/2024-05-30-json-to-html/index.html | 34 ++ static/2024-05-30-json-to-html/index.js | 224 ++++++++++ static/interpreted-graph/graph.js | 300 ------------- 174 files changed, 765 insertions(+), 300 deletions(-) rename static/{ui-generation-sketch-01 => 2024-04-26-ui-generation-sketch-01}/access.js (100%) rename static/{ui-generation-sketch-01 => 2024-04-26-ui-generation-sketch-01}/arena.js (100%) rename static/{ui-generation-sketch-01 => 2024-04-26-ui-generation-sketch-01}/index.html (100%) rename static/{ui-generation-sketch-01 => 2024-04-26-ui-generation-sketch-01}/llm.js (100%) rename static/{ui-generation-sketch-02 => 2024-04-28-ui-generation-sketch-02}/access.js (100%) rename static/{ui-generation-sketch-02 => 2024-04-28-ui-generation-sketch-02}/arena.js (100%) rename static/{ui-generation-sketch-02 => 2024-04-28-ui-generation-sketch-02}/index.html (100%) rename static/{ui-generation-sketch-02 => 2024-04-28-ui-generation-sketch-02}/llm.js (100%) rename static/{ui-generation-sketch-02 => 2024-04-28-ui-generation-sketch-02}/viewer.html (100%) rename static/{frp-graph-01 => 2024-05-12-frp-graph-01}/graph.js (100%) rename static/{frp-graph-01 => 2024-05-12-frp-graph-01}/index.html (100%) rename static/{frp-graph-02 => 2024-05-12-frp-graph-02}/graph.js (100%) rename static/{frp-graph-02 => 2024-05-12-frp-graph-02}/index.html (100%) rename static/{dissector => 2024-05-15-dissector}/analysis-card.js (100%) rename static/{dissector => 2024-05-15-dissector}/app.js (100%) rename static/{dissector => 2024-05-15-dissector}/index.html (100%) rename static/{dissector => 2024-05-15-dissector}/styles.css (100%) rename static/{ui-generation-sketch-03 => 2024-05-15-ui-generation-sketch-03}/index.html (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/apiKey.js (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/connect.js (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/graph.js (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/imagine.js (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/index.html (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/llm.js (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/nodes/BehaviourNode.js (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/nodes/CombinedDataUI.js (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/nodes/Cursor.js (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/nodes/DangerousUI.js (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/nodes/GeneratedBackstoryUI.js (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/nodes/GeneratedNameTagUI.js (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/nodes/GeneratedNameUI.js (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/nodes/NameTagUI.js (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/nodes/NameUI.js (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/policy.js (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/render.js (100%) rename static/{frp-graph-03 => 2024-05-21-frp-graph-03}/state.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/apiKey.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/connect.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/demo.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/graph.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/imagine.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/index.html (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/llm.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/nodes/BehaviourNode.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/nodes/CombinedDataUI.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/nodes/Cursor.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/nodes/DangerousUI.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/nodes/GeneratedBackstoryUI.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/nodes/GeneratedNameTagUI.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/nodes/GeneratedNameUI.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/nodes/GeneratedStatsUI.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/nodes/NameTagUI.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/nodes/NameUI.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/nodes/PortraitUI.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/policy.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/render.js (100%) rename static/{frp-graph-04 => 2024-05-21-frp-graph-04}/state.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/apiKey.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/connect.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/graph.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/imagine.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/index.html (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/llm.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/nodes/BehaviourNode.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/nodes/CombinedDataUI.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/nodes/Cursor.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/nodes/DangerousUI.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/nodes/GeneratedBackstoryUI.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/nodes/GeneratedNameTagUI.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/nodes/GeneratedNameUI.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/nodes/GeneratedStatsUI.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/nodes/GeneratedUI.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/nodes/NameTagUI.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/nodes/NameUI.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/nodes/PortraitUI.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/policy.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/render.js (100%) rename static/{frp-graph-05 => 2024-05-21-frp-graph-05}/state.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/apiKey.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/connect.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/graph.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/imagine.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/index.html (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/llm.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/nodes/BehaviourNode.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/nodes/CombinedDataUI.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/nodes/Cursor.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/nodes/DangerousUI.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/nodes/GeneratedBackstoryUI.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/nodes/GeneratedNameTagUI.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/nodes/GeneratedNameUI.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/nodes/GeneratedStatsUI.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/nodes/GeneratedUI.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/nodes/NameTagUI.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/nodes/NameUI.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/nodes/PortraitUI.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/nodes/SerializedGeneratedUI.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/nodes/SerializedLLMNode.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/policy.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/render.js (100%) rename static/{frp-graph-06-no-static-ui-code => 2024-05-21-frp-graph-06-no-static-ui-code}/state.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/apiKey.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/connect.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/graph.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/imagine.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/index.html (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/llm.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/nodes/BehaviourNode.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/nodes/CombinedDataUI.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/nodes/Cursor.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/nodes/DangerousUI.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/nodes/GeneratedBackstoryUI.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/nodes/GeneratedNameTagUI.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/nodes/GeneratedNameUI.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/nodes/GeneratedStatsUI.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/nodes/GeneratedUI.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/nodes/NameTagUI.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/nodes/NameUI.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/nodes/PortraitUI.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/nodes/SerializedGeneratedUI.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/nodes/SerializedLLMNode.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/policy.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/render.js (100%) rename static/{frp-graph-07-llm-generated => 2024-05-21-frp-graph-07-llm-generated}/state.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/apiKey.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/connect.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/graph.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/imagine.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/index.html (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/llm.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/nodes/BehaviourNode.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/nodes/CodeNode.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/nodes/CombinedDataUI.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/nodes/Cursor.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/nodes/DangerousUI.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/nodes/GeneratedBackstoryUI.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/nodes/GeneratedNameTagUI.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/nodes/GeneratedNameUI.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/nodes/GeneratedStatsUI.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/nodes/GeneratedUI.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/nodes/NameTagUI.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/nodes/NameUI.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/nodes/PortraitUI.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/nodes/SerializedGeneratedUI.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/nodes/SerializedLLMNode.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/policy.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/render.js (100%) rename static/{frp-graph-08-describe-ports => 2024-05-23-frp-graph-08-describe-ports}/state.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/apiKey.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/connect.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/graph copy 2.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/graph copy.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/graph.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/imagine.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/index.html (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/llm.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/nodes/BehaviourNode.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/nodes/CodeNode.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/nodes/GeneratedUI.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/nodes/JSONLLMNode.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/nodes/NameTagUI.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/nodes/NameUI.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/nodes/SerializedGeneratedUI.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/nodes/SerializedLLMNode.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/nodes/TextLLMNode.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/policy.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/render.js (100%) rename static/{frp-graph-09-llm-generated-2 => 2024-05-25-frp-graph-09-llm-generated-2}/state.js (100%) create mode 100644 static/2024-05-29-interpreted-graph/graph.js rename static/{interpreted-graph => 2024-05-29-interpreted-graph}/index.html (96%) create mode 100644 static/2024-05-29-interpreted-graph/json-ui-tree-sketch-bindings.js create mode 100644 static/2024-05-30-json-to-html/index.html create mode 100644 static/2024-05-30-json-to-html/index.js delete mode 100644 static/interpreted-graph/graph.js diff --git a/static/ui-generation-sketch-01/access.js b/static/2024-04-26-ui-generation-sketch-01/access.js similarity index 100% rename from static/ui-generation-sketch-01/access.js rename to static/2024-04-26-ui-generation-sketch-01/access.js diff --git a/static/ui-generation-sketch-01/arena.js b/static/2024-04-26-ui-generation-sketch-01/arena.js similarity index 100% rename from static/ui-generation-sketch-01/arena.js rename to static/2024-04-26-ui-generation-sketch-01/arena.js diff --git a/static/ui-generation-sketch-01/index.html b/static/2024-04-26-ui-generation-sketch-01/index.html similarity index 100% rename from static/ui-generation-sketch-01/index.html rename to static/2024-04-26-ui-generation-sketch-01/index.html diff --git a/static/ui-generation-sketch-01/llm.js b/static/2024-04-26-ui-generation-sketch-01/llm.js similarity index 100% rename from static/ui-generation-sketch-01/llm.js rename to static/2024-04-26-ui-generation-sketch-01/llm.js diff --git a/static/ui-generation-sketch-02/access.js b/static/2024-04-28-ui-generation-sketch-02/access.js similarity index 100% rename from static/ui-generation-sketch-02/access.js rename to static/2024-04-28-ui-generation-sketch-02/access.js diff --git a/static/ui-generation-sketch-02/arena.js b/static/2024-04-28-ui-generation-sketch-02/arena.js similarity index 100% rename from static/ui-generation-sketch-02/arena.js rename to static/2024-04-28-ui-generation-sketch-02/arena.js diff --git a/static/ui-generation-sketch-02/index.html b/static/2024-04-28-ui-generation-sketch-02/index.html similarity index 100% rename from static/ui-generation-sketch-02/index.html rename to static/2024-04-28-ui-generation-sketch-02/index.html diff --git a/static/ui-generation-sketch-02/llm.js b/static/2024-04-28-ui-generation-sketch-02/llm.js similarity index 100% rename from static/ui-generation-sketch-02/llm.js rename to static/2024-04-28-ui-generation-sketch-02/llm.js diff --git a/static/ui-generation-sketch-02/viewer.html b/static/2024-04-28-ui-generation-sketch-02/viewer.html similarity index 100% rename from static/ui-generation-sketch-02/viewer.html rename to static/2024-04-28-ui-generation-sketch-02/viewer.html diff --git a/static/frp-graph-01/graph.js b/static/2024-05-12-frp-graph-01/graph.js similarity index 100% rename from static/frp-graph-01/graph.js rename to static/2024-05-12-frp-graph-01/graph.js diff --git a/static/frp-graph-01/index.html b/static/2024-05-12-frp-graph-01/index.html similarity index 100% rename from static/frp-graph-01/index.html rename to static/2024-05-12-frp-graph-01/index.html diff --git a/static/frp-graph-02/graph.js b/static/2024-05-12-frp-graph-02/graph.js similarity index 100% rename from static/frp-graph-02/graph.js rename to static/2024-05-12-frp-graph-02/graph.js diff --git a/static/frp-graph-02/index.html b/static/2024-05-12-frp-graph-02/index.html similarity index 100% rename from static/frp-graph-02/index.html rename to static/2024-05-12-frp-graph-02/index.html diff --git a/static/dissector/analysis-card.js b/static/2024-05-15-dissector/analysis-card.js similarity index 100% rename from static/dissector/analysis-card.js rename to static/2024-05-15-dissector/analysis-card.js diff --git a/static/dissector/app.js b/static/2024-05-15-dissector/app.js similarity index 100% rename from static/dissector/app.js rename to static/2024-05-15-dissector/app.js diff --git a/static/dissector/index.html b/static/2024-05-15-dissector/index.html similarity index 100% rename from static/dissector/index.html rename to static/2024-05-15-dissector/index.html diff --git a/static/dissector/styles.css b/static/2024-05-15-dissector/styles.css similarity index 100% rename from static/dissector/styles.css rename to static/2024-05-15-dissector/styles.css diff --git a/static/ui-generation-sketch-03/index.html b/static/2024-05-15-ui-generation-sketch-03/index.html similarity index 100% rename from static/ui-generation-sketch-03/index.html rename to static/2024-05-15-ui-generation-sketch-03/index.html diff --git a/static/frp-graph-03/apiKey.js b/static/2024-05-21-frp-graph-03/apiKey.js similarity index 100% rename from static/frp-graph-03/apiKey.js rename to static/2024-05-21-frp-graph-03/apiKey.js diff --git a/static/frp-graph-03/connect.js b/static/2024-05-21-frp-graph-03/connect.js similarity index 100% rename from static/frp-graph-03/connect.js rename to static/2024-05-21-frp-graph-03/connect.js diff --git a/static/frp-graph-03/graph.js b/static/2024-05-21-frp-graph-03/graph.js similarity index 100% rename from static/frp-graph-03/graph.js rename to static/2024-05-21-frp-graph-03/graph.js diff --git a/static/frp-graph-03/imagine.js b/static/2024-05-21-frp-graph-03/imagine.js similarity index 100% rename from static/frp-graph-03/imagine.js rename to static/2024-05-21-frp-graph-03/imagine.js diff --git a/static/frp-graph-03/index.html b/static/2024-05-21-frp-graph-03/index.html similarity index 100% rename from static/frp-graph-03/index.html rename to static/2024-05-21-frp-graph-03/index.html diff --git a/static/frp-graph-03/llm.js b/static/2024-05-21-frp-graph-03/llm.js similarity index 100% rename from static/frp-graph-03/llm.js rename to static/2024-05-21-frp-graph-03/llm.js diff --git a/static/frp-graph-03/nodes/BehaviourNode.js b/static/2024-05-21-frp-graph-03/nodes/BehaviourNode.js similarity index 100% rename from static/frp-graph-03/nodes/BehaviourNode.js rename to static/2024-05-21-frp-graph-03/nodes/BehaviourNode.js diff --git a/static/frp-graph-03/nodes/CombinedDataUI.js b/static/2024-05-21-frp-graph-03/nodes/CombinedDataUI.js similarity index 100% rename from static/frp-graph-03/nodes/CombinedDataUI.js rename to static/2024-05-21-frp-graph-03/nodes/CombinedDataUI.js diff --git a/static/frp-graph-03/nodes/Cursor.js b/static/2024-05-21-frp-graph-03/nodes/Cursor.js similarity index 100% rename from static/frp-graph-03/nodes/Cursor.js rename to static/2024-05-21-frp-graph-03/nodes/Cursor.js diff --git a/static/frp-graph-03/nodes/DangerousUI.js b/static/2024-05-21-frp-graph-03/nodes/DangerousUI.js similarity index 100% rename from static/frp-graph-03/nodes/DangerousUI.js rename to static/2024-05-21-frp-graph-03/nodes/DangerousUI.js diff --git a/static/frp-graph-03/nodes/GeneratedBackstoryUI.js b/static/2024-05-21-frp-graph-03/nodes/GeneratedBackstoryUI.js similarity index 100% rename from static/frp-graph-03/nodes/GeneratedBackstoryUI.js rename to static/2024-05-21-frp-graph-03/nodes/GeneratedBackstoryUI.js diff --git a/static/frp-graph-03/nodes/GeneratedNameTagUI.js b/static/2024-05-21-frp-graph-03/nodes/GeneratedNameTagUI.js similarity index 100% rename from static/frp-graph-03/nodes/GeneratedNameTagUI.js rename to static/2024-05-21-frp-graph-03/nodes/GeneratedNameTagUI.js diff --git a/static/frp-graph-03/nodes/GeneratedNameUI.js b/static/2024-05-21-frp-graph-03/nodes/GeneratedNameUI.js similarity index 100% rename from static/frp-graph-03/nodes/GeneratedNameUI.js rename to static/2024-05-21-frp-graph-03/nodes/GeneratedNameUI.js diff --git a/static/frp-graph-03/nodes/NameTagUI.js b/static/2024-05-21-frp-graph-03/nodes/NameTagUI.js similarity index 100% rename from static/frp-graph-03/nodes/NameTagUI.js rename to static/2024-05-21-frp-graph-03/nodes/NameTagUI.js diff --git a/static/frp-graph-03/nodes/NameUI.js b/static/2024-05-21-frp-graph-03/nodes/NameUI.js similarity index 100% rename from static/frp-graph-03/nodes/NameUI.js rename to static/2024-05-21-frp-graph-03/nodes/NameUI.js diff --git a/static/frp-graph-03/policy.js b/static/2024-05-21-frp-graph-03/policy.js similarity index 100% rename from static/frp-graph-03/policy.js rename to static/2024-05-21-frp-graph-03/policy.js diff --git a/static/frp-graph-03/render.js b/static/2024-05-21-frp-graph-03/render.js similarity index 100% rename from static/frp-graph-03/render.js rename to static/2024-05-21-frp-graph-03/render.js diff --git a/static/frp-graph-03/state.js b/static/2024-05-21-frp-graph-03/state.js similarity index 100% rename from static/frp-graph-03/state.js rename to static/2024-05-21-frp-graph-03/state.js diff --git a/static/frp-graph-04/apiKey.js b/static/2024-05-21-frp-graph-04/apiKey.js similarity index 100% rename from static/frp-graph-04/apiKey.js rename to static/2024-05-21-frp-graph-04/apiKey.js diff --git a/static/frp-graph-04/connect.js b/static/2024-05-21-frp-graph-04/connect.js similarity index 100% rename from static/frp-graph-04/connect.js rename to static/2024-05-21-frp-graph-04/connect.js diff --git a/static/frp-graph-04/demo.js b/static/2024-05-21-frp-graph-04/demo.js similarity index 100% rename from static/frp-graph-04/demo.js rename to static/2024-05-21-frp-graph-04/demo.js diff --git a/static/frp-graph-04/graph.js b/static/2024-05-21-frp-graph-04/graph.js similarity index 100% rename from static/frp-graph-04/graph.js rename to static/2024-05-21-frp-graph-04/graph.js diff --git a/static/frp-graph-04/imagine.js b/static/2024-05-21-frp-graph-04/imagine.js similarity index 100% rename from static/frp-graph-04/imagine.js rename to static/2024-05-21-frp-graph-04/imagine.js diff --git a/static/frp-graph-04/index.html b/static/2024-05-21-frp-graph-04/index.html similarity index 100% rename from static/frp-graph-04/index.html rename to static/2024-05-21-frp-graph-04/index.html diff --git a/static/frp-graph-04/llm.js b/static/2024-05-21-frp-graph-04/llm.js similarity index 100% rename from static/frp-graph-04/llm.js rename to static/2024-05-21-frp-graph-04/llm.js diff --git a/static/frp-graph-04/nodes/BehaviourNode.js b/static/2024-05-21-frp-graph-04/nodes/BehaviourNode.js similarity index 100% rename from static/frp-graph-04/nodes/BehaviourNode.js rename to static/2024-05-21-frp-graph-04/nodes/BehaviourNode.js diff --git a/static/frp-graph-04/nodes/CombinedDataUI.js b/static/2024-05-21-frp-graph-04/nodes/CombinedDataUI.js similarity index 100% rename from static/frp-graph-04/nodes/CombinedDataUI.js rename to static/2024-05-21-frp-graph-04/nodes/CombinedDataUI.js diff --git a/static/frp-graph-04/nodes/Cursor.js b/static/2024-05-21-frp-graph-04/nodes/Cursor.js similarity index 100% rename from static/frp-graph-04/nodes/Cursor.js rename to static/2024-05-21-frp-graph-04/nodes/Cursor.js diff --git a/static/frp-graph-04/nodes/DangerousUI.js b/static/2024-05-21-frp-graph-04/nodes/DangerousUI.js similarity index 100% rename from static/frp-graph-04/nodes/DangerousUI.js rename to static/2024-05-21-frp-graph-04/nodes/DangerousUI.js diff --git a/static/frp-graph-04/nodes/GeneratedBackstoryUI.js b/static/2024-05-21-frp-graph-04/nodes/GeneratedBackstoryUI.js similarity index 100% rename from static/frp-graph-04/nodes/GeneratedBackstoryUI.js rename to static/2024-05-21-frp-graph-04/nodes/GeneratedBackstoryUI.js diff --git a/static/frp-graph-04/nodes/GeneratedNameTagUI.js b/static/2024-05-21-frp-graph-04/nodes/GeneratedNameTagUI.js similarity index 100% rename from static/frp-graph-04/nodes/GeneratedNameTagUI.js rename to static/2024-05-21-frp-graph-04/nodes/GeneratedNameTagUI.js diff --git a/static/frp-graph-04/nodes/GeneratedNameUI.js b/static/2024-05-21-frp-graph-04/nodes/GeneratedNameUI.js similarity index 100% rename from static/frp-graph-04/nodes/GeneratedNameUI.js rename to static/2024-05-21-frp-graph-04/nodes/GeneratedNameUI.js diff --git a/static/frp-graph-04/nodes/GeneratedStatsUI.js b/static/2024-05-21-frp-graph-04/nodes/GeneratedStatsUI.js similarity index 100% rename from static/frp-graph-04/nodes/GeneratedStatsUI.js rename to static/2024-05-21-frp-graph-04/nodes/GeneratedStatsUI.js diff --git a/static/frp-graph-04/nodes/NameTagUI.js b/static/2024-05-21-frp-graph-04/nodes/NameTagUI.js similarity index 100% rename from static/frp-graph-04/nodes/NameTagUI.js rename to static/2024-05-21-frp-graph-04/nodes/NameTagUI.js diff --git a/static/frp-graph-04/nodes/NameUI.js b/static/2024-05-21-frp-graph-04/nodes/NameUI.js similarity index 100% rename from static/frp-graph-04/nodes/NameUI.js rename to static/2024-05-21-frp-graph-04/nodes/NameUI.js diff --git a/static/frp-graph-04/nodes/PortraitUI.js b/static/2024-05-21-frp-graph-04/nodes/PortraitUI.js similarity index 100% rename from static/frp-graph-04/nodes/PortraitUI.js rename to static/2024-05-21-frp-graph-04/nodes/PortraitUI.js diff --git a/static/frp-graph-04/policy.js b/static/2024-05-21-frp-graph-04/policy.js similarity index 100% rename from static/frp-graph-04/policy.js rename to static/2024-05-21-frp-graph-04/policy.js diff --git a/static/frp-graph-04/render.js b/static/2024-05-21-frp-graph-04/render.js similarity index 100% rename from static/frp-graph-04/render.js rename to static/2024-05-21-frp-graph-04/render.js diff --git a/static/frp-graph-04/state.js b/static/2024-05-21-frp-graph-04/state.js similarity index 100% rename from static/frp-graph-04/state.js rename to static/2024-05-21-frp-graph-04/state.js diff --git a/static/frp-graph-05/apiKey.js b/static/2024-05-21-frp-graph-05/apiKey.js similarity index 100% rename from static/frp-graph-05/apiKey.js rename to static/2024-05-21-frp-graph-05/apiKey.js diff --git a/static/frp-graph-05/connect.js b/static/2024-05-21-frp-graph-05/connect.js similarity index 100% rename from static/frp-graph-05/connect.js rename to static/2024-05-21-frp-graph-05/connect.js diff --git a/static/frp-graph-05/graph.js b/static/2024-05-21-frp-graph-05/graph.js similarity index 100% rename from static/frp-graph-05/graph.js rename to static/2024-05-21-frp-graph-05/graph.js diff --git a/static/frp-graph-05/imagine.js b/static/2024-05-21-frp-graph-05/imagine.js similarity index 100% rename from static/frp-graph-05/imagine.js rename to static/2024-05-21-frp-graph-05/imagine.js diff --git a/static/frp-graph-05/index.html b/static/2024-05-21-frp-graph-05/index.html similarity index 100% rename from static/frp-graph-05/index.html rename to static/2024-05-21-frp-graph-05/index.html diff --git a/static/frp-graph-05/llm.js b/static/2024-05-21-frp-graph-05/llm.js similarity index 100% rename from static/frp-graph-05/llm.js rename to static/2024-05-21-frp-graph-05/llm.js diff --git a/static/frp-graph-05/nodes/BehaviourNode.js b/static/2024-05-21-frp-graph-05/nodes/BehaviourNode.js similarity index 100% rename from static/frp-graph-05/nodes/BehaviourNode.js rename to static/2024-05-21-frp-graph-05/nodes/BehaviourNode.js diff --git a/static/frp-graph-05/nodes/CombinedDataUI.js b/static/2024-05-21-frp-graph-05/nodes/CombinedDataUI.js similarity index 100% rename from static/frp-graph-05/nodes/CombinedDataUI.js rename to static/2024-05-21-frp-graph-05/nodes/CombinedDataUI.js diff --git a/static/frp-graph-05/nodes/Cursor.js b/static/2024-05-21-frp-graph-05/nodes/Cursor.js similarity index 100% rename from static/frp-graph-05/nodes/Cursor.js rename to static/2024-05-21-frp-graph-05/nodes/Cursor.js diff --git a/static/frp-graph-05/nodes/DangerousUI.js b/static/2024-05-21-frp-graph-05/nodes/DangerousUI.js similarity index 100% rename from static/frp-graph-05/nodes/DangerousUI.js rename to static/2024-05-21-frp-graph-05/nodes/DangerousUI.js diff --git a/static/frp-graph-05/nodes/GeneratedBackstoryUI.js b/static/2024-05-21-frp-graph-05/nodes/GeneratedBackstoryUI.js similarity index 100% rename from static/frp-graph-05/nodes/GeneratedBackstoryUI.js rename to static/2024-05-21-frp-graph-05/nodes/GeneratedBackstoryUI.js diff --git a/static/frp-graph-05/nodes/GeneratedNameTagUI.js b/static/2024-05-21-frp-graph-05/nodes/GeneratedNameTagUI.js similarity index 100% rename from static/frp-graph-05/nodes/GeneratedNameTagUI.js rename to static/2024-05-21-frp-graph-05/nodes/GeneratedNameTagUI.js diff --git a/static/frp-graph-05/nodes/GeneratedNameUI.js b/static/2024-05-21-frp-graph-05/nodes/GeneratedNameUI.js similarity index 100% rename from static/frp-graph-05/nodes/GeneratedNameUI.js rename to static/2024-05-21-frp-graph-05/nodes/GeneratedNameUI.js diff --git a/static/frp-graph-05/nodes/GeneratedStatsUI.js b/static/2024-05-21-frp-graph-05/nodes/GeneratedStatsUI.js similarity index 100% rename from static/frp-graph-05/nodes/GeneratedStatsUI.js rename to static/2024-05-21-frp-graph-05/nodes/GeneratedStatsUI.js diff --git a/static/frp-graph-05/nodes/GeneratedUI.js b/static/2024-05-21-frp-graph-05/nodes/GeneratedUI.js similarity index 100% rename from static/frp-graph-05/nodes/GeneratedUI.js rename to static/2024-05-21-frp-graph-05/nodes/GeneratedUI.js diff --git a/static/frp-graph-05/nodes/NameTagUI.js b/static/2024-05-21-frp-graph-05/nodes/NameTagUI.js similarity index 100% rename from static/frp-graph-05/nodes/NameTagUI.js rename to static/2024-05-21-frp-graph-05/nodes/NameTagUI.js diff --git a/static/frp-graph-05/nodes/NameUI.js b/static/2024-05-21-frp-graph-05/nodes/NameUI.js similarity index 100% rename from static/frp-graph-05/nodes/NameUI.js rename to static/2024-05-21-frp-graph-05/nodes/NameUI.js diff --git a/static/frp-graph-05/nodes/PortraitUI.js b/static/2024-05-21-frp-graph-05/nodes/PortraitUI.js similarity index 100% rename from static/frp-graph-05/nodes/PortraitUI.js rename to static/2024-05-21-frp-graph-05/nodes/PortraitUI.js diff --git a/static/frp-graph-05/policy.js b/static/2024-05-21-frp-graph-05/policy.js similarity index 100% rename from static/frp-graph-05/policy.js rename to static/2024-05-21-frp-graph-05/policy.js diff --git a/static/frp-graph-05/render.js b/static/2024-05-21-frp-graph-05/render.js similarity index 100% rename from static/frp-graph-05/render.js rename to static/2024-05-21-frp-graph-05/render.js diff --git a/static/frp-graph-05/state.js b/static/2024-05-21-frp-graph-05/state.js similarity index 100% rename from static/frp-graph-05/state.js rename to static/2024-05-21-frp-graph-05/state.js diff --git a/static/frp-graph-06-no-static-ui-code/apiKey.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/apiKey.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/apiKey.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/apiKey.js diff --git a/static/frp-graph-06-no-static-ui-code/connect.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/connect.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/connect.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/connect.js diff --git a/static/frp-graph-06-no-static-ui-code/graph.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/graph.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/graph.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/graph.js diff --git a/static/frp-graph-06-no-static-ui-code/imagine.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/imagine.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/imagine.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/imagine.js diff --git a/static/frp-graph-06-no-static-ui-code/index.html b/static/2024-05-21-frp-graph-06-no-static-ui-code/index.html similarity index 100% rename from static/frp-graph-06-no-static-ui-code/index.html rename to static/2024-05-21-frp-graph-06-no-static-ui-code/index.html diff --git a/static/frp-graph-06-no-static-ui-code/llm.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/llm.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/llm.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/llm.js diff --git a/static/frp-graph-06-no-static-ui-code/nodes/BehaviourNode.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/BehaviourNode.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/nodes/BehaviourNode.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/BehaviourNode.js diff --git a/static/frp-graph-06-no-static-ui-code/nodes/CombinedDataUI.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/CombinedDataUI.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/nodes/CombinedDataUI.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/CombinedDataUI.js diff --git a/static/frp-graph-06-no-static-ui-code/nodes/Cursor.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/Cursor.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/nodes/Cursor.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/Cursor.js diff --git a/static/frp-graph-06-no-static-ui-code/nodes/DangerousUI.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/DangerousUI.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/nodes/DangerousUI.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/DangerousUI.js diff --git a/static/frp-graph-06-no-static-ui-code/nodes/GeneratedBackstoryUI.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/GeneratedBackstoryUI.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/nodes/GeneratedBackstoryUI.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/GeneratedBackstoryUI.js diff --git a/static/frp-graph-06-no-static-ui-code/nodes/GeneratedNameTagUI.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/GeneratedNameTagUI.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/nodes/GeneratedNameTagUI.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/GeneratedNameTagUI.js diff --git a/static/frp-graph-06-no-static-ui-code/nodes/GeneratedNameUI.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/GeneratedNameUI.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/nodes/GeneratedNameUI.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/GeneratedNameUI.js diff --git a/static/frp-graph-06-no-static-ui-code/nodes/GeneratedStatsUI.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/GeneratedStatsUI.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/nodes/GeneratedStatsUI.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/GeneratedStatsUI.js diff --git a/static/frp-graph-06-no-static-ui-code/nodes/GeneratedUI.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/GeneratedUI.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/nodes/GeneratedUI.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/GeneratedUI.js diff --git a/static/frp-graph-06-no-static-ui-code/nodes/NameTagUI.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/NameTagUI.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/nodes/NameTagUI.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/NameTagUI.js diff --git a/static/frp-graph-06-no-static-ui-code/nodes/NameUI.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/NameUI.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/nodes/NameUI.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/NameUI.js diff --git a/static/frp-graph-06-no-static-ui-code/nodes/PortraitUI.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/PortraitUI.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/nodes/PortraitUI.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/PortraitUI.js diff --git a/static/frp-graph-06-no-static-ui-code/nodes/SerializedGeneratedUI.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/SerializedGeneratedUI.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/nodes/SerializedGeneratedUI.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/SerializedGeneratedUI.js diff --git a/static/frp-graph-06-no-static-ui-code/nodes/SerializedLLMNode.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/SerializedLLMNode.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/nodes/SerializedLLMNode.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/nodes/SerializedLLMNode.js diff --git a/static/frp-graph-06-no-static-ui-code/policy.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/policy.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/policy.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/policy.js diff --git a/static/frp-graph-06-no-static-ui-code/render.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/render.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/render.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/render.js diff --git a/static/frp-graph-06-no-static-ui-code/state.js b/static/2024-05-21-frp-graph-06-no-static-ui-code/state.js similarity index 100% rename from static/frp-graph-06-no-static-ui-code/state.js rename to static/2024-05-21-frp-graph-06-no-static-ui-code/state.js diff --git a/static/frp-graph-07-llm-generated/apiKey.js b/static/2024-05-21-frp-graph-07-llm-generated/apiKey.js similarity index 100% rename from static/frp-graph-07-llm-generated/apiKey.js rename to static/2024-05-21-frp-graph-07-llm-generated/apiKey.js diff --git a/static/frp-graph-07-llm-generated/connect.js b/static/2024-05-21-frp-graph-07-llm-generated/connect.js similarity index 100% rename from static/frp-graph-07-llm-generated/connect.js rename to static/2024-05-21-frp-graph-07-llm-generated/connect.js diff --git a/static/frp-graph-07-llm-generated/graph.js b/static/2024-05-21-frp-graph-07-llm-generated/graph.js similarity index 100% rename from static/frp-graph-07-llm-generated/graph.js rename to static/2024-05-21-frp-graph-07-llm-generated/graph.js diff --git a/static/frp-graph-07-llm-generated/imagine.js b/static/2024-05-21-frp-graph-07-llm-generated/imagine.js similarity index 100% rename from static/frp-graph-07-llm-generated/imagine.js rename to static/2024-05-21-frp-graph-07-llm-generated/imagine.js diff --git a/static/frp-graph-07-llm-generated/index.html b/static/2024-05-21-frp-graph-07-llm-generated/index.html similarity index 100% rename from static/frp-graph-07-llm-generated/index.html rename to static/2024-05-21-frp-graph-07-llm-generated/index.html diff --git a/static/frp-graph-07-llm-generated/llm.js b/static/2024-05-21-frp-graph-07-llm-generated/llm.js similarity index 100% rename from static/frp-graph-07-llm-generated/llm.js rename to static/2024-05-21-frp-graph-07-llm-generated/llm.js diff --git a/static/frp-graph-07-llm-generated/nodes/BehaviourNode.js b/static/2024-05-21-frp-graph-07-llm-generated/nodes/BehaviourNode.js similarity index 100% rename from static/frp-graph-07-llm-generated/nodes/BehaviourNode.js rename to static/2024-05-21-frp-graph-07-llm-generated/nodes/BehaviourNode.js diff --git a/static/frp-graph-07-llm-generated/nodes/CombinedDataUI.js b/static/2024-05-21-frp-graph-07-llm-generated/nodes/CombinedDataUI.js similarity index 100% rename from static/frp-graph-07-llm-generated/nodes/CombinedDataUI.js rename to static/2024-05-21-frp-graph-07-llm-generated/nodes/CombinedDataUI.js diff --git a/static/frp-graph-07-llm-generated/nodes/Cursor.js b/static/2024-05-21-frp-graph-07-llm-generated/nodes/Cursor.js similarity index 100% rename from static/frp-graph-07-llm-generated/nodes/Cursor.js rename to static/2024-05-21-frp-graph-07-llm-generated/nodes/Cursor.js diff --git a/static/frp-graph-07-llm-generated/nodes/DangerousUI.js b/static/2024-05-21-frp-graph-07-llm-generated/nodes/DangerousUI.js similarity index 100% rename from static/frp-graph-07-llm-generated/nodes/DangerousUI.js rename to static/2024-05-21-frp-graph-07-llm-generated/nodes/DangerousUI.js diff --git a/static/frp-graph-07-llm-generated/nodes/GeneratedBackstoryUI.js b/static/2024-05-21-frp-graph-07-llm-generated/nodes/GeneratedBackstoryUI.js similarity index 100% rename from static/frp-graph-07-llm-generated/nodes/GeneratedBackstoryUI.js rename to static/2024-05-21-frp-graph-07-llm-generated/nodes/GeneratedBackstoryUI.js diff --git a/static/frp-graph-07-llm-generated/nodes/GeneratedNameTagUI.js b/static/2024-05-21-frp-graph-07-llm-generated/nodes/GeneratedNameTagUI.js similarity index 100% rename from static/frp-graph-07-llm-generated/nodes/GeneratedNameTagUI.js rename to static/2024-05-21-frp-graph-07-llm-generated/nodes/GeneratedNameTagUI.js diff --git a/static/frp-graph-07-llm-generated/nodes/GeneratedNameUI.js b/static/2024-05-21-frp-graph-07-llm-generated/nodes/GeneratedNameUI.js similarity index 100% rename from static/frp-graph-07-llm-generated/nodes/GeneratedNameUI.js rename to static/2024-05-21-frp-graph-07-llm-generated/nodes/GeneratedNameUI.js diff --git a/static/frp-graph-07-llm-generated/nodes/GeneratedStatsUI.js b/static/2024-05-21-frp-graph-07-llm-generated/nodes/GeneratedStatsUI.js similarity index 100% rename from static/frp-graph-07-llm-generated/nodes/GeneratedStatsUI.js rename to static/2024-05-21-frp-graph-07-llm-generated/nodes/GeneratedStatsUI.js diff --git a/static/frp-graph-07-llm-generated/nodes/GeneratedUI.js b/static/2024-05-21-frp-graph-07-llm-generated/nodes/GeneratedUI.js similarity index 100% rename from static/frp-graph-07-llm-generated/nodes/GeneratedUI.js rename to static/2024-05-21-frp-graph-07-llm-generated/nodes/GeneratedUI.js diff --git a/static/frp-graph-07-llm-generated/nodes/NameTagUI.js b/static/2024-05-21-frp-graph-07-llm-generated/nodes/NameTagUI.js similarity index 100% rename from static/frp-graph-07-llm-generated/nodes/NameTagUI.js rename to static/2024-05-21-frp-graph-07-llm-generated/nodes/NameTagUI.js diff --git a/static/frp-graph-07-llm-generated/nodes/NameUI.js b/static/2024-05-21-frp-graph-07-llm-generated/nodes/NameUI.js similarity index 100% rename from static/frp-graph-07-llm-generated/nodes/NameUI.js rename to static/2024-05-21-frp-graph-07-llm-generated/nodes/NameUI.js diff --git a/static/frp-graph-07-llm-generated/nodes/PortraitUI.js b/static/2024-05-21-frp-graph-07-llm-generated/nodes/PortraitUI.js similarity index 100% rename from static/frp-graph-07-llm-generated/nodes/PortraitUI.js rename to static/2024-05-21-frp-graph-07-llm-generated/nodes/PortraitUI.js diff --git a/static/frp-graph-07-llm-generated/nodes/SerializedGeneratedUI.js b/static/2024-05-21-frp-graph-07-llm-generated/nodes/SerializedGeneratedUI.js similarity index 100% rename from static/frp-graph-07-llm-generated/nodes/SerializedGeneratedUI.js rename to static/2024-05-21-frp-graph-07-llm-generated/nodes/SerializedGeneratedUI.js diff --git a/static/frp-graph-07-llm-generated/nodes/SerializedLLMNode.js b/static/2024-05-21-frp-graph-07-llm-generated/nodes/SerializedLLMNode.js similarity index 100% rename from static/frp-graph-07-llm-generated/nodes/SerializedLLMNode.js rename to static/2024-05-21-frp-graph-07-llm-generated/nodes/SerializedLLMNode.js diff --git a/static/frp-graph-07-llm-generated/policy.js b/static/2024-05-21-frp-graph-07-llm-generated/policy.js similarity index 100% rename from static/frp-graph-07-llm-generated/policy.js rename to static/2024-05-21-frp-graph-07-llm-generated/policy.js diff --git a/static/frp-graph-07-llm-generated/render.js b/static/2024-05-21-frp-graph-07-llm-generated/render.js similarity index 100% rename from static/frp-graph-07-llm-generated/render.js rename to static/2024-05-21-frp-graph-07-llm-generated/render.js diff --git a/static/frp-graph-07-llm-generated/state.js b/static/2024-05-21-frp-graph-07-llm-generated/state.js similarity index 100% rename from static/frp-graph-07-llm-generated/state.js rename to static/2024-05-21-frp-graph-07-llm-generated/state.js diff --git a/static/frp-graph-08-describe-ports/apiKey.js b/static/2024-05-23-frp-graph-08-describe-ports/apiKey.js similarity index 100% rename from static/frp-graph-08-describe-ports/apiKey.js rename to static/2024-05-23-frp-graph-08-describe-ports/apiKey.js diff --git a/static/frp-graph-08-describe-ports/connect.js b/static/2024-05-23-frp-graph-08-describe-ports/connect.js similarity index 100% rename from static/frp-graph-08-describe-ports/connect.js rename to static/2024-05-23-frp-graph-08-describe-ports/connect.js diff --git a/static/frp-graph-08-describe-ports/graph.js b/static/2024-05-23-frp-graph-08-describe-ports/graph.js similarity index 100% rename from static/frp-graph-08-describe-ports/graph.js rename to static/2024-05-23-frp-graph-08-describe-ports/graph.js diff --git a/static/frp-graph-08-describe-ports/imagine.js b/static/2024-05-23-frp-graph-08-describe-ports/imagine.js similarity index 100% rename from static/frp-graph-08-describe-ports/imagine.js rename to static/2024-05-23-frp-graph-08-describe-ports/imagine.js diff --git a/static/frp-graph-08-describe-ports/index.html b/static/2024-05-23-frp-graph-08-describe-ports/index.html similarity index 100% rename from static/frp-graph-08-describe-ports/index.html rename to static/2024-05-23-frp-graph-08-describe-ports/index.html diff --git a/static/frp-graph-08-describe-ports/llm.js b/static/2024-05-23-frp-graph-08-describe-ports/llm.js similarity index 100% rename from static/frp-graph-08-describe-ports/llm.js rename to static/2024-05-23-frp-graph-08-describe-ports/llm.js diff --git a/static/frp-graph-08-describe-ports/nodes/BehaviourNode.js b/static/2024-05-23-frp-graph-08-describe-ports/nodes/BehaviourNode.js similarity index 100% rename from static/frp-graph-08-describe-ports/nodes/BehaviourNode.js rename to static/2024-05-23-frp-graph-08-describe-ports/nodes/BehaviourNode.js diff --git a/static/frp-graph-08-describe-ports/nodes/CodeNode.js b/static/2024-05-23-frp-graph-08-describe-ports/nodes/CodeNode.js similarity index 100% rename from static/frp-graph-08-describe-ports/nodes/CodeNode.js rename to static/2024-05-23-frp-graph-08-describe-ports/nodes/CodeNode.js diff --git a/static/frp-graph-08-describe-ports/nodes/CombinedDataUI.js b/static/2024-05-23-frp-graph-08-describe-ports/nodes/CombinedDataUI.js similarity index 100% rename from static/frp-graph-08-describe-ports/nodes/CombinedDataUI.js rename to static/2024-05-23-frp-graph-08-describe-ports/nodes/CombinedDataUI.js diff --git a/static/frp-graph-08-describe-ports/nodes/Cursor.js b/static/2024-05-23-frp-graph-08-describe-ports/nodes/Cursor.js similarity index 100% rename from static/frp-graph-08-describe-ports/nodes/Cursor.js rename to static/2024-05-23-frp-graph-08-describe-ports/nodes/Cursor.js diff --git a/static/frp-graph-08-describe-ports/nodes/DangerousUI.js b/static/2024-05-23-frp-graph-08-describe-ports/nodes/DangerousUI.js similarity index 100% rename from static/frp-graph-08-describe-ports/nodes/DangerousUI.js rename to static/2024-05-23-frp-graph-08-describe-ports/nodes/DangerousUI.js diff --git a/static/frp-graph-08-describe-ports/nodes/GeneratedBackstoryUI.js b/static/2024-05-23-frp-graph-08-describe-ports/nodes/GeneratedBackstoryUI.js similarity index 100% rename from static/frp-graph-08-describe-ports/nodes/GeneratedBackstoryUI.js rename to static/2024-05-23-frp-graph-08-describe-ports/nodes/GeneratedBackstoryUI.js diff --git a/static/frp-graph-08-describe-ports/nodes/GeneratedNameTagUI.js b/static/2024-05-23-frp-graph-08-describe-ports/nodes/GeneratedNameTagUI.js similarity index 100% rename from static/frp-graph-08-describe-ports/nodes/GeneratedNameTagUI.js rename to static/2024-05-23-frp-graph-08-describe-ports/nodes/GeneratedNameTagUI.js diff --git a/static/frp-graph-08-describe-ports/nodes/GeneratedNameUI.js b/static/2024-05-23-frp-graph-08-describe-ports/nodes/GeneratedNameUI.js similarity index 100% rename from static/frp-graph-08-describe-ports/nodes/GeneratedNameUI.js rename to static/2024-05-23-frp-graph-08-describe-ports/nodes/GeneratedNameUI.js diff --git a/static/frp-graph-08-describe-ports/nodes/GeneratedStatsUI.js b/static/2024-05-23-frp-graph-08-describe-ports/nodes/GeneratedStatsUI.js similarity index 100% rename from static/frp-graph-08-describe-ports/nodes/GeneratedStatsUI.js rename to static/2024-05-23-frp-graph-08-describe-ports/nodes/GeneratedStatsUI.js diff --git a/static/frp-graph-08-describe-ports/nodes/GeneratedUI.js b/static/2024-05-23-frp-graph-08-describe-ports/nodes/GeneratedUI.js similarity index 100% rename from static/frp-graph-08-describe-ports/nodes/GeneratedUI.js rename to static/2024-05-23-frp-graph-08-describe-ports/nodes/GeneratedUI.js diff --git a/static/frp-graph-08-describe-ports/nodes/NameTagUI.js b/static/2024-05-23-frp-graph-08-describe-ports/nodes/NameTagUI.js similarity index 100% rename from static/frp-graph-08-describe-ports/nodes/NameTagUI.js rename to static/2024-05-23-frp-graph-08-describe-ports/nodes/NameTagUI.js diff --git a/static/frp-graph-08-describe-ports/nodes/NameUI.js b/static/2024-05-23-frp-graph-08-describe-ports/nodes/NameUI.js similarity index 100% rename from static/frp-graph-08-describe-ports/nodes/NameUI.js rename to static/2024-05-23-frp-graph-08-describe-ports/nodes/NameUI.js diff --git a/static/frp-graph-08-describe-ports/nodes/PortraitUI.js b/static/2024-05-23-frp-graph-08-describe-ports/nodes/PortraitUI.js similarity index 100% rename from static/frp-graph-08-describe-ports/nodes/PortraitUI.js rename to static/2024-05-23-frp-graph-08-describe-ports/nodes/PortraitUI.js diff --git a/static/frp-graph-08-describe-ports/nodes/SerializedGeneratedUI.js b/static/2024-05-23-frp-graph-08-describe-ports/nodes/SerializedGeneratedUI.js similarity index 100% rename from static/frp-graph-08-describe-ports/nodes/SerializedGeneratedUI.js rename to static/2024-05-23-frp-graph-08-describe-ports/nodes/SerializedGeneratedUI.js diff --git a/static/frp-graph-08-describe-ports/nodes/SerializedLLMNode.js b/static/2024-05-23-frp-graph-08-describe-ports/nodes/SerializedLLMNode.js similarity index 100% rename from static/frp-graph-08-describe-ports/nodes/SerializedLLMNode.js rename to static/2024-05-23-frp-graph-08-describe-ports/nodes/SerializedLLMNode.js diff --git a/static/frp-graph-08-describe-ports/policy.js b/static/2024-05-23-frp-graph-08-describe-ports/policy.js similarity index 100% rename from static/frp-graph-08-describe-ports/policy.js rename to static/2024-05-23-frp-graph-08-describe-ports/policy.js diff --git a/static/frp-graph-08-describe-ports/render.js b/static/2024-05-23-frp-graph-08-describe-ports/render.js similarity index 100% rename from static/frp-graph-08-describe-ports/render.js rename to static/2024-05-23-frp-graph-08-describe-ports/render.js diff --git a/static/frp-graph-08-describe-ports/state.js b/static/2024-05-23-frp-graph-08-describe-ports/state.js similarity index 100% rename from static/frp-graph-08-describe-ports/state.js rename to static/2024-05-23-frp-graph-08-describe-ports/state.js diff --git a/static/frp-graph-09-llm-generated-2/apiKey.js b/static/2024-05-25-frp-graph-09-llm-generated-2/apiKey.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/apiKey.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/apiKey.js diff --git a/static/frp-graph-09-llm-generated-2/connect.js b/static/2024-05-25-frp-graph-09-llm-generated-2/connect.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/connect.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/connect.js diff --git a/static/frp-graph-09-llm-generated-2/graph copy 2.js b/static/2024-05-25-frp-graph-09-llm-generated-2/graph copy 2.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/graph copy 2.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/graph copy 2.js diff --git a/static/frp-graph-09-llm-generated-2/graph copy.js b/static/2024-05-25-frp-graph-09-llm-generated-2/graph copy.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/graph copy.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/graph copy.js diff --git a/static/frp-graph-09-llm-generated-2/graph.js b/static/2024-05-25-frp-graph-09-llm-generated-2/graph.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/graph.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/graph.js diff --git a/static/frp-graph-09-llm-generated-2/imagine.js b/static/2024-05-25-frp-graph-09-llm-generated-2/imagine.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/imagine.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/imagine.js diff --git a/static/frp-graph-09-llm-generated-2/index.html b/static/2024-05-25-frp-graph-09-llm-generated-2/index.html similarity index 100% rename from static/frp-graph-09-llm-generated-2/index.html rename to static/2024-05-25-frp-graph-09-llm-generated-2/index.html diff --git a/static/frp-graph-09-llm-generated-2/llm.js b/static/2024-05-25-frp-graph-09-llm-generated-2/llm.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/llm.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/llm.js diff --git a/static/frp-graph-09-llm-generated-2/nodes/BehaviourNode.js b/static/2024-05-25-frp-graph-09-llm-generated-2/nodes/BehaviourNode.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/nodes/BehaviourNode.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/nodes/BehaviourNode.js diff --git a/static/frp-graph-09-llm-generated-2/nodes/CodeNode.js b/static/2024-05-25-frp-graph-09-llm-generated-2/nodes/CodeNode.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/nodes/CodeNode.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/nodes/CodeNode.js diff --git a/static/frp-graph-09-llm-generated-2/nodes/GeneratedUI.js b/static/2024-05-25-frp-graph-09-llm-generated-2/nodes/GeneratedUI.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/nodes/GeneratedUI.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/nodes/GeneratedUI.js diff --git a/static/frp-graph-09-llm-generated-2/nodes/JSONLLMNode.js b/static/2024-05-25-frp-graph-09-llm-generated-2/nodes/JSONLLMNode.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/nodes/JSONLLMNode.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/nodes/JSONLLMNode.js diff --git a/static/frp-graph-09-llm-generated-2/nodes/NameTagUI.js b/static/2024-05-25-frp-graph-09-llm-generated-2/nodes/NameTagUI.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/nodes/NameTagUI.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/nodes/NameTagUI.js diff --git a/static/frp-graph-09-llm-generated-2/nodes/NameUI.js b/static/2024-05-25-frp-graph-09-llm-generated-2/nodes/NameUI.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/nodes/NameUI.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/nodes/NameUI.js diff --git a/static/frp-graph-09-llm-generated-2/nodes/SerializedGeneratedUI.js b/static/2024-05-25-frp-graph-09-llm-generated-2/nodes/SerializedGeneratedUI.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/nodes/SerializedGeneratedUI.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/nodes/SerializedGeneratedUI.js diff --git a/static/frp-graph-09-llm-generated-2/nodes/SerializedLLMNode.js b/static/2024-05-25-frp-graph-09-llm-generated-2/nodes/SerializedLLMNode.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/nodes/SerializedLLMNode.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/nodes/SerializedLLMNode.js diff --git a/static/frp-graph-09-llm-generated-2/nodes/TextLLMNode.js b/static/2024-05-25-frp-graph-09-llm-generated-2/nodes/TextLLMNode.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/nodes/TextLLMNode.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/nodes/TextLLMNode.js diff --git a/static/frp-graph-09-llm-generated-2/policy.js b/static/2024-05-25-frp-graph-09-llm-generated-2/policy.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/policy.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/policy.js diff --git a/static/frp-graph-09-llm-generated-2/render.js b/static/2024-05-25-frp-graph-09-llm-generated-2/render.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/render.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/render.js diff --git a/static/frp-graph-09-llm-generated-2/state.js b/static/2024-05-25-frp-graph-09-llm-generated-2/state.js similarity index 100% rename from static/frp-graph-09-llm-generated-2/state.js rename to static/2024-05-25-frp-graph-09-llm-generated-2/state.js diff --git a/static/2024-05-29-interpreted-graph/graph.js b/static/2024-05-29-interpreted-graph/graph.js new file mode 100644 index 000000000..b048f9004 --- /dev/null +++ b/static/2024-05-29-interpreted-graph/graph.js @@ -0,0 +1,403 @@ +import { BehaviorSubject, combineLatest } from 'https://cdn.jsdelivr.net/npm/rxjs@7.8.1/+esm'; +import Ajv from 'https://cdn.jsdelivr.net/npm/ajv@8.14.0/+esm' +import Mustache from 'https://cdn.jsdelivr.net/npm/mustache@4.2.0/+esm' +import { render, html } from 'https://cdn.jsdelivr.net/npm/lit-html@3.1.3/+esm' + +const tag = (name) => (props, ...children) => ({ name, props, children }); +const VStack = tag('div'); +const Checkbox = tag('checkbox'); +const Label = tag('label'); +const Heading = tag('h1'); +const ForEach = (items, template) => { + return items.map(template) +}; +const TodoItem = ({ label, checked, onClick }) => Label({ label, onClick }, Checkbox({ checked })) + +// next steps: +// 1. updating state and re-rendering via callbacks (implies using a different templating system) +// 2. bind in two phases, register names in context and then for each note, using "imports", we map those global names to local names + +export function start() { } + +function coerce(val) { + if (val == 'true') return true; + if (val == 'false') return false; + if (!isNaN(val)) return parseFloat(val); + return val; +} + +const system = { + get: (key) => { + if (key == 'todos') { + return [ + { label: 'Buy groceries', checked: false }, + { label: 'Vacuum house', checked: true }, + { label: 'Learn RxJS', checked: false } + ] + } + } +}; + +// Function to create the RxJS network from JSON document +function createRxJSNetworkFromJson(jsonDocument) { + const context = {}; + const validators = {}; + + // Create subjects and validators for each cell + jsonDocument.conversation.forEach(conversation => { + conversation.messages.forEach(message => { + if (message.role === 'assistant') { + const cellName = message.name || generateUniqueId(); + context[cellName] = new BehaviorSubject(message.output.schema.default || null); + } + }); + }); + + // Define a unique ID generator + function generateUniqueId() { + return '_' + Math.random().toString(36).substr(2, 9); + } + + // Process messages and set up reactive bindings + jsonDocument.conversation.forEach(conversation => { + conversation.messages.forEach(message => { + if (message.role === 'assistant') { + const cellName = message.name || generateUniqueId(); + + if (message.contentType === 'text/javascript') { + // Evaluate the JavaScript content and bind it to the subject + const func = new Function('system', ...message.content.args, message.content.body); + const result = func(system, { + get: (key) => context[key].getValue(), + set: (key, value) => context[key].next(value) + }); + + // // Validate the result against the output schema + // if (validators[`${cellName}_output`] && !validators[`${cellName}_output`](result)) { + // console.error(`Output validation failed for cell ${cellName}`, validators[`${cellName}_output`].errors); + // } else { + context[cellName].next(result); + // } + } else if (message.contentType === 'text/vnd.common.template') { + // Set up template rendering + const { inputs } = message; + const inputObservables = []; + + for (const [key, schema] of Object.entries(inputs)) { + const inputName = key; + if (context[inputName]) { + inputObservables.push(context[inputName]); + } + } + + combineLatest(inputObservables).subscribe(values => { + const inputValues = values.reduce((acc, value, index) => { + const key = Object.keys(inputs)[index]; + acc[key] = value; + return acc; + }, {}); + + const renderedTemplate = (message.content(inputValues)); + context[cellName]?.next(renderedTemplate); + }); + } + } + }); + }); + + return context; +} + +// Example JSON document +const jsonDocument = { + "conversation": [ + { + "id": "", + "messages": [ + { + "role": "user", + "content": "Write a title" + }, + { + "role": "assistant", + "contentType": "text/javascript", + "name": "title", + "inputs": {}, + "output": { + "schema": { + "type": "string", + } + }, + "content": { + args: [], + body: "return 'hello'" + } + } + ] + }, + { + "id": "", + "messages": [ + { + "role": "user", + "content": "Get my todos" + }, + { + "role": "assistant", + "contentType": "text/javascript", + "name": "todos", + "inputs": {}, + "output": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "checked": { + "type": "boolean", + "default": false + } + }, + "required": ["label"], + }, + "default": [] + } + }, + "content": { + args: [], + body: "return system.get('todos')" + } + } + ] + }, + { + "id": "", + "messages": [ + { + "role": "user", + "content": "I would like a todo item component, e.g. vacuum house" + }, + { + "role": "assistant", + "contentType": "text/vnd.common.template", + "tag": "todo-item", + "inputs": { + "checked": { + "type": "boolean", + "default": false + }, + "label": { + "type": "string" + } + }, + "output": { + "schema": { + "type": "template" + } + }, + "imports": { + "Label": "common:ui/label.component.json", + "Checkbox": "common:ui/checkbox.component.json" + }, + "content": ({ label, checked }) => Label({ label, test: 'test' }, Checkbox({ checked })) + } + ] + }, + { + "id": "", + "messages": [ + { + "role": "user", + "content": "Ok, now make a task list using that todo item." + }, + { + "role": "assistant", + "contentType": "text/vnd.common.template", + "name": "ui", + "inputs": { + "title": { + "type": "string", + }, + "todos": { + "type": "array", + "items": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "checked": { + "type": "boolean", + "default": false + } + }, + "required": ["label"] + }, + "default": [] + } + }, + "output": { + "schema": { + "type": "template" + } + }, + // use these to bind names in context, don't infer via the inputs + "imports": { + "todos": "todos", + "title": "title", + "VStack": "common:ui/vstack.component.json", + "Header": "common:ui/label.component.json", + "Checkbox": "common:ui/checkbox.component.json", + "TodoItem": "todo-item" + }, + "content": ({ title, todos }) => + VStack({}, + Heading({ text: title }), + VStack({}, + ForEach(todos, TodoItem) + ) + ) + } + ] + } + ] +}; + +const calendar = { + "conversation": [ + { + "id": "", + "messages": [ + { + "role": "user", + "content": "Get my calendar events" + }, + { + "role": "assistant", + "contentType": "text/javascript", + "name": "calendarEvents", + "inputs": {}, + "output": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "date": { + "type": "string", + "format": "date-time" + } + }, + "required": ["title", "date"] + } + } + }, + "content": { + "args": [], + "body": "return system.get('calendarEvents')" + } + } + ] + }, + { + "id": "", + "messages": [ + { + "role": "user", + "content": "I would like a calendar event item component, e.g. Meeting with Bob - 2024-05-29T14:30:00Z" + }, + { + "role": "assistant", + "contentType": "text/vnd.common.template", + "tag": "calendar-event", + "inputs": { + "title": { + "type": "string" + }, + "date": { + "type": "string", + "format": "date-time" + } + }, + "output": { + "schema": { + "type": "template" + } + }, + "content": "
{{title}} - {{date}}
" + } + ] + }, + { + "id": "", + "messages": [ + { + "role": "user", + "content": "Ok, now make a calendar list using that calendar event." + }, + { + "role": "assistant", + "contentType": "text/vnd.common.template", + "name": "ui", + "inputs": { + "events": { + "type": "array", + "items": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "date": { + "type": "string", + "format": "date-time" + } + }, + "required": ["title", "date"] + }, + "default": [] + } + }, + "output": { + "schema": { + "type": "template" + } + }, + "imports": { + "event": "calendar-event" + }, + "content": "

{{title}}

" + } + ] + } + ] +} + +// Create the RxJS network +const subjects = createRxJSNetworkFromJson(jsonDocument); + +// Example usage: Adding a new todo item +// subjects['todos'].next([ +// { label: 'Buy groceries', checked: false }, +// { label: 'Vacuum house', checked: true }, +// { label: 'Learn RxJS', checked: false } +// ]); + +// Example usage: Updating the title +subjects['title'].next('My Updated Task List'); + +console.log(subjects) + +subjects['ui'].subscribe(console.log); +// subjects['calendarEvents'].subscribe(console.log); +subjects['ui'].subscribe(html => { + document.getElementById('tree').innerHTML = JSON.stringify(html, null, 2); +}); + +window.subjects = subjects; diff --git a/static/interpreted-graph/index.html b/static/2024-05-29-interpreted-graph/index.html similarity index 96% rename from static/interpreted-graph/index.html rename to static/2024-05-29-interpreted-graph/index.html index f2349674d..d71f74a9a 100644 --- a/static/interpreted-graph/index.html +++ b/static/2024-05-29-interpreted-graph/index.html @@ -39,6 +39,8 @@
+

+
         
diff --git a/static/2024-05-29-interpreted-graph/json-ui-tree-sketch-bindings.js b/static/2024-05-29-interpreted-graph/json-ui-tree-sketch-bindings.js
new file mode 100644
index 000000000..7b0921fed
--- /dev/null
+++ b/static/2024-05-29-interpreted-graph/json-ui-tree-sketch-bindings.js
@@ -0,0 +1,102 @@
+const clicks = () => {
+  return Signal(0)
+}
+
+const todoItem = {
+  "tag": "div",
+  "props": {},
+  "children": [{
+    "tag": "label",
+    "props": {
+      "label": {
+        "type": "string"
+      }
+    },
+    "children": [
+      {
+        "tag": "checkbox",
+        "props": {
+          "checked": {
+            "type": "boolean"
+          },
+          "onclick": {
+            "$id": "https://common.tools/stream-binding.schema.json",
+            "name": "clicks"
+          }
+        },
+        "children": []
+      }
+    ]
+  }]
+}
+
+const tree = {
+  "tag": "div",
+  "props": {},
+  "children": [
+    {
+      "tag": "h1",
+      "props": {
+        "text": "My Updated Task List"
+      },
+      "children": []
+    },
+    {
+      "tag": "div",
+      "props": {},
+      "children": [
+        [
+          {
+            "tag": "label",
+            "props": {
+              "label": "Buy groceries"
+            },
+            "children": [
+              {
+                "tag": "checkbox",
+                "props": {
+                  "checked": false,
+                  "onclick": {
+                    "$id": "https://common.tools/stream-binding.schema.json",
+                    "name": "clicks"
+                  }
+                },
+                "children": []
+              }
+            ]
+          },
+          {
+            "tag": "label",
+            "props": {
+              "label": "Vacuum house"
+            },
+            "children": [
+              {
+                "tag": "checkbox",
+                "props": {
+                  "checked": true
+                },
+                "children": []
+              }
+            ]
+          },
+          {
+            "tag": "label",
+            "props": {
+              "label": "Learn RxJS"
+            },
+            "children": [
+              {
+                "tag": "checkbox",
+                "props": {
+                  "checked": false
+                },
+                "children": []
+              }
+            ]
+          }
+        ]
+      ]
+    }
+  ]
+}
diff --git a/static/2024-05-30-json-to-html/index.html b/static/2024-05-30-json-to-html/index.html
new file mode 100644
index 000000000..4f4975ac8
--- /dev/null
+++ b/static/2024-05-30-json-to-html/index.html
@@ -0,0 +1,34 @@
+
+
+    
+        test
+    
+    
+    
+        
+
+ +
+

+            

+        
+ + + + diff --git a/static/2024-05-30-json-to-html/index.js b/static/2024-05-30-json-to-html/index.js new file mode 100644 index 000000000..27963d77f --- /dev/null +++ b/static/2024-05-30-json-to-html/index.js @@ -0,0 +1,224 @@ +import { BehaviorSubject, Subject, combineLatest } from 'https://cdn.jsdelivr.net/npm/rxjs@7.8.1/+esm'; + +const STREAM = 'https://common.tools/stream-binding.schema.json' +const CELL = 'https://common.tools/cell-binding.schema.json' + +function createElement(node, context) { + if (typeof node === 'string') { + const textNode = document.createTextNode(node); + return textNode; + } + + if (!node || typeof node !== 'object') return null; + + // Handle text nodes + if (!node.tag && node.$id && node.name) { + // Bind the reactive source to update the text node if it changes + if (context[node.name] && context[node.name].subscribe) { + if (node.type == 'slot') { + const uiNode = createElement(context[node.name].getValue(), context) + context[node.name].subscribe(newValue => { + uiNode.innerHTML = ''; + uiNode.appendChild(createElement(newValue, context)); + }); + return uiNode; + } else { + const textNode = document.createTextNode(context[node.name] || ''); + context[node.name].subscribe(newValue => { + textNode.textContent = newValue; + }); + return textNode; + } + } + } + + // Handle element nodes + const element = document.createElement(node.tag); + + // Set properties + for (const [key, value] of Object.entries(node.props || {})) { + if (typeof value === 'object' && value.type) { + // Handle specific types and bind reactive sources from context + if (value.type && value["$id"] && value["$id"] === CELL) { + let name = value.name || key; + if (!context[name]) continue; + element[key] = context[name].getValue(); + context[name].subscribe(newValue => element[key] = newValue); + } else { + // Fallback to setting attribute + element.setAttribute(key, value.type); + } + } else if (value["$id"] && value["$id"] === STREAM && value.name) { + // Handle event binding to a stream + if (context[value.name]) { + element.addEventListener(key, context[value.name]); + } + } else { + element[key] = value; + } + } + + // Recursively create and append child elements + (node.children || []).forEach(childNode => { + const childElement = createElement(childNode, context); + if (childElement) { + element.appendChild(childElement); + } + }); + + return element; +} + +// Example usage +const uiTree = { + "tag": "div", + "props": { + "style": "padding: 10px; border: 1px solid #ccc;" + }, + "children": [ + { + "tag": "input", + "props": { + "type": "text", + "input": { + "$id": "https://common.tools/stream-binding.schema.json", + "name": "changes" + }, + "value": { + "$id": "https://common.tools/cell-binding.schema.json", + "type": "string", + "name": "label" + } + } + }, + { "tag": "br" }, + { + "tag": "label", + "props": {}, + "children": [ + { + "tag": "input", + "props": { + "type": "checkbox", + "checked": { + "$id": "https://common.tools/cell-binding.schema.json", + "type": "boolean" + }, + "click": { + "$id": "https://common.tools/stream-binding.schema.json", + "name": "clicks" + } + }, + "children": [] + }, + { + "$id": "https://common.tools/cell-binding.schema.json", + "type": "string", + "name": "label" + } + ] + }, + { "tag": "br" }, + { + "$id": "https://common.tools/cell-binding.schema.json", + "type": "slot", + "name": "dynamic" + }, + { "tag": "br" }, + { + "$id": "https://common.tools/cell-binding.schema.json", + "type": "slot", + "name": "list" + }, + ] +}; + + +// output of a code node, tree held in a cell +function DynamicComponent(checked) { + return { + tag: "b", + props: {}, + children: [ + { + tag: "label", + children: [ + checked ? "Yo!" : 'Nope!' + ] + }, + { + tag: "button", + props: { + disabled: checked ? false : true, + click: { + "$id": "https://common.tools/stream-binding.schema.json", + "name": "addItem" + } + }, + children: [ + "Click me!" + ] + } + ] + } +} + +function List(items) { + return { + tag: "ul", + props: {}, + children: items.map(item => { + return { + tag: "li", + props: {}, + children: [ + item + ] + } + }) + } +} + +const items = new BehaviorSubject(['one']) +const label = new BehaviorSubject('Toggle') +const checked = new BehaviorSubject(false); +const dynamic = new BehaviorSubject(DynamicComponent(false)); +const list = new BehaviorSubject(List(items.getValue())); + +const context = { + label, + checked, + dynamic, + list, + addItem: () => { + items.next([...items.getValue(), label.getValue()]); + list.next(List(items.getValue())); + }, + clicks: () => { + checked.next(!checked.getValue()); + dynamic.next(DynamicComponent(checked.getValue())); + }, + changes: (event) => { + label.next(event.target.value) + } +}; + +// Object.values(context).forEach(cell => { +// if (cell && cell.subscribe) { +// cell.subscribe(() => { +// debug(); +// }) +// } +// }); + +function debug() { + document.querySelector('#tree').innerHTML = JSON.stringify(uiTree, null, 2); + document.querySelector('#ctx').innerHTML = JSON.stringify(context, null, 2); +} + +export function start() { + debug(); + + const todoElement = createElement(uiTree, context); + document.querySelector('#app').appendChild(todoElement); +} diff --git a/static/interpreted-graph/graph.js b/static/interpreted-graph/graph.js deleted file mode 100644 index 58e48e007..000000000 --- a/static/interpreted-graph/graph.js +++ /dev/null @@ -1,300 +0,0 @@ -import { BehaviorSubject, combineLatest } from 'https://cdn.jsdelivr.net/npm/rxjs@7.8.1/+esm'; -import Ajv from 'https://cdn.jsdelivr.net/npm/ajv@8.14.0/+esm' -import Mustache from 'https://cdn.jsdelivr.net/npm/mustache@4.2.0/+esm' - -export function start() { } - -function coerce(val) { - if (val == 'true') return true; - if (val == 'false') return false; - if (!isNaN(val)) return parseFloat(val); - return val; -} - -// Function to create the RxJS network from JSON document -function createRxJSNetworkFromJson(jsonDocument) { - const ajv = new Ajv(); - const cells = {}; - const validators = {}; - - - const system = { - get: (key) => { - if (key == 'todos') { - return [ - { label: 'Buy groceries', checked: false }, - { label: 'Vacuum house', checked: true }, - { label: 'Learn RxJS', checked: false } - ] - } - } - }; - - // Create subjects and validators for each cell - jsonDocument.conversation.forEach(conversation => { - conversation.messages.forEach(message => { - if (message.role === 'assistant') { - const cellName = message.name || generateUniqueId(); - - cells[cellName] = new BehaviorSubject(null); - - // if (message.inputs) { - - // for (const [key, schema] of Object.entries(message.inputs)) { - // const inputName = key; - // validators[inputName] = ajv.compile(message.input); - // } - - // if schema has not been compiled, compile it - - // } - - // // If there is an output schema, validate the output - // if (message.output && message.output.schema) { - // validators[`${cellName}_output`] = ajv.compile(message.output.schema); - // } - } - }); - }); - - // Define a unique ID generator - function generateUniqueId() { - return '_' + Math.random().toString(36).substr(2, 9); - } - - // Process messages and set up reactive bindings - jsonDocument.conversation.forEach(conversation => { - conversation.messages.forEach(message => { - if (message.role === 'assistant') { - const cellName = message.name || generateUniqueId(); - - if (message.contentType === 'text/javascript') { - // Evaluate the JavaScript content and bind it to the subject - const func = new Function('system', ...message.content.args, message.content.body); - const result = func(system, { - get: (key) => cells[key].getValue(), - set: (key, value) => cells[key].next(value) - }); - - // Validate the result against the output schema - if (validators[`${cellName}_output`] && !validators[`${cellName}_output`](result)) { - console.error(`Output validation failed for cell ${cellName}`, validators[`${cellName}_output`].errors); - } else { - cells[cellName].next(result); - } - } else if (message.contentType === 'text/vnd.common.template') { - // Set up template rendering - const { inputs } = message; - const inputObservables = []; - - for (const [key, schema] of Object.entries(inputs)) { - const inputName = key; - if (cells[inputName]) { - inputObservables.push(cells[inputName]); - } - } - - if (message.tag) { - // register as web component - customElements.define(message.tag, class extends HTMLElement { - constructor() { - super(); - this.attachShadow({ mode: 'open' }); - } - - connectedCallback() { - const attrs = Object.fromEntries(Object.entries(this.attributes).map(([key, attr]) => ([attr.name, coerce(attr.value)]))); - - attrs.alert = () => { - alert('clicked'); - }; - - const renderedTemplate = Mustache.render(message.content, attrs); - this.shadowRoot.innerHTML = renderedTemplate; - } - }); - } else { - combineLatest(inputObservables).subscribe(values => { - const inputValues = values.reduce((acc, value, index) => { - const key = Object.keys(inputs)[index]; - acc[key] = value; - return acc; - }, {}); - - const renderedTemplate = Mustache.render(message.content, inputValues); - cells[cellName]?.next(renderedTemplate); - }); - } - } - } - }); - }); - - return cells; -} - -// Example JSON document -const jsonDocument = { - "conversation": [ - { - "id": "", - "messages": [ - { - "role": "user", - "content": "Write a title" - }, - { - "role": "assistant", - "contentType": "text/javascript", - "name": "title", - "inputs": {}, - "output": { - "schema": { - "type": "string", - } - }, - "content": { - args: [], - body: "return 'hello'" - } - } - ] - }, - { - "id": "", - "messages": [ - { - "role": "user", - "content": "Get my todos" - }, - { - "role": "assistant", - "contentType": "text/javascript", - "name": "todos", - "inputs": {}, - "output": { - "schema": { - "type": "array", - "items": { - "type": "object", - "properties": { - "label": { - "type": "string" - }, - "checked": { - "type": "boolean", - "default": false - } - }, - "required": ["label"] - } - } - }, - "content": { - args: [], - body: "return system.get('todos')" - } - } - ] - }, - { - "id": "", - "messages": [ - { - "role": "user", - "content": "I would like a todo item component, e.g. vacuum house" - }, - { - "role": "assistant", - "contentType": "text/vnd.common.template", - "tag": "todo-item", - "imports": { - "label": "common:ui/label.component.json", - "checkbox": "common:ui/checkbox.component.json" - }, - "inputs": { - "checked": { - "type": "boolean", - "default": false - }, - "label": { - "type": "string" - } - }, - "output": { - "schema": { - "type": "template" - } - }, - "content": "" - } - ] - }, - { - "id": "", - "messages": [ - { - "role": "user", - "content": "Ok, now make a task list using that todo item." - }, - { - "role": "assistant", - "contentType": "text/vnd.common.template", - "name": "ui", - "inputs": { - "title": { - "type": "string", - }, - "todos": { - "type": "array", - "items": { - "type": "object", - "properties": { - "label": { - "type": "string" - }, - "checked": { - "type": "boolean", - "default": false - } - }, - "required": ["label"] - }, - "default": [] - } - }, - "output": { - "schema": { - "type": "template" - } - }, - "imports": { - "task": "todo-item" - }, - "content": "

{{title}}

" - } - ] - } - ] -}; - -// Create the RxJS network -const subjects = createRxJSNetworkFromJson(jsonDocument); - -// Example usage: Adding a new todo item -// subjects['todos'].next([ -// { label: 'Buy groceries', checked: false }, -// { label: 'Vacuum house', checked: true }, -// { label: 'Learn RxJS', checked: false } -// ]); - -// Example usage: Updating the title -subjects['title'].next('My Updated Task List'); - -console.log(subjects) - -// subjects['ui'].subscribe(console.log); -subjects['todos'].subscribe(console.log); -subjects['ui'].subscribe(html => { - document.getElementById('app').innerHTML = html; -});