diff --git a/src/api/graphql/schema.gql.v b/src/api/graphql/schema.gql.v deleted file mode 100644 index b46609e3..00000000 --- a/src/api/graphql/schema.gql.v +++ /dev/null @@ -1,10 +0,0 @@ -// GENERATED BY v-graphql-gen - DO NOT EDIT -module api - -import v_ecosystem.v_api_interfaces.v_graphql - -pub interface AerieGraphQLService { - telemetry_snapshot() string - route_forensics_snapshot(target string) string - audit_snapshot(limit int) string -} diff --git a/src/api/proto/opsm.pb.v b/src/api/proto/opsm.pb.v deleted file mode 100644 index 035b2316..00000000 --- a/src/api/proto/opsm.pb.v +++ /dev/null @@ -1,17 +0,0 @@ -// GENERATED BY v-grpc-gen - DO NOT EDIT -module api - -import v_ecosystem.v_grpc - -pub interface AerieService { - get_telemetry_snapshot(req TelemetryRequest) TelemetryPayload - get_route_forensics_snapshot(req RouteForensicsRequest) RouteForensicsPayload - get_audit_snapshot(req AuditRequest) AuditPayload -} - -// --- High-Assurance Provider --- -pub struct AerieProvider { -mut: - // Points to the Zig FFI / Idris ABI handle - abi_handle voidptr -} diff --git a/src/api/v/main.v b/src/api/v/main.v deleted file mode 100644 index 6d2224e5..00000000 --- a/src/api/v/main.v +++ /dev/null @@ -1,91 +0,0 @@ -// SPDX-License-Identifier: MPL-2.0 -// OPSM API Service (zig Implementation) -// Triple API: GraphQL / gRPC / REST - -module main - -import os -import net.http -import x.json2 -import v_ecosystem.v_api_interfaces.v_api_interfaces - -fn main() { - mut port := os.getenv('PORT').int() - if port == 0 { - port = 5000 - } - - println('╔══════════════════════════════════════════════════════╗') - println('║ OPSM API SERVICE - zig ║') - println('║ GraphQL • gRPC • REST • High-Assurance ║') - println('╚══════════════════════════════════════════════════════╝') - println('Starting server on port ${port}...') - - // Initialize the high-assurance API suite - mut suite := v_api_interfaces.new_suite(port) - - // Register verified services - suite.grpc.register_service(OpsmGrpcService{}) - suite.graphql.register_service(OpsmGraphQLService{}) - - // Start the suite (REST is handled by http.listen_and_serve for now) - go suite.grpc.start() - go suite.graphql.start() - - http.listen_and_serve(port, handle_request)! -} - -fn handle_request(req http.Request) http.Response { - match req.url { - '/api/v1/package' { - return get_package_metadata(req) - } - '/api/v1/install' { - return install_package(req) - } - '/api/v1/search' { - return search_registries(req) - } - '/graphql' { - return handle_graphql(req) - } - else { - return http.Response{ - status_code: 404 - body: 'Not Found' - } - } - } -} - -fn get_package_metadata(req http.Request) http.Response { - return http.Response{ - status_code: 200 - body: '{"status": "ok", "module": "metadata"}' - header: http.new_header(key: .content_type, value: 'application/json') - } -} - -fn install_package(req http.Request) http.Response { - return http.Response{ - status_code: 200 - body: '{"status": "queued", "module": "installer"}' - header: http.new_header(key: .content_type, value: 'application/json') - } -} - -fn search_registries(req http.Request) http.Response { - return http.Response{ - status_code: 200 - body: '{"results": []}' - header: http.new_header(key: .content_type, value: 'application/json') - } -} - -fn handle_graphql(req http.Request) http.Response { - return http.Response{ - status_code: 200 - body: '{"data": {}}' - header: http.new_header(key: .content_type, value: 'application/json') - } -} diff --git a/src/api/v/service.v b/src/api/v/service.v deleted file mode 100644 index 84276e79..00000000 --- a/src/api/v/service.v +++ /dev/null @@ -1,73 +0,0 @@ -// SPDX-License-Identifier: MPL-2.0 -// OPSM API Implementation (zig) - -module main - -import v_ecosystem.v_api_interfaces.v_grpc -import v_ecosystem.v_api_interfaces.v_graphql -import proven - -// --- gRPC Implementation --- - -pub struct OpsmGrpcService {} - -pub fn (s OpsmGrpcService) get_package_metadata(req PackageRequest) PackageMetadata { - // 1. High-Assurance Validation via Idris/Zig (libproven) - if !proven.is_initialized() { - proven.init() - } - - // Validate package name for traversal/injection - if proven.has_traversal(req.name) { - return PackageMetadata{ name: "ERROR", version: "INVALID" } - } - - println('gRPC: Fetching metadata for ${req.name}...') - return PackageMetadata{ - name: req.name - version: req.version - license: 'PMPL-1.0' - dependencies: ['proven', 'v_grpc'] - } -} - -// --- GraphQL Implementation --- - -pub struct OpsmGraphQLService {} - -pub fn (s OpsmGraphQLService) telemetry_snapshot() string { - return '{"status": "not_implemented_in_opsm"}' -} - -pub fn (s OpsmGraphQLService) route_forensics_snapshot(target string) string { - return '{"status": "not_implemented_in_opsm"}' -} - -pub fn (s OpsmGraphQLService) audit_snapshot(limit int) string { - // Cross-module query: using OPSM to audit its own API calls - println('GraphQL: Fetching audit logs (limit: ${limit})...') - return '{"events": []}' -} - -// --- Request/Response Types (Matching Protobuf/GraphQL) --- - -pub struct PackageRequest { -pub: - name string - version string -} - -pub struct PackageMetadata { -pub: - name string - version string - license string - dependencies []string -} - -pub struct TransactionResult { -pub: - transaction_id string - status string - error_message string -}