Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0951ba18e1 | ||
|
|
d0876626df |
@@ -1,4 +1,4 @@
|
|||||||
# Runs on the Nix runner on nexus (label `nixos`, host executor).
|
# Runs on a self-hosted Nix runner (label `nixos`, host executor).
|
||||||
name: ci
|
name: ci
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
|||||||
@@ -10,28 +10,33 @@ change its own code.
|
|||||||
|
|
||||||
## Start
|
## Start
|
||||||
|
|
||||||
You need [Nix](https://nixos.org/download) with flakes.
|
You need [Nix](https://nixos.org/download) with flakes, and an API token for
|
||||||
|
an LLM (OpenAI Responses or Anthropic Messages API). No clone needed:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
nix run -- init # creates ./world and builds the agent (a few minutes)
|
nix run git+https://gitea.surma.technology/surma/sausage -- init # creates ./world and builds the agent (a few minutes)
|
||||||
nix run -- run # starts the world and a console
|
nix run git+https://gitea.surma.technology/surma/sausage -- run # starts the world and a console
|
||||||
```
|
```
|
||||||
|
|
||||||
`init` asks for the API shape (`openai-responses` or `anthropic-messages`),
|
`init` asks for the API shape (`openai-responses` or `anthropic-messages`),
|
||||||
the base URL, the model, and the token. It reads `SAUSAGE_API`,
|
the base URL, the model, and the token. It reads `SAUSAGE_API`,
|
||||||
`SAUSAGE_BASE_URL`, `SAUSAGE_MODEL`, and `SAUSAGE_API_TOKEN` first. The
|
`SAUSAGE_BASE_URL`, `SAUSAGE_MODEL`, and `SAUSAGE_API_TOKEN` first. The
|
||||||
values go to `world/actor/agent/data/config.json`. Both commands take another
|
values go to `world/actor/agent/data/config.json`. Both commands take another
|
||||||
folder as an argument, for example `nix run -- run my-world`.
|
folder as an argument, for example `... -- run my-world`.
|
||||||
|
|
||||||
To keep a world on the newest version, run it in a loop:
|
To keep a world on the newest version, run it in a loop:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
nix run .#loop -- my-world # or .#loop-internal (Gitea on the LAN)
|
nix run git+https://gitea.surma.technology/surma/sausage#loop -- my-world
|
||||||
```
|
```
|
||||||
|
|
||||||
The loop runs `nix run --refresh git+ssh://…/surma/sausage -- run my-world`.
|
The loop runs `nix run --refresh git+https://gitea.surma.technology/surma/sausage -- run my-world`.
|
||||||
When the host crashes or an actor sends `@broker {"type":"exit"}`, the loop
|
When the host crashes or an actor sends `@broker {"type":"exit"}`, the loop
|
||||||
fetches the newest commit and starts it again. `/quit` ends the loop.
|
fetches the newest commit and starts it again. `/quit` ends the loop. Set
|
||||||
|
`SAUSAGE_FLAKE` to run another flake URL instead, for example your fork.
|
||||||
|
|
||||||
|
From a clone (`git clone https://gitea.surma.technology/surma/sausage`), the
|
||||||
|
same commands are `nix run -- init`, `nix run -- run` and `nix run .#loop`.
|
||||||
|
|
||||||
In the console:
|
In the console:
|
||||||
|
|
||||||
|
|||||||
@@ -36,15 +36,14 @@
|
|||||||
meta.mainProgram = "sausage";
|
meta.mainProgram = "sausage";
|
||||||
};
|
};
|
||||||
# `nix run .#loop -- <world>` runs the newest `sausage run <world>`
|
# `nix run .#loop -- <world>` runs the newest `sausage run <world>`
|
||||||
# from the Gitea repo, again and again: after a crash or a broker
|
# from the public repo, again and again: after a crash or a broker
|
||||||
# `exit` request it refreshes the flake and starts the host again,
|
# `exit` request it refreshes the flake and starts the host again,
|
||||||
# so the world updates itself. `/quit` (exit code 0) ends the loop.
|
# so the world updates itself. `/quit` (exit code 0) ends the loop.
|
||||||
# `--internal` (or `.#loop-internal`) uses Gitea's SSH port on the LAN.
|
# SAUSAGE_FLAKE overrides where it fetches from (any flake URL,
|
||||||
publicUrl = "git+ssh://containeruser@gitea.surma.technology:2222/surma/sausage";
|
# e.g. a fork or a local checkout).
|
||||||
internalUrl = "git+ssh://containeruser@10.0.0.2:2222/surma/sausage";
|
repoUrl = "git+https://gitea.surma.technology/surma/sausage";
|
||||||
loop = name: url: pkgs.writeShellScriptBin name ''
|
loop = pkgs.writeShellScriptBin "sausage-loop" ''
|
||||||
url="${url}"
|
url="''${SAUSAGE_FLAKE:-${repoUrl}}"
|
||||||
if [ "''${1:-}" = "--internal" ]; then url="${internalUrl}"; shift; fi
|
|
||||||
if [ $# -eq 0 ]; then set -- world; fi
|
if [ $# -eq 0 ]; then set -- world; fi
|
||||||
while true; do
|
while true; do
|
||||||
nix run --refresh "$url#default" -- run "$@"
|
nix run --refresh "$url#default" -- run "$@"
|
||||||
@@ -72,8 +71,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
apps.default = { type = "app"; program = "${sausage}/bin/sausage"; };
|
apps.default = { type = "app"; program = "${sausage}/bin/sausage"; };
|
||||||
apps.loop = { type = "app"; program = "${loop "sausage-loop" publicUrl}/bin/sausage-loop"; };
|
apps.loop = { type = "app"; program = "${loop}/bin/sausage-loop"; };
|
||||||
apps.loop-internal = { type = "app"; program = "${loop "sausage-loop-internal" internalUrl}/bin/sausage-loop-internal"; };
|
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
packages = [ rust pkgs.wasmtime pkgs.wasm-tools ];
|
packages = [ rust pkgs.wasmtime pkgs.wasm-tools ];
|
||||||
|
|||||||
Reference in New Issue
Block a user