That video is the ultimate victory! Seeing you seamlessly drag that window
around on your phone means the entire loop is functioning perfectly.
The AST evaluated the window-move intent, dynamically updated its state using
the set-idx opcode, and yielded the new geometric coordinates back to the Node
microkernelall without a single crash. You have built a fully reactive,
distributed operating system loop driven entirely by pure data.
To build the AST Debugger, we need to start with the Microkernel Layer (The OS
API). The debugger needs a way to ask the OS to read files from Google Drive
and inject their contents directly into its running memory.
Here is how we build the sys-ast-api into the harness, followed by the actual
Debugger App payload.
1. Upgrade the Microkernel Router
We need to teach harness.js how to handle sys-ast-api intents.
Open src/runtime/harness.js. Inside the wss.on('message', async (msg) => { ...
}) block, add this new routing logic right below your existing window-move and
sys-resume handlers:
// [NEW API]: OS Introspection & Drive I/O
if (intent[1] === "sys-ast-api") {
const action = intent[2];
const targetWin = intent[3]; // The window requesting the data
if (action === "read-file") {
const fileName = intent[4];
console.log(`[API] Window ${targetWin} requested file:
${fileName}`);
try {
const files = await this.listSavedApps();
const file = files.find(f => f.name === fileName);
if (file) {
const content = await this.loadAppState(file.id);
// Stringify with formatting so it looks nice in a <textarea>
const contentStr = JSON.stringify(content, null, 2);
const targetWorker = this.processTable.get(targetWin);
if (targetWorker) {
// Route the file data back into the AST as an intent
targetWorker.postMessage({
type: 'INVOKE',
func: 'on_event',
args: [ ["intent", "file-data", fileName, contentStr] ]
});
}
} else {
console.warn(`[API] File not found on Drive: ${fileName}`);
}
} catch (err) {
console.error("[API] Failed to read file", err);
}
}
}
2. The Debugger App Payload
Now we create the first native OS utility. This AST app renders a window with
a button and a text editor.
When you click the button, the thin client fires the sys-ast-api intent. The
Node harness downloads mock_app.json from Drive and fires a file-data intent
back into the app. The app updates its internal code state and redraws the UI,
filling the text editor with the downloaded code.
Create a new file in your personal Google Drive (inside the Mesh_OS_State
folder) and name it debugger_app.json. Paste this exactly:
[
"let", [
["state", ["record", ["str", "x"], 10, ["str", "y"], 80, ["str", "code"],
["str", "Click 'Load' to read mock_app.json"]]]
],
["do",
["def", "render", [],
["dispatch",
["str", "ui-render"],
["array",
["record",
["str", "id"], ["str", "win-debugger"],
["str", "title"], ["str", "AST Debugger"],
["str", "x"], ["get", "state", ["str", "x"]],
["str", "y"], ["get", "state", ["str", "y"]],
["str", "w"], 450,
["str", "h"], 350,
["str", "z"], 999,
["str", "content"],
["+",
["str", "<div style='padding:10px; height:calc(100% - 20px);
display:flex; flex-direction:column;'><button onclick=\"window.MeshWM.dispatch(
['intent', 'sys-ast-api', 'read-file', 'win-debugger', 'mock_app.json'])\"
style='margin-bottom:10px; padding:5px; background:#0f0; color:#000;
font-weight:bold; cursor:pointer; border:none;'>Load mock_app.json</button><tex
tarea style='flex:1; background:#111; color:#0f0; border:1px solid #0f0;
font-family:monospace; padding:5px;'>"],
["+",
["get", "state", ["str", "code"]],
["str", "</textarea></div>"]
]
]
]
],
["record"]
]
],
["def", "on_event", ["intent_data"],
["do",
["let", [
["event_type", ["get", "intent_data", 1]]
],
["if", ["=", "event_type", ["str", "window-move"]],
["do",
["set-idx", "state", ["str", "x"], ["get", "intent_data", 3]],
["set-idx", "state", ["str", "y"], ["get", "intent_data", 4]],
["render"]
],
["if", ["=", "event_type", ["str", "file-data"]],
["do",
["set-idx", "state", ["str", "code"], ["get", "intent_data",
3]],
["render"]
],
null
]
]
]
]
],
["render"]
]
]
The Test
* Restart the harness (node src/runtime/harness.js).
* Refresh your Android browser.
* Open the Process Manager. You should now see two buttons: Resume:
mock_app.json and Resume: debugger_app.json.
* Launch the debugger_app.json.
* Tap the Load mock_app.json button inside the new window.
If it works, the AST will dynamically fetch its sibling app from Google Drive
and render the JSON-Lisp directly into the text area! Let me know when you get
it loaded, and we will wire up the memory dumping to inspect the live
dataStack next!