Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile.steamcmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG VERSION=latest
FROM artifacts.druid.gg/druid-team/druid:${VERSION} AS base
FROM gameservermanagers/steamcmd:ubuntu-24.04
FROM gameservermanagers/steamcmd:ubuntu-24.04@sha256:b180c05a5b34a0d06c0d34180ecf6230c26f76cbf207162aba7efb38861ff393

RUN mkdir -p /tmp/steamcmd-seed && \
cp -a /home/steam/.local/share/Steam/steamcmd /tmp/steamcmd-seed/steamcmd && \
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ WSL_HOST_IP ?= $(word 1,$(shell hostname -I 2>/dev/null))
DRUID_WORKER_CALLBACK_URL_WINDOWS ?= http://$(WSL_HOST_IP):8083
DRUID_WATCH_ARGS ?= daemon --runtime kubernetes --listen 127.0.0.1:8081 --public-listen 127.0.0.1:8082 --worker-callback-listen $(DRUID_WORKER_CALLBACK_LISTEN) --worker-callback-url $(DRUID_WORKER_CALLBACK_URL) --unsafe-allow-unauthenticated-management --unsafe-allow-unauthenticated-public --k8s-namespace $(DRUID_K8S_NAMESPACE) --k8s-pull-image $(DRUID_K8S_PULL_IMAGE)
export DRUID_K8S_UI_S3_BUCKET ?= druid-ui
export DRUID_WORKLOAD_API_URL ?= http://host.docker.internal:8082
DRUID_AUTH_JWKS_URL ?= http://127.0.0.1:3010/v2/jwks
export DRUID_K8S_UI_S3_PUBLIC_BASE_URL ?= http://127.0.0.1:9000/druid-ui
export DRUID_K8S_UI_S3_REGION ?= us-east-1
export DRUID_K8S_UI_S3_ENDPOINT ?= http://host.docker.internal:9000
Expand Down Expand Up @@ -74,7 +76,7 @@ run: ## Run Daemon

watch: k3d-build-local-images ## Build local runtime images, then run Daemon with auto reload.
@command -v air >/dev/null 2>&1 || go install github.com/air-verse/air@latest
air --build.cmd "CGO_ENABLED=0 go build -ldflags '-X github.com/highcard-dev/daemon/internal.Version=$(VERSION)' -o ./bin/druid ./apps/druid" --build.full_bin "DRUID_REGISTRY_PLAIN_HTTP=true ./bin/druid $(DRUID_WATCH_ARGS)"
DRUID_AUTH_JWKS_URL="$(DRUID_AUTH_JWKS_URL)" air --build.cmd "CGO_ENABLED=0 go build -ldflags '-X github.com/highcard-dev/daemon/internal.Version=$(VERSION)' -o ./bin/druid ./apps/druid" --build.full_bin "DRUID_REGISTRY_PLAIN_HTTP=true ./bin/druid $(DRUID_WATCH_ARGS)"

watch-windows: ## Build local runtime images, then run the daemon with auto reload inside WSL2.
@grep -qi microsoft /proc/sys/kernel/osrelease 2>/dev/null || (echo "watch-windows must run inside WSL2; use make watch on Linux or macOS." >&2; exit 1)
Expand Down
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,55 @@ There is also websocket support for stdout. TTY is also supported.

Runtime selection is daemon-only: start the daemon with `druid daemon --runtime docker`, then use `druid` to create, run, and inspect scrolls without passing a runtime. Docker runtime state stays in SQLite under the runtime state directory. Scroll specs and runtime data live together in one runtime root.

Agent tools are exposed through `/:id/mcp` and normal REST resource routes.
Existing queue, command-run/removal and UI-publication routes are registered once
and accept either their existing owner authentication or scoped workload credentials.
Other owner REST endpoints are unchanged.

REST paths below are relative to `/:id/api/v1`. Tool arguments are JSON bodies;
GET limits use `tail_lines` or `timeout_seconds` query parameters. Workload
responses use the same result objects as MCP. Existing owner handlers preserve
their previous response shapes and status codes.

