Skip to content

Commit 43bebd5

Browse files
committed
feat: refactor instance management to use a plugin-based instance provider and agent app for status and actions.
1 parent 5161c74 commit 43bebd5

11 files changed

Lines changed: 74 additions & 1003 deletions

File tree

plugins/clawset-multipass/scripts/get.js

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// Get detailed info for a single Multipass instance
1+
// Get detailed VM info for a single Multipass instance
2+
// NOTE: This only returns machine-level info. App-specific status
3+
// (node, openclaw, provisioning) comes from the agent app's status script.
24
var instanceId = clawset.env("INSTANCE_ID");
35
var result = clawset.shell("multipass", ["info", instanceId, "--format", "json"]);
46

@@ -47,37 +49,6 @@ if (info.ipv4 && info.ipv4.length > 0) {
4749
ip = info.ipv4[0];
4850
}
4951

50-
// Check node/openclaw/provisioning status inside the VM
51-
var innerResult = clawset.shell("multipass", [
52-
"exec", instanceId, "--", "bash", "-ic",
53-
"source ~/.bashrc; echo '===NODE==='; node -v || echo 'NOT_FOUND'; echo '===OPENCLAW_VER==='; openclaw --version || echo 'NOT_FOUND'; echo '===PROVISIONING==='; if [ -f /tmp/provisioning ]; then echo 'YES'; else echo 'NO'; fi"
54-
]);
55-
56-
var nodeInstalled = null;
57-
var openclawInstalled = false;
58-
var isProvisioning = false;
59-
60-
if (innerResult.exitCode === 0) {
61-
var lines = innerResult.stdout.split("\n");
62-
var section = "";
63-
for (var i = 0; i < lines.length; i++) {
64-
var line = lines[i].trim();
65-
if (line === "===NODE===") { section = "node"; continue; }
66-
if (line === "===OPENCLAW_VER===") { section = "openclaw"; continue; }
67-
if (line === "===PROVISIONING===") { section = "provisioning"; continue; }
68-
69-
if (section === "node" && line !== "NOT_FOUND" && line !== "") {
70-
nodeInstalled = line;
71-
}
72-
if (section === "openclaw" && line !== "NOT_FOUND" && line !== "") {
73-
openclawInstalled = true;
74-
}
75-
if (section === "provisioning") {
76-
isProvisioning = (line === "YES");
77-
}
78-
}
79-
}
80-
8152
return {
8253
id: instanceId,
8354
name: instanceId,
@@ -92,8 +63,5 @@ return {
9263
memory: memory,
9364
storage: storage
9465
},
95-
mounts: mounts,
96-
node_installed: nodeInstalled,
97-
openclaw_installed: openclawInstalled,
98-
is_provisioning: isProvisioning
66+
mounts: mounts
9967
};

plugins/clawset-openclaw/manifest.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ scripts:
1919
update: scripts/install-ubuntu.sh
2020

2121
config:
22-
path: "/home/ubuntu/clawset/.openclaw/openclaw.json"
22+
path: "${HOME}/clawset/.openclaw/openclaw.json"
2323

2424
auth:
25-
path: "/home/ubuntu/clawset/.openclaw/agents/main/agent/auth-profiles.json"
25+
path: "${HOME}/clawset/.openclaw/agents/main/agent/auth-profiles.json"
2626

2727
requires_auth:
2828
- openai-codex
Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
#!/usr/bin/env bash
22
source ~/.bashrc 2>/dev/null || true
33

4-
# Output JSON status to stdout
5-
openclaw status --all --json 2>/dev/null || echo '{"running": false}'
4+
# Collect all app-level status as JSON
5+
# This is the agent app's responsibility — not the instance provider's
6+
7+
NODE_VERSION=""
8+
OPENCLAW_INSTALLED="false"
9+
OPENCLAW_STATUS="{}"
10+
IS_PROVISIONING="false"
11+
12+
# Node.js
13+
if command -v node &>/dev/null; then
14+
NODE_VERSION=$(node -v 2>/dev/null || echo "")
15+
fi
16+
17+
# OpenClaw
18+
if command -v openclaw &>/dev/null; then
19+
OPENCLAW_INSTALLED="true"
20+
OPENCLAW_STATUS=$(openclaw status --all --json 2>/dev/null || echo '{}')
21+
fi
22+
23+
# Provisioning
24+
if [ -f /tmp/provisioning ]; then
25+
IS_PROVISIONING="true"
26+
fi
27+
28+
# Output structured JSON
29+
cat <<EOF
30+
{
31+
"node_installed": "$NODE_VERSION",
32+
"openclaw_installed": $OPENCLAW_INSTALLED,
33+
"is_provisioning": $IS_PROVISIONING,
34+
"openclaw_status": $OPENCLAW_STATUS
35+
}
36+
EOF

src-tauri/setup-instance/provision.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ echo "npm : $(npm -v)"
6565
# -------------------------
6666
echo "Configuring OpenClaw Workspace Directories..."
6767

68-
WORKSPACE_DIR="/home/ubuntu/clawset"
68+
WORKSPACE_DIR="${HOME}/clawset"
6969
CONFIG_DIR="$WORKSPACE_DIR/.openclaw"
7070

7171
# Set for current script

0 commit comments

Comments
 (0)