From 9046812b5fb5e14a637d52e0c2c35eb1a38744d7 Mon Sep 17 00:00:00 2001 From: AlyciaBHZ <50111876+AlyciaBHZ@users.noreply.github.com> Date: Wed, 17 Jun 2026 18:18:07 +0800 Subject: [PATCH 1/3] Add standalone compute pool service integration --- integrations/compute-pool-service/.gitignore | 3 + integrations/compute-pool-service/README.md | 173 ++++++ .../compute-pool-service/openapi.yaml | 201 +++++++ .../compute-pool-service/package.json | 14 + integrations/compute-pool-service/server.mjs | 508 ++++++++++++++++++ integrations/compute-pool-service/worker.mjs | 169 ++++++ 6 files changed, 1068 insertions(+) create mode 100644 integrations/compute-pool-service/.gitignore create mode 100644 integrations/compute-pool-service/README.md create mode 100644 integrations/compute-pool-service/openapi.yaml create mode 100644 integrations/compute-pool-service/package.json create mode 100644 integrations/compute-pool-service/server.mjs create mode 100644 integrations/compute-pool-service/worker.mjs diff --git a/integrations/compute-pool-service/.gitignore b/integrations/compute-pool-service/.gitignore new file mode 100644 index 00000000..198deac1 --- /dev/null +++ b/integrations/compute-pool-service/.gitignore @@ -0,0 +1,3 @@ +.compute-pool-store.json +.env +node_modules/ diff --git a/integrations/compute-pool-service/README.md b/integrations/compute-pool-service/README.md new file mode 100644 index 00000000..00097d10 --- /dev/null +++ b/integrations/compute-pool-service/README.md @@ -0,0 +1,173 @@ +# Compute Pool Service + +This integration is the long-term shape for shared GPU / Mac / lab compute: +the queue and worker protocol live outside NyxID core. NyxID manages the +service as a normal user/org service: auth, agent API keys, credential +injection, node routing, audit metadata, and future load balancing stay in +NyxID; compute-specific task state stays in this service. + +This integration does not require a NyxID org model change. To share it with +company members, create the NyxID service under the existing org owner and +use the current org membership/admin checks that already apply to services. + +## Architecture + +```text +agent / org user + -> NyxID proxy / service governance + -> optional NyxID Credential Node + -> compute-pool-service + -> trusted GPU/Mac/Slurm workers + -> local OpenAI-compatible backend +``` + +NyxID core does not store compute tasks, worker tokens, local backend URLs, +or local backend credentials. + +## Security Boundary + +This shares controlled task execution capacity, not host access. + +- NyxID does not SSH into worker hosts. +- NyxID does not execute shell commands. +- NyxID does not expose worker filesystems or environment variables. +- NyxID does not store worker-local model endpoint URLs. +- NyxID does not store worker-local backend bearer tokens. +- If routed through a Credential Node, the service API token can stay on the + node host and be injected locally. + +The standalone service stores task input/output in its own local store. The +default store is a JSON file intended for smoke tests and small trusted +deployments, not production durability. A production version should replace +the store with Postgres, Redis, MongoDB, or another managed queue backend. + +## Start The Service + +Generate two independent tokens: + +```bash +export COMPUTE_POOL_API_TOKEN="$(openssl rand -hex 32)" +export COMPUTE_POOL_WORKER_TOKEN="$(openssl rand -hex 32)" +``` + +Start the queue service on the private host: + +```bash +cd integrations/compute-pool-service +node server.mjs +``` + +For local throwaway testing only: + +```bash +COMPUTE_POOL_DEV_INSECURE=1 node server.mjs +``` + +## Add To NyxID As A Service + +Recommended: run a NyxID Credential Node on the host that can reach this +service, then register the service through that node. + +```bash +nyxid service add --custom \ + --slug chrono-compute \ + --label "Chrono Compute Pool" \ + --endpoint-url "http://127.0.0.1:8787" \ + --auth-method bearer \ + --auth-key-name "Authorization" \ + --via-node +``` + +Then store the service API token on the node: + +```bash +nyxid node credentials add \ + --service chrono-compute \ + --url "http://127.0.0.1:8787" \ + --header "Authorization" \ + --secret-format bearer +``` + +Agents and org members call it through NyxID like any other service: + +```bash +nyxid proxy request chrono-compute /v1/tasks \ + -m POST \ + -d '{"model":"codex-local","input":{"messages":[{"role":"user","content":"ping"}]}}' +``` + +The returned `task_id` can be polled: + +```bash +nyxid proxy request chrono-compute /v1/tasks/ +``` + +## Run A Worker + +Start a local OpenAI-compatible backend first, bound to localhost. Then run a +worker on that same trusted host: + +```bash +export COMPUTE_POOL_WORKER_TOKEN="..." + +node integrations/compute-pool-service/worker.mjs \ + --service-url http://127.0.0.1:8787 \ + --worker home-4060-a \ + --endpoint-url http://127.0.0.1:8000/v1/chat/completions \ + --backend vllm \ + --host-kind linux-nvidia \ + --gpu-name "RTX 4060" \ + --model codex-local +``` + +Use `--model '*'` only for workers that should accept any submitted model. +Workers with no advertised model do not claim model-routed work. + +If the local backend needs a token, keep it on the worker host: + +```bash +export LOCAL_BACKEND_TOKEN="..." + +node integrations/compute-pool-service/worker.mjs \ + --service-url http://127.0.0.1:8787 \ + --worker home-4090-a \ + --endpoint-url http://127.0.0.1:8000/v1/chat/completions \ + --backend-token-env LOCAL_BACKEND_TOKEN \ + --model codex-local +``` + +`LOCAL_BACKEND_TOKEN` is sent only to the local endpoint. It is not sent to +NyxID and is not sent to compute-pool-service. + +## API Summary + +Consumer API, called through NyxID service proxy: + +- `POST /v1/tasks` +- `GET /v1/tasks/{task_id}` +- `POST /v1/tasks/{task_id}/cancel` +- `GET /v1/status` + +Worker API, called directly by trusted workers: + +- `POST /worker/task?worker=