| MCP tool | REST operation |
| --- | --- |
| `list_commands` | `GET /commands` |
| `create_command` | `POST /commands` |
| `remove_command` | `DELETE /scroll/commands/:command` |
| `run_command` | `POST /command` |
| `wait_for_command` | `GET /commands/:command/wait` |
| `get_queue` | `GET /queue` |
| `read_logs` | `GET /consoles/:console/logs` |
| `search_logs` | `POST /consoles/:console/logs/search` |
| `send_stdin` | `POST /consoles/:console/stdin` |
| `get_deployment_status` | `GET /status` |
| `publish_ui` | `POST /ui/packages/:scope/publish` |

`remove_command` requires `commands:remove`, stops the command and removes its
definition, queue/status and runtime containers. Its console/log access is also
removed; deployment data and other commands are retained. New OpenHands commands
request this permission; existing Kubernetes agents require explicit recreation
to gain it.

Kubernetes authorizes each tool request when it is accepted. An accepted command
wait may finish after its caller's credential is revoked (at most 30 seconds);
subsequent requests must pass authentication again.

Commands have no execution IDs. `run_command` acknowledges the command name and
`wait_for_command` observes its current status. Restarted/replaced runs are not
distinguished, and delayed status events from older containers may update the
current command status.

**Docker agent-tool caveat:** HTTP/MCP tool endpoints on the Docker runtime are
unauthenticated and ignore command permissions. Anyone who can reach them can
invoke every tool for any deployment, including command creation/execution,
stdin, log access and UI publication. Docker creates no workload credentials or
identity registry. Use it only for trusted, single-user local development; keep
the daemon proxy bound to loopback and do not expose it to untrusted networks or
multi-tenant workloads. Container workloads may also reach these endpoints.
Existing authentication on unrelated dashboard, management and worker routes is
unchanged. Kubernetes retains Pod-bound authentication and per-tool permissions.

Kubernetes runtime support is available with `druid daemon --runtime kubernetes` for in-cluster daemons or out-of-cluster daemons using kubeconfig. It stores daemon scroll state in ConfigMaps, materializes OCI artifacts through `druid worker pull` Jobs, and uses kubelet pod stats for procedure-level traffic checks. See `docs/kubernetes_runtime.md` for kubeconfig, RBAC, and PVC setup.

## Documentation
Expand Down
21 changes: 6 additions & 15 deletions api/dev.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ paths:
get:
operationId: watchNotifications
tags: [watch]
summary: Subscribe to file change and build notifications
summary: Subscribe to file change notifications
responses:
'101':
description: WebSocket upgrade accepted
/api/v1/watch/status:
get:
operationId: getWatchStatus
tags: [watch]
summary: Get the in-container build watcher status
summary: Get the file watcher status
responses:
'200':
description: Watcher status
Expand All @@ -115,7 +115,7 @@ paths:
post:
operationId: enableWatch
tags: [watch]
summary: Start or reconfigure the in-container build watcher
summary: Start or reconfigure the file watcher
requestBody:
required: true
content:
Expand All @@ -135,7 +135,7 @@ paths:
post:
operationId: disableWatch
tags: [watch]
summary: Stop the in-container build watcher
summary: Stop the file watcher
responses:
'200':
description: Watcher stopped
Expand All @@ -147,23 +147,14 @@ components:
schemas:
WatchModeRequest:
type: object
required: [watch_paths, working_directory, command]
required: [watch_paths]
properties:
watch_paths:
type: array
minItems: 1
items:
type: string
description: Paths relative to the mounted runtime root.
working_directory:
type: string
description: Working directory relative to the mounted runtime root.
command:
type: array
minItems: 1
items:
type: string
description: Executable followed by its arguments.
description: Individual file paths relative to the mounted runtime root. Files can be created after the watcher starts.
WatchModeResponse:
type: object
required: [status]
Expand Down
13 changes: 10 additions & 3 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -242,21 +242,28 @@ components:
PublishUIPackageRequest:
type: object
properties:
path:
type: string
description: Optional scroll-root-relative .wasm path. Defaults to private/dist/app.wasm or public/dist/app.wasm.
with_build:
type: boolean
default: false
description: Run the scope's declared buildcommand as a dependency before uploading its declared WASM/OpenUI pair.

RuntimeUIPackage:
type: object
required:
- url
- path
- updated_at
- openui_url
- openui_path
properties:
url:
type: string
path:
type: string
openui_url:
type: string
openui_path:
type: string
updated_at:
type: string
format: date-time
Expand Down
Loading
Loading