@fungi.computer/spore 0.10.0 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,117 @@
1
+ # Fungi VM: a Lima template that runs Fungi's agent in its own Linux VM.
2
+ # It ships inside Spore; `fungi vm` starts it from the project folder you want
3
+ # the agent to work on, with only that folder mounted.
4
+ #
5
+ # The agent can change and run anything in the mounted project folder and reach
6
+ # the internet. Your home folder, SSH keys and other projects are not mounted,
7
+ # and no SSH agent or port is forwarded. Lima owns the VM's lifecycle:
8
+ # `limactl stop`, `limactl start` and `limactl delete`.
9
+ # Guide: https://docs.fungi.computer/guides/run-fungi-in-a-vm/
10
+
11
+ minimumLimaVersion: 2.0.0
12
+
13
+ # Lima's maintained Ubuntu 24.04 LTS image list, pinned by digest in each Lima
14
+ # release. Deliberately not `template:_default/mounts`, which mounts your home.
15
+ base:
16
+ - template:_images/ubuntu-24.04
17
+
18
+ cpus: 2
19
+ memory: 4GiB
20
+ disk: 20GiB
21
+
22
+ # No mounts unless `--mount-only` names one. Lima mounts a writable folder at
23
+ # the same path inside the VM.
24
+ mounts: []
25
+
26
+ # No container runtime: Fungi does not need one.
27
+ containerd:
28
+ system: false
29
+ user: false
30
+
31
+ ssh:
32
+ # Your SSH agent stays on your computer.
33
+ forwardAgent: false
34
+ # Your ~/.ssh public keys are not copied into the VM.
35
+ loadDotSSHPubKeys: false
36
+
37
+ # Ports opened inside the VM stay inside it. Forward one explicitly with
38
+ # `limactl start --port-forward` if you need to reach it from your computer.
39
+ portForwards:
40
+ - guestIP: 0.0.0.0
41
+ proto: any
42
+ ignore: true
43
+ - guestIP: 127.0.0.1
44
+ proto: any
45
+ ignore: true
46
+
47
+ param:
48
+ # Node.js 24 LTS, pinned with Node's published SHA-256 checksums.
49
+ NODE_VERSION: 24.22.1
50
+ NODE_SHA256_X64: 6c172a9ab6718f7b801fb5a7bd486af2ee5e32758086a04b84fcce2aa77095e6
51
+ NODE_SHA256_ARM64: dbabf7a1cbf947e6059ffad2c27b80041db97dea1e553b62afdee7f13fca336e
52
+ # The published docs copy pins the current Spore release.
53
+ SPORE_VERSION: latest
54
+
55
+ provision:
56
+ - mode: system
57
+ script: |
58
+ #!/bin/bash
59
+ set -euo pipefail
60
+ if ! command -v bwrap >/dev/null || ! command -v git >/dev/null; then
61
+ export DEBIAN_FRONTEND=noninteractive
62
+ apt-get update -q
63
+ apt-get install -yq --no-install-recommends bubblewrap ca-certificates curl git xz-utils
64
+ fi
65
+ # Ubuntu 24.04 blocks unprivileged user namespaces by default, which
66
+ # leaves Fungi's Workspace sandbox (bubblewrap) unavailable in the VM.
67
+ echo "kernel.apparmor_restrict_unprivileged_userns = 0" >/etc/sysctl.d/60-fungi-sandbox.conf
68
+ sysctl -q --system
69
+ # host.lima.internal is your computer's localhost seen from the VM. Drop
70
+ # new connections to it on every boot so services bound to your
71
+ # computer's 127.0.0.1 stay out of reach. Root in the VM can undo this.
72
+ # DNS must keep working: on macOS (VZ) the resolver is this same address,
73
+ # and with QEMU Lima DNATs 192.168.5.3:53 to it, hence the original
74
+ # destination match.
75
+ host_address="$(getent ahostsv4 host.lima.internal | awk 'NR == 1 { print $1 }')"
76
+ if [ -n "$host_address" ]; then
77
+ nft delete table inet fungi_vm 2>/dev/null || true
78
+ nft -f - <<EOF
79
+ table inet fungi_vm {
80
+ chain output {
81
+ type filter hook output priority 0; policy accept;
82
+ ct original ip daddr ${host_address} meta l4proto { tcp, udp } th dport 53 accept
83
+ ct original ip daddr ${host_address} ct state new drop
84
+ }
85
+ }
86
+ EOF
87
+ fi
88
+ if [ "$(node --version 2>/dev/null)" != "v${PARAM_NODE_VERSION}" ]; then
89
+ case "$(uname -m)" in
90
+ x86_64) node_arch=x64; node_sha256="${PARAM_NODE_SHA256_X64}" ;;
91
+ aarch64) node_arch=arm64; node_sha256="${PARAM_NODE_SHA256_ARM64}" ;;
92
+ *) echo "Fungi VM supports x86_64 and aarch64 guests, not $(uname -m)" >&2; exit 1 ;;
93
+ esac
94
+ archive="node-v${PARAM_NODE_VERSION}-linux-${node_arch}.tar.xz"
95
+ curl -fsSLo "/tmp/${archive}" "https://nodejs.org/dist/v${PARAM_NODE_VERSION}/${archive}"
96
+ echo "${node_sha256} /tmp/${archive}" | sha256sum -c -
97
+ tar -xJf "/tmp/${archive}" -C /usr/local --strip-components=1 \
98
+ --exclude=CHANGELOG.md --exclude=LICENSE --exclude=README.md
99
+ rm -f "/tmp/${archive}"
100
+ fi
101
+ if [ ! -e /usr/local/lib/node_modules/@fungi.computer/spore/package.json ]; then
102
+ npm install --global --no-fund --no-audit "@fungi.computer/spore@${PARAM_SPORE_VERSION}"
103
+ fi
104
+
105
+ probes:
106
+ - mode: readiness
107
+ description: Node.js and the fungi command to be installed
108
+ script: |
109
+ #!/bin/bash
110
+ set -eu
111
+ if ! timeout 600s bash -c "until command -v fungi >/dev/null; do sleep 3; done"; then
112
+ echo >&2 "the fungi command is not installed yet"
113
+ exit 1
114
+ fi
115
+ hint: |
116
+ Spore was not installed. Run `limactl shell <instance> sudo cat /var/log/cloud-init-output.log`
117
+ and check the guest's network access to nodejs.org and registry.npmjs.org.