diff --git a/buildomat.json b/buildomat.json new file mode 100644 index 0000000..011fd7c --- /dev/null +++ b/buildomat.json @@ -0,0 +1,863 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Buildomat", + "version": "1.0" + }, + "paths": { + "/v1/control/hold": { + "post": { + "operationId": "control_hold", + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json; charset=utf-8": { + "schema": { + "enum": [ + null + ] + } + } + } + } + } + } + }, + "/v1/control/resume": { + "post": { + "operationId": "control_resume", + "responses": { + "200": { + "description": "successful operation" + } + } + } + }, + "/v1/task/{Task}": { + "get": { + "operationId": "task_get", + "parameters": [ + { + "in": "path", + "name": "Task", + "required": true, + "schema": { + "type": "string" + }, + "style": "simple" + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/Task" + } + } + } + } + } + } + }, + "/v1/tasks": { + "get": { + "operationId": "tasks_get", + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json; charset=utf-8": { + "schema": { + "title": "Array_of_Task", + "type": "array", + "items": { + "$ref": "#/components/schemas/Task" + } + } + } + } + } + } + }, + "post": { + "operationId": "task_submit", + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/TaskSubmit" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/TaskSubmitResult" + } + } + } + } + } + } + }, + "/v1/tasks/{task}/events": { + "get": { + "operationId": "task_events_get", + "parameters": [ + { + "in": "path", + "name": "task", + "required": true, + "schema": { + "type": "string" + }, + "style": "simple" + }, + { + "in": "query", + "name": "minseq", + "schema": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json; charset=utf-8": { + "schema": { + "title": "Array_of_TaskEvent", + "type": "array", + "items": { + "$ref": "#/components/schemas/TaskEvent" + } + } + } + } + } + } + } + }, + "/v1/tasks/{task}/outputs": { + "get": { + "operationId": "task_outputs_get", + "parameters": [ + { + "in": "path", + "name": "task", + "required": true, + "schema": { + "type": "string" + }, + "style": "simple" + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json; charset=utf-8": { + "schema": { + "title": "Array_of_TaskOutput", + "type": "array", + "items": { + "$ref": "#/components/schemas/TaskOutput" + } + } + } + } + } + } + } + }, + "/v1/tasks/{task}/outputs/{output}": { + "get": { + "operationId": "task_output_download", + "parameters": [ + { + "in": "path", + "name": "output", + "required": true, + "schema": { + "type": "string" + }, + "style": "simple" + }, + { + "in": "path", + "name": "task", + "required": true, + "schema": { + "type": "string" + }, + "style": "simple" + } + ], + "responses": {} + } + }, + "/v1/users": { + "post": { + "operationId": "user_create", + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UserCreate" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UserCreateResult" + } + } + } + } + } + } + }, + "/v1/whoami": { + "get": { + "operationId": "whoami", + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/WhoamiResult" + } + } + } + } + } + } + }, + "/v1/whoami/name": { + "put": { + "operationId": "whoami_put_name", + "requestBody": { + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "responses": { + "200": { + "description": "successful operation" + } + } + } + }, + "/v1/worker/bootstrap": { + "post": { + "operationId": "worker_bootstrap", + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/WorkerBootstrap" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/WorkerBootstrapResult" + } + } + } + } + } + } + }, + "/v1/worker/ping": { + "get": { + "operationId": "worker_ping", + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/WorkerPingResult" + } + } + } + } + } + } + }, + "/v1/worker/task/{task}/append": { + "post": { + "operationId": "worker_task_append", + "parameters": [ + { + "in": "path", + "name": "task", + "required": true, + "schema": { + "type": "string" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/WorkerAppendTask" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation" + } + } + } + }, + "/v1/worker/task/{task}/chunk": { + "post": { + "operationId": "worker_task_upload_chunk", + "parameters": [ + { + "in": "path", + "name": "task", + "required": true, + "schema": { + "type": "string" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UploadedChunk" + } + } + } + } + } + } + }, + "/v1/worker/task/{task}/complete": { + "post": { + "operationId": "worker_task_complete", + "parameters": [ + { + "in": "path", + "name": "task", + "required": true, + "schema": { + "type": "string" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/WorkerCompleteTask" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "successful operation" + } + } + } + }, + "/v1/worker/task/{task}/output": { + "post": { + "operationId": "worker_task_add_output", + "parameters": [ + { + "in": "path", + "name": "task", + "required": true, + "schema": { + "type": "string" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/WorkerAddOutput" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation" + } + } + } + }, + "/v1/workers": { + "get": { + "operationId": "workers_list", + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/WorkersResult" + } + } + } + } + } + } + }, + "/v1/workers/recycle": { + "post": { + "operationId": "workers_recycle", + "responses": { + "200": { + "description": "successful operation" + } + } + } + } + }, + "components": { + "schemas": { + "Task": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "output_rules": { + "type": "array", + "items": { + "type": "string" + } + }, + "script": { + "type": "string" + }, + "state": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "output_rules", + "script", + "state" + ] + }, + "TaskEvent": { + "type": "object", + "properties": { + "payload": { + "type": "string" + }, + "seq": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "stream": { + "type": "string" + }, + "time": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "payload", + "seq", + "stream", + "time" + ] + }, + "TaskOutput": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "path": { + "type": "string" + }, + "size": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "id", + "path", + "size" + ] + }, + "TaskSubmit": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "output_rules": { + "type": "array", + "items": { + "type": "string" + } + }, + "script": { + "type": "string" + } + }, + "required": [ + "name", + "script" + ] + }, + "TaskSubmitResult": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": [ + "id" + ] + }, + "UploadedChunk": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": [ + "id" + ] + }, + "UserCreate": { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "required": [ + "name" + ] + }, + "UserCreateResult": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "token": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "token" + ] + }, + "WhoamiResult": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "id", + "name" + ] + }, + "Worker": { + "type": "object", + "properties": { + "deleted": { + "type": "boolean" + }, + "id": { + "type": "string" + }, + "instance_id": { + "type": "string" + }, + "lastping": { + "type": "string", + "format": "date-time" + }, + "recycle": { + "type": "boolean" + }, + "tasks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WorkerTask" + } + } + }, + "required": [ + "deleted", + "id", + "recycle", + "tasks" + ] + }, + "WorkerAddOutput": { + "type": "object", + "properties": { + "chunks": { + "type": "array", + "items": { + "type": "string" + } + }, + "path": { + "type": "string" + }, + "size": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "chunks", + "path", + "size" + ] + }, + "WorkerAppendTask": { + "type": "object", + "properties": { + "payload": { + "type": "string" + }, + "stream": { + "type": "string" + }, + "time": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "payload", + "stream", + "time" + ] + }, + "WorkerBootstrap": { + "type": "object", + "properties": { + "bootstrap": { + "type": "string" + }, + "token": { + "type": "string" + } + }, + "required": [ + "bootstrap", + "token" + ] + }, + "WorkerBootstrapResult": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": [ + "id" + ] + }, + "WorkerCompleteTask": { + "type": "object", + "properties": { + "failed": { + "type": "boolean" + } + }, + "required": [ + "failed" + ] + }, + "WorkerPingResult": { + "type": "object", + "properties": { + "poweroff": { + "type": "boolean" + }, + "task": { + "$ref": "#/components/schemas/WorkerPingTask" + } + }, + "required": [ + "poweroff" + ] + }, + "WorkerPingTask": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "output_rules": { + "type": "array", + "items": { + "type": "string" + } + }, + "script": { + "type": "string" + } + }, + "required": [ + "id", + "output_rules", + "script" + ] + }, + "WorkerTask": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "owner": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "owner" + ] + }, + "WorkersResult": { + "type": "object", + "properties": { + "workers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Worker" + } + } + }, + "required": [ + "workers" + ] + }, + "ObjWithOptionArray": { + "type": "object", + "properties": { + "things": { + "type": "array", + "items": { + "nullable": true, + "allOf": [ + { + "$ref": "#/components/schemas/Task" + } + ] + } + }, + "stranger-things": { + "type": "array", + "items": { + "nullable": true, + "allOf": [ + { + "$ref": "#/components/schemas/Task" + } + ], + "oneOf": [ + {} + ] + } + } + }, + "required": [ + "things", + "stranger-things" + ] + } + } + } +} diff --git a/flake.lock b/flake.lock index 7b2cdc3..3c4bc94 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "advisory-db": { "flake": false, "locked": { - "lastModified": 1731808107, - "narHash": "sha256-HSx5EDsO07KULW4bNPVeGVAfpQqzwwS005vqISdOzNg=", + "lastModified": 1733749954, + "narHash": "sha256-2Ug80Uf/oUujxgh02Iy5vTG0V+Ab9+YUHuRLRY0ayiY=", "owner": "rustsec", "repo": "advisory-db", - "rev": "8e353a172f1baf11c0c917cfc9ae3c5eff8b9d06", + "rev": "ec9ce28714bb38d77a2223e7266df705500a7f11", "type": "github" }, "original": { @@ -18,11 +18,11 @@ }, "crane": { "locked": { - "lastModified": 1731974733, - "narHash": "sha256-enYSSZVVl15FI5p+0Y5/Ckf5DZAvXe6fBrHxyhA/njc=", + "lastModified": 1733688869, + "narHash": "sha256-KrhxxFj1CjESDrL5+u/zsVH0K+Ik9tvoac/oFPoxSB8=", "owner": "ipetkov", "repo": "crane", - "rev": "3cb338ce81076ce5e461cf77f7824476addb0e1c", + "rev": "604637106e420ad99907cae401e13ab6b452e7d9", "type": "github" }, "original": { @@ -66,16 +66,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1734083684, - "narHash": "sha256-5fNndbndxSx5d+C/D0p/VF32xDiJCJzyOqorOYW4JEo=", + "lastModified": 1734017764, + "narHash": "sha256-msOfmyJSjAHgIygI/JD0Ae3JsDv4rT54Nlfr5t6MQMQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "314e12ba369ccdb9b352a4db26ff419f7c49fa84", + "rev": "64e9404f308e0f0a0d8cdd7c358f74e34802494b", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-24.11", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } @@ -98,11 +98,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1731890469, - "narHash": "sha256-D1FNZ70NmQEwNxpSSdTXCSklBH1z2isPR84J6DQrJGs=", + "lastModified": 1733097829, + "narHash": "sha256-9hbb1rqGelllb4kVUCZ307G2k3/UhmA8PPGBoyuWaSw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5083ec887760adfe12af64830a66807423a859a7", + "rev": "2c15aa59df0017ca140d9ba302412298ab4bf22a", "type": "github" }, "original": { @@ -128,11 +128,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1732328983, - "narHash": "sha256-RHt12f/slrzDpSL7SSkydh8wUE4Nr4r23HlpWywed9E=", + "lastModified": 1734143514, + "narHash": "sha256-1+r8wYucn8kp9d/IBW1uYGs31QQmSZURElsiOTx65xM=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "ed8aa5b64f7d36d9338eb1d0a3bb60cf52069a72", + "rev": "81fe5c27cb281a9b796d7ad05ad9179e5bd0c78d", "type": "github" }, "original": { @@ -161,11 +161,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1732292307, - "narHash": "sha256-5WSng844vXt8uytT5djmqBCkopyle6ciFgteuA9bJpw=", + "lastModified": 1733761991, + "narHash": "sha256-s4DalCDepD22jtKL5Nw6f4LP5UwoMcPzPZgHWjAfqbQ=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "705df92694af7093dfbb27109ce16d828a79155f", + "rev": "0ce9d149d99bc383d1f2d85f31f6ebd146e46085", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 6c90e4b..4d0b8df 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,7 @@ crane.url = "github:ipetkov/crane"; flake-utils.url = "github:numtide/flake-utils"; nix-filter.url = "github:numtide/nix-filter"; - nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; rust-overlay.url = "github:oxalica/rust-overlay"; treefmt-nix.url = "github:numtide/treefmt-nix"; }; @@ -189,11 +189,11 @@ rust-dev-toolchain watchexec ]; - RUST_BACKTRACE = 1; + # RUST_BACKTRACE = 1; RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc; # Required for rust-analyzer shellHook = '' echo - echo "✨🛠️ Welcome to the Patagia development environment 🛠️✨" + echo "✨ Welcome to the Patagia development environment! ✨" echo "Run 'just' to see available commands." echo '';