Add unit tests for SBOM ingestion and transformation
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
- Implement `SbomIngestServiceCollectionExtensionsTests` to verify the SBOM ingestion pipeline exports snapshots correctly. - Create `SbomIngestTransformerTests` to ensure the transformation produces expected nodes and edges, including deduplication of license nodes and normalization of timestamps. - Add `SbomSnapshotExporterTests` to test the export functionality for manifest, adjacency, nodes, and edges. - Introduce `VexOverlayTransformerTests` to validate the transformation of VEX nodes and edges. - Set up project file for the test project with necessary dependencies and configurations. - Include JSON fixture files for testing purposes.
This commit is contained in:
210
docs/advisory-ai/api.md
Normal file
210
docs/advisory-ai/api.md
Normal file
@@ -0,0 +1,210 @@
|
||||
|
||||
> **Imposed rule:** Work of this type or tasks of this type on this component must also be applied everywhere else it should be applied.
|
||||
|
||||
# Advisory AI API Reference (Sprint 110 Preview)
|
||||
|
||||
_Updated: 2025-11-03 • Owner: Docs Guild & Advisory AI Guild • Status: In progress_
|
||||
|
||||
## 1. Overview
|
||||
|
||||
The Advisory AI service exposes deterministic, guardrail-enforced endpoints for generating advisory summaries, conflict explanations, and remediation plans. Each request is backed by the Aggregation-Only Contract (AOC); inputs originate from immutable Conseiller/Excititor evidence and SBOM context, and every output ships with verifiable citations and cache digests.
|
||||
|
||||
This document captures the API surface targeted for Sprint 110. The surface is gated behind Authority scopes and designed to operate identically online or offline (local inference profiles).
|
||||
|
||||
## 2. Base conventions
|
||||
|
||||
| Item | Value |
|
||||
|------|-------|
|
||||
| Base path | `/v1/advisory-ai` |
|
||||
| Media types | `application/json` (request + response) |
|
||||
| Authentication | OAuth2 access token (JWT, DPoP-bound or mTLS as per tenant policy) |
|
||||
| Required scopes | See [Authentication & scopes](#3-authentication--scopes) |
|
||||
| Idempotency | Requests are cached by `(taskType, advisoryKey, policyVersion, profile, artifactId/purl, preferredSections)` unless `forceRefresh` is `true` |
|
||||
| Determinism | Guardrails reject outputs lacking citations; cache digests allow replay and offline verification |
|
||||
|
||||
## 3. Authentication & scopes
|
||||
|
||||
Advisory AI calls must include `aoc:verify` plus an Advisory AI scope. Authority enforces tenant binding for all combinations.
|
||||
|
||||
| Scope | Purpose | Typical principals |
|
||||
|-------|---------|--------------------|
|
||||
| `advisory-ai:view` | Read cached artefacts (`GET /outputs/{{hash}}`) | Console backend, evidence exporters |
|
||||
| `advisory-ai:operate` | Submit inference jobs (`POST /summaries`, `/conflicts`, `/remediation`) | Platform services, CLI automation |
|
||||
| `advisory-ai:admin` | Manage profiles & policy (`PATCH /profiles`, future) | Platform operators |
|
||||
|
||||
Requests without `aoc:verify` are rejected with `invalid_scope`. Tokens aimed at remote inference profiles must also satisfy tenant consent (`requireTenantConsent` in Authority config).
|
||||
|
||||
## 4. Profiles & inference selection
|
||||
|
||||
Profiles determine which model backend and guardrail stack execute the request. The `profile` field defaults to `default` (`fips-local`).
|
||||
|
||||
| Profile | Description |
|
||||
|---------|-------------|
|
||||
| `default` / `fips-local` | Local deterministic model packaged with Offline Kit; FIPS-compliant crypto |
|
||||
| `gost-local` | Local profile using GOST-approved crypto stack |
|
||||
| `cloud-openai` | Remote inference via cloud connector (disabled unless tenant consent flag set) |
|
||||
| Custom | Installations may register additional profiles via Authority `advisory-ai` admin APIs |
|
||||
|
||||
## 5. Common request envelope
|
||||
|
||||
All task endpoints accept the same JSON payload; `taskType` is implied by the route.
|
||||
|
||||
```json
|
||||
{
|
||||
"advisoryKey": "csaf:redhat:RHSA-2025:1001",
|
||||
"artifactId": "registry.stella-ops.internal/runtime/api",
|
||||
"artifactPurl": "pkg:oci/runtime-api@sha256:d2c3...",
|
||||
"policyVersion": "2025.10.1",
|
||||
"profile": "fips-local",
|
||||
"preferredSections": ["Summary", "Remediation"],
|
||||
"forceRefresh": false
|
||||
}
|
||||
```
|
||||
|
||||
Field notes:
|
||||
|
||||
- `advisoryKey` **required**. Matches Conseiller advisory identifier or VEX statement key.
|
||||
- `artifactId` / `artifactPurl` optional but recommended for remediation tasks (enables SBOM context).
|
||||
- `policyVersion` locks evaluation to a specific Policy Engine digest. Omit for "current".
|
||||
- `profile` selects inference profile (see §4). Unknown values return `400`.
|
||||
- `preferredSections` prioritises advisory sections; the orchestrator still enforces AOC.
|
||||
- `forceRefresh` bypasses cache, regenerating output and resealing DSSE bundle.
|
||||
|
||||
## 6. Responses & caching
|
||||
|
||||
Successful responses share a common envelope:
|
||||
|
||||
```json
|
||||
{
|
||||
"taskType": "Summary",
|
||||
"profile": "fips-local",
|
||||
"generatedAt": "2025-11-03T18:22:43Z",
|
||||
"inputDigest": "sha256:6f3b...",
|
||||
"outputHash": "sha256:1d7e...",
|
||||
"ttlSeconds": 86400,
|
||||
"content": {
|
||||
"format": "markdown",
|
||||
"body": "### Summary
|
||||
1. [Vendor statement][1] ..."
|
||||
},
|
||||
"citations": [
|
||||
{
|
||||
"index": 1,
|
||||
"kind": "advisory",
|
||||
"sourceId": "concelier:csaf:redhat:RHSA-2025:1001:paragraph:12",
|
||||
"uri": "https://access.redhat.com/errata/RHSA-2025:1001"
|
||||
}
|
||||
],
|
||||
"context": {
|
||||
"planCacheKey": "adv-summary:csaf:redhat:RHSA-2025:1001:fips-local",
|
||||
"chunks": 42,
|
||||
"vectorMatches": 12,
|
||||
"sbom": {
|
||||
"artifactId": "registry.stella-ops.internal/runtime/api",
|
||||
"versionTimeline": 8,
|
||||
"dependencyPaths": 5,
|
||||
"dependencyNodes": 17
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `content.format` is `markdown` for human-readable payloads; machine-readable JSON attachments will use `json`. The CLI and Console render Markdown directly.
|
||||
- `citations` indexes correspond to bracketed references in the Markdown body.
|
||||
- `context.planCacheKey` lets operators resubmit the same request or inspect the plan (`GET /v1/advisory-ai/plans/`cacheKey``) – optional when enabled.
|
||||
- Cached copies honour tenant-specific TTLs (default 24h). Exceeding TTL triggers regeneration on next request.
|
||||
|
||||
## 7. Endpoints
|
||||
|
||||
### 7.1 `POST /v1/advisory-ai/summaries`
|
||||
|
||||
Generate or retrieve a cached advisory summary. Requires `advisory-ai:operate`.
|
||||
|
||||
- **Request body:** Common envelope (preferred sections default to `Summary`).
|
||||
- **Response:** Summary output (see §6 example).
|
||||
- **Errors:**
|
||||
- `400 advisory.summary.missingAdvisoryKey` – empty or malformed `advisoryKey`.
|
||||
- `404 advisory.summary.advisoryNotFound` – Conseiller cannot resolve the advisory or tenant forbidden.
|
||||
- `409 advisory.summary.contextUnavailable` – SBOM context still indexing; retry later.
|
||||
|
||||
### 7.2 `POST /v1/advisory-ai/conflicts`
|
||||
|
||||
Explain conflicting VEX statements, ranked by trust metadata.
|
||||
|
||||
- **Additional payload hints:** Set `preferredSections` to include `Conflicts` or targeted statement IDs.
|
||||
- **Response extensions:** `content.format` remains Markdown; `context.conflicts` array highlights conflicting statement IDs and trust scores.
|
||||
- **Errors:** include `404 advisory.conflict.vexNotFound`, `409 advisory.conflict.trustDataPending` (waiting on Excititor linksets).
|
||||
|
||||
### 7.3 `POST /v1/advisory-ai/remediation`
|
||||
|
||||
Produce remediation plan with fix versions and verification steps.
|
||||
|
||||
- **Additional payload hints:** Provide `artifactId` or `artifactPurl` to unlock SBOM timeline + dependency analysis.
|
||||
- **Response extensions:** `content.format` Markdown plus `context.remediation` with recommended fix versions (`package`, `fixedVersion`, `rationale`).
|
||||
- **Errors:** `422 advisory.remediation.noFixAvailable` (vendor has not published fix), `409 advisory.remediation.policyHold` (policy forbids automated remediation).
|
||||
|
||||
### 7.4 `GET /v1/advisory-ai/outputs/{{outputHash}}`
|
||||
|
||||
Fetch cached artefact (same envelope as §6). Requires `advisory-ai:view`.
|
||||
|
||||
- **Headers:** Supports `If-None-Match` with the `outputHash` (Etag) for cache validation.
|
||||
- **Errors:** `404 advisory.output.notFound` if cache expired or tenant lacks access.
|
||||
|
||||
### 7.5 `GET /v1/advisory-ai/plans/{{cacheKey}}` (optional)
|
||||
|
||||
When plan preview is enabled (feature flag `advisoryAi.planPreview.enabled`), this endpoint returns the orchestration plan using `AdvisoryPipelinePlanResponse` (task metadata, chunk/vector counts). Requires `advisory-ai:operate`.
|
||||
|
||||
## 8. Error model
|
||||
|
||||
Errors follow a standard problem+JSON envelope:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 400,
|
||||
"code": "advisory.summary.missingAdvisoryKey",
|
||||
"message": "advisoryKey must be provided",
|
||||
"traceId": "01HECAJ6RE8T5H4P6Q0XZ7ZD4T",
|
||||
"retryAfter": 30
|
||||
}
|
||||
```
|
||||
|
||||
| HTTP | Code prefix | Meaning |
|
||||
|------|-------------|---------|
|
||||
| 400 | `advisory.summary.*`, `advisory.remediation.*` | Validation failures or unsupported profile/task combinations |
|
||||
| 401 | `auth.invalid_token` | Token expired/invalid; ensure DPoP proof matches access token |
|
||||
| 403 | `auth.insufficient_scope` | Missing `advisory-ai` scope or tenant consent |
|
||||
| 404 | `advisory.*.notFound` | Advisory/key not available for tenant |
|
||||
| 409 | `advisory.*.contextUnavailable` | Dependencies (SBOM, VEX, policy) not ready; retry after indicated seconds |
|
||||
| 422 | `advisory.*.noFixAvailable` | Remediation cannot be produced given current evidence |
|
||||
| 429 | `rate_limit.exceeded` | Caller breached tenant or profile rate limit; examine `Retry-After` |
|
||||
| 503 | `advisory.backend.unavailable` | Model backend offline or remote profile disabled |
|
||||
|
||||
All errors include `traceId` for cross-service correlation and log search.
|
||||
|
||||
## 9. Rate limiting & quotas
|
||||
|
||||
Advisory AI honours per-tenant quotas configured under `advisoryAi.rateLimits`:
|
||||
|
||||
- Default: 30 summary/conflict requests per minute per tenant & profile.
|
||||
- Remediation requests default to 10/minute due to heavier SBOM analysis.
|
||||
- Cached `GET /outputs/{{hash}}` calls share the `advisory-ai:view` bucket (60/minute).
|
||||
|
||||
Limits are enforced at the gateway; the API returns `429` with standard `Retry-After` seconds. Operators can adjust limits via Authority configuration bundles and propagate offline using the Offline Kit.
|
||||
|
||||
## 10. Observability & audit
|
||||
|
||||
- Metrics: `advisory_ai_requests_total``tenant,task,profile``, `advisory_ai_latency_seconds`, `advisory_ai_validation_failures_total`, `advisory_ai_cache_hits_total`.
|
||||
- Logs: Structured with `traceId`, `tenant`, `task`, `profile`, `outputHash`, `cacheStatus` (`hit`|`miss`|`bypass`). Prompt bodies are **never** logged; guardrail violations emit sanitized snippets only.
|
||||
- Audit events: `advisory_ai.output.generated`, `advisory_ai.output.accessed`, `advisory_ai.guardrail.blocked` ship to the Authority audit stream with tenant + actor metadata.
|
||||
|
||||
## 11. Offline & sovereignty considerations
|
||||
|
||||
- Offline installations bundle prompt templates, guardrail configs, and local model weights. Remote profiles (`cloud-openai`) remain disabled unless operators explicitly enable them and record consent per tenant.
|
||||
- Cached outputs include DSSE attestations when DSSE mode is enabled. Export Center ingests cached artefacts via `GET /outputs/{{hash}}` using `advisory-ai:view`.
|
||||
- Force-refresh regenerates outputs using the same cache key, allowing auditors to replay evidence during compliance reviews.
|
||||
|
||||
## 12. Change log
|
||||
|
||||
| Date (UTC) | Change |
|
||||
|------------|--------|
|
||||
| 2025-11-03 | Initial sprint-110 preview covering summary/conflict/remediation endpoints, cache retrieval, plan preview, and error/rate limit model. |
|
||||
168
docs/advisory-ai/architecture.md
Normal file
168
docs/advisory-ai/architecture.md
Normal file
@@ -0,0 +1,168 @@
|
||||
|
||||
> **Imposed rule:** Work of this type or tasks of this type on this component must also be applied everywhere else it should be applied.
|
||||
|
||||
# Advisory AI Architecture
|
||||
|
||||
_Updated: 2025-11-03 • Owner: Docs Guild & Advisory AI Guild • Status: Draft_
|
||||
|
||||
This document decomposes how Advisory AI transforms immutable evidence into deterministic, explainable outputs. It complements `docs/modules/advisory-ai/architecture.md` with service-level views, data flows, and integration checklists for Sprint 110.
|
||||
|
||||
## 1. High-level flow
|
||||
|
||||
```
|
||||
Conseiller / Excititor / SBOM / Policy
|
||||
| (retrievers)
|
||||
v
|
||||
+----------------------------+
|
||||
| AdvisoryPipelineOrchestrator |
|
||||
| (plan generation) |
|
||||
+----------------------------+
|
||||
| plan + cache key
|
||||
v
|
||||
+----------------------------+
|
||||
| Guarded Prompt Runtime |
|
||||
| (profile-specific) |
|
||||
+----------------------------+
|
||||
| validated output + citations
|
||||
v
|
||||
+----------------------------+
|
||||
| Cache & Provenance |
|
||||
| (Mongo + DSSE optional) |
|
||||
+----------------------------+
|
||||
| \
|
||||
v v
|
||||
REST API CLI / Console
|
||||
```
|
||||
|
||||
Key stages:
|
||||
1. **Retrieval** – deterministic chunkers pull AOC-compliant data: Conseiller advisories, Excititor VEX statements, SBOM context, Policy explain traces, optional runtime telemetry.
|
||||
2. **Plan generation** – the orchestrator builds an `AdvisoryTaskPlan` (Summary / Conflict / Remediation) containing budgets, prompt template IDs, cache keys, and metadata.
|
||||
3. **Guarded inference** – profile-specific prompt runners execute with guardrails (redaction, injection defence, citation enforcement). Failures are logged and downstream consumers receive deterministic errors.
|
||||
4. **Persistence** – outputs are hashed (`outputHash`), referenced with `inputDigest`, optionally sealed with DSSE, and exposed for CLI/Console consumption.
|
||||
|
||||
## 2. Component responsibilities
|
||||
|
||||
| Component | Description | Notes |
|
||||
|-----------|-------------|-------|
|
||||
| `AdvisoryRetrievalService` | Facade that composes Conseiller/Excititor/SBOM/Policy clients into context packs. | Deterministic ordering; per-source limits enforced. |
|
||||
| `AdvisoryPipelineOrchestrator` | Builds task plans, selects prompt templates, allocates token budgets. | Tenant-scoped; memoises by cache key. |
|
||||
| `GuardrailService` | Applies redaction filters, prompt allowlists, validation schemas, and DSSE sealing. | Shares configuration with Security Guild. |
|
||||
| `ProfileRegistry` | Maps profile IDs to runtime implementations (local model, remote connector). | Enforces tenant consent and allowlists. |
|
||||
| `AdvisoryOutputStore` | Mongo collection storing cached artefacts plus provenance manifest. | TTL defaults 24h; DSSE metadata optional. |
|
||||
| `AdvisoryPipelineWorker` | Background executor for queued jobs (future sprint once 004A wires queue). | Consumes `advisory.pipeline.execute` messages. |
|
||||
|
||||
## 3. Data contracts
|
||||
|
||||
### 3.1 `AdvisoryTaskRequest`
|
||||
|
||||
```json
|
||||
{
|
||||
"taskType": "Summary",
|
||||
"advisoryKey": "csaf:redhat:RHSA-2025:1001",
|
||||
"artifactId": "registry.stella-ops.internal/runtime/api",
|
||||
"artifactPurl": "pkg:oci/runtime-api@sha256:d2c3...",
|
||||
"policyVersion": "2025.10.1",
|
||||
"profile": "fips-local",
|
||||
"preferredSections": ["Summary", "Remediation"],
|
||||
"forceRefresh": false
|
||||
}
|
||||
```
|
||||
|
||||
- `taskType` ∈ `Summary|Conflict|Remediation`.
|
||||
- Provide either `artifactId` or `artifactPurl` for remediation tasks (unlocks dependency analysis).
|
||||
- `forceRefresh` bypasses cache and regenerates output (deterministic with identical inputs).
|
||||
|
||||
### 3.2 `AdvisoryPipelinePlanResponse`
|
||||
|
||||
Returned when plan preview is enabled; summarises chunk and vector usage so operators can verify evidence.
|
||||
|
||||
```json
|
||||
{
|
||||
"taskType": "Summary",
|
||||
"cacheKey": "adv-summary:csaf:redhat:RHSA-2025:1001:fips-local",
|
||||
"budget": { "promptTokens": 1024, "completionTokens": 256 },
|
||||
"chunks": [{"documentId": "doc-1", "chunkId": "doc-1:0001", "section": "Summary"}],
|
||||
"vectors": [{"query": "Summary query", "matches": [{"chunkId": "doc-1:0001", "score": 0.92}]}],
|
||||
"sbom": {
|
||||
"artifactId": "registry.stella-ops.internal/runtime/api",
|
||||
"versionTimelineCount": 8,
|
||||
"dependencyPathCount": 5,
|
||||
"dependencyNodeCount": 17
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3.3 Output envelope
|
||||
|
||||
See `docs/advisory-ai/api.md` §6. Each response includes `inputDigest`, `outputHash`, Markdown content, citations, TTL, and context summary to support offline replay.
|
||||
|
||||
## 4. Profiles & runtime selection
|
||||
|
||||
| Profile | Runtime | Crypto posture | Default availability |
|
||||
|---------|---------|----------------|----------------------|
|
||||
| `default` / `fips-local` | On-prem model (GPU/CPU) | FIPS-validated primitives | Enabled |
|
||||
| `gost-local` | Sovereign local model | GOST algorithms | Opt-in |
|
||||
| `cloud-openai` | Remote connector via secure gateway | Depends on hosting region | Disabled (requires tenant consent) |
|
||||
| Custom | Operator-supplied | Matches declared policy | Disabled until Authority admin approves |
|
||||
|
||||
Profile selection is controlled via Authority configuration (`advisoryAi.allowedProfiles`). Remote profiles require tenant consent, allowlisted endpoints, and custom SLIs to track latency/error budgets.
|
||||
|
||||
## 5. Guardrails & validation pipeline
|
||||
|
||||
1. **Prompt preparation** – sanitized context injected into templated prompts (Liquid/Handlebars). Sensitive tokens scrubbed before render.
|
||||
2. **Prompt allowlist** – each template fingerprinted; runtime rejects prompts whose hash is not documented.
|
||||
3. **Response schema** – JSON validator ensures sections, severity tags, and citation arrays meet contract.
|
||||
4. **Citation resolution** – referenced `[n]` items must map to context chunk identifiers.
|
||||
5. **DSSE sealing (optional)** – outputs can be sealed with the Advisory AI signing key; DSSE bundle stored alongside cache artefact.
|
||||
6. **Audit trail** – guardrail results logged (`advisory_ai.guardrail.blocked|passed`) with tenant and trace IDs.
|
||||
|
||||
## 6. Caching & storage model
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| `_id` | `outputHash` (sha256 of content body). |
|
||||
| `inputDigest` | sha256 of canonical context pack. |
|
||||
| `taskType` | Summary/Conflict/Remediation. |
|
||||
| `profile` | Inference profile used. |
|
||||
| `content` | Markdown/JSON body and format metadata. |
|
||||
| `citations` | Array of `{index, kind, sourceId, uri}`. |
|
||||
| `generatedAt` | UTC timestamp. |
|
||||
| `ttlSeconds` | Derived from tenant configuration (default 86400). |
|
||||
| `dsse` | Optional DSSE bundle metadata. |
|
||||
|
||||
Cache misses trigger orchestration and inference; hits return stored artefacts immediately. TTL expiry removes entries unless `forceRefresh` has already regenerated them.
|
||||
|
||||
## 7. Telemetry & SLOs
|
||||
|
||||
Metrics (registered in Observability backlog):
|
||||
- `advisory_ai_requests_total{tenant,task,profile}`
|
||||
- `advisory_ai_latency_seconds_bucket`
|
||||
- `advisory_ai_guardrail_blocks_total`
|
||||
- `advisory_ai_cache_hits_total`
|
||||
- `advisory_ai_remote_profile_requests_total`
|
||||
|
||||
Logs include `traceId`, `tenant`, `task`, `profile`, `outputHash`, `cacheStatus` (`hit|miss|bypass`). Prompt bodies are never logged; guardrail violations log sanitized excerpts only.
|
||||
|
||||
Suggested SLOs:
|
||||
- **Latency:** P95 ≤ 3s (local), ≤ 8s (remote).
|
||||
- **Availability:** 99.5% successful responses per tenant over 7 days.
|
||||
- **Guardrail block rate:** ≤ 1%; investigate higher values.
|
||||
|
||||
## 8. Deployment & offline guidance
|
||||
|
||||
- Package prompts, guardrail configs, profile manifests, and local model weights in the Offline Kit.
|
||||
- Remote profiles remain disabled until Authority admins set `advisoryAi.remoteProfiles` and record tenant consent.
|
||||
- Export Center reads cached outputs using `advisory-ai:view` and benefits from DSSE sealing when enabled.
|
||||
|
||||
## 9. Checklist
|
||||
|
||||
- [ ] `AdvisoryRetrievalService` wired to the SBOM context client (AIAI-31-002).
|
||||
- [ ] Authority scopes (`advisory-ai:*`, `aoc:verify`) validated in staging.
|
||||
- [ ] Guardrail library reviewed by Security Guild (AIAI-31-005).
|
||||
- [ ] Cache TTLs/DSSE policy signed off by Platform & Compliance.
|
||||
- [ ] Observability dashboards published (DOCS-OBS backlog).
|
||||
- [ ] Offline Kit bundle updated with prompts, guardrails, local profile assets.
|
||||
|
||||
---
|
||||
|
||||
_For questions or contributions, contact the Advisory AI Guild (Slack #guild-advisory-ai) and tag Docs Guild reviewers._
|
||||
102
docs/advisory-ai/overview.md
Normal file
102
docs/advisory-ai/overview.md
Normal file
@@ -0,0 +1,102 @@
|
||||
> **Imposed rule:** Work of this type or tasks of this type on this component must also be applied everywhere else it should be applied.
|
||||
|
||||
# Advisory AI Overview
|
||||
|
||||
_Updated: 2025-11-03 • Owner: Docs Guild & Advisory AI Guild • Status: Draft_
|
||||
|
||||
Advisory AI is the retrieval-augmented assistant that synthesises Conseiller (advisory) and Excititor (VEX) evidence, Policy Engine context, and SBOM insights into explainable outputs. It operates under the Aggregation-Only Contract (AOC): no derived intelligence alters or mutates raw facts, and every generated recommendation is paired with verifiable provenance.
|
||||
|
||||
## 1. Value proposition
|
||||
|
||||
- **Summaries on demand** – deterministically produce advisory briefs that highlight impact, exploitability, and mitigation steps with paragraph-level citations.
|
||||
- **Conflict explainers** – reconcile diverging VEX statements by exposing supplier trust metadata, confidence weights, and precedence logic.
|
||||
- **Remediation planning** – merge SBOM timelines, dependency paths, and policy thresholds to propose actionable remediation plans tailored to the requesting tenant.
|
||||
- **Offline parity** – the same workflows execute in air-gapped deployments using local inference profiles; cache artefacts can be exported as DSSE bundles for audits.
|
||||
|
||||
## 2. Architectural highlights
|
||||
|
||||
| Layer | Responsibilities | Key dependencies |
|
||||
|-------|------------------|------------------|
|
||||
| Retrievers | Fetch deterministic advisory/VEX/SBOM context, guardrail inputs, policy digests. | Conseiller, Excititor, SBOM Service, Policy Engine |
|
||||
| Orchestrator | Builds `AdvisoryTaskPlan` objects (summary/conflict/remediation) with budgets and cache keys. | Deterministic toolset (AIAI-31-003), Authority scopes |
|
||||
| Guardrails | Enforce redaction, structured prompts, citation validation, injection defence, and DSSE sealing. | Security Guild guardrail library |
|
||||
| Outputs | Persist cache entries (hash + context manifest), expose via API/CLI/Console, emit telemetry. | Mongo cache store, Export Center, Observability stack |
|
||||
|
||||
See `docs/modules/advisory-ai/architecture.md` for deep technical diagrams and sequence flows.
|
||||
|
||||
## 3. Guardrails & compliance
|
||||
|
||||
1. **Aggregation-only** – only raw facts from authorised sources are consumed; no on-the-fly enrichment beyond deterministic tooling.
|
||||
2. **Citation-first** – every sentence referencing external evidence must cite a canonical paragraph/statement identifier.
|
||||
3. **Content filters** – redaction, policy-based profanity filters, and prompt allowlists are applied before model invocation.
|
||||
4. **Deterministic cache** – outputs are stored with `inputDigest` and `outputHash`; force-refresh regenerates the same output unless upstream evidence changes.
|
||||
5. **Audit & scope** – Authority scopes (`advisory-ai:view|operate|admin`) plus `aoc:verify` are mandatory; audit events (`advisory_ai.output.generated`, etc.) flow to the Authority ledger.
|
||||
|
||||
## 4. Supported personas & surfaces
|
||||
|
||||
| Persona | Typical role | Access |
|
||||
|---------|--------------|--------|
|
||||
| **Operations engineer** | Reviews summaries/remediation recommendations during incident triage. | Console + `advisory-ai:view` |
|
||||
| **Platform engineer** | Automates remediation planning via CI/CD or CLI. | CLI + API + `advisory-ai:operate` |
|
||||
| **Security/Compliance** | Audits guardrail decisions, exports outputs for evidence lockers. | API/Export Center + `advisory-ai:view` |
|
||||
| **Service owner** | Tunes profiles, remote inference settings, and rate limits. | Authority admin + `advisory-ai:admin` |
|
||||
|
||||
Surfaces:
|
||||
- **Console**: dashboard widgets (pending in CONSOLE-AIAI backlog) render cached summaries and conflicts.
|
||||
- **CLI**: `stella advise run <task>` (AIAI-31-004C) for automation scripts.
|
||||
- **API**: `/v1/advisory-ai/*` endpoints documented in `docs/advisory-ai/api.md`.
|
||||
|
||||
## 5. Data sources & provenance
|
||||
|
||||
- **Advisories** – Conseiller raw observations (CSAF/OSV) with paragraph anchors and supersedes chains.
|
||||
- **VEX statements** – Excititor VEX observations plus trust weights provided by VEX Lens.
|
||||
- **SBOM context** – SBOM Service timelines and dependency graphs (requires AIAI-31-002 completion).
|
||||
- **Policy** – Policy Engine explain traces, waivers, and risk ratings used to contextualise responses.
|
||||
- **Runtime posture** – Optional Zastava signals (exposure, admission status) when available.
|
||||
|
||||
All sources are referenced via content hashes (`content_hash`, `statement_id`, `timeline_entry_id`) ensuring reproducibility.
|
||||
|
||||
## 6. Profiles & deployment options
|
||||
|
||||
| Profile | Location | Notes |
|
||||
|---------|----------|-------|
|
||||
| `default` / `fips-local` | On-prem GPU/CPU | Packaged with Offline Kit; FIPS-approved crypto.
|
||||
| `gost-local` | Sovereign clusters | GOST-compliant crypto & model pipeline.
|
||||
| `cloud-openai` | Remote (optional) | Disabled by default; requires tenant consent and policy alignment.
|
||||
| Custom profiles | Operator-defined | Managed via Authority `advisory-ai` admin APIs and documented policy bundles.
|
||||
|
||||
Offline deployments mirror prompts, guardrails, and weights within Offline Kits. Remote profiles must pass through Authority consent enforcement and strict allowlists.
|
||||
|
||||
## 7. Observability & SLOs
|
||||
|
||||
Metrics (pre-registered in Observability backlog):
|
||||
- `advisory_ai_requests_total{tenant,task,profile}`
|
||||
- `advisory_ai_latency_seconds_bucket`
|
||||
- `advisory_ai_guardrail_blocks_total`
|
||||
- `advisory_ai_cache_hits_total`
|
||||
|
||||
Suggested SLOs (subject to Observability sprint sign-off):
|
||||
- P95 latency ≤ 3s for local profiles, ≤ 8s for remote profiles.
|
||||
- Guardrail block rate < 1% (investigate above threshold).
|
||||
- Cache hit ratio ≥ 60% for repeated advisory requests per tenant.
|
||||
|
||||
## 8. Roadmap & dependencies
|
||||
|
||||
| Area | Key tasks |
|
||||
|------|----------|
|
||||
| API delivery | DOCS-AIAI-31-003 (completed), AIAI-31-004A (service wiring), AIAI-31-006 (public endpoints). |
|
||||
| Guardrails | AIAI-31-005, Security Guild reviews, DSSE provenance wiring (AIAI-31-004B). |
|
||||
| CLI & Console | AIAI-31-004C (CLI), CONSOLE-AIAI tasks (dashboards, widgets). |
|
||||
| Docs | DOCS-AIAI-31-002 (architecture deep-dive), DOCS-AIAI-31-004 (console guide), DOCS-AIAI-31-005 (CLI guide). |
|
||||
|
||||
## 9. Checklist
|
||||
|
||||
- [ ] SBOM context retriever (AIAI-31-002) completed and tested across ecosystems.
|
||||
- [ ] Guardrail library integrated and security-reviewed.
|
||||
- [ ] Authority scopes and consent toggles validated in staging.
|
||||
- [ ] Telemetry dashboard reviewed with Observability guild.
|
||||
- [ ] Offline kit bundle includes prompts, guardrail configs, local profile weights.
|
||||
|
||||
---
|
||||
|
||||
_For questions or contributions, contact the Advisory AI Guild (Slack #guild-advisory-ai) and tag Docs Guild reviewers._
|
||||
Reference in New Issue
Block a user