Platform scripts, MCP servers, deployment and docs for the KAB runs

- Scripts to run workflows from a YAML context or run inputs (kab_run_workflow.py, with
  --input name=@file), store per-project discovery connections, bootstrap agent MCP keys,
  refresh the KAB token, publish reports and build estate snapshots.
- Hyperscaler discovery servers extended in place; cloud-knowledge folded into them.
- deploy/crucible-kab-dev.yaml: the Discovery package agent and the Assessment agents.
- Platform issue write-ups and current-wiring notes under docs/platform-issues/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-05 22:13:25 +00:00
parent c14a94f33b
commit f659564208
71 changed files with 2818 additions and 2821 deletions

View File

@@ -77,7 +77,7 @@ import hmac
import json
import re
import secrets
from typing import Any, Dict, List, Optional
from typing import Any, Callable, Dict, List, Optional
VENDOR = "com.kyndryl.mcp"
SCHEMA_KEY = f"{VENDOR}/connection-schema"
@@ -202,7 +202,43 @@ def missing_fields(profile: Optional[Dict[str, Any]], schema: Dict[str, Any]) ->
return [name for name in required if not str(profile.get(name) or "").strip()]
def install_invalid_request_handler(app: Any, on_invalid: Optional[Callable[[str], None]] = None) -> None:
"""Answer a request that is not valid JSON-RPC with a JSON-RPC error that does not repeat the request.
FastAPI's own answer (HTTP 422) repeats the request body under "input". The body is where the gateway puts
the tenant's connection, so a request that is merely malformed (no "id", say) would get the credential back
in the reply, and in the log of anything that records replies. The status stays 422; the body is a JSON-RPC
error (-32600) that names only the fields at fault. `on_invalid`, if given, is called with that text, already
reduced to harmless characters, so the caller can log it in its own style.
Call it once, right after `app = FastAPI(...)`. FastAPI is imported here, not at module level, so the rest of
this module stays importable without it.
"""
from fastapi.exceptions import RequestValidationError
from fastapi.responses import JSONResponse
@app.exception_handler(RequestValidationError)
async def invalid_request(request, exc):
names = {
"body" if error.get("type") == "json_invalid" else ".".join(str(p) for p in error.get("loc", ())[1:]) or "body"
for error in exc.errors()
}
fields = re.sub(r"[^\w.\-, ]", "?", ", ".join(sorted(names)))[:200]
if on_invalid is not None:
on_invalid(fields)
return JSONResponse(
status_code=422,
content={
"jsonrpc": "2.0",
"id": None,
"result": None,
"error": {"code": -32600, "message": "Invalid request: check " + fields},
},
)
__all__ = [
"install_invalid_request_handler",
"VENDOR",
"SCHEMA_KEY",
"CONNECTION_KEY",