32 lines
1004 B
JavaScript
32 lines
1004 B
JavaScript
// Pinokio menu "Start": runs the local server (server.py) and records its URL.
|
|
module.exports = {
|
|
// daemon: keeps the server running in the background until stopped from Pinokio.
|
|
daemon: true,
|
|
run: [
|
|
// Step 1: start the server.
|
|
{
|
|
// Run server.py in app/ with uv (its script dependencies are resolved by uv).
|
|
method: "shell.run",
|
|
params: {
|
|
path: "app",
|
|
// LOG_LEVEL: INFO (default) or DEBUG (adds HTTP request lines + Prefect debug output)
|
|
env: { LOG_LEVEL: "INFO" },
|
|
// port stays 18765: the browser extension's host_permissions hardcode it
|
|
message: "uv run --script server.py",
|
|
on: [{
|
|
// Wait for the URL the server prints (http://IP:port); the step is done once it matches.
|
|
event: "/(http:\\/\\/[0-9.:]+)/",
|
|
done: true
|
|
}]
|
|
}
|
|
},
|
|
{
|
|
// Step 2: save the URL so pinokio.js can show "Open Web UI".
|
|
method: "local.set",
|
|
params: {
|
|
url: "{{input.event[1]}}"
|
|
}
|
|
}
|
|
]
|
|
}
|