feat: add marketplace metrics, privacy features, and service registry endpoints

- Add Prometheus metrics for marketplace API throughput and error rates with new dashboard panels
- Implement confidential transaction models with encryption support and access control
- Add key management system with registration, rotation, and audit logging
- Create services and registry routers for service discovery and management
- Integrate ZK proof generation for privacy-preserving receipts
- Add metrics instru
This commit is contained in:
oib
2025-12-22 10:33:23 +01:00
parent d98b2c7772
commit c8be9d7414
260 changed files with 59033 additions and 351 deletions

View File

@ -0,0 +1,304 @@
# AITBC Extension Manifest
# This file defines the extension metadata and lifecycle configuration
apiVersion: "v1"
kind: "Extension"
# Basic information
metadata:
name: "{{ cookiecutter.extension_name }}"
displayName: "{{ cookiecutter.extension_display_name }}"
description: "{{ cookiecutter.extension_description }}"
version: "{{ cookiecutter.version }}"
author: "{{ cookiecutter.author_name }}"
email: "{{ cookiecutter.author_email }}"
license: "{{ cookiecutter.license }}"
homepage: "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.extension_name }}"
repository: "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.extension_name }}.git"
documentation: "https://{{ cookiecutter.extension_name }}.readthedocs.io"
# Extension classification
spec:
type: "{{ cookiecutter.extension_type }}"
category:
{% if cookiecutter.extension_type == "payment" %}
- "payment-processor"
{% elif cookiecutter.extension_type == "erp" %}
- "erp-connector"
{% elif cookiecutter.extension_type == "analytics" %}
- "analytics-tool"
{% else %}
- "developer-tool"
{% endif %}
# AITBC compatibility
aitbc:
minVersion: "1.0.0"
maxVersion: "2.0.0"
sdkVersion: "^1.0.0"
# Runtime requirements
runtime:
python: ">= {{ cookiecutter.python_version }}"
{% if cookiecutter.use_asyncio %}
features: ["async"]
{% endif %}
# Dependencies
dependencies:
core:
- "aitbc-enterprise>=1.0.0"
{% if cookiecutter.extension_type == "payment" %}
payments:
- "stripe>=5.0.0"
{% elif cookiecutter.extension_type == "erp" %}
erp:
- "requests>=2.25.0"
- "pandas>=1.3.0"
{% elif cookiecutter.extension_type == "analytics" %}
analytics:
- "matplotlib>=3.5.0"
- "plotly>=5.0.0"
{% else %}
devtools:
- "click>=8.0.0"
{% endif %}
# Extension configuration schema
configSchema:
type: "object"
properties:
{% if cookiecutter.extension_type == "payment" %}
api_key:
type: "string"
description: "API key for the payment service"
sensitive: true
webhook_secret:
type: "string"
description: "Webhook secret for verification"
sensitive: true
sandbox:
type: "boolean"
description: "Use sandbox environment"
default: false
{% elif cookiecutter.extension_type == "erp" %}
host:
type: "string"
description: "ERP system host"
format: "hostname"
port:
type: "integer"
description: "ERP system port"
default: 443
username:
type: "string"
description: "ERP username"
sensitive: true
password:
type: "string"
description: "ERP password"
sensitive: true
database:
type: "string"
description: "ERP database name"
{% elif cookiecutter.extension_type == "analytics" %}
data_source:
type: "string"
description: "Data source URL"
refresh_interval:
type: "integer"
description: "Data refresh interval in seconds"
default: 300
retention_days:
type: "integer"
description: "Data retention period in days"
default: 90
{% else %}
debug_mode:
type: "boolean"
description: "Enable debug logging"
default: false
log_level:
type: "string"
enum: ["DEBUG", "INFO", "WARNING", "ERROR"]
default: "INFO"
{% endif %}
required:
{% if cookiecutter.extension_type == "payment" %}
- "api_key"
{% elif cookiecutter.extension_type == "erp" %}
- "host"
- "username"
- "password"
- "database"
{% elif cookiecutter.extension_type == "analytics" %}
- "data_source"
{% endif %}
# Health check configuration
health:
enabled: true
endpoint: "/health"
interval: 30
timeout: 5
checks:
- name: "service_connection"
type: "external"
command: "python -c 'import {{ cookiecutter.package_name }}; print(\"OK\")'"
{% if cookiecutter.extension_type == "payment" %}
- name: "payment_api"
type: "http"
url: "https://api.stripe.com/v1"
expectedStatus: 200
{% endif %}
# Metrics configuration
metrics:
enabled: true
endpoint: "/metrics"
format: "prometheus"
customMetrics:
{% if cookiecutter.extension_type == "payment" %}
- name: "payment_operations_total"
type: "counter"
help: "Total number of payment operations"
- name: "payment_amount_sum"
type: "histogram"
help: "Payment amount distribution"
{% elif cookiecutter.extension_type == "erp" %}
- name: "sync_operations_total"
type: "counter"
help: "Total number of sync operations"
- name: "sync_records_processed"
type: "counter"
help: "Total records processed during sync"
{% elif cookiecutter.extension_type == "analytics" %}
- name: "analytics_queries_total"
type: "counter"
help: "Total number of analytics queries"
- name: "data_processing_time"
type: "histogram"
help: "Time spent processing analytics data"
{% endif %}
# Webhook configuration (if applicable)
{% if cookiecutter.extension_type == "payment" %}
webhooks:
enabled: true
events:
- "payment.created"
- "payment.succeeded"
- "payment.failed"
- "refund.created"
endpoint: "/webhooks"
secret: "{{ cookiecutter.extension_name }}_webhook"
retryPolicy:
maxRetries: 3
backoff: "exponential"
{% endif %}
# Security configuration
security:
{% if cookiecutter.extension_type == "payment" %}
pciCompliance: true
dataEncryption: true
{% elif cookiecutter.extension_type == "erp" %}
tlsRequired: true
auditLogging: true
{% endif %}
permissions:
- "read:transactions"
- "write:transactions"
{% if cookiecutter.extension_type == "erp" %}
- "read:customers"
- "write:customers"
{% endif %}
# Deployment configuration
deployment:
type: "docker"
# Docker configuration
docker:
image: "{{ cookiecutter.github_username }}/{{ cookiecutter.extension_name }}:{{ cookiecutter.version }}"
ports:
- "8080:8080"
environment:
- "AITBC_ENV=production"
- "LOG_LEVEL=INFO"
volumes:
- "/data/{{ cookiecutter.extension_name }}:/app/data"
resources:
limits:
cpu: "500m"
memory: "512Mi"
requests:
cpu: "100m"
memory: "128Mi"
# Kubernetes configuration (optional)
kubernetes:
enabled: false
replicas: 2
service:
type: "ClusterIP"
port: 80
ingress:
enabled: false
host: "{{ cookiecutter.extension_name }}.aitbc.local"
# Scaling configuration
scaling:
minReplicas: 1
maxReplicas: 10
targetCPUUtilization: 70
targetMemoryUtilization: 80
# Testing configuration
testing:
frameworks:
- "pytest"
- "pytest-asyncio" # if asyncio enabled
coverage:
enabled: true
threshold: 80
environments:
- name: "unit"
command: "pytest tests/unit/"
- name: "integration"
command: "pytest tests/integration/"
- name: "e2e"
command: "pytest tests/e2e/"
# Documentation
documentation:
type: "sphinx"
theme: "sphinx_rtd_theme"
build:
command: "sphinx-build -b html docs docs/_build"
deploy:
type: "github-pages"
branch: "gh-pages"
# Release configuration
release:
type: "semantic"
branches:
main: "main"
develop: "develop"
release: "release/*"
changelog:
enabled: true
file: "CHANGELOG.md"
artifacts:
- "dist/*.whl"
- "dist/*.tar.gz"
# Support information
support:
website: "https://{{ cookiecutter.extension_name }}.aitbc.io"
documentation: "https://{{ cookiecutter.extension_name }}.readthedocs.io"
issues: "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.extension_name }}/issues"
discussions: "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.extension_name }}/discussions"
email: "{{ cookiecutter.author_email }}"
slack: "#{{ cookiecutter.extension_name }}-support"