From ddd95611c0a93e0147ed1a11890eb6b6ca96a91d Mon Sep 17 00:00:00 2001 From: Alexandre Date: Tue, 20 Jan 2026 14:33:09 +0100 Subject: [PATCH] feat(validation-proto): Reformat, rearrange, logic, and fix proto files: - Create _dto files for Request/Response in each service. - Create _messages files that contain all the proto objects. - Create _enum files to define the enum of each service. - Update Request to add pagination if list of objects is required. - Update Response to match the bulk structure for all the responses. - Standardize/Add validation rules to all fields with CEL. - Standardize DTOs (Create/Delete/List/Search/Update/Upload). - Update Taskfile for better workflow and unifying with the others Taskfile. --- .gitignore | 1 + Taskfile.yml | 212 ---------- .../agentic_mesh_protocol/cost/v1/cost.proto | 291 ------------- .../cost/v1/cost_dto.proto | 174 ++++++++ .../cost/v1/cost_enums.proto | 35 ++ .../cost/v1/cost_messages.proto | 167 ++++++++ .../cost/v1/cost_service.proto | 16 +- .../filesystem/v1/filesystem.proto | 386 ------------------ .../filesystem/v1/filesystem_dto.proto | 206 ++++++++++ .../filesystem/v1/filesystem_enums.proto | 53 +++ .../filesystem/v1/filesystem_messages.proto | 254 ++++++++++++ .../filesystem/v1/filesystem_service.proto | 6 +- .../module/v1/information.proto | 228 ----------- .../module/v1/lifecycle.proto | 126 ------ .../module/v1/module_dto.proto | 300 ++++++++++++++ .../module/v1/module_enums.proto | 39 ++ .../module/v1/module_messages.proto | 58 +++ .../module/v1/module_service.proto | 8 +- .../module/v1/monitoring.proto | 116 ------ .../module_registry/v1/discover.proto | 94 ----- .../module_registry/v1/metadata.proto | 44 -- .../v1/module_registry_service.proto | 48 --- .../module_registry/v1/registration.proto | 75 ---- .../module_registry/v1/status.proto | 91 ----- .../pagination/v1/bulk.proto | 53 +++ .../pagination/v1/pagination.proto | 70 ++++ .../registry/v1/registry_dto.proto | 308 ++++++++++++++ .../registry/v1/registry_enums.proto | 66 +-- .../registry/v1/registry_messages.proto | 279 +++++++++++++ .../registry/v1/registry_models.proto | 202 --------- .../registry/v1/registry_requests.proto | 206 ---------- .../registry/v1/registry_service.proto | 26 +- .../setup/v1/setup.proto | 356 ---------------- .../setup/v1/setup_dto.proto | 242 +++++++++++ .../setup/v1/setup_enums.proto | 41 ++ .../setup/v1/setup_messages.proto | 167 ++++++++ .../setup/v1/setup_service.proto | 17 +- .../setup/v1/setup_version_dto.proto | 182 +++++++++ .../setup/v1/setup_version_service.proto | 34 ++ .../storage/v1/data.proto | 178 -------- .../storage/v1/storage_dto.proto | 245 +++++++++++ .../storage/v1/storage_enums.proto | 31 ++ .../storage/v1/storage_messages.proto | 95 +++++ .../storage/v1/storage_service.proto | 10 +- .../user_profile/v1/user_profile.proto | 107 ----- .../user_profile/v1/user_profile_dto.proto | 46 +++ .../v1/user_profile_messages.proto | 197 +++++++++ .../v1/user_profile_service.proto | 2 +- proto/buf.lock | 4 +- proto/buf.yaml | 5 +- taskfile.yml | 96 +++++ 51 files changed, 3409 insertions(+), 2884 deletions(-) delete mode 100644 Taskfile.yml delete mode 100644 proto/agentic_mesh_protocol/cost/v1/cost.proto create mode 100644 proto/agentic_mesh_protocol/cost/v1/cost_dto.proto create mode 100644 proto/agentic_mesh_protocol/cost/v1/cost_enums.proto create mode 100644 proto/agentic_mesh_protocol/cost/v1/cost_messages.proto delete mode 100644 proto/agentic_mesh_protocol/filesystem/v1/filesystem.proto create mode 100644 proto/agentic_mesh_protocol/filesystem/v1/filesystem_dto.proto create mode 100644 proto/agentic_mesh_protocol/filesystem/v1/filesystem_enums.proto create mode 100644 proto/agentic_mesh_protocol/filesystem/v1/filesystem_messages.proto delete mode 100644 proto/agentic_mesh_protocol/module/v1/information.proto delete mode 100644 proto/agentic_mesh_protocol/module/v1/lifecycle.proto create mode 100644 proto/agentic_mesh_protocol/module/v1/module_dto.proto create mode 100644 proto/agentic_mesh_protocol/module/v1/module_enums.proto create mode 100644 proto/agentic_mesh_protocol/module/v1/module_messages.proto delete mode 100644 proto/agentic_mesh_protocol/module/v1/monitoring.proto delete mode 100644 proto/agentic_mesh_protocol/module_registry/v1/discover.proto delete mode 100644 proto/agentic_mesh_protocol/module_registry/v1/metadata.proto delete mode 100644 proto/agentic_mesh_protocol/module_registry/v1/module_registry_service.proto delete mode 100644 proto/agentic_mesh_protocol/module_registry/v1/registration.proto delete mode 100644 proto/agentic_mesh_protocol/module_registry/v1/status.proto create mode 100644 proto/agentic_mesh_protocol/pagination/v1/bulk.proto create mode 100644 proto/agentic_mesh_protocol/pagination/v1/pagination.proto create mode 100644 proto/agentic_mesh_protocol/registry/v1/registry_dto.proto create mode 100644 proto/agentic_mesh_protocol/registry/v1/registry_messages.proto delete mode 100644 proto/agentic_mesh_protocol/registry/v1/registry_models.proto delete mode 100644 proto/agentic_mesh_protocol/registry/v1/registry_requests.proto delete mode 100644 proto/agentic_mesh_protocol/setup/v1/setup.proto create mode 100644 proto/agentic_mesh_protocol/setup/v1/setup_dto.proto create mode 100644 proto/agentic_mesh_protocol/setup/v1/setup_enums.proto create mode 100644 proto/agentic_mesh_protocol/setup/v1/setup_messages.proto create mode 100644 proto/agentic_mesh_protocol/setup/v1/setup_version_dto.proto create mode 100644 proto/agentic_mesh_protocol/setup/v1/setup_version_service.proto delete mode 100644 proto/agentic_mesh_protocol/storage/v1/data.proto create mode 100644 proto/agentic_mesh_protocol/storage/v1/storage_dto.proto create mode 100644 proto/agentic_mesh_protocol/storage/v1/storage_enums.proto create mode 100644 proto/agentic_mesh_protocol/storage/v1/storage_messages.proto delete mode 100644 proto/agentic_mesh_protocol/user_profile/v1/user_profile.proto create mode 100644 proto/agentic_mesh_protocol/user_profile/v1/user_profile_dto.proto create mode 100644 proto/agentic_mesh_protocol/user_profile/v1/user_profile_messages.proto create mode 100644 taskfile.yml diff --git a/.gitignore b/.gitignore index 2323953..3bf4770 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ # Generated code (buf generate output) /gen/ /docs/ +.task/ # Dependencies node_modules/ diff --git a/Taskfile.yml b/Taskfile.yml deleted file mode 100644 index 7487cbd..0000000 --- a/Taskfile.yml +++ /dev/null @@ -1,212 +0,0 @@ -version: '3' - -vars: - GEN_DIR: gen - PROTO_DIR: proto - -tasks: - default: - desc: Show available tasks - cmds: - - task --list - silent: true - - # Installation - install: - desc: Install npm dependencies and update buf dependencies - cmds: - - task: check - - npm install - - npx buf dep update proto - - echo "✅ All dependencies installed successfully!" - - check: - desc: Check if required tools are installed - cmds: - - | - echo "Checking required tools..." - echo "" - - MISSING_REQUIRED=0 - - # Check required tools - command -v node &> /dev/null && echo "✅ Node.js $(node --version)" || { echo "❌ Node.js - Install from: https://nodejs.org/"; MISSING_REQUIRED=1; } - command -v npm &> /dev/null && echo "✅ npm $(npm --version)" || { echo "❌ npm - Install from: https://nodejs.org/"; MISSING_REQUIRED=1; } - - # Check optional tools - command -v buf &> /dev/null && echo "✅ buf $(buf --version)" || { npx buf --version &> /dev/null 2>&1 && echo "✅ buf $(npx buf --version) (via npx)" || echo "⚠️ buf - Will use npx (optional: go install github.com/bufbuild/buf/cmd/buf@latest)"; } - command -v go &> /dev/null && echo "✅ Go $(go version | awk '{print $3}')" || echo "⚠️ Go (optional) - Install from: https://go.dev/dl/" - - echo "" - [ $MISSING_REQUIRED -eq 0 ] && echo "✅ All required tools are installed!" || { echo "❌ Some required tools are missing. Please install them before continuing."; exit 1; } - - # Linting - lint: - desc: Lint proto files with buf - cmds: - - npx buf lint {{.PROTO_DIR}} - sources: - - '{{.PROTO_DIR}}/**/*.proto' - - '{{.PROTO_DIR}}/buf.yaml' - - lint:buf: - desc: Lint proto files with buf - cmds: - - npx buf lint {{.PROTO_DIR}} - sources: - - '{{.PROTO_DIR}}/**/*.proto' - - '{{.PROTO_DIR}}/buf.yaml' - - lint:ci: - desc: Run all linting checks (CI mode) - cmds: - - task: lint - - task: format:check - - # Formatting - format: - desc: Format proto files with buf - cmds: - - npx buf format -w - sources: - - '{{.PROTO_DIR}}/**/*.proto' - - format:check: - desc: Check if proto files are formatted (no write) - cmds: - - npx buf format -d --exit-code - sources: - - '{{.PROTO_DIR}}/**/*.proto' - - # Breaking changes - breaking: - desc: Check for breaking changes against main branch - cmds: - - npx buf breaking --against '.git#branch=main' - sources: - - '{{.PROTO_DIR}}/**/*.proto' - - breaking:verbose: - desc: Check for breaking changes with verbose output - cmds: - - npx buf breaking --against '.git#branch=main' --error-format=json | jq - - # Code generation - generate: - desc: Generate code for all languages Python - cmds: - - npx buf generate - sources: - - '{{.PROTO_DIR}}/**/*.proto' - - buf.gen.yaml - generates: - - '{{.GEN_DIR}}/**/*' - - generate:check: - desc: Verify generated code is up to date - cmds: - - npx buf generate - - | - if [ -n "$(git status --porcelain {{.GEN_DIR}}/)" ]; then - echo "Error: Generated code is out of date" - echo "Run 'task generate' and commit the changes" - exit 1 - fi - - # Buf Schema Registry - push: - desc: Push schema to Buf Schema Registry (requires DKIN_CLOUD_TOKEN or BUF_TOKEN) - cmds: - - npx buf push {{.PROTO_DIR}} - preconditions: - - sh: '[ ! -z "$DKIN_CLOUD_TOKEN" ] || [ ! -z "$BUF_TOKEN" ]' - msg: 'DKIN_CLOUD_TOKEN or BUF_TOKEN environment variable must be set' - - push:tag: - desc: "Push schema with a tag (usage: task push:tag TAG=v1.0.0)" - cmds: - - npx buf push {{.PROTO_DIR}} --tag {{.TAG}} - preconditions: - - sh: '[ ! -z "{{.TAG}}" ]' - msg: 'TAG variable must be set (e.g., task push:tag TAG=v1.0.0)' - - sh: '[ ! -z "$DKIN_CLOUD_TOKEN" ] || [ ! -z "$BUF_TOKEN" ]' - msg: 'DKIN_CLOUD_TOKEN or BUF_TOKEN environment variable must be set' - - # Build workflows - build: - desc: Full build - format, lint, and generate - cmds: - - task: format - - task: lint - - task: generate - - echo "✅ Build completed successfully!" - - build:ci: - desc: CI build - format check, lint, breaking, and generate check - cmds: - - task: format:check - - task: lint - - task: breaking - - task: generate:check - - # CI simulation - ci: - desc: Run all CI checks locally (format, lint, breaking, generate) - cmds: - - echo "Running CI checks..." - - task: format:check - - task: lint - - task: breaking - - task: generate:check - - echo "✅ All CI checks passed!" - - # Cleanup - clean: - desc: Remove generated files (gen/) - cmds: - - rm -rf {{.GEN_DIR}}/ - - clean:all: - desc: Remove all generated and dependency files - cmds: - - task: clean - - rm -rf node_modules/ - - # Validation - validate: - desc: Validate proto files are syntactically correct - cmds: - - npx buf build {{.PROTO_DIR}} - - # Dependency management - deps: - desc: Show buf dependencies - cmds: - - npx buf dep ls {{.PROTO_DIR}} - - deps:update: - desc: Update buf dependencies - cmds: - - npx buf dep update {{.PROTO_DIR}} - - # Development helpers - watch: - desc: Watch for changes and auto-generate code - cmds: - - | - echo "Watching for proto file changes..." - while true; do - inotifywait -e modify,create,delete -r {{.PROTO_DIR}}/ && task generate - done - - stats: - desc: Show statistics about proto files - cmds: - - | - echo "Proto File Statistics:" - echo "======================" - echo "Total proto files: $(find {{.PROTO_DIR}} -name '*.proto' | wc -l)" - echo "Total services: $(grep -r 'service ' {{.PROTO_DIR}} --include='*.proto' | wc -l)" - echo "Total messages: $(grep -r 'message ' {{.PROTO_DIR}} --include='*.proto' | wc -l)" - echo "Total RPCs: $(grep -r 'rpc ' {{.PROTO_DIR}} --include='*.proto' | wc -l)" - echo "Lines of proto: $(find {{.PROTO_DIR}} -name '*.proto' -exec wc -l {} + | tail -1)" diff --git a/proto/agentic_mesh_protocol/cost/v1/cost.proto b/proto/agentic_mesh_protocol/cost/v1/cost.proto deleted file mode 100644 index 4745290..0000000 --- a/proto/agentic_mesh_protocol/cost/v1/cost.proto +++ /dev/null @@ -1,291 +0,0 @@ -// Copyright 2025 DigitalKin Inc. -// -// Licensed under the GNU General Public License, Version 3.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.gnu.org/licenses/gpl-3.0.html -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package agentic_mesh_protocol.cost.v1; - -import "buf/validate/validate.proto"; - -// CostType represents the classification of cost types in the system. -enum CostType { - // UNSPECIFIED is the default unspecified value. - UNSPECIFIED = 0; - // TOKEN_INPUT represents token input costs. - TOKEN_INPUT = 1; - // TOKEN_OUTPUT represents token output costs. - TOKEN_OUTPUT = 2; - // API_CALL represents API call costs. - API_CALL = 3; - // STORAGE represents storage costs. - STORAGE = 4; - // TIME represents time-based costs. - TIME = 5; - // OTHER represents other types of costs. - OTHER = 6; -} - -// Cost represents a cost entry with comprehensive tracking information. -message Cost { - // cost is the total cost value. - double cost = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).double.gte = 0 - ]; - - // mission_id is the mission ID linked to this cost. - string mission_id = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "missions:", - (buf.validate.field).string.min_len = 1 - ]; - - // name is the descriptive name of the cost. - string name = 3 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // cost_type is the classification of the cost. - CostType cost_type = 4 [ - (buf.validate.field).required = true, - (buf.validate.field).enum.not_in = 0 - ]; - - // unit is the unit of measurement for the cost (e.g., "tokens", "calls", "GB"). - string unit = 5 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // rate is the cost per unit. - double rate = 6 [ - (buf.validate.field).required = true, - (buf.validate.field).double.gte = 0 - ]; - - // setup_version_id is the setup version ID associated with this cost. - string setup_version_id = 7 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "setup_versions:", - (buf.validate.field).string.min_len = 1 - ]; - - // quantity is the number of units consumed. - double quantity = 8 [ - (buf.validate.field).required = true, - (buf.validate.field).double.gte = 0 - ]; -} - -// AddCostRequest is the request message for adding a cost entry. -message AddCostRequest { - // cost is the total cost value. - double cost = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).double.gte = 0 - ]; - - // mission_id is the mission ID to link this cost to. - string mission_id = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "missions:", - (buf.validate.field).string.min_len = 1 - ]; - - // name is the descriptive name for this cost. - string name = 3 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // cost_type is the classification of the cost. - CostType cost_type = 4 [ - (buf.validate.field).required = true, - (buf.validate.field).enum.not_in = 0 - ]; - - // unit is the unit of measurement (e.g., "tokens", "calls", "GB"). - string unit = 5 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // rate is the cost per unit. - double rate = 6 [ - (buf.validate.field).required = true, - (buf.validate.field).double.gte = 0 - ]; - - // setup_version_id is the setup version ID to associate with this cost. - string setup_version_id = 7 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "setup_versions:", - (buf.validate.field).string.min_len = 1 - ]; - - // quantity is the number of units consumed. - double quantity = 8 [ - (buf.validate.field).required = true, - (buf.validate.field).double.gte = 0 - ]; -} - -// AddCostResponse is the response message for adding a cost entry. -message AddCostResponse { - // success indicates whether the cost was successfully added. - bool success = 1; -} - -// CostFilter contains criteria for filtering cost queries. -message CostFilter { - // names filters costs by one or more names. - repeated string names = 1 [(buf.validate.field).repeated.items.string.min_len = 1]; - - // cost_types filters costs by cost type classifications. - repeated CostType cost_types = 2 [(buf.validate.field).repeated.items.enum.not_in = 0]; - - // setup_version_ids filters costs by setup version IDs. - repeated string setup_version_ids = 3 [ - (buf.validate.field).repeated.items.string.prefix = "setup_versions:", - (buf.validate.field).repeated.items.string.min_len = 1 - ]; -} - -// GetCostsRequest is the request message for retrieving multiple costs. -message GetCostsRequest { - // mission_id is the mission ID to query costs for. - string mission_id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "missions:", - (buf.validate.field).string.min_len = 1 - ]; - - // filter contains optional filtering criteria. - CostFilter filter = 2; - - // limit is the maximum number of costs to return. - int32 limit = 3 [ - (buf.validate.field).int32.gte = 1, - (buf.validate.field).int32.lte = 1000 - ]; - - // offset is the number of costs to skip for pagination. - int32 offset = 4 [(buf.validate.field).int32.gte = 0]; -} - -// GetCostsResponse is the response message containing multiple costs. -message GetCostsResponse { - // costs is the list of matching cost entries. - repeated Cost costs = 1; - - // total_count is the total number of costs matching the criteria. - int32 total_count = 2 [(buf.validate.field).int32.gte = 0]; - - // total_cost is the sum of all matching cost values. - double total_cost = 3 [(buf.validate.field).double.gte = 0]; -} - -// GetCostRequest is the request message for retrieving costs by name. -message GetCostRequest { - // mission_id is the mission ID to query costs for. - string mission_id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "missions:", - (buf.validate.field).string.min_len = 1 - ]; - - // name is the specific cost name to retrieve. - string name = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; -} - -// GetCostResponse is the response message for cost retrieval by name. -message GetCostResponse { - // costs is the list of cost entries matching the name. - repeated Cost costs = 1; - - // total_cost is the sum of all matching cost values. - double total_cost = 2 [(buf.validate.field).double.gte = 0]; -} - -// CostConfig represents a cost configuration entry defining pricing structure. -message CostConfig { - // name is the unique identifier for this cost configuration. - string name = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // cost_type is the classification of this cost configuration. - CostType cost_type = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).enum.defined_only = true - ]; - - // description provides context about this cost configuration. - string description = 3; - - // unit is the measurement unit (e.g., "tokens", "calls", "MB"). - string unit = 4 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // rate is the cost per unit in dollars. - double rate = 5 [ - (buf.validate.field).required = true, - (buf.validate.field).double.gt = 0 - ]; -} - -// GetCostConfigRequest is the request for retrieving cost configurations. -message GetCostConfigRequest { - // setup_version_id identifies the setup version to get cost config for. - string setup_version_id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "setup_versions:", - (buf.validate.field).string.min_len = 1 - ]; -} - -// GetCostConfigResponse is the response containing cost configurations. -message GetCostConfigResponse { - // success indicates whether the retrieval was successful. - bool success = 1; - - // configs is the list of cost configuration entries. - repeated CostConfig configs = 2; -} - -// SetCostConfigRequest is the request for storing cost configurations. -message SetCostConfigRequest { - // setup_version_id identifies the setup version to set cost config for. - string setup_version_id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "setup_versions:", - (buf.validate.field).string.min_len = 1 - ]; - - // configs is the list of cost configuration entries to store. - repeated CostConfig configs = 2 [(buf.validate.field).required = true]; -} - -// SetCostConfigResponse is the response for storing cost configurations. -message SetCostConfigResponse { - // success indicates whether the storage was successful. - bool success = 1; -} diff --git a/proto/agentic_mesh_protocol/cost/v1/cost_dto.proto b/proto/agentic_mesh_protocol/cost/v1/cost_dto.proto new file mode 100644 index 0000000..1e168f7 --- /dev/null +++ b/proto/agentic_mesh_protocol/cost/v1/cost_dto.proto @@ -0,0 +1,174 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.cost.v1; + +import "agentic_mesh_protocol/cost/v1/cost_enums.proto"; +import "agentic_mesh_protocol/cost/v1/cost_messages.proto"; +import "agentic_mesh_protocol/pagination/v1/bulk.proto"; +import "agentic_mesh_protocol/pagination/v1/pagination.proto"; +import "buf/validate/validate.proto"; + +// ═════════════════════════════════════ Add Cost ════════════════════════════════════ // + +// AddCostRequest is the request message for adding a cost entry. +message CreateCostRequest { + // mission_id is the mission ID to link this cost to. + string mission_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "mission_id_prefix" + expression: "this.startsWith('missions:')" + message: "missions must start with 'mission:'" + }, + (buf.validate.field).cel = { + id: "mission_id_length" + expression: "this.size() >= 10" + message: "missions must be at least 1 characters long" + } + ]; + // setup_version_id is the setup version ID to associate with this cost. + string setup_version_id = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_version_id_prefix" + expression: "this.startsWith('setup_versions:')" + message: "setup_version_id must start with 'setup_versions:'" + }, + (buf.validate.field).cel = { + id: "setup_version_id_length" + expression: "this.size() >= 16" + message: "setup_version_id must be at least 16 characters long" + } + ]; + // name is the descriptive name for this cost. + string name = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // cost is the total cost value. + double cost = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).double.gt = 0, + (buf.validate.field).double.finite = true + ]; + // quantity is the number of units consumed. + double quantity = 5 [ + (buf.validate.field).required = true, + (buf.validate.field).double.gt = 0, + (buf.validate.field).double.finite = true + ]; + // rate is the cost per unit. + double rate = 6 [ + (buf.validate.field).required = true, + (buf.validate.field).double.gt = 0, + (buf.validate.field).double.finite = true + ]; + // unit is the unit of measurement (e.g., "tokens", "calls", "GB"). + string unit = 7 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // cost_type is the classification of the cost. + CostType type = 8 [ + (buf.validate.field).required = true, + (buf.validate.field).enum.defined_only = true + ]; +} + +// AddCostResponse is the response message for adding a cost entry. +message CreateCostResponse { + // Result of the operation. Expected oneof type: Cost or OperationError. + CostResult result = 1 [(buf.validate.field).required = true]; +} + +// ═════════════════════════════════════ List Costs ════════════════════════════════════ // + +// GetCostsRequest is the request message for retrieving multiple costs. +message ListCostsRequest { + // mission_id is the mission ID to query costs for. + string mission_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "mission_id_prefix" + expression: "this.startsWith('missions:')" + message: "missions must start with 'mission:'" + }, + (buf.validate.field).cel = { + id: "mission_id_length" + expression: "this.size() >= 10" + message: "missions must be at least 1 characters long" + } + ]; + // pagination contains pagination settings. + agentic_mesh_protocol.pagination.v1.PaginationRequest pagination = 2 [(buf.validate.field).required = true]; + // filter contains optional filtering criteria (optional). + optional CostFilter filter = 3 [(buf.validate.field).required = false]; +} + +// GetCostsResponse is the response message containing multiple costs. +message ListCostsResponse { + // Result of the operation. Expected oneof type: Cost or OperationError. + repeated CostResult result = 1 [(buf.validate.field).required = true]; + // bulk contains information about the bulk operation and pagination. + agentic_mesh_protocol.pagination.v1.BulkResponse bulk = 2 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════ List Cost Config ═════════════════════════════════ // + +// GetCostConfigRequest is the request for retrieving cost configurations. +message ListCostConfigRequest { + // setup_version_id identifies the setup version to get cost config for. + string setup_version_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.prefix = "setup_versions:", + (buf.validate.field).string.min_len = 1 + ]; + + // pagination contains pagination settings + optional agentic_mesh_protocol.pagination.v1.PaginationRequest pagination = 2 [(buf.validate.field).required = false]; +} + +// GetCostConfigResponse is the response containing cost configurations. +message ListCostConfigResponse { + // Result of the operation. Expected oneof type: Cost or OperationError. + repeated CostResult result = 1 [(buf.validate.field).required = true]; + // bulk contains information about the bulk operation and pagination. + agentic_mesh_protocol.pagination.v1.BulkResponse bulk = 2 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════ Set Cost Config ═════════════════════════════════ // + +// SetCostConfigRequest is the request for storing cost configurations. +message SetCostConfigRequest { + // setup_version_id identifies the setup version to set cost config for. + string setup_version_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.prefix = "setup_versions:", + (buf.validate.field).string.min_len = 1 + ]; + + // configs is the list of cost configuration entries to store. + repeated CostConfig configs = 2 [(buf.validate.field).required = true]; +} + +// SetCostConfigResponse is the response for storing cost configurations. +message SetCostConfigResponse { + // Result of the operation. Expected oneof type: Cost or OperationError. + repeated CostResult result = 1 [(buf.validate.field).required = true]; + // bulk contains information about the bulk operation and pagination. + agentic_mesh_protocol.pagination.v1.BulkResponse bulk = 2 [(buf.validate.field).required = true]; +} diff --git a/proto/agentic_mesh_protocol/cost/v1/cost_enums.proto b/proto/agentic_mesh_protocol/cost/v1/cost_enums.proto new file mode 100644 index 0000000..b79b2a4 --- /dev/null +++ b/proto/agentic_mesh_protocol/cost/v1/cost_enums.proto @@ -0,0 +1,35 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.cost.v1; + +// CostType represents the classification of cost types in the system. +enum CostType { + // UNTYPED represents an unspecified cost type. + COST_TYPE_UNSPECIFIED = 0; + // TOKEN_INPUT represents token input costs. + TOKEN_INPUT = 1; + // TOKEN_OUTPUT represents token output costs. + TOKEN_OUTPUT = 2; + // API_CALL represents API call costs. + API_CALL = 3; + // STORAGE represents storage costs. + STORAGE = 4; + // TIME represents time-based costs. + TIME = 5; + // OTHER represents other types of costs. + OTHER = 6; +} diff --git a/proto/agentic_mesh_protocol/cost/v1/cost_messages.proto b/proto/agentic_mesh_protocol/cost/v1/cost_messages.proto new file mode 100644 index 0000000..39ebca0 --- /dev/null +++ b/proto/agentic_mesh_protocol/cost/v1/cost_messages.proto @@ -0,0 +1,167 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.cost.v1; + +import "agentic_mesh_protocol/cost/v1/cost_enums.proto"; +import "agentic_mesh_protocol/pagination/v1/bulk.proto"; +import "buf/validate/validate.proto"; + +// Cost represents a cost entry with comprehensive tracking information. +message Cost { + // mission_id is the mission ID linked to this cost. + string mission_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "mission_id_prefix" + expression: "this.startsWith('missions:')" + message: "missions must start with 'mission:'" + }, + (buf.validate.field).cel = { + id: "mission_id_length" + expression: "this.size() >= 10" + message: "missions must be at least 1 characters long" + } + ]; + // setup_version_id is the setup version ID associated with this cost. + string setup_version_id = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_versions_id_prefix" + expression: "this.startsWith('setup_versions:')" + message: "setup_versions_id must start with 'setup_versions:'" + }, + (buf.validate.field).cel = { + id: "setup_versions_id_length" + expression: "this.size() >= 16" + message: "setup_versions must be at least 1 characters long" + } + ]; + // name is the descriptive name for this cost entry (e.g., LLM model name, API endpoint). + string name = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // cost is the total cost value. + double cost = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).double.gt = 0, + (buf.validate.field).double.finite = true + ]; + // quantity is the number of units consumed. + double quantity = 5 [ + (buf.validate.field).required = true, + (buf.validate.field).double.gt = 0, + (buf.validate.field).double.finite = true + ]; + // rate is the cost per unit. + double rate = 6 [ + (buf.validate.field).required = true, + (buf.validate.field).double.gt = 0, + (buf.validate.field).double.finite = true + ]; + // unit is the unit of measurement for the cost (e.g., "tokens", "calls", "GB"). + string unit = 7 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // cost_type is the classification of the cost. + CostType type = 8 [ + (buf.validate.field).required = true, + (buf.validate.field).enum.defined_only = true + ]; +} + +// CostFilter contains criteria for filtering cost queries. +message CostFilter { + // cost_types filters costs by cost type classifications. + repeated CostType types = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).repeated.items.enum.defined_only = true + ]; + // names filters costs by one or more names. + repeated string names = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).repeated.items.string.min_len = 1 + ]; + // setup_version_ids filters costs by setup version IDs. + repeated string setup_version_ids = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_versions_id_prefix" + expression: "this.all(x, x.startsWith('setup_versions:'))" + message: "setup_versions must start with 'setup_versions:'" + }, + (buf.validate.field).cel = { + id: "setup_versions_id_length" + expression: "this.all(x, x.size() >= 16)" + message: "setup_versions must be at least 1 characters long" + } + ]; +} + +// CostConfig represents a cost configuration entry defining pricing structure. +message CostConfig { + // name is the unique identifier for this cost configuration. + string name = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // cost_type is the classification of this cost configuration. + CostType cost_type = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).enum.defined_only = true + ]; + + // description provides context about this cost configuration. + string description = 3; + + // unit is the measurement unit (e.g., "tokens", "calls", "MB"). + string unit = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // rate is the cost per unit in dollars. + double rate = 5 [ + (buf.validate.field).required = true, + (buf.validate.field).double.gt = 0 + ]; +} + +// CostResult represents the result of processing an individual item in the bulk operation. +message CostResult { + // identifier is the unique identifier for the item being processed + string identifier = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // success indicates if the operation was successful (optional for backward compatibility). + optional bool success = 2 [(buf.validate.field).required = false]; + + // One of the following fields will be set based on the outcome of processing the item. + oneof outcom { + // cost is the cost data if the operation was successful. + Cost cost = 3; + // cost config is the cost config if the operation was successful. + CostConfig config = 4; + // error represents the error that occurred while processing the item, if applicable. + agentic_mesh_protocol.pagination.v1.OperationError error = 5; + } +} diff --git a/proto/agentic_mesh_protocol/cost/v1/cost_service.proto b/proto/agentic_mesh_protocol/cost/v1/cost_service.proto index 78193e5..22f12a0 100644 --- a/proto/agentic_mesh_protocol/cost/v1/cost_service.proto +++ b/proto/agentic_mesh_protocol/cost/v1/cost_service.proto @@ -16,22 +16,16 @@ syntax = "proto3"; package agentic_mesh_protocol.cost.v1; -import "agentic_mesh_protocol/cost/v1/cost.proto"; +import "agentic_mesh_protocol/cost/v1/cost_dto.proto"; // CostService provides operations for tracking and querying operational costs. service CostService { + // GetCosts retrieves multiple cost entries with optional filtering and pagination. + rpc ListCosts(ListCostsRequest) returns (ListCostsResponse); // AddCost records a new cost entry for a mission. - rpc AddCost(AddCostRequest) returns (AddCostResponse); - - // GetCost retrieves cost entries by name within a mission. - rpc GetCost(GetCostRequest) returns (GetCostResponse); - - // GetCosts retrieves multiple cost entries with filtering and pagination. - rpc GetCosts(GetCostsRequest) returns (GetCostsResponse); - + rpc CreateCost(CreateCostRequest) returns (CreateCostResponse); // GetCostConfig retrieves cost configuration for a setup version. - rpc GetCostConfig(GetCostConfigRequest) returns (GetCostConfigResponse); - + rpc ListCostConfig(ListCostConfigRequest) returns (ListCostConfigResponse); // SetCostConfig stores cost configuration for a setup version. rpc SetCostConfig(SetCostConfigRequest) returns (SetCostConfigResponse); } diff --git a/proto/agentic_mesh_protocol/filesystem/v1/filesystem.proto b/proto/agentic_mesh_protocol/filesystem/v1/filesystem.proto deleted file mode 100644 index 1960bff..0000000 --- a/proto/agentic_mesh_protocol/filesystem/v1/filesystem.proto +++ /dev/null @@ -1,386 +0,0 @@ -// Copyright 2025 DigitalKin Inc. -// -// Licensed under the GNU General Public License, Version 3.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.gnu.org/licenses/gpl-3.0.html -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package agentic_mesh_protocol.filesystem.v1; - -import "buf/validate/validate.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -// FileType represents the classification of file types in the system. -enum FileType { - // FILE_TYPE_UNSPECIFIED is the default unspecified value. - FILE_TYPE_UNSPECIFIED = 0; - // FILE_TYPE_DOCUMENT represents document files (PDF, DOC, TXT, etc.). - FILE_TYPE_DOCUMENT = 1; - // FILE_TYPE_IMAGE represents image files (PNG, JPG, GIF, etc.). - FILE_TYPE_IMAGE = 2; - // FILE_TYPE_VIDEO represents video files (MP4, AVI, MOV, etc.). - FILE_TYPE_VIDEO = 3; - // FILE_TYPE_AUDIO represents audio files (MP3, WAV, etc.). - FILE_TYPE_AUDIO = 4; - // FILE_TYPE_ARCHIVE represents archive files (ZIP, TAR, etc.). - FILE_TYPE_ARCHIVE = 5; - // FILE_TYPE_CODE represents source code files. - FILE_TYPE_CODE = 6; - // FILE_TYPE_OTHER represents other file types. - FILE_TYPE_OTHER = 7; -} - -// FileStatus represents the lifecycle status of a file in the system. -enum FileStatus { - // FILE_STATUS_UNSPECIFIED is the default unspecified value. - FILE_STATUS_UNSPECIFIED = 0; - // FILE_STATUS_UPLOADING indicates the file is currently being uploaded. - FILE_STATUS_UPLOADING = 1; - // FILE_STATUS_ACTIVE indicates the file is active and available for use. - FILE_STATUS_ACTIVE = 2; - // FILE_STATUS_PROCESSING indicates the file is being processed. - FILE_STATUS_PROCESSING = 3; - // FILE_STATUS_ARCHIVED indicates the file has been archived. - FILE_STATUS_ARCHIVED = 4; - // FILE_STATUS_DELETED indicates the file is marked for deletion. - FILE_STATUS_DELETED = 5; -} - -// File represents a stored file with comprehensive metadata. -message File { - // file_id: Unique identifier for the file - string file_id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.pattern = "^files:.*$" - ]; - - // context: Context ID linked to the file - string context = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.pattern = "^(missions:|setups:).*$" - ]; - - // name: Name of the file (unique within context) - string name = 3 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // file_type: Type classification of the file - FileType file_type = 4 [ - (buf.validate.field).required = true, - (buf.validate.field).enum.not_in = 0 - ]; - - // content_type: MIME type of the file - string content_type = 5 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // size_bytes: Size of the file in bytes - int64 size_bytes = 6 [ - (buf.validate.field).required = true, - (buf.validate.field).int64.gte = 0 - ]; - - // checksum: SHA-256 checksum of the file content (SHA-256 format) - string checksum = 7 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // metadata: Flexible metadata for additional file properties - google.protobuf.Struct metadata = 8; - - // storage_uri: Internal URI for accessing the file content - string storage_uri = 9 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // file_url: External URL for accessing the file content - string file_url = 10 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // status: Current status of the file - FileStatus status = 11 [ - (buf.validate.field).required = true, - (buf.validate.field).enum.not_in = 0 - ]; - - // content: The content of the file - bytes content = 12; -} - -// FileFilter contains criteria for querying and filtering files. -message FileFilter { - // names: Filter by file names (exact matches) - repeated string names = 1; - - // file_ids: Filter by file IDs - repeated string file_ids = 2 [(buf.validate.field).repeated.items.string.pattern = "^files:.*$"]; - - // file_types: Filter by file types - repeated FileType file_types = 3 [(buf.validate.field).repeated.items.enum.not_in = 0]; - - // context: Filter by context (required for scoping) - string context = 4 [ - (buf.validate.field).required = true, - (buf.validate.field).string.pattern = "^(missions:|setups:).*$" - ]; - - // created_after: Filter files created after this timestamp - google.protobuf.Timestamp created_after = 5; - - // created_before: Filter files created before this timestamp - google.protobuf.Timestamp created_before = 6; - - // updated_after: Filter files updated after this timestamp - google.protobuf.Timestamp updated_after = 7; - - // updated_before: Filter files updated before this timestamp - google.protobuf.Timestamp updated_before = 8; - - // status: Filter by file status - FileStatus status = 9; - - // content_type_prefix: Filter by content type prefix (e.g., "image/") - string content_type_prefix = 10; - - // min_size_bytes: Filter files with minimum size - int64 min_size_bytes = 11 [(buf.validate.field).int64.gte = 0]; - - // max_size_bytes: Filter files with maximum size - int64 max_size_bytes = 12 [(buf.validate.field).int64.gte = 0]; - - // prefix: Filter by path prefix (e.g., "/folder1/"). Prevents path traversal (no ".." allowed). - string prefix = 13 [(buf.validate.field).string.pattern = "^[^.]*([.][^.]+)*[.]?$"]; - - // content_type: Filter by content type - string content_type = 14; -} - -// FileResult wraps the result of a file operation which may succeed or fail. -message FileResult { - // result contains either a successfully processed file or error information. - oneof result { - // file: Successfully processed file - File file = 1; - // error: Error information if operation failed - string error = 2; - } -} - -// UploadFileData contains the data required for uploading a single file. -message UploadFileData { - // context: Context ID for the file - string context = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.pattern = "(^(missions:|setups:).*$|^default$)" - ]; - - // name: Name of the file - string name = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.pattern = "^[^.]*([.][^.]+)*[.]?$" - ]; - - // file_type: Type classification of the file - FileType file_type = 3 [ - (buf.validate.field).required = true, - (buf.validate.field).enum.not_in = 0 - ]; - - // content_type: MIME type of the file - string content_type = 4 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // content: File content - bytes content = 5 [ - (buf.validate.field).required = true, - (buf.validate.field).bytes.min_len = 1 - ]; - - // metadata: Additional metadata for the file - google.protobuf.Struct metadata = 6; - - // status: Status of the file - FileStatus status = 7 [ - (buf.validate.field).required = true, - (buf.validate.field).enum.not_in = 0 - ]; - - // replace_if_exists: Whether to replace existing file with same name - bool replace_if_exists = 8; -} - -// UploadFilesRequest is the request message for uploading multiple files. -message UploadFilesRequest { - // files: List of files to upload - repeated UploadFileData files = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).repeated.min_items = 1 - ]; -} - -// UploadFilesResponse is the response message for file upload operations. -message UploadFilesResponse { - // results: Results for each uploaded file - repeated FileResult results = 1; - - // total_uploaded: Number of successfully uploaded files - int32 total_uploaded = 2 [(buf.validate.field).int32.gte = 0]; - - // total_failed: Number of failed uploads - int32 total_failed = 3 [(buf.validate.field).int32.gte = 0]; -} - -// GetFileRequest is the request message for retrieving a specific file. -message GetFileRequest { - // context: Context ID for the file - string context = 1 [ - (buf.validate.field).string.pattern = "^(missions:|setups:).*$" - ]; - - // file_id: File ID - string file_id = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.pattern = "^files:.*$" - ]; - - // include_content: Whether to include file content in response - bool include_content = 3; -} - -// GetFileResponse is the response message containing file information. -message GetFileResponse { - // file: The requested file - File file = 1 [(buf.validate.field).required = true]; - - // content: File content (only if requested) - bytes content = 2; -} - -// UpdateFileRequest is the request message for updating a file. -message UpdateFileRequest { - // context: Context ID for the file - string context = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.pattern = "^(missions:|setups:).*$" - ]; - - // file_id: Current id of the file - string file_id = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.pattern = "^files:.*$" - ]; - - // new_name: New name for the file (optional) - string new_name = 3 [(buf.validate.field).string.min_len = 1]; - - // file_type: New file type (optional, cannot be UNSPECIFIED) - FileType file_type = 4 [(buf.validate.field).enum.not_in = 0]; - - // content_type: New content type (optional) - string content_type = 5 [(buf.validate.field).string.min_len = 1]; - - // content: New file content (optional) - bytes content = 6; - - // status: New status of the file - FileStatus status = 7 [ - (buf.validate.field).required = true, - (buf.validate.field).enum.not_in = 0 - ]; - - // metadata: New metadata (optional, will merge with existing) - google.protobuf.Struct metadata = 8; -} - -// UpdateFileResponse is the response message for file update operations. -message UpdateFileResponse { - // result: Result of the file update operation - FileResult result = 1; -} - -// GetFilesRequest is the request message for retrieving multiple files by various criteria. -message GetFilesRequest { - // context: Context ID for the files - string context = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.pattern = "^(missions:|setups:).*$" - ]; - - // filters: How to identify the files - FileFilter filters = 2 [(buf.validate.field).required = true]; - - // list_size: Number of files to return per page - int32 list_size = 3 [ - (buf.validate.field).int32.gte = 1, - (buf.validate.field).int32.lte = 1000 - ]; - - // offset: Offset of the first file in the list - int32 offset = 4 [(buf.validate.field).int32.gte = 0]; - - // order: Field to order results by - string order = 5; - - // include_content: Whether to include file content in response - bool include_content = 6; -} - -// GetFilesResponse is the response message containing multiple files. -message GetFilesResponse { - // files: List of files matching the criteria - repeated File files = 1; - - // total_count: Total number of files matching the criteria - int32 total_count = 2 [(buf.validate.field).int32.gte = 0]; -} - -// DeleteFilesRequest is the request message for deleting multiple files. -message DeleteFilesRequest { - // context: Context ID for the files - string context = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.pattern = "^(missions:|setups:).*$" - ]; - - // filters: How to identify the files - FileFilter filters = 2 [(buf.validate.field).required = true]; - - // force: Whether to force delete even if file is in use - bool force = 3; - - // permanent: Whether to permanently delete (vs mark as deleted) - bool permanent = 4; -} - -// DeleteFilesResponse is the response message for file deletion operations. -message DeleteFilesResponse { - // results: Results for each file deletion attempt - map results = 1; - - // total_deleted: Number of successfully deleted files - int32 total_deleted = 2 [(buf.validate.field).int32.gte = 0]; - - // total_failed: Number of failed deletions - int32 total_failed = 3 [(buf.validate.field).int32.gte = 0]; -} diff --git a/proto/agentic_mesh_protocol/filesystem/v1/filesystem_dto.proto b/proto/agentic_mesh_protocol/filesystem/v1/filesystem_dto.proto new file mode 100644 index 0000000..2fd968c --- /dev/null +++ b/proto/agentic_mesh_protocol/filesystem/v1/filesystem_dto.proto @@ -0,0 +1,206 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.filesystem.v1; + +import "agentic_mesh_protocol/filesystem/v1/filesystem_enums.proto"; +import "agentic_mesh_protocol/filesystem/v1/filesystem_messages.proto"; +import "agentic_mesh_protocol/pagination/v1/bulk.proto"; +import "agentic_mesh_protocol/pagination/v1/pagination.proto"; +import "buf/validate/validate.proto"; +import "google/protobuf/struct.proto"; + +// ════════════════════════════════════ GetFile ════════════════════════════════════ // + +// GetFileRequest is the request message for retrieving a single file. +message GetFileRequest { + // context: Context ID for the file + string context = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "context_prefix" + expression: "this.startsWith('missions:') || this.startsWith('setups:')" + message: "context must start with 'mission:' or 'setups:'" + }, + (buf.validate.field).cel = { + id: "context_length" + expression: + "this.startsWith('missions:') ? this.size() >= 10 : true" + "|| this.startsWith('setups:') ? this.size() >= 8 : true" + message: "context must be at least 1 characters long" + } + ]; + // file_id: File ID + string id = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.uuid = true, + (buf.validate.field).string.min_len = 1 + ]; + // include_content: Whether to include file content in response + bool include_content = 3 [(buf.validate.field).required = true]; +} + +// GetFileResponse is the response message containing the requested file. +message GetFileResponse { + // Result of the operation. Expected oneof type: File or OperationError. + FileResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ GetFiles ════════════════════════════════════ // + +// GetFilesRequest is the request message for retrieving multiple files. +message ListFilesRequest { + // context: Context ID for the files + string context = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "context_prefix" + expression: "this.startsWith('missions:') || this.startsWith('setups:')" + message: "context must start with 'mission:' or 'setups:'" + }, + (buf.validate.field).cel = { + id: "context_length" + expression: + "this.startsWith('missions:') ? this.size() >= 10 : true" + "|| this.startsWith('setups:') ? this.size() >= 8 : true" + message: "context must be at least 1 characters long" + } + ]; + // include_content: Whether to include file content in response + bool include_content = 3 [(buf.validate.field).required = true]; + // pagination contains pagination settings. + agentic_mesh_protocol.pagination.v1.PaginationRequest pagination = 4 [(buf.validate.field).required = true]; + // filters: How to identify the files + FileFilter filters = 5 [(buf.validate.field).required = true]; +} + +// GetFilesResponse is the response message containing the list of files. +message ListFilesResponse { + // Result of the operation. Expected oneof type: File or OperationError. + repeated FileResult result = 1 [(buf.validate.field).required = true]; + // bulk: Bulk response containing the list of files and pagination info + agentic_mesh_protocol.pagination.v1.BulkResponse bulk = 2 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ UploadFiles ════════════════════════════════════ // + +// UploadFilesRequest is the request message for uploading multiple files. +message UploadFilesRequest { + // files: List of files to upload + repeated UploadFileData files = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).repeated.min_items = 1 + ]; +} + +// UploadFilesResponse is the response message for file upload operations. +message UploadFilesResponse { + // Result of the operation. Expected oneof type: File or OperationError. + repeated FileResult result = 1 [(buf.validate.field).required = true]; + // bulk: Bulk response containing the results of the upload operation + agentic_mesh_protocol.pagination.v1.BulkResponse bulk = 2 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ UpdateFile ════════════════════════════════════ // + +// UpdateFileRequest is the request message for updating a file. +message UpdateFileRequest { + // context: Context ID for the file + string context = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "context_prefix" + expression: "this.startsWith('missions:') || this.startsWith('setups:')" + message: "context must start with 'mission:' or 'setups:'" + }, + (buf.validate.field).cel = { + id: "context_length" + expression: + "this.startsWith('missions:') ? this.size() >= 10 : true" + "|| this.startsWith('setups:') ? this.size() >= 8 : true" + message: "context must be at least 1 characters long" + } + ]; + // file_id: Current id of the file + string id = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.uuid = true, + (buf.validate.field).string.min_len = 1 + ]; + // content: New file content (optional) + optional bytes content = 3 [(buf.validate.field).required = false]; + // new_name: New name for the file (optional) + optional string new_name = 4 [ + (buf.validate.field).required = false, + (buf.validate.field).string.min_len = 1 + ]; + // content_type: New content type (optional) + optional string content_type = 5 [ + (buf.validate.field).required = false, + (buf.validate.field).string.min_len = 1 + ]; + // file_type: New file type + optional FileType type = 6 [ + (buf.validate.field).required = false, + (buf.validate.field).enum.defined_only = true + ]; + // status: New status of the file + FileStatus status = 7 [(buf.validate.field).required = true]; + // metadata: New metadata (optional, will merge with existing) + optional google.protobuf.Struct metadata = 8 [(buf.validate.field).required = false]; +} + +// UpdateFileResponse is the response message for file update operations. +message UpdateFileResponse { + // Result of the operation. Expected oneof type: File or OperationError. + FileResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ DeleteFiles ════════════════════════════════════ // + +// DeleteFilesRequest is the request message for deleting multiple files. +message DeleteFilesRequest { + // context: Context ID for the files + string context = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "context_prefix" + expression: "this.startsWith('missions:') || this.startsWith('setups:')" + message: "context must start with 'mission:' or 'setups:'" + }, + (buf.validate.field).cel = { + id: "context_length" + expression: + "this.startsWith('missions:') ? this.size() >= 10 : true" + "|| this.startsWith('setups:') ? this.size() >= 8 : true" + message: "context must be at least 1 characters long" + } + ]; + // force: Whether to force delete even if file is in use + bool force = 2 [(buf.validate.field).required = true]; + // permanent: Whether to permanently delete (vs mark as deleted) + bool permanent = 3 [(buf.validate.field).required = true]; + // filters: How to identify the files + FileFilter filters = 4 [(buf.validate.field).required = true]; +} + +// DeleteFilesResponse is the response message for file deletion operations. +message DeleteFilesResponse { + // Result of the operation. Expected oneof type: File or OperationError. + repeated FileResult result = 1 [(buf.validate.field).required = true]; + // bulk: Bulk response containing the results of the delete operation + agentic_mesh_protocol.pagination.v1.BulkResponse bulk = 2 [(buf.validate.field).required = true]; +} diff --git a/proto/agentic_mesh_protocol/filesystem/v1/filesystem_enums.proto b/proto/agentic_mesh_protocol/filesystem/v1/filesystem_enums.proto new file mode 100644 index 0000000..3b7a89c --- /dev/null +++ b/proto/agentic_mesh_protocol/filesystem/v1/filesystem_enums.proto @@ -0,0 +1,53 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.filesystem.v1; + +// FileType represents the classification of file types in the system. +enum FileType { + // UNTYPED represents an unspecified file type. + FILE_TYPE_UNSPECIFIED = 0; + // DOCUMENT represents document files (PDF, DOC, TXT, etc.). + DOCUMENT = 1; + // IMAGE represents image files (PNG, JPG, GIF, etc.). + IMAGE = 2; + // VIDEO represents video files (MP4, AVI, MOV, etc.). + VIDEO = 3; + // AUDIO represents audio files (MP3, WAV, etc.). + AUDIO = 4; + // ARCHIVE represents archive files (ZIP, TAR, etc.). + ARCHIVE = 5; + // CODE represents source code files. + CODE = 6; + // OTHER represents other file types. + OTHER = 7; +} + +// FileStatus represents the lifecycle status of a file in the system. +enum FileStatus { + //UNSPECIFIED indicates an unspecified file status. + FILE_STATUS_UNSPECIFIED = 0; + // UPLOADING indicates the file is currently being uploaded. + UPLOADING = 1; + // ACTIVE indicates the file is active and available for use. + ACTIVE = 2; + // PROCESSING indicates the file is being processed. + PROCESSING = 3; + // ARCHIVED indicates the file has been archived. + ARCHIVED = 4; + // DELETED indicates the file is marked for deletion. + DELETED = 5; +} diff --git a/proto/agentic_mesh_protocol/filesystem/v1/filesystem_messages.proto b/proto/agentic_mesh_protocol/filesystem/v1/filesystem_messages.proto new file mode 100644 index 0000000..7894e03 --- /dev/null +++ b/proto/agentic_mesh_protocol/filesystem/v1/filesystem_messages.proto @@ -0,0 +1,254 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.filesystem.v1; + +import "agentic_mesh_protocol/filesystem/v1/filesystem_enums.proto"; +import "agentic_mesh_protocol/pagination/v1/bulk.proto"; +import "buf/validate/validate.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +// File represents a stored file with comprehensive metadata. +message File { + option (buf.validate.message).cel = { + id: "file.size_matches_content" + message: "size_bytes must match the actual content length" + expression: "!has(this.content) || this.size_bytes == this.content.size()" + }; + // file_id: Unique identifier for the file (UUID) + string id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.uuid = true, + (buf.validate.field).string.min_len = 1 + ]; + // context: Context ID linked to the file + string context = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "context_prefix" + expression: "this.startsWith('missions:') || this.startsWith('setups:')" + message: "context must start with 'mission:' or 'setups:'" + }, + (buf.validate.field).cel = { + id: "context_length" + expression: + "this.startsWith('missions:') ? this.size() >= 10 : true" + "|| this.startsWith('setups:') ? this.size() >= 8 : true" + message: "context must be at least 1 characters long" + } + ]; + // name: Name of the file (unique within context) + string name = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // content_type: MIME type of the file + string content_type = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // checksum: SHA-256 checksum of the file content (SHA-256 format) + string checksum = 5 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // storage_uri: Internal URI for accessing the file content + string storage_uri = 6 [ + (buf.validate.field).required = true, + (buf.validate.field).string.uri_ref = true, + (buf.validate.field).string.min_len = 1 + ]; + // file_url: External URL for accessing the file content + string url = 7 [ + (buf.validate.field).required = true, + (buf.validate.field).string.uri = true, + (buf.validate.field).string.min_len = 1 + ]; + // size_bytes: Size of the file in bytes + int64 size_bytes = 8 [ + (buf.validate.field).required = true, + (buf.validate.field).int64.gt = 0 + ]; + // content: The content of the file + bytes content = 9 [(buf.validate.field).required = true]; + // status: Current status of the file + FileStatus status = 10 [ + (buf.validate.field).required = true, + (buf.validate.field).enum.defined_only = true + ]; + // file_type: Type classification of the file + FileType type = 11 [ + (buf.validate.field).required = true, + (buf.validate.field).enum.defined_only = true + ]; + // metadata: Flexible metadata for additional file properties + google.protobuf.Struct metadata = 12 [(buf.validate.field).required = true]; +} + +// FileFilter contains criteria for querying and filtering files. +message FileFilter { + option (buf.validate.message).cel = { + id: "created_after_before_created_before" + expression: "!has(this.created_after) || !has(this.created_before) || this.created_after < this.created_before" + message: "created_after must be before created_before" + }; + option (buf.validate.message).cel = { + id: "created_after_before_updated_after" + expression: "!has(this.created_after) || !has(this.updated_after) || this.created_after < this.updated_after" + message: "created_after must be before updated_after" + }; + option (buf.validate.message).cel = { + id: "created_before_before_updated_before" + expression: "!has(this.created_before) || !has(this.updated_before) || this.created_before < this.updated_before" + message: "created_before must be before updated_before" + }; + option (buf.validate.message).cel = { + id: "updated_after_before_updated_before" + expression: "!has(this.updated_after) || !has(this.updated_before) || this.updated_after < this.updated_before" + message: "updated_after must be before updated_before" + }; + + // context: Filter by context (required for scoping) + string context = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // content_type_prefix: Filter by content type prefix (e.g., "image/") + string content_type_prefix = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // prefix: Filter by path prefix (e.g., "folder1/") + string prefix = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "prefix_format" + expression: "this.endsWith('/') || !this.contains('/')" + message: "prefix must be a single path segment or end with '/'" + } + ]; + // content_type: Filter by content type + string content_type = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // min_size_bytes: Filter files with minimum size + int64 min_size_bytes = 5 [ + (buf.validate.field).required = true, + (buf.validate.field).int64.gt = 0 + ]; + // max_size_bytes: Filter files with maximum size + int64 max_size_bytes = 6 [ + (buf.validate.field).required = true, + (buf.validate.field).int64.gt = 0 + ]; + // status: Filter by file status + FileStatus status = 7 [ + (buf.validate.field).required = true, + (buf.validate.field).enum.defined_only = true + ]; + // created_after: Filter files created after this timestamp + google.protobuf.Timestamp created_after = 8 [(buf.validate.field).required = true]; + // created_before: Filter files created before this timestamp + google.protobuf.Timestamp created_before = 9 [(buf.validate.field).required = true]; + // updated_after: Filter files updated after this timestamp + google.protobuf.Timestamp updated_after = 10 [(buf.validate.field).required = true]; + // updated_before: Filter files updated before this timestamp + google.protobuf.Timestamp updated_before = 11 [(buf.validate.field).required = true]; + // names: Filter by file names (exact matches) + repeated string names = 12 [ + (buf.validate.field).required = true, + (buf.validate.field).repeated.items.string.min_len = 1 + ]; + // file_ids: Filter by file IDs + repeated string ids = 13 [ + (buf.validate.field).required = true, + (buf.validate.field).repeated.items.string.uuid = true, + (buf.validate.field).repeated.items.string.min_len = 1 + ]; + // file_types: Filter by file types + repeated FileType types = 14 [ + (buf.validate.field).required = true, + (buf.validate.field).repeated.items.enum.defined_only = true + ]; +} + +// UploadFileData contains the data required for uploading a single file. +message UploadFileData { + // context: Context ID for the file + string context = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "context_prefix" + expression: "this.startsWith('missions:') || this.startsWith('setups:')" + message: "context must start with 'mission:' or 'setups:'" + }, + (buf.validate.field).cel = { + id: "context_length" + expression: + "this.startsWith('missions:') ? this.size() >= 10 : true" + "|| this.startsWith('setups:') ? this.size() >= 8 : true" + message: "context must be at least 1 characters long" + } + ]; + // name: Name of the file + string name = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // content_type: MIME type of the file + string content_type = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // content: File content + bytes content = 4 [(buf.validate.field).required = true]; + // replace_if_exists: Whether to replace existing file with same name + bool replace_if_exists = 5 [(buf.validate.field).required = true]; + // status: Status of the file + FileStatus status = 6 [(buf.validate.field).required = true]; + // file_type: Type classification of the file + FileType type = 7 [ + (buf.validate.field).required = true, + (buf.validate.field).enum.defined_only = true + ]; + // metadata: Additional metadata for the file + google.protobuf.Struct metadata = 8 [(buf.validate.field).required = true]; +} + +// FileResult represents the result of a file operation, including success or error information. +message FileResult { + // identifier is the unique identifier for the item being processed + string identifier = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // success indicates if the operation was successful (optional for backward compatibility). + optional bool success = 2 [(buf.validate.field).required = false]; + + // content is the raw file content if requested and operation was successful. + optional bytes content = 3 [(buf.validate.field).required = false]; + + // One of the following fields will be set based on the outcome of processing the item. + oneof outcom { + // file is the file data if the operation was successful. + File file = 4; + // error represents the error that occurred while processing the item, if applicable. + agentic_mesh_protocol.pagination.v1.OperationError error = 5; + } +} diff --git a/proto/agentic_mesh_protocol/filesystem/v1/filesystem_service.proto b/proto/agentic_mesh_protocol/filesystem/v1/filesystem_service.proto index 8bb3078..0c01f08 100644 --- a/proto/agentic_mesh_protocol/filesystem/v1/filesystem_service.proto +++ b/proto/agentic_mesh_protocol/filesystem/v1/filesystem_service.proto @@ -16,7 +16,7 @@ syntax = "proto3"; package agentic_mesh_protocol.filesystem.v1; -import "agentic_mesh_protocol/filesystem/v1/filesystem.proto"; +import "agentic_mesh_protocol/filesystem/v1/filesystem_dto.proto"; // FilesystemService provides comprehensive file management capabilities including // upload, retrieval, update, and deletion operations with metadata support, @@ -32,11 +32,11 @@ service FilesystemService { // unique ID or name within a context. rpc GetFile(GetFileRequest) returns (GetFileResponse); - // GetFiles provides efficient retrieval of multiple files using + // ListFiles provides efficient retrieval of multiple files using // file IDs, file names, or path prefix, with support for // pagination for large result sets, optional content inclusion, // and total count of matching files. - rpc GetFiles(GetFilesRequest) returns (GetFilesResponse); + rpc ListFiles(ListFilesRequest) returns (ListFilesResponse); // UpdateFile allows updating various aspects of a file including // renaming files, updating content and content type, modifying metadata, diff --git a/proto/agentic_mesh_protocol/module/v1/information.proto b/proto/agentic_mesh_protocol/module/v1/information.proto deleted file mode 100644 index 88ac1c4..0000000 --- a/proto/agentic_mesh_protocol/module/v1/information.proto +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright 2025 DigitalKin Inc. -// -// Licensed under the GNU General Public License, Version 3.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.gnu.org/licenses/gpl-3.0.html -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package agentic_mesh_protocol.module.v1; - -import "buf/validate/validate.proto"; -import "google/protobuf/struct.proto"; - -// GetModuleInputRequest -// -// Fields: -// -// - module_id: Database ID of the Module to get input schema -// - llm_format: Define if the input schema should be in LLM format or raw pydantic format -message GetModuleInputRequest { - // module_id: Database ID of the Module to get input schema - string module_id = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.prefix = "modules:", - (buf.validate.field).required = true - ]; - // llm_format: Define if the input schema should be in LLM format or raw pydantic format - bool llm_format = 2; -} - -// GetModuleSelectSchemaRequest -// -// Fields: -// -// - module_id: Database ID of the Module to get select schema -// - llm_format: Define if the select schema should be in LLM format or raw pydantic format -message GetModuleSelectInputRequest { - // module_id: Database ID of the Module to get select input schema - string module_id = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.prefix = "modules:", - (buf.validate.field).required = true - ]; -} - -// GetModuleOutputRequest -// -// Fields: -// -// - module_id: Database ID of the Module to get output schema -// - llm_format: Define if the output schema should be in LLM format or raw pydantic format -message GetModuleOutputRequest { - // module_id: Database ID of the Module to get output schema - string module_id = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.prefix = "modules:", - (buf.validate.field).required = true - ]; - // llm_format: Define if the output schema should be in LLM format or raw pydantic format - bool llm_format = 2; -} - -// GetModuleSetupRequest -// -// Fields: -// -// - module_id: Database ID of the Module to get setup schema -// - llm_format: Define if the setup schema should be in LLM format or raw pydantic format -message GetModuleSetupRequest { - // module_id: Database ID of the Module to get setup schema - string module_id = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.prefix = "modules:", - (buf.validate.field).required = true - ]; - // llm_format: Define if the setup schema should be in LLM format or raw pydantic format - bool llm_format = 2; -} - -// GetModuleSecretRequest -// -// Fields: -// -// - module_id: Database ID of the Module to get secret schema -// - llm_format: Define if the secret schema should be in LLM format or raw pydantic format -message GetModuleSecretRequest { - // module_id: Database ID of the Module to get secret schema - string module_id = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.prefix = "modules:", - (buf.validate.field).required = true - ]; - // llm_format: Define if the secret schema should be in LLM format or raw pydantic format - bool llm_format = 2; -} - -// GetModuleInputResponse -// -// Returns: -// -// - success: Flag to indicate if the input schema request was successful -// - input_schema: Input schema of the Module -message GetModuleInputResponse { - // success: Flag to indicate if the input schema request was successful - bool success = 1; - // input_schema: Input schema of the Module - google.protobuf.Struct input_schema = 2 [(buf.validate.field).required = true]; -} - -// GetModuleInputSelectResponse -// -// Returns: -// -// - success: Flag to indicate if the input schema request was successful -// - input_schema: Input schema of the Module -message GetModuleSelectInputResponse { - // success: Flag to indicate if the input schema request was successful - bool success = 1; - // input_schema: Input schema of the Module - google.protobuf.Struct select_input_schema = 2 [(buf.validate.field).required = true]; -} - -// GetModuleOutputResponse -// -// Returns: -// -// - success: Flag to indicate if the output schema request was successful -// - output_schema: Output schema of the Module -message GetModuleOutputResponse { - // success: Flag to indicate if the output schema request was successful - bool success = 1; - // output_schema: Output schema of the Module - google.protobuf.Struct output_schema = 2 [(buf.validate.field).required = true]; -} - -// GetModuleSetupResponse -// -// Returns: -// -// - success: Flag to indicate if the setup schema request was successful -// - setup_schema: Setup schema of the Module -message GetModuleSetupResponse { - // success: Flag to indicate if the setup schema request was successful - bool success = 1; - // setup_schema: Setup schema of the Module - google.protobuf.Struct setup_schema = 2 [(buf.validate.field).required = true]; -} - -// GetModuleSecretResponse -// -// Returns: -// -// - success: Flag to indicate if the secret schema request was successful -// - setup_schema: Secret schema of the Module -message GetModuleSecretResponse { - // success: Flag to indicate if the secret schema request was successful - bool success = 1; - // secret_schema: Secret schema of the Module - google.protobuf.Struct secret_schema = 2 [(buf.validate.field).required = true]; -} - -// GetConfigSetupModuleRequest -// -// Fields: -// -// - module_id: Database ID of the Module to get config setup schema -// - llm_format: Define if the setup schema should be in LLM format or raw pydantic format -message GetConfigSetupModuleRequest { - // module_id: Database ID of the Module to get setup schema - string module_id = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.prefix = "modules:", - (buf.validate.field).required = true - ]; - // llm_format: Define if the setup schema should be in LLM format or raw pydantic format - bool llm_format = 2; -} - -// GetConfigSetupModuleResponse -// -// Returns: -// -// - success: Flag to indicate if the config setup schema request was successful -// - config_setup_schema: Config setup schema of the Module -message GetConfigSetupModuleResponse { - // success: Flag to indicate if the setup schema request was successful - bool success = 1; - // config_setup_schema: Setup schema of the Module - google.protobuf.Struct config_setup_schema = 2 [(buf.validate.field).required = true]; -} - -// GetModuleCostRequest -// -// Fields: -// -// - module_id: Database ID of the Module to get cost schema -// - llm_format: If true, return LLM format; else raw pydantic format -message GetModuleCostRequest { - // module_id: Database ID of the Module to get cost schema - string module_id = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.prefix = "modules:", - (buf.validate.field).required = true - ]; - // llm_format: If true, return LLM format; else raw pydantic format - bool llm_format = 2; -} - -// GetModuleCostResponse -// -// Returns: -// -// - success: Flag to indicate if the cost schema request was successful -// - cost_schema: Cost configuration schema of the Module -message GetModuleCostResponse { - // success: Flag to indicate if the cost schema request was successful - bool success = 1; - // cost_schema: Cost configuration schema of the Module - google.protobuf.Struct cost_schema = 2 [(buf.validate.field).required = true]; -} diff --git a/proto/agentic_mesh_protocol/module/v1/lifecycle.proto b/proto/agentic_mesh_protocol/module/v1/lifecycle.proto deleted file mode 100644 index 2d0494a..0000000 --- a/proto/agentic_mesh_protocol/module/v1/lifecycle.proto +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright 2025 DigitalKin Inc. -// -// Licensed under the GNU General Public License, Version 3.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.gnu.org/licenses/gpl-3.0.html -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package agentic_mesh_protocol.module.v1; - -import "agentic_mesh_protocol/setup/v1/setup.proto"; -import "buf/validate/validate.proto"; -import "google/protobuf/struct.proto"; - -// ConfigSetupModuleRequest -// This request is used to configure an existing setup version. -// -// Fields: -// - setup_version: The setup version to configure. -// - content: The new content to compute and/or configure. -// - mission_id: Database ID of the Module to start -message ConfigSetupModuleRequest { - // setup_version: The setup version to configure. - agentic_mesh_protocol.setup.v1.SetupVersion setup_version = 1 [(buf.validate.field).required = true]; - // content: The new content to compute and/or configure. - google.protobuf.Struct content = 2 [(buf.validate.field).required = true]; - // mission_id: Database ID of the Module to start - string mission_id = 3 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.prefix = "missions:", - (buf.validate.field).required = true - ]; -} - -// ConfigSetupModuleResponse -// Returns the configured setup version. -// -// Fields: -// - success: description flag of the operation. -// - setup_version: The updated setup version entity. -message ConfigSetupModuleResponse { - // success: description flag of the operation. - bool success = 1; - // setup_version: The updated setup version entity. - agentic_mesh_protocol.setup.v1.SetupVersion setup_version = 2; -} - -// StartModuleRequest -// TODO: do we have to add secret_id ? -// -// Fields: -// -// - input: Structured input data for the module -// - setup_id: Database ID of the setupused to start the module -// - mission_id: Database ID of the Module to start -message StartModuleRequest { - // input: Structured input data for the module - google.protobuf.Struct input = 1 [(buf.validate.field).required = true]; - // setup_id: Database ID of the setup used to start the module - string setup_id = 2 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.prefix = "setups:", - (buf.validate.field).required = true - ]; - // mission_id: Database ID of the Module to start - string mission_id = 3 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.prefix = "missions:", - (buf.validate.field).required = true - ]; -} - -// StopModuleRequest -// -// Fields: -// -// - module_id: Database ID of the Module to stop -message StopModuleRequest { - // job_id: Database ID of the job to stop - string job_id = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.prefix = "jobs:", - (buf.validate.field).required = true - ]; -} - -// StartModuleResponse -// -// Returns: -// -// - success: Flag to indicate if the started/stopped request was successful -// - output: Structured output data a job -// - job_id: Database ID of the job inside the Module that was queried -message StartModuleResponse { - // success: Flag to indicate if the started request was successful - bool success = 1; - // output: Structured output data of a started job (streamed) - google.protobuf.Struct output = 2 [(buf.validate.field).required = true]; - // job_id: Database ID of the job inside the Module that was queried - string job_id = 3 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.prefix = "jobs:", - (buf.validate.field).required = true - ]; -} - -// StopModuleResponse -// -// Returns: -// -// - success: Flag to indicate if the started/stopped request was successful -// - module_id: Database ID of the Module that was started/stopped -message StopModuleResponse { - // success: Flag to indicate if the started/stopped request was successful - bool success = 1; - // job_id: Database ID of the Module that was started/stopped - optional string job_id = 2 [(buf.validate.field).string.prefix = "jobs:"]; -} diff --git a/proto/agentic_mesh_protocol/module/v1/module_dto.proto b/proto/agentic_mesh_protocol/module/v1/module_dto.proto new file mode 100644 index 0000000..c0d0587 --- /dev/null +++ b/proto/agentic_mesh_protocol/module/v1/module_dto.proto @@ -0,0 +1,300 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.module.v1; + +import "agentic_mesh_protocol/module/v1/module_messages.proto"; +import "agentic_mesh_protocol/setup/v1/setup_messages.proto"; +import "buf/validate/validate.proto"; +import "google/protobuf/struct.proto"; + +// ════════════════════════════════════ GetModuleInput ════════════════════════════════════ // + +// Retrieves the input schema for a given module. +message GetModuleInputRequest { + // The unique identifier of the module. + string id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "module_id_prefix" + expression: "this.startsWith('modules:')" + message: "module_id must start with 'modules:'" + }, + (buf.validate.field).cel = { + id: "module_id_length" + expression: "this.size() >= 9" + message: "module_id must be at least 1 characters long" + } + ]; + // If true, returns the schema in LLM format. + bool llm_format = 2 [(buf.validate.field).required = true]; +} + +// Response containing the input schema of the module. +message GetModuleInputResponse { + // Result of the operation. Expected oneof type: input_schema (Struct) or OperationError. + ModuleResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ GetModuleOutput ════════════════════════════════════ // + +// Retrieves the output schema for a given module. +message GetModuleOutputRequest { + // The unique identifier of the module. + string id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "module_id_prefix" + expression: "this.startsWith('modules:')" + message: "module_id must start with 'modules:'" + }, + (buf.validate.field).cel = { + id: "module_id_length" + expression: "this.size() >= 9" + message: "module_id must be at least 1 characters long" + } + ]; + // If true, returns the schema in LLM format. + bool llm_format = 2 [(buf.validate.field).required = true]; +} + +// Response containing the output schema of the module. +message GetModuleOutputResponse { + // Result of the operation. Expected oneof type: output_schema (Struct) or OperationError. + ModuleResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ GetModuleSetup ════════════════════════════════════ // + +// Retrieves the setup schema for a given module. +message GetModuleSetupRequest { + // The unique identifier of the module. + string id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "module_id_prefix" + expression: "this.startsWith('modules:')" + message: "module_id must start with 'modules:'" + }, + (buf.validate.field).cel = { + id: "module_id_length" + expression: "this.size() >= 9" + message: "module_id must be at least 1 characters long" + } + ]; + // If true, returns the schema in LLM format. + bool llm_format = 2 [(buf.validate.field).required = true]; +} + +// Response containing the setup schema of the module. +message GetModuleSetupResponse { + // Result of the operation. Expected oneof type: setup_schema (Struct) or OperationError. + ModuleResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ GetModuleSecret ════════════════════════════════════ // + +// Retrieves the secret schema for a given module. +message GetModuleSecretRequest { + // The unique identifier of the module. + string id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "module_id_prefix" + expression: "this.startsWith('modules:')" + message: "module_id must start with 'modules:'" + }, + (buf.validate.field).cel = { + id: "module_id_length" + expression: "this.size() >= 9" + message: "module_id must be at least 1 characters long" + } + ]; + // If true, returns the schema in LLM format. + bool llm_format = 2 [(buf.validate.field).required = true]; +} + +// Response containing the secret schema of the module. +message GetModuleSecretResponse { + // Result of the operation. Expected oneof type: secret_schema (Struct) or OperationError. + ModuleResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ GetConfigSetupModule ════════════════════════════════════ // + +// Retrieves the configuration setup schema for a given module. +message GetConfigSetupModuleRequest { + // The unique identifier of the module. + string id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "module_id_prefix" + expression: "this.startsWith('modules:')" + message: "module_id must start with 'modules:'" + }, + (buf.validate.field).cel = { + id: "module_id_length" + expression: "this.size() >= 9" + message: "module_id must be at least 1 characters long" + } + ]; + // If true, returns the schema in LLM format. + bool llm_format = 2 [(buf.validate.field).required = true]; +} + +// Response containing the configuration setup schema of the module. +message GetConfigSetupModuleResponse { + // Result of the operation. Expected oneof type: config_setup_schema (Struct) or OperationError. + ModuleResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ ConfigSetupModule ════════════════════════════════════ // + +// Configures the setup for a given module. +message ConfigSetupModuleRequest { + // The mission ID associated with the setup. + string mission_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "mission_id_prefix" + expression: "this.startsWith('missions:')" + message: "mission_id must start with 'missions:'" + }, + (buf.validate.field).cel = { + id: "mission_id_length" + expression: "this.size() >= 10" + message: "mission_id must be at least 1 characters long" + } + ]; + // The configuration content for the setup. + google.protobuf.Struct content = 2 [(buf.validate.field).required = true]; + // The setup version to configure. + agentic_mesh_protocol.setup.v1.SetupVersion setup_version = 3 [(buf.validate.field).required = true]; +} + +// Response confirming the configuration of the module setup. +message ConfigSetupModuleResponse { + // Result of the operation. Expected oneof type: setup_version (SetupVersion) or OperationError. + ModuleResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ StartModule ════════════════════════════════════ // + +// Starts a module with the provided input and setup. +message StartModuleRequest { + // The setup ID to use for the module. + string setup_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_id_prefix" + expression: "this.startsWith('setups:')" + message: "setup_id must start with 'setups:'" + }, + (buf.validate.field).cel = { + id: "setup_id_length" + expression: "this.size() >= 8" + message: "setup_id must be at least 1 characters long" + } + ]; + // The mission ID associated with the module run. + string mission_id = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "mission_id_prefix" + expression: "this.startsWith('missions:')" + message: "mission_id must start with 'missions:'" + }, + (buf.validate.field).cel = { + id: "mission_id_length" + expression: "this.size() >= 10" + message: "mission_id must be at least 1 characters long" + } + ]; + // The input data for the module. + google.protobuf.Struct input = 3 [(buf.validate.field).required = true]; +} + +// Response containing the result of the started module operation. +message StartModuleResponse { + // job_id for return which module we start + string job_id = 1 [(buf.validate.field).required = true]; + // Result of the operation. Expected oneof type: job_id (string), output (Struct), or OperationError. + ModuleResult result = 2 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ StopModule ════════════════════════════════════ // + +// Stops a running module by job ID. +message StopModuleRequest { + // The job ID to stop. + string job_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "job_id_prefix" + expression: "this.startsWith('jobs:')" + message: "job_id must start with 'jobs:'" + }, + (buf.validate.field).cel = { + id: "job_id_length" + expression: "this.size() >= 6" + message: "job_id must be at least 1 characters long" + } + ]; +} + +// Response confirming the stopping of the module. +message StopModuleResponse { + // Result of the operation. Expected oneof type: job_id (string) or OperationError. + ModuleResult result = 1 [(buf.validate.field).required = true]; +} + +// ══════════════════════════════ Getmoduleselectinput ══════════════════════════════ // + +// Retreive module select input +message GetModuleSelectInputRequest { + // module_id: Database ID of the Module to get select input schema + string module_id = 1 [ + (buf.validate.field).string.min_len = 1, + (buf.validate.field).string.prefix = "modules:", + (buf.validate.field).required = true + ]; +} + +// Response to give module selct input +message GetModuleSelectInputResponse { + // Result of the operation. Expected oneof type: job_id (string) or OperationError. + ModuleResult result = 1 [(buf.validate.field).required = true]; +} + +// ═════════════════════════════════ Getmodulecost ══════════════════════════════════ // + +// Retreive modult cost +message GetModuleCostRequest { + // module_id: Database ID of the Module to get cost schema + string module_id = 1 [ + (buf.validate.field).string.min_len = 1, + (buf.validate.field).string.prefix = "modules:", + (buf.validate.field).required = true + ]; + // llm_format: If true, return LLM format; else raw pydantic format + bool llm_format = 2; +} + +// Response to give cost module +message GetModuleCostResponse { + // Result of the operation. Expected oneof type: job_id (string) or OperationError. + ModuleResult result = 1 [(buf.validate.field).required = true]; +} diff --git a/proto/agentic_mesh_protocol/module/v1/module_enums.proto b/proto/agentic_mesh_protocol/module/v1/module_enums.proto new file mode 100644 index 0000000..5315edb --- /dev/null +++ b/proto/agentic_mesh_protocol/module/v1/module_enums.proto @@ -0,0 +1,39 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.module.v1; + +// Status of a module in the system. +enum ModuleStatus { + //UNSPECIFIED indicates an unspecified module status. + MODULE_STATUS_UNSPECIFIED = 0; + // The module is ready to be used. + READY = 1; + // The module is currently active. + ACTIVE = 2; + // The module is archived and inactive. + ARCHIVED = 3; +} + +// Type of the module in the system. +enum ModuleType { + // UNTYPED represents an unspecified module type. + MODULE_TYPE_UNSPECIFIED = 0; + // The module is an archetype (template or base type). + ARCHETYPE = 1; + // The module is a tool (utility or service). + TOOL = 2; +} diff --git a/proto/agentic_mesh_protocol/module/v1/module_messages.proto b/proto/agentic_mesh_protocol/module/v1/module_messages.proto new file mode 100644 index 0000000..3feb0b0 --- /dev/null +++ b/proto/agentic_mesh_protocol/module/v1/module_messages.proto @@ -0,0 +1,58 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.module.v1; + +import "agentic_mesh_protocol/pagination/v1/bulk.proto"; +import "agentic_mesh_protocol/setup/v1/setup_messages.proto"; +import "buf/validate/validate.proto"; +import "google/protobuf/struct.proto"; + +// ModuleResult represents the result of a module operation, including success or error information. +message ModuleResult { + // identifier is the unique identifier for the item being processed + string identifier = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // success indicates if the operation was successful (optional for backward compatibility). + optional bool success = 2 [(buf.validate.field).required = false]; + + // One of the following fields will be set based on the outcome of processing the item. + oneof outcom { + // input_schema is the input schema of the module. + google.protobuf.Struct input_schema = 3; + // output_schema is the output schema of the module. + google.protobuf.Struct output_schema = 4; + // setup_schema is the setup schema of the module. + google.protobuf.Struct setup_schema = 5; + // secret_schema is the secret schema of the module. + google.protobuf.Struct secret_schema = 6; + // cost_schema is the cost schema of the module. + google.protobuf.Struct cost_schema = 7; + // config_setup_schema is the config setup schema of the module. + google.protobuf.Struct config_setup_schema = 8; + // select_input_schema of the module + google.protobuf.Struct select_input_schema = 9; + // output is the output data of the module execution. + google.protobuf.Struct output = 10; + // setup_version is the setup version if the operation was successful. + agentic_mesh_protocol.setup.v1.SetupVersion setup_version = 11; + // error represents the error that occurred while processing the item, if applicable. + agentic_mesh_protocol.pagination.v1.OperationError error = 12; + } +} diff --git a/proto/agentic_mesh_protocol/module/v1/module_service.proto b/proto/agentic_mesh_protocol/module/v1/module_service.proto index 9b28dcf..b8a10dc 100644 --- a/proto/agentic_mesh_protocol/module/v1/module_service.proto +++ b/proto/agentic_mesh_protocol/module/v1/module_service.proto @@ -16,9 +16,7 @@ syntax = "proto3"; package agentic_mesh_protocol.module.v1; -import "agentic_mesh_protocol/module/v1/information.proto"; -import "agentic_mesh_protocol/module/v1/lifecycle.proto"; -import "agentic_mesh_protocol/module/v1/monitoring.proto"; +import "agentic_mesh_protocol/module/v1/module_dto.proto"; // ModuleService // It represents a functional unit within an agent in the multi-agent system (SMA). @@ -33,10 +31,6 @@ service ModuleService { rpc StartModule(StartModuleRequest) returns (stream StartModuleResponse); // StopModule rpc StopModule(StopModuleRequest) returns (StopModuleResponse); - // GetModuleStatus - rpc GetModuleStatus(GetModuleStatusRequest) returns (GetModuleStatusResponse); - // GetModuleJobs - rpc GetModuleJobs(GetModuleJobsRequest) returns (GetModuleJobsResponse); // GetModuleInput rpc GetModuleInput(GetModuleInputRequest) returns (GetModuleInputResponse); // GetModuleSelectInput diff --git a/proto/agentic_mesh_protocol/module/v1/monitoring.proto b/proto/agentic_mesh_protocol/module/v1/monitoring.proto deleted file mode 100644 index 4fd9d08..0000000 --- a/proto/agentic_mesh_protocol/module/v1/monitoring.proto +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright 2025 DigitalKin Inc. -// -// Licensed under the GNU General Public License, Version 3.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.gnu.org/licenses/gpl-3.0.html -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package agentic_mesh_protocol.module.v1; - -import "buf/validate/validate.proto"; - -// ModuleStatus -// TODO: adapt to the real status of the module -enum ModuleStatus { - // MODULE_STATUS_UNSPECIFIED is the default unspecified value - MODULE_STATUS_UNSPECIFIED = 0; - // MODULE_STATUS_STARTING is the status when the module is starting - MODULE_STATUS_STARTING = 1; - // MODULE_STATUS_PROCESSING is the status when the module is processing - MODULE_STATUS_PROCESSING = 2; - // MODULE_STATUS_CANCELED is the status when the module is canceled - MODULE_STATUS_CANCELED = 3; - // MODULE_STATUS_FAILED is the status when the module is failed - MODULE_STATUS_FAILED = 4; - // MODULE_STATUS_EXPIRED is the status when the module is expired - MODULE_STATUS_EXPIRED = 5; - // MODULE_STATUS_SUCCESS is the status when the module is successful - MODULE_STATUS_SUCCESS = 6; - // MODULE_STATUS_STOPPED is the status when the module is stopped - MODULE_STATUS_STOPPED = 7; -} - -// JobInfo -// -// Represents information about a single job -message JobInfo { - // job_id: Database ID of the job inside the Module - string job_id = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.prefix = "jobs:", - (buf.validate.field).required = true - ]; - - // job_status: Status of the individual job - ModuleStatus job_status = 2 [ - (buf.validate.field).enum.defined_only = true, - (buf.validate.field).required = true - ]; -} - -// GetModuleStatusRequest -// -// Fields: -// -// - job_id: Database ID of the Job Module to get status -message GetModuleStatusRequest { - // job_id: Database ID of the Job Module to get status - string job_id = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.prefix = "jobs:", - (buf.validate.field).required = true - ]; -} - -// GetModuleStatusResponse -// -// Returns: -// -// - success: Flag to indicate if the status request was successful -// - status: Status of the Module -// - job_id: Database ID of the job inside the Module that was queried -message GetModuleStatusResponse { - // success: Flag to indicate if the status request was successful - bool success = 1; - // status: Status of the Module - ModuleStatus status = 2 [ - (buf.validate.field).enum.defined_only = true, - (buf.validate.field).required = true - ]; - // job_id: Database ID of the job inside the Module that was queried - string job_id = 3 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.prefix = "jobs:", - (buf.validate.field).required = true - ]; -} - -// GetModuleJobsRequest -// TODO: adapt depending on the real way we will get the jobs -// -// Fields: -// -// - job_id: Database ID of the Job Module to get status -message GetModuleJobsRequest {} - -// GetModuleJobsResponse -// -// Returns: -// -// - success: Flag to indicate if the status request was successful -// - jobs: List of jobs with their respective IDs and statuses -message GetModuleJobsResponse { - // success: Flag to indicate if the status request was successful - bool success = 1; - // jobs: List of jobs with their respective IDs and statuses - repeated JobInfo jobs = 3; -} diff --git a/proto/agentic_mesh_protocol/module_registry/v1/discover.proto b/proto/agentic_mesh_protocol/module_registry/v1/discover.proto deleted file mode 100644 index 8840b11..0000000 --- a/proto/agentic_mesh_protocol/module_registry/v1/discover.proto +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2025 DigitalKin Inc. -// -// Licensed under the GNU General Public License, Version 3.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.gnu.org/licenses/gpl-3.0.html -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package agentic_mesh_protocol.module_registry.v1; - -import "agentic_mesh_protocol/module_registry/v1/metadata.proto"; -import "buf/validate/validate.proto"; - -// DiscoverSearchRequest -message DiscoverSearchRequest { - // module_type: Type of the module to search for (trigger, tool, kin, view). - optional string module_type = 1 [ - (buf.validate.field).string.in = "trigger", - (buf.validate.field).string.in = "tool", - (buf.validate.field).string.in = "kin", - (buf.validate.field).string.in = "view", - (buf.validate.field).required = true - ]; - // name: Module's name to search - optional string name = 2 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).required = true - ]; - // tags: List of tags to filter modules with. - repeated Tag tags = 3; - // description: Module's description to search. - optional string description = 4 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).required = true - ]; -} - -// DiscoverSearchResponse -message DiscoverSearchResponse { - // modules: List of matching modules. - repeated DiscoverInfoResponse modules = 1; -} - -// DiscoverInfoRequest -message DiscoverInfoRequest { - // module_id: Id of the module. - string module_id = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).required = true - ]; -} - -// DiscoverInfoResponse -message DiscoverInfoResponse { - // module_id: Id of the module. - string module_id = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).required = true - ]; - // module_type: Type of the module (trigger, tool, kin, view). - string module_type = 2 [ - (buf.validate.field).string.in = "trigger", - (buf.validate.field).string.in = "tool", - (buf.validate.field).string.in = "kin", - (buf.validate.field).string.in = "view", - (buf.validate.field).required = true - ]; - // address: Address used to communicate with the module. - string address = 3 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).required = true - ]; - // port: Port used to communicate with the module. - int32 port = 4 [ - (buf.validate.field).int32.gte = 1, - (buf.validate.field).int32.lte = 65535, - (buf.validate.field).required = true - ]; - // version: Current module version. - string version = 5 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).required = true - ]; - // metadata: user defined module name, description and tags - optional Metadata metadata = 6; -} diff --git a/proto/agentic_mesh_protocol/module_registry/v1/metadata.proto b/proto/agentic_mesh_protocol/module_registry/v1/metadata.proto deleted file mode 100644 index 19483ee..0000000 --- a/proto/agentic_mesh_protocol/module_registry/v1/metadata.proto +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2025 DigitalKin Inc. -// -// Licensed under the GNU General Public License, Version 3.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.gnu.org/licenses/gpl-3.0.html -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package agentic_mesh_protocol.module_registry.v1; - -import "buf/validate/validate.proto"; - -// Tag -message Tag { - // tag: Describe a Module function. - string tag = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).required = true - ]; -} - -// Metadata -message Metadata { - // name: Module's name - string name = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).required = true - ]; - // tags: List of tag to describe a module functionalities. - repeated Tag tags = 2; - // description: Module's description for search and indexing - optional string description = 3 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).required = true - ]; -} diff --git a/proto/agentic_mesh_protocol/module_registry/v1/module_registry_service.proto b/proto/agentic_mesh_protocol/module_registry/v1/module_registry_service.proto deleted file mode 100644 index fdc752f..0000000 --- a/proto/agentic_mesh_protocol/module_registry/v1/module_registry_service.proto +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2025 DigitalKin Inc. -// -// Licensed under the GNU General Public License, Version 3.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.gnu.org/licenses/gpl-3.0.html -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package agentic_mesh_protocol.module_registry.v1; - -import "agentic_mesh_protocol/module_registry/v1/discover.proto"; -import "agentic_mesh_protocol/module_registry/v1/registration.proto"; -import "agentic_mesh_protocol/module_registry/v1/status.proto"; - -// ModuleRegistryService -// It manages the registration, discovery, and status tracking of modules within a multi-agent system (MAS). -// In the context of MAS, this service allows autonomous agents to register their modules, making their capabilities -// discoverable by other agents. It facilitates dynamic collaboration by enabling agents to find and interact -// with available modules in real-time. Additionally, it ensures that the status of each module is kept up to date, -// supporting the overall adaptability and coordination of the multi-agent environment. -service ModuleRegistryService { - // RegisterModule - rpc RegisterModule(RegisterRequest) returns (RegisterResponse) {} - // DeregisterModule - rpc DeregisterModule(DeregisterRequest) returns (DeregisterResponse) {} - - // DiscoverInfoModule - rpc DiscoverInfoModule(DiscoverInfoRequest) returns (DiscoverInfoResponse) {} - // DiscoverSearchModule - rpc DiscoverSearchModule(DiscoverSearchRequest) returns (DiscoverSearchResponse) {} - - // GetModuleStatus - rpc GetModuleStatus(ModuleStatusRequest) returns (ModuleStatusResponse) {} - // ListModuleStatus - rpc ListModuleStatus(ListModulesStatusRequest) returns (ListModulesStatusResponse) {} - // GetAllModuleStatus - rpc GetAllModuleStatus(GetAllModulesStatusRequest) returns (stream ModuleStatusResponse) {} - // UpdateModuleStatus - rpc UpdateModuleStatus(UpdateStatusRequest) returns (UpdateStatusResponse) {} -} diff --git a/proto/agentic_mesh_protocol/module_registry/v1/registration.proto b/proto/agentic_mesh_protocol/module_registry/v1/registration.proto deleted file mode 100644 index f8508eb..0000000 --- a/proto/agentic_mesh_protocol/module_registry/v1/registration.proto +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2025 DigitalKin Inc. -// -// Licensed under the GNU General Public License, Version 3.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.gnu.org/licenses/gpl-3.0.html -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package agentic_mesh_protocol.module_registry.v1; - -import "agentic_mesh_protocol/module_registry/v1/metadata.proto"; -import "buf/validate/validate.proto"; - -// RegisterRequest -message RegisterRequest { - // module_id: Id of the module - string module_id = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).required = true - ]; - // module_type: Type of the module (trigger, tool, kin, view) - string module_type = 2 [ - (buf.validate.field).string.in = "trigger", - (buf.validate.field).string.in = "tool", - (buf.validate.field).string.in = "kin", - (buf.validate.field).string.in = "view", - (buf.validate.field).required = true - ]; - // address: Address used to communicate with the module - string address = 3 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).required = true - ]; - // port: Port used to communicate with the module - int32 port = 4 [(buf.validate.field).int32 = { - gte: 1 - lte: 65535 - }]; - // version: Current module version. - string version = 5 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).required = true - ]; - // metadata: user defined module name, description and tags - optional Metadata metadata = 6; -} - -// RegisterResponse -message RegisterResponse { - // success: True if the registration was successful - bool success = 1; -} - -// DeregisterRequest -message DeregisterRequest { - // module_id: Id of the module - string module_id = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).required = true - ]; -} - -// DeregisterResponse -message DeregisterResponse { - // success: True if the registration was successful - bool success = 1; -} diff --git a/proto/agentic_mesh_protocol/module_registry/v1/status.proto b/proto/agentic_mesh_protocol/module_registry/v1/status.proto deleted file mode 100644 index 34383a1..0000000 --- a/proto/agentic_mesh_protocol/module_registry/v1/status.proto +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2025 DigitalKin Inc. -// -// Licensed under the GNU General Public License, Version 3.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.gnu.org/licenses/gpl-3.0.html -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package agentic_mesh_protocol.module_registry.v1; - -import "buf/validate/validate.proto"; - -// ModuleStatus mirroring a module instance state, -enum ModuleStatus { - // MODULE_STATUS_UNSPECIFIED is the default unspecified value. - MODULE_STATUS_UNSPECIFIED = 0; - // MODULE_STATUS_RUNNING indicates the module is alive. - MODULE_STATUS_RUNNING = 1; - // MODULE_STATUS_IDLE indicates the module is waiting for an event / update. - MODULE_STATUS_IDLE = 2; - // MODULE_STATUS_ENDED indicates the module signals the end of task or have been killed. - MODULE_STATUS_ENDED = 3; -} - -// ModuleStatusRequest -message ModuleStatusRequest { - // module_id: Database ID of the job inside the Module. - string module_id = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.prefix = "modules:", - (buf.validate.field).required = true - ]; -} - -// ModuleStatusResponse -message ModuleStatusResponse { - // module_id: Database ID of the job inside the Module. - string module_id = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.prefix = "modules:", - (buf.validate.field).required = true - ]; - // status: Representation of the Module current state (running, idle, ended...). - ModuleStatus status = 2; - // message: (Optional) Details about the status. - optional string message = 3; -} - -// GetAllModulesStatusRequest -message GetAllModulesStatusRequest {} - -// ListModulesStatusRequest -message ListModulesStatusRequest { - // list_size: (Optional) The maximum number of module status to return in the response. - optional int32 list_size = 1; - // offset: (Optional) define the start index to start the list. - optional int32 offset = 2; -} - -// ListModulesStatusResponse -message ListModulesStatusResponse { - // list_size: length of the modules_status list. - int32 list_size = 1; - // modules_statuses: List of modules with their respective IDs and statuses. - repeated ModuleStatusResponse modules_statuses = 2; -} - -// UpdateStatusRequest -message UpdateStatusRequest { - // module_id: Id of the module - string module_id = 1 [ - (buf.validate.field).string.min_len = 1, - (buf.validate.field).required = true - ]; - // status: Set new fixed value for the current module. - ModuleStatus status = 2; -} - -// UpdateStatusResponse -message UpdateStatusResponse { - // success: True if the status was updated - bool success = 1; -} diff --git a/proto/agentic_mesh_protocol/pagination/v1/bulk.proto b/proto/agentic_mesh_protocol/pagination/v1/bulk.proto new file mode 100644 index 0000000..dcd3794 --- /dev/null +++ b/proto/agentic_mesh_protocol/pagination/v1/bulk.proto @@ -0,0 +1,53 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.pagination.v1; + +import "agentic_mesh_protocol/pagination/v1/pagination.proto"; +import "buf/validate/validate.proto"; + +// BulkResponse represents the response for a bulk operation on multiple items. +message BulkResponse { + // total is the total number of items processed in the bulk operation. + int32 total_process = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).int32.gte = 0 + ]; + + // total_failed is the total number of items that failed in the bulk operation. + int32 total_failed = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).int32.gte = 0 + ]; + + // pagination contains information about the pagination of the results, if applicable. + optional agentic_mesh_protocol.pagination.v1.PaginationResponse pagination = 3; +} + +// OperationError represents an error that occurred while processing an individual item in the bulk operation. +message OperationError { + // code is a short string representing the type of error that occurred. + string code = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // message is a human-readable description of the error that occurred. + string message = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; +} diff --git a/proto/agentic_mesh_protocol/pagination/v1/pagination.proto b/proto/agentic_mesh_protocol/pagination/v1/pagination.proto new file mode 100644 index 0000000..4f4d910 --- /dev/null +++ b/proto/agentic_mesh_protocol/pagination/v1/pagination.proto @@ -0,0 +1,70 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.pagination.v1; + +import "buf/validate/validate.proto"; + +// Pagination represents pagination parameters for listing requests. +message PaginationRequest { + // order: Field to order results by + string order = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // limit is the maximum number of items to return. + int32 limit = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).int32 = { + gt: 0 + lt: 100 + } + ]; + + // offset is the number of items to skip before starting to collect the result set. + int32 offset = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).int32.gte = 0 + ]; +} + +// PaginationResponse represents pagination information for listing responses. +message PaginationResponse { + // total_count is the total number of items available. + int32 total_count = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).int32.gte = 0 + ]; + + // page is the current page number. + int32 page = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).int32.gte = 0 + ]; + + // per_page is the number of items per page. + int32 per_page = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).int32.gte = 0 + ]; + + // total_pages is the total number of pages available. + int32 total_pages = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).int32.gte = 0 + ]; +} diff --git a/proto/agentic_mesh_protocol/registry/v1/registry_dto.proto b/proto/agentic_mesh_protocol/registry/v1/registry_dto.proto new file mode 100644 index 0000000..313e625 --- /dev/null +++ b/proto/agentic_mesh_protocol/registry/v1/registry_dto.proto @@ -0,0 +1,308 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.registry.v1; + +import "agentic_mesh_protocol/module/v1/module_enums.proto"; +import "agentic_mesh_protocol/pagination/v1/bulk.proto"; +import "agentic_mesh_protocol/pagination/v1/pagination.proto"; +import "agentic_mesh_protocol/registry/v1/registry_enums.proto"; +import "agentic_mesh_protocol/registry/v1/registry_messages.proto"; +import "agentic_mesh_protocol/setup/v1/setup_enums.proto"; +import "buf/validate/validate.proto"; + +// ════════════════════════════════════ RegisterModule ════════════════════════════════════ // + +// RegisterModuleRequest is used by a module to register itself with the registry. +message RegisterModuleRequest { + // module_id is the unique identifier of the module (must already exist in database). + string module_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "module_id_prefix" + expression: "this.startsWith('modules:')" + message: "module_id must start with 'modules:'" + }, + (buf.validate.field).cel = { + id: "module_id_length" + expression: "this.size() >= 9" + message: "module_id must be at least 1 characters long" + } + ]; + + // address is the network address to communicate with the module. + string address = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.uri = true, + (buf.validate.field).string.min_len = 1 + ]; + + // version is the runtime version of the deployed module. + string version = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // port is the network port to communicate with the module. + int32 port = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).int32 = { + gte: 1 + lte: 65535 + } + ]; +} + +// RegisterModuleResponse is returned by the registry after successful registration. +message RegisterModuleResponse { + // Result of the operation. Expected oneof type: ModuleDescriptor or OperationError. + RegistryResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ Heartbeat ════════════════════════════════════ // + +// HeartbeatRequest is sent periodically by a module to indicate it is alive. +message HeartbeatRequest { + // module_id is the unique identifier of the module. + string module_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "module_id_prefix" + expression: "this.startsWith('modules:')" + message: "module_id must start with 'modules:'" + }, + (buf.validate.field).cel = { + id: "module_id_length" + expression: "this.size() >= 9" + message: "module_id must be at least 1 characters long" + } + ]; +} + +// HeartbeatResponse is returned by the registry in response to a heartbeat. +message HeartbeatResponse { + // status is the module status as considered by the registry (ACTIVE, READY, etc.). + agentic_mesh_protocol.module.v1.ModuleStatus status = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).enum.defined_only = true + ]; +} + +// ════════════════════════════════════ DiscoverSetups ════════════════════════════════════ // + +// DiscoverSetupsRequest is used to query available setups in the registry. +message SearchSetupsRequest { + // organization_id filters by organization identifier. + string organization_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "organization_id_prefix" + expression: "this.startsWith('organizations:')" + message: "organization_id must start with 'organizations:'" + }, + (buf.validate.field).cel = { + id: "organization_id_length" + expression: "this.size() >= 15" + message: "organization_id must be at least 1 characters long" + } + ]; + + // query is a text search that matches on name or documentation. + string query = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // pagination contains pagination settings. + agentic_mesh_protocol.pagination.v1.PaginationRequest pagination = 3 [(buf.validate.field).required = true]; + + // module_ids filters by specific module identifiers. + repeated string module_ids = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "module_id_prefix" + expression: "this.all(x, x.startsWith('modules:'))" + message: "module_id must start with 'modules:'" + }, + (buf.validate.field).cel = { + id: "module_id_length" + expression: "this.all(x, x.size() >= 9)" + message: "module_id must be at least 1 characters long" + } + ]; + + // visibility filters by visibility level. + repeated Visibility visibility = 5 [ + (buf.validate.field).required = true, + (buf.validate.field).repeated.items.enum.defined_only = true + ]; + + // status filters by setup status (typically READY or CONFIGURATION_SUCCEEDED). + repeated agentic_mesh_protocol.setup.v1.SetupStatus status = 6 [ + (buf.validate.field).required = true, + (buf.validate.field).repeated.items.enum.defined_only = true + ]; + + // module_types filters by module type (e.g., agent, tool). + repeated agentic_mesh_protocol.module.v1.ModuleType module_types = 7 [ + (buf.validate.field).required = true, + (buf.validate.field).repeated.items.enum.defined_only = true + ]; +} + +// DiscoverSetupsResponse is returned with the list of available setups. +message SearchSetupsResponse { + // Result of the operation. Expected oneof type: SetupDescriptor or OperationError. + repeated agentic_mesh_protocol.registry.v1.RegistryResult result = 1 [(buf.validate.field).required = true]; + // bulk contains pagination metadata for the response. + agentic_mesh_protocol.pagination.v1.BulkResponse bulk = 2 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ DiscoverModules ════════════════════════════════════ // + +// DiscoverModulesRequest is used to query available modules in the registry. +message SearchModulesRequest { + // organization_id filters by organization identifier. + string organization_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "organization_id_prefix" + expression: "this.startsWith('organizations:')" + message: "organization_id must start with 'organizations:'" + }, + (buf.validate.field).cel = { + id: "organization_id_length" + expression: "this.size() >= 15" + message: "organization_id must be at least 1 characters long" + } + ]; + + // query is a text search that matches on name or documentation. + string query = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // pagination contains pagination settings. + agentic_mesh_protocol.pagination.v1.PaginationRequest pagination = 3 [(buf.validate.field).required = true]; + + // visibility filters by visibility level. + repeated Visibility visibility = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).repeated.items.enum.defined_only = true + ]; + + // module_types filters by module type. + repeated agentic_mesh_protocol.module.v1.ModuleType module_types = 5 [ + (buf.validate.field).required = true, + (buf.validate.field).repeated.items.enum.defined_only = true + ]; + + // status filters by module status. + repeated agentic_mesh_protocol.module.v1.ModuleStatus status = 6 [ + (buf.validate.field).required = true, + (buf.validate.field).repeated.items.enum.defined_only = true + ]; +} + +// DiscoverModulesResponse is returned with the list of available modules. +message SearchModulesResponse { + // Result of the operation. Expected oneof type: ModuleDescriptor or OperationError. + repeated RegistryResult result = 1 [(buf.validate.field).required = true]; + // bulk contains pagination metadata for the response. + agentic_mesh_protocol.pagination.v1.BulkResponse bulk = 2 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ GetSetup ════════════════════════════════════ // + +// GetSetupRequest is used to retrieve a specific setup by its identifier. +message GetSetupRequest { + // setup_id is the unique identifier of the setup. + string setup_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_id_prefix" + expression: "this.startsWith('setups:')" + message: "setup_id must start with 'setups:'" + }, + (buf.validate.field).cel = { + id: "setup_id_length" + expression: "this.size() >= 8" + message: "setup_id must be at least 1 characters long" + } + ]; +} + +// GetSetupResponse is returned with the specific setup. +message GetSetupResponse { + // Result of the operation. Expected oneof type: SetupDescriptor or OperationError. + RegistryResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ GetModule ════════════════════════════════════ // + +// GetModuleRequest is used to retrieve a specific module by its identifier. +message GetModuleRequest { + // module_id is the unique identifier of the module. + string module_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "module_id_prefix" + expression: "this.startsWith('modules:')" + message: "module_id must start with 'modules:'" + }, + (buf.validate.field).cel = { + id: "module_id_length" + expression: "this.size() >= 9" + message: "module_id must be at least 1 characters long" + } + ]; +} + +// GetModuleResponse is returned with the specific module. +message GetModuleResponse { + // Result of the operation. Expected oneof type: ModuleDescriptor or OperationError. + RegistryResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ GetModuleStatus ════════════════════════════════════ // + +// GetModuleStatusRequest is used to retrieve the current status of a specific module. +message GetModuleStatusRequest { + // module_id is the unique identifier of the module. + string module_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "module_id_prefix" + expression: "this.startsWith('modules:')" + message: "module_id must start with 'modules:'" + }, + (buf.validate.field).cel = { + id: "module_id_length" + expression: "this.size() >= 9" + message: "module_id must be at least 1 characters long" + } + ]; +} + +// GetModuleStatusResponse is returned with the current status of the specific module. +message GetModuleStatusResponse { + // status is the current status of the module as considered by the registry (ACTIVE, READY, etc.). + agentic_mesh_protocol.module.v1.ModuleStatus status = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).enum.defined_only = true + ]; +} diff --git a/proto/agentic_mesh_protocol/registry/v1/registry_enums.proto b/proto/agentic_mesh_protocol/registry/v1/registry_enums.proto index b77fa14..d621a29 100644 --- a/proto/agentic_mesh_protocol/registry/v1/registry_enums.proto +++ b/proto/agentic_mesh_protocol/registry/v1/registry_enums.proto @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// https://www.gnu.org/licenses/gpl-3.0.html +// https://www.gnu.org/licenses/gpl-3.0.html // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -16,64 +16,14 @@ syntax = "proto3"; package agentic_mesh_protocol.registry.v1; -// ------------------------- -// ENUMS -// ------------------------- - -// ModuleStatus -enum ModuleStatus { - // Unspecified - MODULE_STATUS_UNSPECIFIED = 0; - // Ready - MODULE_STATUS_READY = 1; - // Active - MODULE_STATUS_ACTIVE = 2; - // Archived - MODULE_STATUS_ARCHIVED = 3; -} - -// SetupStatus -enum SetupStatus { - // Unspecified - SETUP_STATUS_UNSPECIFIED = 0; - // Draft - SETUP_STATUS_DRAFT = 1; - // Waiting for approval - SETUP_STATUS_WAITING_FOR_APPROVAL = 2; - // Ready - SETUP_STATUS_READY = 3; - // Paused - SETUP_STATUS_PAUSED = 4; - // Failed - SETUP_STATUS_FAILED = 5; - // Archived - SETUP_STATUS_ARCHIVED = 6; - // Needs configuration - SETUP_STATUS_NEEDS_CONFIGURATION = 7; - // Configuration failed - SETUP_STATUS_CONFIGURATION_FAILED = 8; - // Configuration succeeded - SETUP_STATUS_CONFIGURATION_SUCCEEDED = 9; -} - // Visibility enum Visibility { - // Unspecified + // UNSPECIFIED visibility: default value, should not be used. VISIBILITY_UNSPECIFIED = 0; - // Public - VISIBILITY_PUBLIC = 1; - // Private - VISIBILITY_PRIVATE = 2; - // Internal - VISIBILITY_INTERNAL = 3; -} - -// ModuleType -enum ModuleType { - // Unspecified - MODULE_TYPE_UNSPECIFIED = 0; - // Archetype - MODULE_TYPE_ARCHETYPE = 1; - // Tool - MODULE_TYPE_TOOL = 2; + // Public visibility: accessible to everyone. + PUBLIC = 1; + // Private visibility: accessible only to the owner or module. + PRIVATE = 2; + // Internal visibility: reserved for internal system use. + INTERNAL = 3; } diff --git a/proto/agentic_mesh_protocol/registry/v1/registry_messages.proto b/proto/agentic_mesh_protocol/registry/v1/registry_messages.proto new file mode 100644 index 0000000..8552e93 --- /dev/null +++ b/proto/agentic_mesh_protocol/registry/v1/registry_messages.proto @@ -0,0 +1,279 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.registry.v1; + +import "agentic_mesh_protocol/module/v1/module_enums.proto"; +import "agentic_mesh_protocol/pagination/v1/bulk.proto"; +import "agentic_mesh_protocol/registry/v1/registry_enums.proto"; +import "agentic_mesh_protocol/setup/v1/setup_enums.proto"; +import "buf/validate/validate.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +// ModuleDescriptor represents a module's complete descriptor as seen by the network. +message ModuleDescriptor { + option (buf.validate.message).cel = { + id: "created_at_after_updated_at" + expression: "!has(this.created_at) || !has(this.updated_at) || this.created_at <= this.updated_at" + message: "created_at must be before or equal to updated_at" + }; + option (buf.validate.message).cel = { + id: "updated_at_before_updated_at" + expression: "!has(this.updated_at) || !has(this.created_at) || this.updated_at >= this.created_at" + message: "updated_at must be after or equal to created_at" + }; + + // id is the unique identifier of the module (SurrealDB format). + string id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "module_id_prefix" + expression: "this.startsWith('modules:')" + message: "module_id must start with 'modules:'" + }, + (buf.validate.field).cel = { + id: "module_id_length" + expression: "this.size() >= 9" + message: "module_id must be at least 1 characters long" + } + ]; // SurrealDB module id + // organization_id is the unique identifier of the organization that owns this module. + string organization_id = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "organization_id_prefix" + expression: "this.startsWith('organizations:')" + message: "organization_id must start with 'organizations:'" + }, + (buf.validate.field).cel = { + id: "organization_id_length" + expression: "this.size() >= 15" + message: "organization_id must be at least 1 characters long" + } + ]; + // owner_id is the unique identifier of the user who owns this module. + string owner_id = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "user_id_prefix" + expression: "this.startsWith('users:')" + message: "user_id must start with 'users:'" + }, + (buf.validate.field).cel = { + id: "user_id_length" + expression: "this.size() >= 7" + message: "user_id must be at least 1 characters long" + } + ]; + // name is the human-readable name of the module. + string name = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // version is the runtime version of the deployed module. + string version = 5 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // address is the network endpoint URI used to communicate with the module. + string address = 6 [ + (buf.validate.field).required = true, + (buf.validate.field).string.uri = true, + (buf.validate.field).string.min_len = 1 + ]; + // documentation is the module's documentation or description. + string documentation = 7 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // port is the network port used to communicate with the module. + int32 port = 8 [ + (buf.validate.field).required = true, + (buf.validate.field).int32 = { + gte: 1 + lte: 65535 + } + ]; + // type is the module type classification (e.g., ARCHETYPE, TOOL). + agentic_mesh_protocol.module.v1.ModuleType type = 9 [ + (buf.validate.field).required = true, + (buf.validate.field).enum.defined_only = true + ]; + // status is the current status of the module (e.g., READY, ACTIVE). + agentic_mesh_protocol.module.v1.ModuleStatus status = 10 [ + (buf.validate.field).required = true, + (buf.validate.field).enum.defined_only = true + ]; + // visibility defines who can access this module (e.g., PUBLIC, PRIVATE). + Visibility visibility = 11 [ + (buf.validate.field).required = true, + (buf.validate.field).enum.defined_only = true + ]; + // created_at is the timestamp when the module was created. + google.protobuf.Timestamp created_at = 12 [(buf.validate.field).required = true]; + // updated_at is the timestamp when the module was last updated. + google.protobuf.Timestamp updated_at = 13 [(buf.validate.field).required = true]; + // input_schema is the JSON schema defining the module's expected input format. + google.protobuf.Struct input_schema = 14 [(buf.validate.field).required = true]; + // output_schema is the JSON schema defining the module's output format. + google.protobuf.Struct output_schema = 15 [(buf.validate.field).required = true]; + // setup_schema is the JSON schema defining the module's setup configuration. + google.protobuf.Struct setup_schema = 16 [(buf.validate.field).required = true]; + // secret_schema is the JSON schema defining the module's secret configuration. + google.protobuf.Struct secret_schema = 17 [(buf.validate.field).required = true]; + // cost_schema is the JSON schema defining the module's cost structure. + google.protobuf.Struct cost_schema = 18 [(buf.validate.field).required = true]; +} + +// SetupDescriptor represents a setup's complete descriptor including its current version. +message SetupDescriptor { + // id is the unique identifier of the setup. + string id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_id_prefix" + expression: "this.startsWith('setups:')" + message: "setup_id must start with 'setups:'" + }, + (buf.validate.field).cel = { + id: "setup_id_length" + expression: "this.size() >= 8" + message: "setup_id must be at least 1 characters long" + } + ]; + // organization_id is the unique identifier of the organization that owns this setup. + string organization_id = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "organization_id_prefix" + expression: "this.startsWith('organizations:')" + message: "organization_id must start with 'organizations:'" + }, + (buf.validate.field).cel = { + id: "organization_id_length" + expression: "this.size() >= 15" + message: "organization_id must be at least 1 characters long" + } + ]; + // owner_id is the unique identifier of the user who owns this setup. + string owner_id = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "user_id_prefix" + expression: "this.startsWith('users:')" + message: "user_id must start with 'users:'" + }, + (buf.validate.field).cel = { + id: "user_id_length" + expression: "this.size() >= 7" + message: "user_id must be at least 1 characters long" + } + ]; + // card_id is the unique identifier of the card associated with this setup. + string card_id = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "card_id_prefix" + expression: "this.startsWith('cards:')" + message: "card_id must start with 'cards:'" + }, + (buf.validate.field).cel = { + id: "card_id_length" + expression: "this.size() >= 7" + message: "card_id must be at least 1 characters long" + } + ]; + // module_id is the unique identifier of the module linked to this setup. + string module_id = 5 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "module_id_prefix" + expression: "this.startsWith('modules:')" + message: "module_id must start with 'modules:'" + }, + (buf.validate.field).cel = { + id: "module_id_length" + expression: "this.size() >= 9" + message: "module_id must be at least 1 characters long" + } + ]; + // setup_version_id is the unique identifier of the current active setup version. + string setup_version_id = 6 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_version_id_prefix" + expression: "this.startsWith('setup_versions:')" + message: "setup_version_id must start with 'setup_versions:'" + }, + (buf.validate.field).cel = { + id: "setup_version_id_length" + expression: "this.size() >= 16" + message: "setup_version_id must be at least 1 characters long" + } + ]; + // name is the human-readable name of the setup. + string name = 7 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // documentation is the setup's documentation or description. + string documentation = 8 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // setup_version is the version label of the current active setup version. + string setup_version = 9 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // status is the current status of the setup (e.g., READY, DRAFT). + agentic_mesh_protocol.setup.v1.SetupStatus status = 10 [ + (buf.validate.field).required = true, + (buf.validate.field).enum.defined_only = true + ]; + // visibility defines who can access this setup (e.g., PUBLIC, PRIVATE). + Visibility visibility = 11 [ + (buf.validate.field).required = true, + (buf.validate.field).enum.defined_only = true + ]; + // config contains the configuration key-value pairs for this setup. + google.protobuf.Struct config = 12 [(buf.validate.field).required = true]; + // module contains the resolved module descriptor for this setup. + ModuleDescriptor module = 13 [(buf.validate.field).required = true]; +} + +// RegistryResult represents the result of a registry operation, including success or error information. +message RegistryResult { + // identifier is the unique identifier for the item being processed + string identifier = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // success indicates if the operation was successful (optional for backward compatibility). + optional bool success = 2 [(buf.validate.field).required = false]; + + // One of the following fields will be set based on the outcome of processing the item. + oneof outcom { + // module_descriptor is the module descriptor if the operation was successful. + ModuleDescriptor module_descriptor = 3; + // setup_descriptor is the setup descriptor if the operation was successful. + SetupDescriptor setup_descriptor = 4; + // error represents the error that occurred while processing the item, if applicable. + agentic_mesh_protocol.pagination.v1.OperationError error = 5; + } +} diff --git a/proto/agentic_mesh_protocol/registry/v1/registry_models.proto b/proto/agentic_mesh_protocol/registry/v1/registry_models.proto deleted file mode 100644 index 7d8734e..0000000 --- a/proto/agentic_mesh_protocol/registry/v1/registry_models.proto +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright 2025 DigitalKin Inc. -// -// Licensed under the GNU General Public License, Version 3.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.gnu.org/licenses/gpl-3.0.html -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package agentic_mesh_protocol.registry.v1; - -import "agentic_mesh_protocol/registry/v1/registry_enums.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -import "buf/validate/validate.proto"; - -// ------------------------- -// DOMAIN MODELS -// ------------------------- - -// Represents your "modules" table as seen by the network. -message ModuleDescriptor { - // ID - string id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "modules:", - (buf.validate.field).string.min_len = 1 - ]; // SurrealDB module id - // Name - string name = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - // Module type - ModuleType module_type = 3 [ - (buf.validate.field).required = true, - (buf.validate.field).enum.not_in = 0 - ]; - // Version - string version = 4 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // Network endpoint - // Address used to communicate with the module - string address = 5 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; // host or IP - // Port used to communicate with the module - int32 port = 6 [ - (buf.validate.field).required = true, - (buf.validate.field).int32.gte = 1, - (buf.validate.field).int32.lte = 65535 - ]; - - // Status - ModuleStatus status = 7 [ - (buf.validate.field).required = true, - (buf.validate.field).enum.not_in = 0 - ]; - // Visibility - Visibility visibility = 8 [ - (buf.validate.field).required = true, - (buf.validate.field).enum.not_in = 0 - ]; - - // Organization ID - string organization_id = 9 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "organizations:", - (buf.validate.field).string.min_len = 1 - ]; - // Owner ID - string owner_id = 10 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "users:", - (buf.validate.field).string.min_len = 1 - ]; - - // Schemas for machine introspection - // Input schema - google.protobuf.Struct input_schema = 11 [ - (buf.validate.field).required = true - ]; - // Output schema - google.protobuf.Struct output_schema = 12 [ - (buf.validate.field).required = true - ]; - // Setup schema - google.protobuf.Struct setup_schema = 13 [ - (buf.validate.field).required = true - ]; - // Secret schema - google.protobuf.Struct secret_schema = 14 [ - (buf.validate.field).required = true - ]; - // Cost schema - google.protobuf.Struct cost_schema = 15 [ - (buf.validate.field).required = true - ]; - - // Documentation - string documentation = 16 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // Created at - google.protobuf.Timestamp created_at = 17 [ - (buf.validate.field).required = true - ]; - // Updated at - google.protobuf.Timestamp updated_at = 18 [ - (buf.validate.field).required = true - ]; -} - -// Represents your "setups" + current "setup_versions" -message SetupDescriptor { - // ID - string id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "setups:", - (buf.validate.field).string.min_len = 1 - ]; - // Name - string name = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - // Documentation - string documentation = 3 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - // Status - SetupStatus status = 4 [ - (buf.validate.field).required = true, - (buf.validate.field).enum.not_in = 0 - ]; - // Visibility - Visibility visibility = 5 [ - (buf.validate.field).required = true, - (buf.validate.field).enum.not_in = 0 - ]; - // Organization ID - string organization_id = 6 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "organizations:", - (buf.validate.field).string.min_len = 1 - ]; - // Owner ID - string owner_id = 7 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "users:", - (buf.validate.field).string.min_len = 1 - ]; - // Card ID - string card_id = 8 [ - (buf.validate.field).string.prefix = "cards:", - (buf.validate.field).string.min_len = 1 - ]; - - // Link to the module - string module_id = 9 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "modules:", - (buf.validate.field).string.min_len = 1 - ]; - - // Current version (setup_versions) - // ID - string setup_version_id = 10 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "setup_versions:", - (buf.validate.field).string.min_len = 1 - ]; - // Version - string setup_version = 11 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - // Configuration - google.protobuf.Struct config = 12 [ - (buf.validate.field).required = true - ]; - - // Resolved module info (so agents don't need another round-trip) - ModuleDescriptor module = 13 [ - (buf.validate.field).required = true - ]; -} diff --git a/proto/agentic_mesh_protocol/registry/v1/registry_requests.proto b/proto/agentic_mesh_protocol/registry/v1/registry_requests.proto deleted file mode 100644 index 44797b0..0000000 --- a/proto/agentic_mesh_protocol/registry/v1/registry_requests.proto +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright 2025 DigitalKin Inc. -// -// Licensed under the GNU General Public License, Version 3.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.gnu.org/licenses/gpl-3.0.html -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package agentic_mesh_protocol.registry.v1; - -import "agentic_mesh_protocol/registry/v1/registry_enums.proto"; -import "agentic_mesh_protocol/registry/v1/registry_models.proto"; - -import "buf/validate/validate.proto"; - -// ------------------------- -// REGISTRATION -// ------------------------- - -// Called by a module gRPC at startup to declare itself in the network. -// NOTE: module_id is expected to already exist in the platform database. -message RegisterModuleRequest { - // ID - string module_id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "modules:", - (buf.validate.field).string.min_len = 1 - ]; - // Address - string address = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - // Port - int32 port = 3 [ - (buf.validate.field).required = true, - (buf.validate.field).int32.gte = 1, - (buf.validate.field).int32.lte = 65535 - ]; - // Version - string version = 4 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; // runtime version of the deployed module -} - -// RegisterModuleResponse -message RegisterModuleResponse { - // Module descriptor - ModuleDescriptor module = 1 [ - (buf.validate.field).required = true - ]; -} - -// HeartbeatRequest -message HeartbeatRequest { - // ID - string module_id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "modules:", - (buf.validate.field).string.min_len = 1 - ]; -} - -// HeartbeatResponse -message HeartbeatResponse { - // Status - ModuleStatus status = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).enum.not_in = 0 - ]; // what the registry considers for this module (ACTIVE, READY, etc.) -} - -// ------------------------- -// DISCOVERY -// ------------------------- - -// Discover setups that are available (agents / tools). -message DiscoverSetupsRequest { - // Basic filtering - // Organization ID - string organization_id = 1 [ - (buf.validate.field).string.prefix = "organizations:", - (buf.validate.field).string.min_len = 1 - ]; - // Visibility - repeated Visibility visibility = 2 [ - (buf.validate.field).repeated.items.enum.not_in = 0 - ]; - // Status - repeated SetupStatus status = 3 [ - (buf.validate.field).repeated.items.enum.not_in = 0 - ]; // typically READY / CONFIGURATION_SUCCEEDED - - // e.g. agent, tool - repeated ModuleType module_types = 4 [ - (buf.validate.field).repeated.items.enum.not_in = 0 - ]; - - // Simple text search - string query = 5 [ - (buf.validate.field).string.min_len = 1 - ]; // matches on name / documentation depending on implementation - - // Filter on specific modules if needed - repeated string module_ids = 6 [ - (buf.validate.field).repeated.items.string.prefix = "modules:", - (buf.validate.field).repeated.items.string.min_len = 1 - ]; - - // Pagination - // Limit - int32 limit = 7 [ - (buf.validate.field).int32.gte = 1, - (buf.validate.field).int32.lte = 100 - ]; - // Offset - int32 offset = 8 [ - (buf.validate.field).int32.gte = 0 - ]; -} - -// DiscoverSetupsResponse -message DiscoverSetupsResponse { - // Setups - repeated SetupDescriptor setups = 1 [ - (buf.validate.field).repeated.items.required = true - ]; -} - -// Discover raw modules (rarely used by agents directly). -message DiscoverModulesRequest { - // Organization ID - string organization_id = 1 [ - (buf.validate.field).string.prefix = "organizations:", - (buf.validate.field).string.min_len = 1 - ]; - // Module types - repeated ModuleType module_types = 2 [ - (buf.validate.field).repeated.items.enum.not_in = 0 - ]; - // Status - repeated ModuleStatus status = 3 [ - (buf.validate.field).repeated.items.enum.not_in = 0 - ]; - // Visibility - repeated Visibility visibility = 4 [ - (buf.validate.field).repeated.items.enum.not_in = 0 - ]; - - // Simple text search - string query = 5 [ - (buf.validate.field).string.min_len = 1 - ]; // matches on name / documentation - - // Pagination - // Limit - int32 limit = 6 [ - (buf.validate.field).int32.gte = 1, - (buf.validate.field).int32.lte = 100 - ]; - // Offset - int32 offset = 7 [ - (buf.validate.field).int32.gte = 0 - ]; -} - -// DiscoverModulesResponse -message DiscoverModulesResponse { - // Modules - repeated ModuleDescriptor modules = 1 [ - (buf.validate.field).repeated.items.required = true - ]; -} - -// ------------------------- -// RESOLUTION / INFO -// ------------------------- - -// Resolve a setup_id into a complete descriptor (config + endpoint module). -message GetSetupRequest { - // ID - string setup_id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "setups:", - (buf.validate.field).string.min_len = 1 - ]; -} - -// Resolve a module_id into a complete descriptor. -message GetModuleRequest { - // ID - string module_id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "modules:", - (buf.validate.field).string.min_len = 1 - ]; -} diff --git a/proto/agentic_mesh_protocol/registry/v1/registry_service.proto b/proto/agentic_mesh_protocol/registry/v1/registry_service.proto index d8b622f..c60e1ce 100644 --- a/proto/agentic_mesh_protocol/registry/v1/registry_service.proto +++ b/proto/agentic_mesh_protocol/registry/v1/registry_service.proto @@ -16,39 +16,23 @@ syntax = "proto3"; package agentic_mesh_protocol.registry.v1; -import "agentic_mesh_protocol/registry/v1/registry_models.proto"; -import "agentic_mesh_protocol/registry/v1/registry_requests.proto"; +import "agentic_mesh_protocol/registry/v1/registry_dto.proto"; // RegistryService is the entry point for agents and tools // to register themselves and discover other resources in the mesh. service RegistryService { - // ----------------------- - // 1. REGISTRATION - // ----------------------- - // Called by a module gRPC at startup to declare itself in the network. rpc RegisterModule(RegisterModuleRequest) returns (RegisterModuleResponse); // Optional but useful if you want a bit of liveness. rpc Heartbeat(HeartbeatRequest) returns (HeartbeatResponse); - // ----------------------- - // 2. DISCOVERY - // ----------------------- - - // Discover setups that are available (agents / tools). - rpc DiscoverSetups(DiscoverSetupsRequest) returns (DiscoverSetupsResponse); - // Discover raw modules (rarely used by agents directly). - rpc DiscoverModules(DiscoverModulesRequest) returns (DiscoverModulesResponse); + rpc SearchModules(SearchModulesRequest) returns (SearchModulesResponse); - // ----------------------- - // 3. RESOLUTION / INFO - // ----------------------- - - // Resolve a setup_id into a complete descriptor (config + endpoint module). - rpc GetSetup(GetSetupRequest) returns (SetupDescriptor); + // Resolve a module_id into a complete descriptor. + rpc GetModule(GetModuleRequest) returns (GetModuleResponse); // Resolve a module_id into a complete descriptor. - rpc GetModule(GetModuleRequest) returns (ModuleDescriptor); + rpc GetModuleStatus(GetModuleStatusRequest) returns (GetModuleStatusResponse); } diff --git a/proto/agentic_mesh_protocol/setup/v1/setup.proto b/proto/agentic_mesh_protocol/setup/v1/setup.proto deleted file mode 100644 index cffe0dd..0000000 --- a/proto/agentic_mesh_protocol/setup/v1/setup.proto +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright 2025 DigitalKin Inc. -// -// Licensed under the GNU General Public License, Version 3.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.gnu.org/licenses/gpl-3.0.html -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package agentic_mesh_protocol.setup.v1; - -import "buf/validate/validate.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -// SetupStatus -// Represents the status of a setup. -// -// Fields: -// - DRAFT: Setup is a draft -// - VALIDATING: Setup is being validated -// - READY: Setup is ready -// - PAUSED: Setup is paused -// - FAILED: Setup failed -// - ARCHIVED: Setup has been archived -// - NEEDS_CONFIGURATION: Setup needs configuration -// - CONFIGURATION_FAILED: Setup configuration failed -// - CONFIGURATION_SUCCEEDED: Setup configuration succeeded -enum SetupStatus { - // DRAFT: Setup is a draft - DRAFT = 0; - // VALIDATING: Setup is being validated - VALIDATING = 1; - // READY: Setup is ready - READY = 2; - // PAUSED: Setup is paused - PAUSED = 4; - // FAILED: Setup failed - FAILED = 5; - // ARCHIVED: Setup has been archived - ARCHIVED = 6; - // NEEDS_CONFIGURATION: Setup needs configuration - NEEDS_CONFIGURATION = 7; - // CONFIGURATION_FAILED: Setup configuration failed - CONFIGURATION_FAILED = 8; - // CONFIGURATION_SUCCEEDED: Setup configuration succeeded - CONFIGURATION_SUCCEEDED = 9; -} - -// SetupVersion -// Represents a version of a setup's configuration. -// -// Fields: -// - id: The unique identifier of the setup version. -// - setup_id: The unique identifier of the parent setup. -// - name: The identifier of the parent setup. -// - version: A label for the version (e.g., "v1", "v2"). -// - content: Key-value pairs containing configuration content. -// - creation_date: setup version creation date -message SetupVersion { - // id: The unique identifier of the setup version. - string id = 1 [(buf.validate.field).required = true]; - // setup_id: The unique identifier of the parent setup. - string setup_id = 2 [(buf.validate.field).required = true]; - // version: The label for this version. - string version = 3 [(buf.validate.field).required = true]; - // content: Key-value pairs for configuration content. - google.protobuf.Struct content = 4 [(buf.validate.field).required = true]; - // creation_date: setup version creation date - google.protobuf.Timestamp creation_date = 5; -} - -// Setup -// Represents a configuration associated with a mission. -// -// Fields: -// - id: unique id used in database -// - name: The name of the setup. -// - organisation_id: The unique identifier of the organisation. -// - owner_id: The owner_id of the setup. -// - module_id: The module identifier associated with the setup. -// - current_setup_version: The identifier of the active setup version. -message Setup { - // id: The unique identifier of the setup. - string id = 1 [(buf.validate.field).required = true]; - // name: The name of the setup. - string name = 2 [(buf.validate.field).required = true]; - // organisation_id: The unique identifier of the organisation. - string organisation_id = 3 [(buf.validate.field).required = true]; - // owner_id: The owner_id of the setup. - string owner_id = 4 [(buf.validate.field).required = true]; - // module_id: The module identifier associated with the setup. - string module_id = 5 [(buf.validate.field).required = true]; - // current_setup_version: The unique identifier of the active setup version. - optional SetupVersion current_setup_version = 6; - // status: The status of the setup. - SetupStatus status = 7 [(buf.validate.field).required = true]; -} - -// CreateSetupRequest -// This request is used to create a new setup. -// -// Fields: -// - name: The name of the setup. -// - organisation_id: The unique identifier of the organisation. -// - owner_id: The owner_id of the setup. -// - module_id: The module identifier associated with the setup. -// - current_setup_version: The unique identifier of the active setup version. -message CreateSetupRequest { - // name: The name of the setup. - string name = 1 [(buf.validate.field).required = true]; - // organisation_id: The unique identifier of the organisation. - string organisation_id = 2 [(buf.validate.field).required = true]; - // owner_id: The owner_id of the setup. - string owner_id = 3 [(buf.validate.field).required = true]; - // module_id: The module identifier associated with the setup. - string module_id = 4 [(buf.validate.field).required = true]; - // current_setup_version: The unique identifier of the active setup version. - optional SetupVersion current_setup_version = 5; - // status: The status of the setup. - SetupStatus status = 6 [(buf.validate.field).required = true]; -} - -// CreateSetupResponse -// Returns the newly created setup status flag. -// -// Fields: -// - success: description flag of the operation. -// - setup: The newly created setup entity. -message CreateSetupResponse { - // success: description flag of the operation. - bool success = 1; - // setup: The newly created setup entity. - Setup setup = 2; -} - -// GetSetupRequest -// This request is used to retrieve a setup by its unique identifier. -// -// Fields: -// - setup_id: The unique identifier of the setup. -// - version: (Optional) The unique identifier of the active setup version. -message GetSetupRequest { - // setup_id: The unique identifier of the setup. - string setup_id = 1 [(buf.validate.field).required = true]; - // version: The unique identifier of the active setup version. - optional string version = 2; -} - -// GetSetupResponse -// Returns the setup corresponding to the requested identifier. -// -// Fields: -// - setup: The retrieved setup entity. -// - setup_version: The retrieved setup_version if exists. -message GetSetupResponse { - // setup: The retrieved setup entity. - Setup setup = 1; - // setup_version: The retrieved setup_version if exists. - SetupVersion setup_version = 2; -} - -// UpdateSetupRequest -// This request is used to update an existing setup. -// -// Fields: -// - name: The unique identifier of the setup to update. -// - owner_id: (Optional) The new owner_id. -// - current_setup_version: (Optional) The new active setup version identifier. -message UpdateSetupRequest { - // setup_id: The unique identifier of the setup. - string setup_id = 1 [(buf.validate.field).required = true]; - // name: The unique identifier of the setup to update. - string name = 2 [(buf.validate.field).required = true]; - // owner_id: The owner_id of the setup. - string owner_id = 3; - // current_setup_version: The unique identifier of the active setup version. - SetupVersion current_setup_version = 4; - // status: The status of the setup. - SetupStatus status = 5 [(buf.validate.field).required = true]; -} - -// UpdateSetupResponse -// Returns the updated setup status flag. -// -// Fields: -// - success: description flag of the operation. -// - setup: The updated setup entity. -message UpdateSetupResponse { - // success: description flag of the operation. - bool success = 1; - // setup: The updated setup entity. - Setup setup = 2; -} - -// DeleteSetupRequest -// This request is used to delete a setup by its unique identifier. -// -// Fields: -// - setup_id: The unique identifier of the setup to delete. -message DeleteSetupRequest { - // setup_id: The unique identifier of the setup. - string setup_id = 1 [(buf.validate.field).required = true]; -} - -// DeleteSetupResponse -// Indicates that the setup has been successfully deleted. -message DeleteSetupResponse { - // success: description flag of the operation. - bool success = 1; -} - -// CreateSetupVersionRequest -// This request is used to create a new setup version. -// -// Fields: -// - setup_id: The unique identifier of the parent setup. -// - version: The label for the new version. -// - content: The configuration content for this version. -message CreateSetupVersionRequest { - // setup_id: The unique identifier of the parent setup. - string setup_id = 1 [(buf.validate.field).required = true]; - // version: The version label (e.g., "v1", "v2"). - string version = 2 [(buf.validate.field).required = true]; - // content: Key-value pairs for configuration content. - google.protobuf.Struct content = 3; -} - -// CreateSetupVersionResponse -// Returns the newly created setup version status flag. -// -// Fields: -// - success: description flag of the operation. -// - setup_version: The newly created setup version entity. -message CreateSetupVersionResponse { - // success: description flag of the operation. - bool success = 1; - // setup_version: The newly created setup version entity. - SetupVersion setup_version = 2; -} - -// GetSetupVersionRequest -// This request is used to retrieve a setup version by its unique identifier. -// -// Fields: -// - setup_version_id: The unique identifier of the setup version. -message GetSetupVersionRequest { - // setup_version_id: The unique identifier of the setup version. - string setup_version_id = 1; -} - -// GetSetupVersionResponse -// Returns the setup version corresponding to the setup_version_id. -// -// Fields: -// - setup_version: The retrieved setup version entity. -message GetSetupVersionResponse { - // setup_version: The retrieved setup version entity. - SetupVersion setup_version = 1; -} - -// SearchSetupVersionsRequest -// This request is used to search for setup versions using filters. -// -// Fields: -// - setup_id: (Optional) Filter by the parent setup identifier. -// - version: (Optional) Filter by the version label. -message SearchSetupVersionsRequest { - // setup_id: The unique identifier of the parent setup. - string setup_id = 1; - // version: The version label to filter wirh. - optional string version = 2; -} - -// SearchSetupVersionsResponse -// Returns a list of setup versions that match the search criteria. -message SearchSetupVersionsResponse { - // setup_versions: A list of setup versions matching the criteria. - repeated SetupVersion setup_versions = 1; -} - -// UpdateSetupVersionRequest -// This request is used to update an existing setup version. -// -// Fields: -// - setup_version_id: The unique identifier of the setup version to update. -// - version: (Optional) The new version label. -// - content: (Optional) The new configuration content. -message UpdateSetupVersionRequest { - // setup_version_id: The unique identifier of the setup version to update. - string setup_version_id = 1 [(buf.validate.field).required = true]; - // version: The version label. - string version = 2 [(buf.validate.field).required = true]; - // content: Key-value pairs for configuration content. - google.protobuf.Struct content = 3 [(buf.validate.field).required = true]; -} - -// UpdateSetupVersionResponse -// Returns the updated setup version. -// -// Fields: -// - success: description flag of the operation. -// - setup_version: The updated setup version entity. -message UpdateSetupVersionResponse { - // success: description flag of the operation. - bool success = 1; - // setup_version: The updated setup version entity. - SetupVersion setup_version = 2; -} - -// DeleteSetupVersionRequest -// This request is used to delete a setup version by its unique identifier. -// -// Fields: -// - setup_version_id: The unique identifier of the setup version to delete. -message DeleteSetupVersionRequest { - // setup_version_id: The unique identifier of the setup version. - string setup_version_id = 1 [(buf.validate.field).required = true]; -} - -// DeleteSetupVersionResponse -// Indicates that the setup version has been successfully deleted. -message DeleteSetupVersionResponse { - // success: description flag of the operation. - bool success = 1; -} - -// ListSetupsRequest is the request message for listing setups. -message ListSetupsRequest { - // organisation_id: Filter by organisation ID. - optional string organisation_id = 1; - // owner_id: Filter by owner ID. - optional string owner_id = 2; - // limit: Maximum number of setups to return. - int32 limit = 3 [ - (buf.validate.field).int32.gte = 1, - (buf.validate.field).int32.lte = 1000 - ]; - // offset: Number of setups to skip. - int32 offset = 4 [(buf.validate.field).int32.gte = 0]; -} - -// ListSetupsResponse is the response message containing a list of setups. -message ListSetupsResponse { - // setups: List of setups matching the criteria. - repeated Setup setups = 1; - // total_count: Total number of setups matching the criteria. - int32 total_count = 2 [(buf.validate.field).int32.gte = 0]; -} diff --git a/proto/agentic_mesh_protocol/setup/v1/setup_dto.proto b/proto/agentic_mesh_protocol/setup/v1/setup_dto.proto new file mode 100644 index 0000000..4d5595c --- /dev/null +++ b/proto/agentic_mesh_protocol/setup/v1/setup_dto.proto @@ -0,0 +1,242 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.setup.v1; + +import "agentic_mesh_protocol/pagination/v1/bulk.proto"; +import "agentic_mesh_protocol/pagination/v1/pagination.proto"; +import "agentic_mesh_protocol/setup/v1/setup_enums.proto"; +import "agentic_mesh_protocol/setup/v1/setup_messages.proto"; +import "buf/validate/validate.proto"; + +// ════════════════════════════════════ CreateSetup ════════════════════════════════════ // + +// Request and Response messages for creating a new Setup. +message CreateSetupRequest { + // organization_id is the unique identifier of the organization. + string organization_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // owner_id is the owner ID of the setup. + string owner_id = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "owner_id_prefix" + expression: "this.startsWith('users:')" + message: "owner_id must start with 'users:'" + }, + (buf.validate.field).cel = { + id: "owner_id_length" + expression: "this.size() >= 7" + message: "owner_id must be at least 1 characters long" + } + ]; + + // module_id is the module identifier associated with the setup. + string module_id = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "module_id_prefix" + expression: "this.startsWith('modules:')" + message: "module_id must start with 'modules:'" + }, + (buf.validate.field).cel = { + id: "module_id_length" + expression: "this.size() >= 9" + message: "module_id must be at least 1 characters long" + } + ]; + + // name is the name of the setup. + string name = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // status is the status of the setup. + SetupStatus status = 5 [(buf.validate.field).required = true]; + + // current_setup_version is the active setup version. + optional SetupVersion current_setup_version = 6 [(buf.validate.field).required = true]; +} + +// Response message for CreateSetup operation. +message CreateSetupResponse { + // Result of the operation. Expected oneof type: Setup or OperationError. + SetupResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ GetSetup ════════════════════════════════════ // + +// Request message for retrieving a Setup by its ID. +message GetSetupRequest { + // setup_id is the unique identifier of the setup. + string setup_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_id_prefix" + expression: "this.startsWith('setups:')" + message: "setup_id must start with 'setups:'" + }, + (buf.validate.field).cel = { + id: "setup_id_length" + expression: "this.size() >= 8" + message: "setup_id must be at least 1 characters long" + } + ]; + + // version is the unique identifier of the active setup version. + optional string version = 2 [ + (buf.validate.field).required = false, + (buf.validate.field).string.min_len = 1 + ]; +} + +// Response message for GetSetup operation. +message GetSetupResponse { + // Result of the operation. Expected oneof type: Setup or OperationError. + SetupResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ UpdateSetup ════════════════════════════════════ // + +// Request and Response messages for updating an existing Setup. +message UpdateSetupRequest { + // setup_id is the unique identifier of the setup. + string setup_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_id_prefix" + expression: "this.startsWith('setups:')" + message: "setup_id must start with 'setups:'" + }, + (buf.validate.field).cel = { + id: "setup_id_length" + expression: "this.size() >= 8" + message: "setup_id must be at least 1 characters long" + } + ]; + + // owner_id is the owner ID of the setup. + string owner_id = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "owner_id_prefix" + expression: "this.startsWith('users:')" + message: "owner_id must start with 'users:'" + }, + (buf.validate.field).cel = { + id: "owner_id_length" + expression: "this.size() >= 7" + message: "owner_id must be at least 1 characters long" + } + ]; + + // name is the name of the setup. + string name = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // status is the status of the setup. + SetupStatus status = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).enum.defined_only = true + ]; + + // current_setup_version is the active setup version. + SetupVersion current_setup_version = 5 [(buf.validate.field).required = true]; +} + +// Response message for UpdateSetup operation. +message UpdateSetupResponse { + // Result of the operation. Expected oneof type: Setup or OperationError. + SetupResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ DeleteSetup ════════════════════════════════════ // + +// Request and Response messages for deleting a Setup. +message DeleteSetupRequest { + // setup_id is the unique identifier of the setup. + string setup_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_id_prefix" + expression: "this.startsWith('setups:')" + message: "setup_id must start with 'setups:'" + }, + (buf.validate.field).cel = { + id: "setup_id_length" + expression: "this.size() >= 8" + message: "setup_id must be at least 1 characters long" + } + ]; +} + +// Response message for DeleteSetup operation. +message DeleteSetupResponse { + // Result of the operation. Expected oneof type: Setup or OperationError. + SetupResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ ListSetups ════════════════════════════════════ // + +// Request and Response messages for listing Setups with filtering and pagination. +message ListSetupsRequest { + // organization_id filters by organization ID. + optional string organization_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "organization_id_prefix" + expression: "this.startsWith('organizations:')" + message: "organization_id must start with 'organizations:'" + }, + (buf.validate.field).cel = { + id: "organization_id_length" + expression: "this.size() >= 15" + message: "organization_id must be at least 1 characters long" + } + ]; + + // owner_id filters by owner ID. + optional string owner_id = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "owner_id_prefix" + expression: "this.startsWith('users:')" + message: "owner_id must start with 'users:'" + }, + (buf.validate.field).cel = { + id: "owner_id_length" + expression: "this.size() >= 7" + message: "owner_id must be at least 1 characters long" + } + ]; + + // pagination contains pagination settings. + agentic_mesh_protocol.pagination.v1.PaginationRequest pagination = 3 [(buf.validate.field).required = true]; +} + +// Response message for ListSetups operation. +message ListSetupsResponse { + // Result of the operation. Expected oneof type: Setup or OperationError. + repeated SetupResult result = 1 [(buf.validate.field).required = true]; + // bulk contains information about the bulk operation, if applicable. + agentic_mesh_protocol.pagination.v1.BulkResponse bulk = 2 [(buf.validate.field).required = true]; +} diff --git a/proto/agentic_mesh_protocol/setup/v1/setup_enums.proto b/proto/agentic_mesh_protocol/setup/v1/setup_enums.proto new file mode 100644 index 0000000..3143b7f --- /dev/null +++ b/proto/agentic_mesh_protocol/setup/v1/setup_enums.proto @@ -0,0 +1,41 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.setup.v1; + +// Status of a setup in the system. +enum SetupStatus { + // UNSPECIFIED indicates that the status is not set. + SETUP_STATUS_UNSPECIFIED = 0; + // The setup is being drafted or edited. + DRAFT = 1; + // The setup is being validated. + VALIDATING = 2; + // The setup is ready for use. + READY = 3; + // The setup is temporarily paused. + PAUSED = 4; + // The setup has failed at some stage. + FAILED = 5; + // The setup is archived and inactive. + ARCHIVED = 6; + // The setup needs additional configuration. + NEEDS_CONFIGURATION = 7; + // The setup configuration failed. + CONFIGURATION_FAILED = 8; + // The setup configuration succeeded. + CONFIGURATION_SUCCEEDED = 9; +} diff --git a/proto/agentic_mesh_protocol/setup/v1/setup_messages.proto b/proto/agentic_mesh_protocol/setup/v1/setup_messages.proto new file mode 100644 index 0000000..79d7496 --- /dev/null +++ b/proto/agentic_mesh_protocol/setup/v1/setup_messages.proto @@ -0,0 +1,167 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.setup.v1; + +import "agentic_mesh_protocol/pagination/v1/bulk.proto"; +import "agentic_mesh_protocol/setup/v1/setup_enums.proto"; +import "buf/validate/validate.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +// ═════════════════════════════════════ Objects ════════════════════════════════════ // + +// SetupVersion represents a version of a setup's configuration. +message SetupVersion { + // id is the unique identifier of the setup version. + string id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_versions_id_prefix" + expression: "this.startsWith('setup_versions:')" + message: "setup_versions must start with 'setup_versions:'" + }, + (buf.validate.field).cel = { + id: "setup_versions_id_length" + expression: "this.size() >= 16" + message: "setup_versions must be at least 1 characters long" + } + ]; + + // setup_id is the unique identifier of the parent setup. + string setup_id = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_id_prefix" + expression: "this.startsWith('setups:')" + message: "setup_versions must start with 'setups:'" + }, + (buf.validate.field).cel = { + id: "setup_id_length" + expression: "this.size() >= 8" + message: "setup_versions must be at least 1 characters long" + } + ]; + + // version is the label for this version (e.g., "v1", "v2"). + string version = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // creation_date is the setup version creation date. + google.protobuf.Timestamp created_at = 4; + + // content contains key-value pairs for configuration content. + google.protobuf.Struct content = 5 [(buf.validate.field).required = true]; +} + +// Setup represents a configuration associated with a mission. +message Setup { + // id is the unique identifier of the setup. + string id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_id_prefix" + expression: "this.startsWith('setups:')" + message: "setup_id must start with 'setups:'" + }, + (buf.validate.field).cel = { + id: "setup_id_length" + expression: "this.size() >= 8" + message: "setup_id must be at least 1 characters long" + } + ]; + + // organization_id is the unique identifier of the organization. + string organization_id = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "organization_id_prefix" + expression: "this.startsWith('organizations:')" + message: "organization_id must start with 'organizations:'" + }, + (buf.validate.field).cel = { + id: "organization_id_length" + expression: "this.size() >= 15" + message: "organization_id must be at least 1 characters long" + } + ]; + + // owner_id is the owner ID of the setup. + string owner_id = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "user_id_prefix" + expression: "this.startsWith('users:')" + message: "user_id must start with 'users:'" + }, + (buf.validate.field).cel = { + id: "user_id_length" + expression: "this.size() >= 7" + message: "users_id must be at least 1 characters long" + } + ]; + + // module_id is the module identifier associated with the setup. + string module_id = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "module_id_prefix" + expression: "this.startsWith('modules:')" + message: "module_id must start with 'modules:'" + }, + (buf.validate.field).cel = { + id: "module_id_length" + expression: "this.size() >= 9" + message: "module_id must be at least 1 characters long" + } + ]; + + // name is the name of the setup. + string name = 5 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // status is the status of the setup. + SetupStatus status = 6 [(buf.validate.field).required = true]; + + // current_setup_version is the active setup version. + optional SetupVersion current_setup_version = 7 [(buf.validate.field).required = false]; +} + +// SetupResult represents the result of processing an individual item in the bulk operation. +message SetupResult { + // identifier is the unique identifier for the item being processed + string identifier = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // success indicates if the operation was successful (optional for backward compatibility). + optional bool success = 2 [(buf.validate.field).required = false]; + + // One of the following fields will be set based on the outcome of processing the item. + oneof outcom { + // setup is the setup data if the operation was successful. + Setup setup = 3; + // version is the setup version data if the operation was successful. + SetupVersion version = 4; + // error represents the error that occurred while processing the item, if applicable. + agentic_mesh_protocol.pagination.v1.OperationError error = 5; + } +} diff --git a/proto/agentic_mesh_protocol/setup/v1/setup_service.proto b/proto/agentic_mesh_protocol/setup/v1/setup_service.proto index 43713fc..b0be8d8 100644 --- a/proto/agentic_mesh_protocol/setup/v1/setup_service.proto +++ b/proto/agentic_mesh_protocol/setup/v1/setup_service.proto @@ -16,7 +16,7 @@ syntax = "proto3"; package agentic_mesh_protocol.setup.v1; -import "agentic_mesh_protocol/setup/v1/setup.proto"; +import "agentic_mesh_protocol/setup/v1/setup_dto.proto"; // SetupService // Provides operations for setups and setup versions. @@ -25,21 +25,10 @@ service SetupService { rpc CreateSetup(CreateSetupRequest) returns (CreateSetupResponse); // GetSetup retrieves a setup by its unique identifier. rpc GetSetup(GetSetupRequest) returns (GetSetupResponse); + // ListSetups retrieves a paginated list of setups, filtered by organization or owner. + rpc ListSetups(ListSetupsRequest) returns (ListSetupsResponse); // UpdateSetup updates an existing setup. rpc UpdateSetup(UpdateSetupRequest) returns (UpdateSetupResponse); // DeleteSetup deletes a setup. rpc DeleteSetup(DeleteSetupRequest) returns (DeleteSetupResponse); - - // CreateSetupVersion creates a new setup version. - rpc CreateSetupVersion(CreateSetupVersionRequest) returns (CreateSetupVersionResponse); - // GetSetupVersion retrieves a setup version by its unique identifier. - rpc GetSetupVersion(GetSetupVersionRequest) returns (GetSetupVersionResponse); - // SearchSetupVersions searches for setup versions based on provided filters. - rpc SearchSetupVersions(SearchSetupVersionsRequest) returns (SearchSetupVersionsResponse); - // UpdateSetupVersion updates an existing setup version. - rpc UpdateSetupVersion(UpdateSetupVersionRequest) returns (UpdateSetupVersionResponse); - // DeleteSetupVersion deletes a setup version. - rpc DeleteSetupVersion(DeleteSetupVersionRequest) returns (DeleteSetupVersionResponse); - // ListSetups retrieves a paginated list of setups, filtered by organisation or owner. - rpc ListSetups(ListSetupsRequest) returns (ListSetupsResponse); } diff --git a/proto/agentic_mesh_protocol/setup/v1/setup_version_dto.proto b/proto/agentic_mesh_protocol/setup/v1/setup_version_dto.proto new file mode 100644 index 0000000..5427635 --- /dev/null +++ b/proto/agentic_mesh_protocol/setup/v1/setup_version_dto.proto @@ -0,0 +1,182 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.setup.v1; + +import "agentic_mesh_protocol/pagination/v1/bulk.proto"; +import "agentic_mesh_protocol/pagination/v1/pagination.proto"; +import "agentic_mesh_protocol/setup/v1/setup_messages.proto"; +import "buf/validate/validate.proto"; +import "google/protobuf/struct.proto"; + +// ════════════════════════════════════ CreateSetupVersion ════════════════════════════════════ // + +// Request and Response messages for creating a new Setup Version. +message CreateSetupVersionRequest { + // setup_id is the unique identifier of the parent setup. + string setup_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_id_prefix" + expression: "this.startsWith('setups:')" + message: "setup_id must start with 'setups:'" + }, + (buf.validate.field).cel = { + id: "setup_id_length" + expression: "this.size() >= 8" + message: "setup_id must be at least 1 characters long" + } + ]; + + // version is the version label (e.g., "v1", "v2"). + string version = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // content contains key-value pairs for configuration content. + google.protobuf.Struct content = 3 [(buf.validate.field).required = true]; +} + +// Response message for CreateSetupVersion operation. +message CreateSetupVersionResponse { + // Result of the operation. Expected oneof type: SetupVersion or OperationError. + SetupResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ GetSetupVersion ════════════════════════════════════ // + +// Request and Response messages for retrieving a Setup Version by its ID. +message GetSetupVersionRequest { + // setup_version_id is the unique identifier of the setup version. + string setup_version_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_versions_id_prefix" + expression: "this.startsWith('setup_versions:')" + message: "setup_versions must start with 'setup_versions:'" + }, + (buf.validate.field).cel = { + id: "setup_versions_id_length" + expression: "this.size() >= 16" + message: "setup_versions must be at least 1 characters long" + } + ]; +} + +// Response message for GetSetupVersion operation. +message GetSetupVersionResponse { + // Result of the operation. Expected oneof type: SetupVersion or OperationError. + SetupResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ SearchSetupVersions ════════════════════════════════════ // + +// Request and Response messages for searching Setup Versions. +message SearchSetupVersionsRequest { + // setup_id is the unique identifier of the parent setup. + string setup_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_id_prefix" + expression: "this.startsWith('setups:')" + message: "setup_id must start with 'setups:'" + }, + (buf.validate.field).cel = { + id: "setup_id_length" + expression: "this.size() >= 8" + message: "setup_id must be at least 1 characters long" + } + ]; + + // version is the version label to filter with. + optional string version = 2 [ + (buf.validate.field).required = false, + (buf.validate.field).string.min_len = 1 + ]; + + // pagination contains pagination settings. + agentic_mesh_protocol.pagination.v1.PaginationRequest pagination = 3 [(buf.validate.field).required = true]; +} + +// Response message for SearchSetupVersions operation. +message SearchSetupVersionsResponse { + // Result of the operation. Expected oneof type: SetupVersion or OperationError. + repeated SetupResult result = 1 [(buf.validate.field).required = true]; + // bulk contains information about the bulk operation and pagination. + agentic_mesh_protocol.pagination.v1.BulkResponse bulk = 2 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ UpdateSetupVersion ════════════════════════════════════ // + +// Request and Response messages for updating an existing Setup Version. +message UpdateSetupVersionRequest { + // setup_version_id is the unique identifier of the setup version to update. + string setup_version_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_versions_id_prefix" + expression: "this.startsWith('setup_versions:')" + message: "setup_versions must start with 'setup_versions:'" + }, + (buf.validate.field).cel = { + id: "setup_versions_id_length" + expression: "this.size() >= 16" + message: "setup_versions must be at least 1 characters long" + } + ]; + + // version is the version label. + string version = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // content contains key-value pairs for configuration content. + google.protobuf.Struct content = 3 [(buf.validate.field).required = true]; +} + +// Response message for UpdateSetupVersion operation. +message UpdateSetupVersionResponse { + // Result of the operation. Expected oneof type: SetupVersion or OperationError. + SetupResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ DeleteSetupVersion ════════════════════════════════════ // + +// Request and Response messages for deleting a Setup Version. +message DeleteSetupVersionRequest { + // setup_version_id is the unique identifier of the setup version. + string setup_version_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "setup_versions_id_prefix" + expression: "this.startsWith('setup_versions:')" + message: "setup_versions must start with 'setup_versions:'" + }, + (buf.validate.field).cel = { + id: "setup_versions_id_length" + expression: "this.size() >= 16" + message: "setup_versions must be at least 1 characters long" + } + ]; +} + +// Response message for DeleteSetupVersion operation. +message DeleteSetupVersionResponse { + // Result of the operation. Expected oneof type: SetupVersion or OperationError. + SetupResult result = 1 [(buf.validate.field).required = true]; +} diff --git a/proto/agentic_mesh_protocol/setup/v1/setup_version_service.proto b/proto/agentic_mesh_protocol/setup/v1/setup_version_service.proto new file mode 100644 index 0000000..a31b71b --- /dev/null +++ b/proto/agentic_mesh_protocol/setup/v1/setup_version_service.proto @@ -0,0 +1,34 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.setup.v1; + +import "agentic_mesh_protocol/setup/v1/setup_version_dto.proto"; + +// SetupVersionService +// Provides operations for setups and setup versions. +service SetupVersionService { + // CreateSetupVersion creates a new setup version. + rpc CreateSetupVersion(CreateSetupVersionRequest) returns (CreateSetupVersionResponse); + // GetSetupVersion retrieves a setup version by its unique identifier. + rpc GetSetupVersion(GetSetupVersionRequest) returns (GetSetupVersionResponse); + // SearchSetupVersions searches for setup versions based on provided filters. + rpc SearchSetupVersions(SearchSetupVersionsRequest) returns (SearchSetupVersionsResponse); + // UpdateSetupVersion updates an existing setup version. + rpc UpdateSetupVersion(UpdateSetupVersionRequest) returns (UpdateSetupVersionResponse); + // DeleteSetupVersion deletes a setup version. + rpc DeleteSetupVersion(DeleteSetupVersionRequest) returns (DeleteSetupVersionResponse); +} diff --git a/proto/agentic_mesh_protocol/storage/v1/data.proto b/proto/agentic_mesh_protocol/storage/v1/data.proto deleted file mode 100644 index 33eb791..0000000 --- a/proto/agentic_mesh_protocol/storage/v1/data.proto +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright 2025 DigitalKin Inc. -// -// Licensed under the GNU General Public License, Version 3.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.gnu.org/licenses/gpl-3.0.html -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package agentic_mesh_protocol.storage.v1; - -import "buf/validate/validate.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -// DataType: Enum to categorize the type of data being stored -enum DataType { - // UNSPECIFIED: Default unspecified data type - UNSPECIFIED = 0; - // OUTPUT: Data generated by the system as output - OUTPUT = 1; - // VIEW: Data intended for display/UI purposes - VIEW = 2; - // LOGS: Log entries and debugging information - LOGS = 3; - // OTHER: Other miscellaneous data types - OTHER = 4; -} - -// StorageRecord: Message to represent stored data -message StorageRecord { - // data: JSON Object to store - google.protobuf.Struct data = 1 [(buf.validate.field).required = true]; - // mission_id: Mission ID linked to the data - string mission_id = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "missions:" - ]; - // collection: Name of a group of records (unique by mission_id) - string collection = 3 [(buf.validate.field).required = true]; - // record_id: Unique identifier for the record within collection - string record_id = 4 [(buf.validate.field).required = true]; - // creation_date: Creation date of the data - google.protobuf.Timestamp creation_date = 5 [(buf.validate.field).required = true]; - // update_date: Update date of the data - google.protobuf.Timestamp update_date = 6 [(buf.validate.field).required = true]; - // data_type: Type of the data - DataType data_type = 7 [(buf.validate.field).required = true]; -} - -// StoreRecordRequest: Request to store record -message StoreRecordRequest { - // data: Data to store or to retrieve - google.protobuf.Struct data = 1 [(buf.validate.field).required = true]; - // mission_id: Mission ID linked to the data - string mission_id = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "missions:" - ]; - // collection: Name of a group of records (unique by mission_id) - string collection = 3 [(buf.validate.field).required = true]; - // record_id: Unique identifier for the record within collection - string record_id = 4 [(buf.validate.field).required = true]; - // data_type: Type of the data - DataType data_type = 5 [(buf.validate.field).required = true]; -} - -// StoreRecordResponse: Response to stored record -message StoreRecordResponse { - // success: Success of the operation - bool success = 1 [(buf.validate.field).required = true]; - // stored_data: Stored data - StorageRecord stored_data = 2 [(buf.validate.field).required = true]; -} - -// ReadRecordRequest: Request to read a record -message ReadRecordRequest { - // mission_id: Mission ID linked to the data - string mission_id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "missions:" - ]; - // collection: Name of a group of records (unique by mission_id) - string collection = 2 [(buf.validate.field).required = true]; - // record_id: Unique identifier for the record within collection - string record_id = 3 [(buf.validate.field).required = true]; -} - -// ReadRecordResponse: Response after read a record -message ReadRecordResponse { - // success: Success of the operation - bool success = 1 [(buf.validate.field).required = true]; - // stored_data: Stored data - StorageRecord stored_data = 2 [(buf.validate.field).required = true]; -} - -// UpdateRecordRequest: Request to modify record -message UpdateRecordRequest { - // data: Data to store or to retrieve - google.protobuf.Struct data = 1 [(buf.validate.field).required = true]; - // mission_id: Mission ID linked to the data - string mission_id = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "missions:" - ]; - // collection: Name of a group of records (unique by mission_id) - string collection = 3 [(buf.validate.field).required = true]; - // record_id: Unique identifier for the record within collection - string record_id = 4 [(buf.validate.field).required = true]; -} - -// UpdateRecordResponse: Response to record modification -message UpdateRecordResponse { - // success: Success of the operation - bool success = 1 [(buf.validate.field).required = true]; - // stored_data: Stored data - StorageRecord stored_data = 2 [(buf.validate.field).required = true]; -} - -// RemoveRecordRequest: Request to remove a record -message RemoveRecordRequest { - // mission_id: Mission ID linked to the data - string mission_id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "missions:" - ]; - // collection: Name of a group of records (unique by mission_id) - string collection = 3 [(buf.validate.field).required = true]; - // record_id: Unique identifier for the record within collection - string record_id = 4 [(buf.validate.field).required = true]; -} - -// RemoveRecordResponse: Response to removed record -message RemoveRecordResponse { - // success: Success of the operation - bool success = 1 [(buf.validate.field).required = true]; -} - -// ListRecordsRequest: Request to list all records in a given collection -message ListRecordsRequest { - // mission_id: Mission ID linked to the data - string mission_id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "missions:" - ]; - // collection: Name of a group of records (unique by mission_id) - string collection = 2 [(buf.validate.field).required = true]; -} - -// ListRecordsResponse: Response to list all records in a given collection -message ListRecordsResponse { - // records: List of records - repeated StorageRecord records = 1 [(buf.validate.field).required = true]; -} - -// RemoveCollectionRequest: Request to remove a collection -message RemoveCollectionRequest { - // mission_id: Mission ID linked to the data - string mission_id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "missions:" - ]; - // collection: Name of a group of records (unique by mission_id) - string collection = 2 [(buf.validate.field).required = true]; -} - -// RemoveCollectionResponse: Response to removed collection -message RemoveCollectionResponse { - // success: Success of the operation - bool success = 1 [(buf.validate.field).required = true]; -} diff --git a/proto/agentic_mesh_protocol/storage/v1/storage_dto.proto b/proto/agentic_mesh_protocol/storage/v1/storage_dto.proto new file mode 100644 index 0000000..72bd6e9 --- /dev/null +++ b/proto/agentic_mesh_protocol/storage/v1/storage_dto.proto @@ -0,0 +1,245 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.storage.v1; + +import "agentic_mesh_protocol/pagination/v1/bulk.proto"; +import "agentic_mesh_protocol/pagination/v1/pagination.proto"; +import "agentic_mesh_protocol/storage/v1/storage_enums.proto"; +import "agentic_mesh_protocol/storage/v1/storage_messages.proto"; +import "buf/validate/validate.proto"; +import "google/protobuf/struct.proto"; + +// ════════════════════════════════════ StoreRecord ════════════════════════════════════ // +message CreateRecordRequest { + // mission_id is the unique identifier of the mission. + string mission_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "missions_id_prefix" + expression: "this.startsWith('missions:')" + message: "missions_id must start with 'missions:'" + }, + (buf.validate.field).cel = { + id: "missions_id_length" + expression: "this.size() >= 9" + message: "missions_id must be at least 1 characters long" + } + ]; + + // collection is the name of the group for the records. + string collection = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // record_id is the unique identifier for the record within the collection. + string record_id = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // data_type is the category of the data being stored. + DataType data_type = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).enum.defined_only = true + ]; + + // data is the JSON object to store. + google.protobuf.Struct data = 5 [(buf.validate.field).required = true]; +} + +// Response message for StoreRecord operation. +message CreateRecordResponse { + // Result of the operation. Expected oneof type: StorageRecord or OperationError. + StorageResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ ReadRecord ════════════════════════════════════ // +message GetRecordRequest { + // mission_id is the unique identifier of the mission. + string mission_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "missions_id_prefix" + expression: "this.startsWith('missions:')" + message: "missions_id must start with 'missions:'" + }, + (buf.validate.field).cel = { + id: "missions_id_length" + expression: "this.size() >= 10" + message: "missions_id must be at least 1 characters long" + } + ]; + + // collection is the name of the group for the records. + string collection = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // record_id is the unique identifier for the record. + string record_id = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; +} + +// Response message for ReadRecord operation. +message GetRecordResponse { + // Result of the operation. Expected oneof type: StorageRecord or OperationError. + StorageResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ UpdateRecord ════════════════════════════════════ // +message UpdateRecordRequest { + // mission_id is the unique identifier of the mission. + string mission_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "missions_id_prefix" + expression: "this.startsWith('missions:')" + message: "missions must start with 'mission:'" + }, + (buf.validate.field).cel = { + id: "missions_id_length" + expression: "this.size() >= 10" + message: "missions must be at least 1 characters long" + } + ]; + + // collection is the name of the group for the records. + string collection = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // record_id is the unique identifier for the record. + string record_id = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // data is the updated JSON object. + google.protobuf.Struct data = 4 [(buf.validate.field).required = true]; +} + +// Response message for UpdateRecord operation. +message UpdateRecordResponse { + // Result of the operation. Expected oneof type: StorageRecord or OperationError. + StorageResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ RemoveRecord ════════════════════════════════════ // +message DeleteRecordRequest { + // mission_id is the unique identifier of the mission. + string mission_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "missions_id_prefix" + expression: "this.startsWith('missions:')" + message: "missions must start with 'mission:'" + }, + (buf.validate.field).cel = { + id: "missions_id_length" + expression: "this.size() >= 10" + message: "missions must be at least 1 characters long" + } + ]; + + // collection is the name of the group for the records. + string collection = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // record_id is the unique identifier for the record. + string record_id = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; +} + +// Response message for RemoveRecord operation. +message DeleteRecordResponse { + // Result of the operation. Expected oneof type: StorageRecord or OperationError. + StorageResult result = 1 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ ListRecords ════════════════════════════════════ // +message ListRecordsRequest { + // mission_id is the unique identifier of the mission. + string mission_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "missions_id_prefix" + expression: "this.startsWith('missions:')" + message: "missions must start with 'missions:'" + }, + (buf.validate.field).cel = { + id: "missions_id_length" + expression: "this.size() >= 10" + message: "missions must be at least 1 characters long" + } + ]; + + // collection is the name of the group for the records. + string collection = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // pagination contains pagination settings. + agentic_mesh_protocol.pagination.v1.PaginationRequest pagination = 3 [(buf.validate.field).required = true]; +} + +// Response message for ListRecords operation. +message ListRecordsResponse { + // Result of the operation. Expected oneof type: StorageRecord or OperationError. + repeated StorageResult result = 1 [(buf.validate.field).required = true]; + // bulk contains information about the bulk operation and pagination. + agentic_mesh_protocol.pagination.v1.BulkResponse bulk = 2 [(buf.validate.field).required = true]; +} + +// ════════════════════════════════════ RemoveCollection ════════════════════════════════════ // +message DeleteCollectionRequest { + // mission_id is the unique identifier of the mission. + string mission_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "missions_id_prefix" + expression: "this.startsWith('missions:')" + message: "missions must start with 'mission:'" + }, + (buf.validate.field).cel = { + id: "missions_id_length" + expression: "this.size() >= 10" + message: "missions must be at least 1 characters long" + } + ]; + + // collection is the name of the collection to remove. + string collection = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; +} + +// Response message for RemoveCollection operation. +message DeleteCollectionResponse { + // Result of the operation. Expected oneof type: StorageRecord or OperationError. + StorageResult result = 1 [(buf.validate.field).required = true]; +} diff --git a/proto/agentic_mesh_protocol/storage/v1/storage_enums.proto b/proto/agentic_mesh_protocol/storage/v1/storage_enums.proto new file mode 100644 index 0000000..9cc2b4f --- /dev/null +++ b/proto/agentic_mesh_protocol/storage/v1/storage_enums.proto @@ -0,0 +1,31 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.storage.v1; + +// Type of data stored in the system. +enum DataType { + // Unspecified data type. + DATA_TYPE_UNSPECIFIED = 0; + // Output data type. + OUTPUT = 1; + // View data type. + VIEW = 2; + // Logs data type. + LOGS = 3; + // Other data type. + OTHER = 4; +} diff --git a/proto/agentic_mesh_protocol/storage/v1/storage_messages.proto b/proto/agentic_mesh_protocol/storage/v1/storage_messages.proto new file mode 100644 index 0000000..a131c98 --- /dev/null +++ b/proto/agentic_mesh_protocol/storage/v1/storage_messages.proto @@ -0,0 +1,95 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.storage.v1; + +import "agentic_mesh_protocol/pagination/v1/bulk.proto"; +import "agentic_mesh_protocol/storage/v1/storage_enums.proto"; +import "buf/validate/validate.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +// ═════════════════════════════════════ Objects ════════════════════════════════════ // + +// StorageRecord represents a stored data entry in the system. +message StorageRecord { + option (buf.validate.message).cel = { + id: "created_at_after_updated_at" + expression: "!has(this.created_at) || !has(this.updated_at) || this.created_at < this.updated_at" + message: "created_at must be before updated_at" + }; + option (buf.validate.message).cel = { + id: "updated_at_before_created_at" + expression: "!has(this.created_at) || !has(this.updated_at) || this.updated_at > this.created_at" + message: "updated_at must be after created_at" + }; + + // mission_id is the unique identifier of the mission. + string mission_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "missions_id_prefix" + expression: "this.startsWith('missions:')" + message: "missions must start with 'mission:'" + }, + (buf.validate.field).cel = { + id: "missions_id_length" + expression: "this.size() >= 10" + message: "missions must be at least 1 characters long" + } + ]; + // collection is the name of the group for the records. + string collection = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // record_id is the unique identifier for the record. + string record_id = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + // data_type is the category of the data. + DataType data_type = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).enum.defined_only = true + ]; + // creation_date is the timestamp when the record was created. + google.protobuf.Timestamp created_at = 5 [(buf.validate.field).required = true]; + // update_date is the timestamp when the record was last updated. + google.protobuf.Timestamp updated_at = 6 [(buf.validate.field).required = true]; + // data is the stored JSON object. + google.protobuf.Struct data = 7 [(buf.validate.field).required = true]; +} + +// StorageResult represents the outcome of a storage operation, including success status and any relevant data or errors. +message StorageResult { + // identifier is the unique identifier for the item being processed + string identifier = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // success indicates if the operation was successful (optional for backward compatibility). + optional bool success = 2 [(buf.validate.field).required = false]; + + // One of the following fields will be set based on the outcome of processing the item. + oneof outcom { + // record is the storage record if the operation was successful. + StorageRecord record = 3; + // error represents the error that occurred while processing the item, if applicable. + agentic_mesh_protocol.pagination.v1.OperationError error = 4; + } +} diff --git a/proto/agentic_mesh_protocol/storage/v1/storage_service.proto b/proto/agentic_mesh_protocol/storage/v1/storage_service.proto index d0588d1..3924717 100644 --- a/proto/agentic_mesh_protocol/storage/v1/storage_service.proto +++ b/proto/agentic_mesh_protocol/storage/v1/storage_service.proto @@ -16,25 +16,25 @@ syntax = "proto3"; package agentic_mesh_protocol.storage.v1; -import "agentic_mesh_protocol/storage/v1/data.proto"; +import "agentic_mesh_protocol/storage/v1/storage_dto.proto"; // StorageService: Service for managing structured data storage service StorageService { // StoreRecord: Create a new record in the storage - rpc StoreRecord(StoreRecordRequest) returns (StoreRecordResponse); + rpc CreateRecord(CreateRecordRequest) returns (CreateRecordResponse); // ReadRecord: Retrieve a single record by ID - rpc ReadRecord(ReadRecordRequest) returns (ReadRecordResponse); + rpc GetRecord(GetRecordRequest) returns (GetRecordResponse); // UpdateRecord: Update an existing record rpc UpdateRecord(UpdateRecordRequest) returns (UpdateRecordResponse); // RemoveRecord: Delete a record from storage - rpc RemoveRecord(RemoveRecordRequest) returns (RemoveRecordResponse); + rpc DeleteRecord(DeleteRecordRequest) returns (DeleteRecordResponse); // ListRecords: List records with filtering and pagination rpc ListRecords(ListRecordsRequest) returns (ListRecordsResponse); // RemoveCollection: Delete all records in a given collection - rpc RemoveCollection(RemoveCollectionRequest) returns (RemoveCollectionResponse); + rpc DeleteCollection(DeleteCollectionRequest) returns (DeleteCollectionResponse); } diff --git a/proto/agentic_mesh_protocol/user_profile/v1/user_profile.proto b/proto/agentic_mesh_protocol/user_profile/v1/user_profile.proto deleted file mode 100644 index 71ea9a4..0000000 --- a/proto/agentic_mesh_protocol/user_profile/v1/user_profile.proto +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2025 DigitalKin Inc. -// -// Licensed under the GNU General Public License, Version 3.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.gnu.org/licenses/gpl-3.0.html -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package agentic_mesh_protocol.user_profile.v1; - -import "buf/validate/validate.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -// Metadata: Message to represent user metadata (security keys, etc.) -message Metadata { - // security_key: Security key for the user - string security_key = 1; -} - -// Subscription: Message to represent user subscription information -message Subscription { - // tier: Subscription tier level - string tier = 1; - // status: Current subscription status - string status = 2; - // start: Subscription start date - google.protobuf.Timestamp start = 3; - // end: Subscription end date - google.protobuf.Timestamp end = 4; -} - -// CreditLot: Message to represent user credit allocation and usage -message CreditLot { - // source: Source of the credit lot (e.g., "top-up", "subs", "free plan"...) - string source = 1; - // total: Total credit lot total to the user - int64 total = 2; - // remaining: credit lot remaining by the user - double remaining = 3; - // timestamp: Last update timestamp for creditLot - google.protobuf.Timestamp timestamp = 4; -} - -// UserProfile: Message to represent a user profile -message UserProfile { - // user_id: Unique identifier for the user - string user_id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "users:" - ]; - // organisation_id: Organisation ID linked to the user - string organisation_id = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "organisations:" - ]; - // email: User email address - string email = 3 [ - (buf.validate.field).required = true, - (buf.validate.field).string.email = true - ]; - // first_name: User first name - string first_name = 4 [(buf.validate.field).required = true]; - // last_name: User last name - string last_name = 5 [(buf.validate.field).required = true]; - // creation_date: Profile creation date - google.protobuf.Timestamp creation_date = 6 [ - (buf.validate.field).required = true - ]; - // update_date: Profile last update date - google.protobuf.Timestamp update_date = 7 [ - (buf.validate.field).required = true - ]; - // locale: User locale preference - string locale = 8 [(buf.validate.field).required = true]; - // subscription: User subscription information - Subscription subscription = 9; - // credits: User credit allocation and usage - repeated CreditLot credits = 10; - // metadata: Additional user metadata (preferences, settings, etc.) - google.protobuf.Struct metadata = 11; -} - -// GetUserProfileRequest: Request to get a user profile -message GetUserProfileRequest { - // mission_id: Unique identifier for the mission - string mission_id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.prefix = "missions:" - ]; -} - -// GetUserProfileResponse: Response after getting a user profile -message GetUserProfileResponse { - // success: Success of the operation - bool success = 1 [(buf.validate.field).required = true]; - // user_profile: Retrieved user profile - UserProfile user_profile = 2 [(buf.validate.field).required = true]; -} diff --git a/proto/agentic_mesh_protocol/user_profile/v1/user_profile_dto.proto b/proto/agentic_mesh_protocol/user_profile/v1/user_profile_dto.proto new file mode 100644 index 0000000..5b43241 --- /dev/null +++ b/proto/agentic_mesh_protocol/user_profile/v1/user_profile_dto.proto @@ -0,0 +1,46 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.user_profile.v1; + +import "agentic_mesh_protocol/user_profile/v1/user_profile_messages.proto"; +import "buf/validate/validate.proto"; + +// ════════════════════════════════════ GetUserProfile ════════════════════════════════════ // + +// Request message for GetUserProfile operation. +message GetUserProfileRequest { + // mission_id is the unique identifier for the mission. + string mission_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "missions_id_prefix" + expression: "this.startsWith('missions:')" + message: "missions must start with 'mission:'" + }, + (buf.validate.field).cel = { + id: "missions_id_length" + expression: "this.size() >= 10" + message: "missions must be at least 1 characters long" + } + ]; +} + +// Response message for GetUserProfile operation. +message GetUserProfileResponse { + // Result of the operation. Expected oneof type: UserProfile or OperationError. + UserProfileResult result = 1 [(buf.validate.field).required = true]; +} diff --git a/proto/agentic_mesh_protocol/user_profile/v1/user_profile_messages.proto b/proto/agentic_mesh_protocol/user_profile/v1/user_profile_messages.proto new file mode 100644 index 0000000..5724a6d --- /dev/null +++ b/proto/agentic_mesh_protocol/user_profile/v1/user_profile_messages.proto @@ -0,0 +1,197 @@ +// Copyright 2025 DigitalKin Inc. +// +// Licensed under the GNU General Public License, Version 3.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.gnu.org/licenses/gpl-3.0.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package agentic_mesh_protocol.user_profile.v1; + +import "agentic_mesh_protocol/pagination/v1/bulk.proto"; +import "buf/validate/validate.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +// ═════════════════════════════════════ Objects ════════════════════════════════════ // + +// Metadata represents user metadata such as security keys. +message Metadata { + // security_key is the security key for the user. + string security_key = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; +} + +// Subscription represents user subscription details. +message Subscription { + option (buf.validate.message).cel = { + id: "start_after_end" + expression: "!has(this.start) || !has(this.end) || this.start < this.end" + message: "start must be before end" + }; + option (buf.validate.message).cel = { + id: "end_before_start" + expression: "!has(this.end) || !has(this.start) || this.end > this.start" + message: "end must be after start" + }; + + // tier is the subscription tier level (e.g., "free", "pro"). + string tier = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // status is the current subscription status. + string status = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // start is the subscription start date. + google.protobuf.Timestamp start = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).timestamp.gt_now = true + ]; + + // end is the subscription end date. + google.protobuf.Timestamp end = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).timestamp.gt_now = true + ]; +} + +// CreditLot represents user credit allocation and usage. +message CreditLot { + // source is the source of the credit lot (e.g., "top-up", "subscription"). + string source = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // total is the total credits allocated in this lot. + int64 total = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).int64.gt = 0 + ]; + + // remaining is the number of credits remaining in this lot. + double remaining = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).double.gte = 0, + (buf.validate.field).double.finite = true + ]; + + // timestamp is the last update timestamp for this credit lot. + google.protobuf.Timestamp timestamp = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).timestamp.lt_now = true + ]; +} + +// UserProfile represents the full profile of a user in the system. +message UserProfile { + // user_id is the unique identifier for the user. + string user_id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "user_id_prefix" + expression: "this.startsWith('users:')" + message: "user_id must start with 'users:'" + }, + (buf.validate.field).cel = { + id: "user_id_length" + expression: "this.size() >= 7" + message: "users_id must be at least 1 characters long" + } + ]; + + // organization_id is the organization ID linked to the user. + string organization_id = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).cel = { + id: "organization_id_prefix" + expression: "this.startsWith('organizations:')" + message: "organization_id must start with 'organizations:'" + }, + (buf.validate.field).cel = { + id: "organization_id_length" + expression: "this.size() >= 15" + message: "organization_id must be at least 1 characters long" + } + ]; + + // email is the user's email address. + string email = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).string.email = true + ]; + + // first_name is the user's first name. + string first_name = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 2 + ]; + + // last_name is the user's last name. + string last_name = 5 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 2 + ]; + + // locale is the user's preferred locale. + string locale = 6 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // creation_date is the timestamp when the profile was created. + google.protobuf.Timestamp created_at = 7 [ + (buf.validate.field).required = true, + (buf.validate.field).timestamp.lt_now = true + ]; + + // update_date is the timestamp when the profile was last updated. + google.protobuf.Timestamp updated_at = 8 [ + (buf.validate.field).required = true, + (buf.validate.field).timestamp.lt_now = true + ]; + + // metadata contains additional key-value preferences or settings. + google.protobuf.Struct metadata = 9 [(buf.validate.field).required = true]; + + // subscription contains user subscription information. + Subscription subscription = 10 [(buf.validate.field).required = true]; + + // credits is the list of user credit allocations. + repeated CreditLot credits = 11 [(buf.validate.field).required = true]; +} + +// UserProfileResult represents the outcome of a user profile operation, including success status and any relevant data or errors. +message UserProfileResult { + // identifier is the unique identifier for the item being processed + string identifier = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // success indicates if the operation was successful (optional for backward compatibility). + optional bool success = 2 [(buf.validate.field).required = false]; + + // One of the following fields will be set based on the outcome of processing the item. + oneof outcom { + // profile is the user profile if the operation was successful. + UserProfile profile = 3; + // error represents the error that occurred while processing the item, if applicable. + agentic_mesh_protocol.pagination.v1.OperationError error = 4; + } +} diff --git a/proto/agentic_mesh_protocol/user_profile/v1/user_profile_service.proto b/proto/agentic_mesh_protocol/user_profile/v1/user_profile_service.proto index a08ade9..6e4b8d3 100644 --- a/proto/agentic_mesh_protocol/user_profile/v1/user_profile_service.proto +++ b/proto/agentic_mesh_protocol/user_profile/v1/user_profile_service.proto @@ -16,7 +16,7 @@ syntax = "proto3"; package agentic_mesh_protocol.user_profile.v1; -import "agentic_mesh_protocol/user_profile/v1/user_profile.proto"; +import "agentic_mesh_protocol/user_profile/v1/user_profile_dto.proto"; // UserProfileService: Service to manage user profiles service UserProfileService { diff --git a/proto/buf.lock b/proto/buf.lock index 069cd88..d15a117 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -2,5 +2,5 @@ version: v2 deps: - name: buf.build/bufbuild/protovalidate - commit: 2a1774d888024a9b93ce7eb4b59f6a83 - digest: b5:6b7f9bc919b65e5b79d7b726ffc03d6f815a412d6b792970fa6f065cae162107bd0a9d47272c8ab1a2c9514e87b13d3fbf71df614374d62d2183afb64be2d30a + commit: 80ab13bee0bf4272b6161a72bf7034e0 + digest: b5:1aa6a965be5d02d64e1d81954fa2e78ef9d1e33a0c30f92bc2626039006a94deb3a5b05f14ed8893f5c3ffce444ac008f7e968188ad225c4c29c813aa5f2daa1 diff --git a/proto/buf.yaml b/proto/buf.yaml index 970a07e..f20e124 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -10,14 +10,15 @@ lint: - STANDARD - COMMENTS - FILE_LOWER_SNAKE_CASE + - PROTOVALIDATE except: - PACKAGE_VERSION_SUFFIX - RPC_REQUEST_STANDARD_NAME - RPC_RESPONSE_STANDARD_NAME - RPC_REQUEST_RESPONSE_UNIQUE - ENUM_VALUE_PREFIX - - ENUM_VALUE_UPPER_SNAKE_CASE - - ENUM_ZERO_VALUE_SUFFIX + # - ENUM_VALUE_UPPER_SNAKE_CASE + # - ENUM_ZERO_VALUE_SUFFIX enum_zero_value_suffix: _UNSPECIFIED rpc_allow_same_request_response: true rpc_allow_google_protobuf_empty_requests: true diff --git a/taskfile.yml b/taskfile.yml new file mode 100644 index 0000000..defa073 --- /dev/null +++ b/taskfile.yml @@ -0,0 +1,96 @@ +version: "3" + +vars: + GEN_DIR: gen/python + PROTO_DIR: proto + +tasks: + # ============================================================================= + # DEFAULT + # ============================================================================= + default: + desc: "Show available tasks" + cmds: + - task --list + silent: true + + # ============================================================================= + # INSTALL + # ============================================================================= + install: + desc: "Install npm dependencies (for buf)" + cmds: + - npm install + sources: + - package.json + - package-lock.json + generates: + - node_modules/**/* + status: + - test -d node_modules + + # ============================================================================= + # GEN - Proto code generation (Python only) + # ============================================================================= + gen: + desc: "Generate Python code from proto files" + cmds: + - npx buf generate + sources: + - "{{.PROTO_DIR}}/**/*.proto" + - buf.gen.yaml + generates: + - "{{.GEN_DIR}}/**/*" + + # ============================================================================= + # LINT - Proto quality + # ============================================================================= + lint: + desc: "Run all proto linting checks" + cmds: + - task: lint:format:check + - task: lint:check + + lint:check: + desc: "Lint proto files with buf" + cmds: + - npx buf lint {{.PROTO_DIR}} + + lint:format: + desc: "Format proto files with buf" + cmds: + - npx buf format -w {{.PROTO_DIR}} + + lint:format:check: + desc: "Check proto file formatting (no write)" + cmds: + - npx buf format -d {{.PROTO_DIR}} --exit-code + + # ============================================================================= + # VERSION - Breaking changes detection + # ============================================================================= + version:breaking: + desc: "Check for breaking changes against main branch" + cmds: + - npx buf breaking --against '.git#branch=main' + + version:breaking:verbose: + desc: "Check for breaking changes (verbose JSON output)" + cmds: + - npx buf breaking --against '.git#branch=main' --error-format=json | jq + + # ============================================================================= + # CLEAN + # ============================================================================= + clean: + desc: "Clean generated Python files" + cmds: + - rm -rf {{.GEN_DIR}} + - rm -rf gen + - rm -rf .task + + clean:all: + desc: "Deep clean (generated files + node_modules)" + cmds: + - task: clean + - rm -rf node_modules