@hivemagnus/magnus-server 0.0.0-stage → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +171 -0
- package/LICENSE +202 -0
- package/README.md +169 -2
- package/agent-version.json +1 -0
- package/dist/ai/HEARTBEAT.md +56 -0
- package/dist/ai/IDENTITY.md +54 -0
- package/dist/ai/MEMORY.md +40 -0
- package/dist/ai/TOOLS.md +538 -0
- package/dist/ai/USER.md +32 -0
- package/dist/cli/args.js +62 -0
- package/dist/cli/env-catalog.js +131 -0
- package/dist/cli/preflight.js +89 -0
- package/dist/cli.js +175 -0
- package/dist/config/cors.js +16 -0
- package/dist/config/env.js +392 -0
- package/dist/config/features.js +16 -0
- package/dist/config/index.js +3 -0
- package/dist/config/listener-security.js +38 -0
- package/dist/config/version.js +31 -0
- package/dist/db/client.js +44 -0
- package/dist/db/generated/prisma/browser.js +18 -0
- package/dist/db/generated/prisma/client.js +35 -0
- package/dist/db/generated/prisma/commonInputTypes.js +11 -0
- package/dist/db/generated/prisma/enums.js +42 -0
- package/dist/db/generated/prisma/internal/class.js +50 -0
- package/dist/db/generated/prisma/internal/prismaNamespace.js +1598 -0
- package/dist/db/generated/prisma/internal/prismaNamespaceBrowser.js +1569 -0
- package/dist/db/generated/prisma/models/A2ATask.js +2 -0
- package/dist/db/generated/prisma/models/AdmissionFence.js +2 -0
- package/dist/db/generated/prisma/models/Agent.js +2 -0
- package/dist/db/generated/prisma/models/AiConversation.js +2 -0
- package/dist/db/generated/prisma/models/AiDashboard.js +2 -0
- package/dist/db/generated/prisma/models/AiMemory.js +2 -0
- package/dist/db/generated/prisma/models/AiMessage.js +2 -0
- package/dist/db/generated/prisma/models/AiScheduledOp.js +2 -0
- package/dist/db/generated/prisma/models/AlertConditionState.js +2 -0
- package/dist/db/generated/prisma/models/AlertRule.js +2 -0
- package/dist/db/generated/prisma/models/AlertViolation.js +2 -0
- package/dist/db/generated/prisma/models/AnomalyEvent.js +2 -0
- package/dist/db/generated/prisma/models/ApplicationObservation.js +2 -0
- package/dist/db/generated/prisma/models/ArdentInstallation.js +2 -0
- package/dist/db/generated/prisma/models/ArdentProfile.js +2 -0
- package/dist/db/generated/prisma/models/ArdentScopeEnrollment.js +2 -0
- package/dist/db/generated/prisma/models/CommandResourceFence.js +2 -0
- package/dist/db/generated/prisma/models/CommandResourceLease.js +2 -0
- package/dist/db/generated/prisma/models/CommandResult.js +2 -0
- package/dist/db/generated/prisma/models/CronJob.js +2 -0
- package/dist/db/generated/prisma/models/CronJobExecution.js +2 -0
- package/dist/db/generated/prisma/models/DeployJob.js +2 -0
- package/dist/db/generated/prisma/models/DriftScan.js +2 -0
- package/dist/db/generated/prisma/models/EngineeringMetricSample.js +2 -0
- package/dist/db/generated/prisma/models/EngineeringRecoveryExercise.js +2 -0
- package/dist/db/generated/prisma/models/ExecutionRun.js +2 -0
- package/dist/db/generated/prisma/models/FilePatchTask.js +2 -0
- package/dist/db/generated/prisma/models/GpuSnapshot.js +2 -0
- package/dist/db/generated/prisma/models/HealthSnapshot.js +2 -0
- package/dist/db/generated/prisma/models/HermesCoreRollout.js +2 -0
- package/dist/db/generated/prisma/models/HermesCoreRolloutHost.js +2 -0
- package/dist/db/generated/prisma/models/HermesCredentialPool.js +2 -0
- package/dist/db/generated/prisma/models/HermesCredentialPoolAttachment.js +2 -0
- package/dist/db/generated/prisma/models/HermesCronJob.js +2 -0
- package/dist/db/generated/prisma/models/HermesHook.js +2 -0
- package/dist/db/generated/prisma/models/HermesInstallation.js +2 -0
- package/dist/db/generated/prisma/models/HermesMcpServer.js +2 -0
- package/dist/db/generated/prisma/models/HermesMcpServerAttachment.js +2 -0
- package/dist/db/generated/prisma/models/HermesMessagingBinding.js +2 -0
- package/dist/db/generated/prisma/models/HermesOperationJob.js +2 -0
- package/dist/db/generated/prisma/models/HermesPluginInstall.js +2 -0
- package/dist/db/generated/prisma/models/HermesProfile.js +2 -0
- package/dist/db/generated/prisma/models/HermesProviderConfig.js +2 -0
- package/dist/db/generated/prisma/models/HermesRegistryClient.js +2 -0
- package/dist/db/generated/prisma/models/HermesRegistryInventory.js +2 -0
- package/dist/db/generated/prisma/models/HermesRegistryReceipt.js +2 -0
- package/dist/db/generated/prisma/models/HermesRegistryRevision.js +2 -0
- package/dist/db/generated/prisma/models/HermesRegistryTarget.js +2 -0
- package/dist/db/generated/prisma/models/HermesRole.js +2 -0
- package/dist/db/generated/prisma/models/HermesRoleApplication.js +2 -0
- package/dist/db/generated/prisma/models/HermesSkillAssignment.js +2 -0
- package/dist/db/generated/prisma/models/HermesToolsetPolicy.js +2 -0
- package/dist/db/generated/prisma/models/IncidentLesson.js +2 -0
- package/dist/db/generated/prisma/models/LibraryCategory.js +2 -0
- package/dist/db/generated/prisma/models/LibraryFile.js +2 -0
- package/dist/db/generated/prisma/models/LogEntry.js +2 -0
- package/dist/db/generated/prisma/models/MagnusReleaseCanary.js +2 -0
- package/dist/db/generated/prisma/models/MaintenanceWindow.js +2 -0
- package/dist/db/generated/prisma/models/ManagedCronDefinition.js +2 -0
- package/dist/db/generated/prisma/models/ManagedCronOccurrence.js +2 -0
- package/dist/db/generated/prisma/models/Node.js +2 -0
- package/dist/db/generated/prisma/models/Notification.js +2 -0
- package/dist/db/generated/prisma/models/NotificationPreference.js +2 -0
- package/dist/db/generated/prisma/models/RemediationExecution.js +2 -0
- package/dist/db/generated/prisma/models/RemediationRule.js +2 -0
- package/dist/db/generated/prisma/models/RemoteCommand.js +2 -0
- package/dist/db/generated/prisma/models/ResourceDrainParticipant.js +2 -0
- package/dist/db/generated/prisma/models/ResourceEnrollment.js +2 -0
- package/dist/db/generated/prisma/models/ResourceParticipantWork.js +2 -0
- package/dist/db/generated/prisma/models/Role.js +2 -0
- package/dist/db/generated/prisma/models/RoleApplication.js +2 -0
- package/dist/db/generated/prisma/models/RolloutTarget.js +2 -0
- package/dist/db/generated/prisma/models/SecurityExportOutbox.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionAction.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionActionApproval.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionCase.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionCaseActivity.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionCaseEntity.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionCaseEvent.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionCaseRelationship.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionCollector.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionCommandOutbox.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionDeletionReceipt.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionDelivery.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionEntity.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionEntityAlias.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionEvent.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionEventEntity.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionEvidence.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionInvestigation.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionNonce.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionReceiptChainHead.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionRuleVersion.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionSourceState.js +2 -0
- package/dist/db/generated/prisma/models/SecurityServiceState.js +2 -0
- package/dist/db/generated/prisma/models/SharedResourceFence.js +2 -0
- package/dist/db/generated/prisma/models/SharedResourceLease.js +2 -0
- package/dist/db/generated/prisma/models/SharedResourceLeaseResource.js +2 -0
- package/dist/db/generated/prisma/models/SkillInstallation.js +2 -0
- package/dist/db/generated/prisma/models/SkillRegistryEntry.js +2 -0
- package/dist/db/generated/prisma/models/SkillTag.js +2 -0
- package/dist/db/generated/prisma/models/SkillVersion.js +2 -0
- package/dist/db/generated/prisma/models/TeamApprovalDecision.js +2 -0
- package/dist/db/generated/prisma/models/User.js +2 -0
- package/dist/db/generated/prisma/models/WebhookDelivery.js +2 -0
- package/dist/db/generated/prisma/models/WebhookEndpoint.js +2 -0
- package/dist/db/generated/prisma/models.js +2 -0
- package/dist/db/index.js +3 -0
- package/dist/db/read-retry.js +35 -0
- package/dist/db/seed.js +348 -0
- package/dist/index.js +162 -0
- package/dist/middleware/auth.js +361 -0
- package/dist/middleware/body-limit.js +14 -0
- package/dist/middleware/correlation-id.js +13 -0
- package/dist/middleware/error-handler.js +28 -0
- package/dist/middleware/iam-token.js +21 -0
- package/dist/middleware/rate-limit.js +78 -0
- package/dist/middleware/request-logger.js +85 -0
- package/dist/middleware/security-headers.js +23 -0
- package/dist/middleware/tracing.js +120 -0
- package/dist/middleware/user-status.js +33 -0
- package/dist/openapi/spec.js +2656 -0
- package/dist/queue/redis.js +20 -0
- package/dist/queue/requeue.js +27 -0
- package/dist/queue/workers.js +342 -0
- package/dist/routes/ai-schedule.js +73 -0
- package/dist/routes/alerts.js +79 -0
- package/dist/routes/anomalies.js +101 -0
- package/dist/routes/ardent.js +82 -0
- package/dist/routes/assistant.js +417 -0
- package/dist/routes/audit.js +138 -0
- package/dist/routes/codex.js +65 -0
- package/dist/routes/commands.js +226 -0
- package/dist/routes/credentials.js +58 -0
- package/dist/routes/cron.js +292 -0
- package/dist/routes/dependencies.js +49 -0
- package/dist/routes/deploy.js +18 -0
- package/dist/routes/discovery.js +168 -0
- package/dist/routes/docs.js +24 -0
- package/dist/routes/drift.js +126 -0
- package/dist/routes/events-stream.js +87 -0
- package/dist/routes/files.js +214 -0
- package/dist/routes/fleet-checks.js +21 -0
- package/dist/routes/health.js +133 -0
- package/dist/routes/heartbeat.js +545 -0
- package/dist/routes/hermes-registry.js +278 -0
- package/dist/routes/hermes.js +61 -0
- package/dist/routes/library.js +402 -0
- package/dist/routes/logs.js +172 -0
- package/dist/routes/managed-cron.js +23 -0
- package/dist/routes/mcp.js +39 -0
- package/dist/routes/metrics.js +187 -0
- package/dist/routes/nodes.js +951 -0
- package/dist/routes/notifications.js +130 -0
- package/dist/routes/ops.js +258 -0
- package/dist/routes/orchestra.js +430 -0
- package/dist/routes/predictions.js +23 -0
- package/dist/routes/profiling.js +68 -0
- package/dist/routes/quick-command.js +72 -0
- package/dist/routes/remediation.js +111 -0
- package/dist/routes/resource-leases.js +297 -0
- package/dist/routes/roles.js +370 -0
- package/dist/routes/rollout.js +124 -0
- package/dist/routes/scan.js +116 -0
- package/dist/routes/security-backup.js +58 -0
- package/dist/routes/security-fusion.js +605 -0
- package/dist/routes/security-integration.js +71 -0
- package/dist/routes/self-update.js +129 -0
- package/dist/routes/shared-resource-leases.js +78 -0
- package/dist/routes/skills.js +485 -0
- package/dist/routes/stats.js +96 -0
- package/dist/routes/team-approvals.js +23 -0
- package/dist/routes/terminal-ticket.js +15 -0
- package/dist/routes/terminal.js +17 -0
- package/dist/routes/topology.js +37 -0
- package/dist/routes/users.js +219 -0
- package/dist/routes/webhooks.js +137 -0
- package/dist/schemas/command-reconciliation.js +14 -0
- package/dist/schemas/commands.js +51 -0
- package/dist/schemas/cron.js +33 -0
- package/dist/schemas/deploy.js +20 -0
- package/dist/schemas/files.js +14 -0
- package/dist/schemas/hermes.js +69 -0
- package/dist/schemas/index.js +11 -0
- package/dist/schemas/library.js +48 -0
- package/dist/schemas/logs.js +35 -0
- package/dist/schemas/managed-cron.js +127 -0
- package/dist/schemas/node-responses.js +87 -0
- package/dist/schemas/node-session-receipt.js +84 -0
- package/dist/schemas/nodes.js +36 -0
- package/dist/schemas/orchestra.js +118 -0
- package/dist/schemas/resource-participant-reconciliation.js +99 -0
- package/dist/schemas/roles.js +54 -0
- package/dist/schemas/shared-resource-lease.js +132 -0
- package/dist/schemas/skills.js +44 -0
- package/dist/schemas/users.js +28 -0
- package/dist/scripts/run-disposable-recovery-exercise.js +39 -0
- package/dist/sdk/index.js +2 -0
- package/dist/sdk/node-api-client.js +474 -0
- package/dist/security/approval-assertion.js +66 -0
- package/dist/security/command-completion-registry.js +35 -0
- package/dist/security/command-request.js +12 -0
- package/dist/security/command-result-signature.js +34 -0
- package/dist/security/managed-http.js +45 -0
- package/dist/security/native-completion-registry.js +44 -0
- package/dist/server.js +178 -0
- package/dist/services/admission-fence.js +71 -0
- package/dist/services/ai-assistant-service.js +2523 -0
- package/dist/services/ai-correlation-service.js +225 -0
- package/dist/services/ai-export-service.js +141 -0
- package/dist/services/ai-insights-service.js +219 -0
- package/dist/services/ai-schedule-service.js +145 -0
- package/dist/services/ai-scratchpad-service.js +222 -0
- package/dist/services/ai-tools.js +1343 -0
- package/dist/services/alert-service.js +313 -0
- package/dist/services/anomaly-detector.js +419 -0
- package/dist/services/api-local-work.js +79 -0
- package/dist/services/application-probes.js +309 -0
- package/dist/services/ardent-scope-enrollment.js +123 -0
- package/dist/services/ardent-service.js +86 -0
- package/dist/services/audit-service.js +308 -0
- package/dist/services/codex-service.js +209 -0
- package/dist/services/command-lifecycle.js +60 -0
- package/dist/services/command-resource-leases.js +305 -0
- package/dist/services/control-host-node.js +242 -0
- package/dist/services/credential-rotation-service.js +294 -0
- package/dist/services/dependency-service.js +145 -0
- package/dist/services/disposable-recovery-runner.js +595 -0
- package/dist/services/docker-group-health.js +121 -0
- package/dist/services/engineering-assurance.js +492 -0
- package/dist/services/engineering-evidence-ledger.js +94 -0
- package/dist/services/engineering-metric-evidence.js +26 -0
- package/dist/services/event-bus.js +227 -0
- package/dist/services/fleet-check-log.js +102 -0
- package/dist/services/forecast-service.js +154 -0
- package/dist/services/health-retention.js +175 -0
- package/dist/services/heartbeat-stream.js +63 -0
- package/dist/services/hermes-catalog-import.js +62 -0
- package/dist/services/hermes-cli-parser.js +671 -0
- package/dist/services/hermes-core-rollout.js +90 -0
- package/dist/services/hermes-dashboard-endpoint.js +13 -0
- package/dist/services/hermes-plugin-source.js +149 -0
- package/dist/services/hermes-registry-service.js +258 -0
- package/dist/services/hermes-service.js +566 -0
- package/dist/services/hivemem-client.js +85 -0
- package/dist/services/host-local-writer.js +82 -0
- package/dist/services/incident-evidence.js +110 -0
- package/dist/services/incident-lessons.js +186 -0
- package/dist/services/llm-providers/anthropic.js +143 -0
- package/dist/services/llm-providers/index.js +7 -0
- package/dist/services/llm-providers/llama-cpp.js +237 -0
- package/dist/services/llm-providers/ollama.js +292 -0
- package/dist/services/llm-providers/openai-compatible.js +200 -0
- package/dist/services/llm-providers/provider-error.js +36 -0
- package/dist/services/llm-providers/registry.js +45 -0
- package/dist/services/llm-providers/types.js +2 -0
- package/dist/services/log-emitter.js +19 -0
- package/dist/services/log-retention.js +66 -0
- package/dist/services/maintenance-service.js +29 -0
- package/dist/services/managed-cron.js +493 -0
- package/dist/services/managed-ssh-admission.js +68 -0
- package/dist/services/monitor-pulse.js +10 -0
- package/dist/services/node-issue-monitor.js +71 -0
- package/dist/services/node-service.js +35 -0
- package/dist/services/notification-retention.js +51 -0
- package/dist/services/notification-service.js +94 -0
- package/dist/services/operational-observations.js +112 -0
- package/dist/services/operations-config.js +67 -0
- package/dist/services/ops-service.js +491 -0
- package/dist/services/orchestra-extras-service.js +370 -0
- package/dist/services/orchestra-resources-service.js +530 -0
- package/dist/services/os-scheduler-writer.js +73 -0
- package/dist/services/password-service.js +22 -0
- package/dist/services/prediction-service.js +284 -0
- package/dist/services/recovery-exercises.js +682 -0
- package/dist/services/remediation-service.js +325 -0
- package/dist/services/resource-enrollment.js +433 -0
- package/dist/services/resource-node-lock.js +18 -0
- package/dist/services/resource-participant-work.js +302 -0
- package/dist/services/role-service.js +388 -0
- package/dist/services/rollout-service.js +440 -0
- package/dist/services/security-export.js +185 -0
- package/dist/services/security-fusion-actions.js +22 -0
- package/dist/services/security-fusion-approvals.js +83 -0
- package/dist/services/security-fusion-evidence-integrity.js +144 -0
- package/dist/services/security-fusion-ingest.js +101 -0
- package/dist/services/security-fusion-outbox.js +185 -0
- package/dist/services/security-fusion-receipt-chain.js +134 -0
- package/dist/services/security-fusion-service.js +751 -0
- package/dist/services/security-fusion-verification.js +50 -0
- package/dist/services/self-update-service.js +200 -0
- package/dist/services/shared-resource-leases.js +413 -0
- package/dist/services/skill-publication-bundle.js +90 -0
- package/dist/services/skill-publication-settlement.js +36 -0
- package/dist/services/skill-publication-state.js +40 -0
- package/dist/services/skill-registry-service.js +327 -0
- package/dist/services/skill-service.js +148 -0
- package/dist/services/ssh-exec-service.js +139 -0
- package/dist/services/ssh-host-verification.js +27 -0
- package/dist/services/tailscale-node-key-service.js +75 -0
- package/dist/services/team-approvals.js +118 -0
- package/dist/services/topology-service.js +138 -0
- package/dist/services/transfer-authority-snapshot.js +151 -0
- package/dist/services/webhook-credential-migration.js +97 -0
- package/dist/services/webhook-security.js +242 -0
- package/dist/services/webhook-service.js +494 -0
- package/dist/types/auth.js +3 -0
- package/dist/types/index.js +3 -0
- package/dist/types/library.js +3 -0
- package/dist/types/notifications.js +3 -0
- package/dist/types/roles.js +3 -0
- package/dist/types/shared-contracts.js +3 -0
- package/dist/utils/env.js +141 -0
- package/dist/utils/heartbeat-peer.js +19 -0
- package/dist/utils/idempotency.js +45 -0
- package/dist/utils/ip.js +25 -0
- package/dist/utils/json-fields.js +94 -0
- package/dist/utils/local-tls.js +39 -0
- package/dist/utils/magnus-home.js +15 -0
- package/dist/utils/node-url.js +59 -0
- package/dist/utils/redact.js +26 -0
- package/dist/utils/safe-equal.js +13 -0
- package/dist/utils/sentinel-nodes.js +16 -0
- package/dist/utils/validate.js +41 -0
- package/package.json +119 -4
- package/prisma/migrations/20261031000000_baseline/migration.sql +2935 -0
- package/prisma/migrations/migration_lock.toml +3 -0
- package/prisma/schema.prisma +2185 -0
- package/prisma.config.ts +14 -0
|
@@ -0,0 +1,2185 @@
|
|
|
1
|
+
// ─── Prisma Schema — Magnus Fleet Management ───
|
|
2
|
+
|
|
3
|
+
generator client {
|
|
4
|
+
provider = "prisma-client"
|
|
5
|
+
output = "../src/db/generated/prisma"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
datasource db {
|
|
9
|
+
provider = "postgresql"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Append-only database side of the root-owned release anti-rewind chain.
|
|
13
|
+
// Application routes never mutate these receipts; deployment tooling does.
|
|
14
|
+
model MagnusReleaseCanary {
|
|
15
|
+
epoch BigInt
|
|
16
|
+
tokenSha256 String @id @db.VarChar(64)
|
|
17
|
+
acceptedCommit String @db.VarChar(40)
|
|
18
|
+
sourceTreeSha256 String @db.VarChar(64)
|
|
19
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
20
|
+
|
|
21
|
+
@@map("magnus_release_canaries")
|
|
22
|
+
@@index([epoch])
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// ─── Users & Auth ───
|
|
26
|
+
|
|
27
|
+
model User {
|
|
28
|
+
id String @id @default(cuid())
|
|
29
|
+
email String @unique
|
|
30
|
+
name String
|
|
31
|
+
password String
|
|
32
|
+
role UserRole @default(VIEWER)
|
|
33
|
+
active Boolean @default(true)
|
|
34
|
+
lastLoginAt DateTime?
|
|
35
|
+
createdAt DateTime @default(now())
|
|
36
|
+
updatedAt DateTime @updatedAt
|
|
37
|
+
|
|
38
|
+
@@map("users")
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
enum UserRole {
|
|
42
|
+
ADMIN
|
|
43
|
+
OPERATOR
|
|
44
|
+
VIEWER
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// ─── Nodes ───
|
|
48
|
+
|
|
49
|
+
model Node {
|
|
50
|
+
id String @id @default(cuid())
|
|
51
|
+
name String @unique
|
|
52
|
+
hostname String
|
|
53
|
+
ipAddress String
|
|
54
|
+
port Int @default(4100)
|
|
55
|
+
status NodeStatus @default(PROVISIONING)
|
|
56
|
+
os String
|
|
57
|
+
arch String
|
|
58
|
+
tags String @default("[]")
|
|
59
|
+
metadata String @default("{}")
|
|
60
|
+
token String @unique
|
|
61
|
+
roleId String?
|
|
62
|
+
lastHeartbeatAt DateTime?
|
|
63
|
+
createdAt DateTime @default(now())
|
|
64
|
+
updatedAt DateTime @updatedAt
|
|
65
|
+
|
|
66
|
+
role Role? @relation(fields: [roleId], references: [id], onDelete: SetNull)
|
|
67
|
+
agent Agent?
|
|
68
|
+
healthSnapshots HealthSnapshot[]
|
|
69
|
+
gpuSnapshots GpuSnapshot[]
|
|
70
|
+
logs LogEntry[]
|
|
71
|
+
commands RemoteCommand[]
|
|
72
|
+
cronJobs CronJob[]
|
|
73
|
+
cronExecutions CronJobExecution[]
|
|
74
|
+
filePatches FilePatchTask[]
|
|
75
|
+
skillInstalls SkillInstallation[]
|
|
76
|
+
rolloutTargets RolloutTarget[]
|
|
77
|
+
roleApplications RoleApplication[]
|
|
78
|
+
notifications Notification[]
|
|
79
|
+
alertViolations AlertViolation[]
|
|
80
|
+
alertConditionStates AlertConditionState[]
|
|
81
|
+
driftScans DriftScan[]
|
|
82
|
+
anomalyEvents AnomalyEvent[]
|
|
83
|
+
hermesInstallations HermesInstallation[]
|
|
84
|
+
ardentInstallation ArdentInstallation?
|
|
85
|
+
resourceEnrollment ResourceEnrollment?
|
|
86
|
+
ardentScopeEnrollment ArdentScopeEnrollment?
|
|
87
|
+
admissionFence AdmissionFence?
|
|
88
|
+
resourceParticipantWork ResourceParticipantWork[]
|
|
89
|
+
engineeringMetricSamples EngineeringMetricSample[]
|
|
90
|
+
|
|
91
|
+
@@index([status])
|
|
92
|
+
@@index([ipAddress])
|
|
93
|
+
@@index([lastHeartbeatAt])
|
|
94
|
+
@@index([roleId])
|
|
95
|
+
@@map("nodes")
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Node-local Ardent remains the authority for tasks, sessions and artifacts.
|
|
99
|
+
// These rows contain only fleet references and bounded observed status.
|
|
100
|
+
model ArdentInstallation {
|
|
101
|
+
id String @id @default(cuid())
|
|
102
|
+
nodeId String @unique
|
|
103
|
+
owner String?
|
|
104
|
+
version String?
|
|
105
|
+
installed Boolean @default(false)
|
|
106
|
+
reachable Boolean @default(false)
|
|
107
|
+
error String?
|
|
108
|
+
observedAt DateTime?
|
|
109
|
+
checkedAt DateTime @default(now())
|
|
110
|
+
createdAt DateTime @default(now())
|
|
111
|
+
updatedAt DateTime @updatedAt
|
|
112
|
+
|
|
113
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
114
|
+
profiles ArdentProfile[]
|
|
115
|
+
|
|
116
|
+
@@index([reachable, checkedAt])
|
|
117
|
+
@@map("ardent_installations")
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
model ArdentProfile {
|
|
121
|
+
id String @id @default(cuid())
|
|
122
|
+
installationId String
|
|
123
|
+
name String
|
|
124
|
+
displayName String
|
|
125
|
+
backend String?
|
|
126
|
+
apiPort Int?
|
|
127
|
+
running Boolean @default(false)
|
|
128
|
+
a2aEnabled Boolean @default(false)
|
|
129
|
+
telegramEnabled Boolean @default(false)
|
|
130
|
+
error String?
|
|
131
|
+
observedAt DateTime @default(now())
|
|
132
|
+
createdAt DateTime @default(now())
|
|
133
|
+
updatedAt DateTime @updatedAt
|
|
134
|
+
|
|
135
|
+
installation ArdentInstallation @relation(fields: [installationId], references: [id], onDelete: Cascade)
|
|
136
|
+
|
|
137
|
+
@@unique([installationId, name])
|
|
138
|
+
@@index([running, observedAt])
|
|
139
|
+
@@map("ardent_profiles")
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
enum NodeStatus {
|
|
143
|
+
ONLINE
|
|
144
|
+
OFFLINE
|
|
145
|
+
DEGRADED
|
|
146
|
+
PROVISIONING
|
|
147
|
+
DECOMMISSIONED
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// ─── Agent ───
|
|
151
|
+
|
|
152
|
+
model Agent {
|
|
153
|
+
id String @id @default(cuid())
|
|
154
|
+
nodeId String @unique
|
|
155
|
+
version String
|
|
156
|
+
status AgentStatus @default(RUNNING)
|
|
157
|
+
pid Int?
|
|
158
|
+
startedAt DateTime @default(now())
|
|
159
|
+
lastCheckIn DateTime @default(now())
|
|
160
|
+
capabilities String @default("[]")
|
|
161
|
+
|
|
162
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
163
|
+
|
|
164
|
+
@@map("agents")
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
enum AgentStatus {
|
|
168
|
+
RUNNING
|
|
169
|
+
STOPPED
|
|
170
|
+
UPDATING
|
|
171
|
+
ERROR
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// ─── Hermes Agent Runtime ───
|
|
175
|
+
|
|
176
|
+
model HermesInstallation {
|
|
177
|
+
id String @id @default(cuid())
|
|
178
|
+
nodeId String?
|
|
179
|
+
hostname String
|
|
180
|
+
sshPort Int @default(22)
|
|
181
|
+
displayName String?
|
|
182
|
+
installMode String @default("unknown") // unknown | official-script | pip | git | existing
|
|
183
|
+
hermesHome String @default("~/.hermes")
|
|
184
|
+
hermesBin String @default("hermes")
|
|
185
|
+
version String?
|
|
186
|
+
status String @default("unknown") // unknown | not_installed | detected | needs_setup | running | degraded | error
|
|
187
|
+
gatewayStatus String @default("unknown")
|
|
188
|
+
dashboardHost String @default("127.0.0.1")
|
|
189
|
+
dashboardPort Int @default(9119)
|
|
190
|
+
dashboardStatus String @default("unknown")
|
|
191
|
+
apiServerEnabled Boolean @default(false)
|
|
192
|
+
apiServerHost String @default("127.0.0.1")
|
|
193
|
+
apiServerPort Int?
|
|
194
|
+
lastDetectedAt DateTime?
|
|
195
|
+
lastSyncedAt DateTime?
|
|
196
|
+
metadata String @default("{}")
|
|
197
|
+
rawStatus String @default("{}")
|
|
198
|
+
createdAt DateTime @default(now())
|
|
199
|
+
updatedAt DateTime @updatedAt
|
|
200
|
+
|
|
201
|
+
node Node? @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
202
|
+
profiles HermesProfile[]
|
|
203
|
+
jobs HermesOperationJob[]
|
|
204
|
+
|
|
205
|
+
@@unique([hostname, hermesHome])
|
|
206
|
+
@@index([nodeId])
|
|
207
|
+
@@index([status])
|
|
208
|
+
@@index([hostname])
|
|
209
|
+
@@map("hermes_installations")
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
model HermesProfile {
|
|
213
|
+
id String @id @default(cuid())
|
|
214
|
+
installationId String
|
|
215
|
+
name String
|
|
216
|
+
description String @default("")
|
|
217
|
+
profileHome String @default("")
|
|
218
|
+
isDefault Boolean @default(false)
|
|
219
|
+
providerSummary String?
|
|
220
|
+
modelSummary String?
|
|
221
|
+
distribution String?
|
|
222
|
+
gatewayStatus String @default("unknown")
|
|
223
|
+
apiServerEnabled Boolean @default(false)
|
|
224
|
+
apiServerHost String @default("127.0.0.1")
|
|
225
|
+
apiServerPort Int?
|
|
226
|
+
apiServerKeyFingerprint String?
|
|
227
|
+
capabilities String @default("{}")
|
|
228
|
+
envStatus String @default("{}")
|
|
229
|
+
metadata String @default("{}")
|
|
230
|
+
lastSyncedAt DateTime?
|
|
231
|
+
createdAt DateTime @default(now())
|
|
232
|
+
updatedAt DateTime @updatedAt
|
|
233
|
+
|
|
234
|
+
installation HermesInstallation @relation(fields: [installationId], references: [id], onDelete: Cascade)
|
|
235
|
+
jobs HermesOperationJob[]
|
|
236
|
+
|
|
237
|
+
@@unique([installationId, name])
|
|
238
|
+
@@index([installationId])
|
|
239
|
+
@@index([gatewayStatus])
|
|
240
|
+
@@map("hermes_profiles")
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
model HermesOperationJob {
|
|
244
|
+
id String @id @default(cuid())
|
|
245
|
+
type String
|
|
246
|
+
status String @default("queued") // queued | running | completed | failed | cancelled
|
|
247
|
+
installationId String?
|
|
248
|
+
profileId String?
|
|
249
|
+
targetHost String?
|
|
250
|
+
createdBy String
|
|
251
|
+
steps String @default("[]")
|
|
252
|
+
result String?
|
|
253
|
+
error String?
|
|
254
|
+
metadata String @default("{}")
|
|
255
|
+
startedAt DateTime @default(now())
|
|
256
|
+
completedAt DateTime?
|
|
257
|
+
|
|
258
|
+
installation HermesInstallation? @relation(fields: [installationId], references: [id], onDelete: SetNull)
|
|
259
|
+
profile HermesProfile? @relation(fields: [profileId], references: [id], onDelete: SetNull)
|
|
260
|
+
|
|
261
|
+
@@index([type])
|
|
262
|
+
@@index([status])
|
|
263
|
+
@@index([installationId])
|
|
264
|
+
@@index([profileId])
|
|
265
|
+
@@index([createdBy])
|
|
266
|
+
@@index([startedAt])
|
|
267
|
+
@@map("hermes_operation_jobs")
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// ─── Health ───
|
|
271
|
+
|
|
272
|
+
model HealthSnapshot {
|
|
273
|
+
id String @id @default(cuid())
|
|
274
|
+
nodeId String
|
|
275
|
+
timestamp DateTime @default(now())
|
|
276
|
+
cpuUsagePercent Float
|
|
277
|
+
cpuCores Int
|
|
278
|
+
cpuLoadAverage String
|
|
279
|
+
memoryTotalBytes BigInt
|
|
280
|
+
memoryUsedBytes BigInt
|
|
281
|
+
memoryPercent Float
|
|
282
|
+
swapTotalBytes BigInt
|
|
283
|
+
swapUsedBytes BigInt
|
|
284
|
+
disks String
|
|
285
|
+
network String
|
|
286
|
+
services String
|
|
287
|
+
wazuh String @default("{}")
|
|
288
|
+
systemUpdates String @default("{}")
|
|
289
|
+
cockpitAvailable Boolean @default(false)
|
|
290
|
+
source String @default("system-probe")
|
|
291
|
+
|
|
292
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
293
|
+
anomalyEvents AnomalyEvent[]
|
|
294
|
+
|
|
295
|
+
@@index([nodeId, timestamp])
|
|
296
|
+
@@map("health_snapshots")
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
model GpuSnapshot {
|
|
300
|
+
id String @id @default(cuid())
|
|
301
|
+
nodeId String
|
|
302
|
+
sampledAt DateTime
|
|
303
|
+
sampleIntervalSeconds Int @default(30)
|
|
304
|
+
status String @default("unavailable")
|
|
305
|
+
devices String
|
|
306
|
+
maxUtilizationPercent Float?
|
|
307
|
+
maxFanPercent Float?
|
|
308
|
+
|
|
309
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
310
|
+
|
|
311
|
+
@@unique([nodeId, sampledAt])
|
|
312
|
+
@@index([nodeId, sampledAt])
|
|
313
|
+
@@map("gpu_snapshots")
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// ─── Logs ───
|
|
317
|
+
|
|
318
|
+
model LogEntry {
|
|
319
|
+
id String @id @default(cuid())
|
|
320
|
+
nodeId String
|
|
321
|
+
source String
|
|
322
|
+
level String
|
|
323
|
+
message String
|
|
324
|
+
metadata String @default("{}")
|
|
325
|
+
timestamp DateTime @default(now())
|
|
326
|
+
|
|
327
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
328
|
+
|
|
329
|
+
@@index([nodeId, timestamp])
|
|
330
|
+
@@index([level])
|
|
331
|
+
@@index([source])
|
|
332
|
+
@@map("log_entries")
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// ─── Remote Commands ───
|
|
336
|
+
|
|
337
|
+
model RemoteCommand {
|
|
338
|
+
id String @id @default(cuid())
|
|
339
|
+
nodeId String
|
|
340
|
+
command String
|
|
341
|
+
args String @default("[]")
|
|
342
|
+
workingDirectory String?
|
|
343
|
+
environment String @default("{}")
|
|
344
|
+
timeoutSeconds Int @default(300)
|
|
345
|
+
status CommandStatus @default(PENDING)
|
|
346
|
+
riskLevel String @default("low")
|
|
347
|
+
idempotencyKey String @unique
|
|
348
|
+
correlationId String?
|
|
349
|
+
createdBy String
|
|
350
|
+
approvedBy String?
|
|
351
|
+
executionDeadline DateTime?
|
|
352
|
+
coordinationJson String?
|
|
353
|
+
createdAt DateTime @default(now())
|
|
354
|
+
startedAt DateTime?
|
|
355
|
+
completedAt DateTime?
|
|
356
|
+
|
|
357
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
358
|
+
result CommandResult?
|
|
359
|
+
|
|
360
|
+
@@index([nodeId, status])
|
|
361
|
+
@@index([idempotencyKey])
|
|
362
|
+
@@index([correlationId])
|
|
363
|
+
@@map("remote_commands")
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
enum CommandStatus {
|
|
367
|
+
PENDING
|
|
368
|
+
QUEUED
|
|
369
|
+
RUNNING
|
|
370
|
+
COMPLETED
|
|
371
|
+
FAILED
|
|
372
|
+
TIMEOUT
|
|
373
|
+
CANCELLED
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
model CommandResult {
|
|
377
|
+
id String @id @default(cuid())
|
|
378
|
+
commandId String @unique
|
|
379
|
+
exitCode Int
|
|
380
|
+
stdout String
|
|
381
|
+
stderr String
|
|
382
|
+
durationMs Int
|
|
383
|
+
truncated Boolean @default(false)
|
|
384
|
+
|
|
385
|
+
command RemoteCommand @relation(fields: [commandId], references: [id], onDelete: Cascade)
|
|
386
|
+
|
|
387
|
+
@@map("command_results")
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// ─── Cron Jobs ───
|
|
391
|
+
|
|
392
|
+
model CronJob {
|
|
393
|
+
id String @id @default(cuid())
|
|
394
|
+
nodeId String
|
|
395
|
+
name String
|
|
396
|
+
description String @default("")
|
|
397
|
+
schedule String
|
|
398
|
+
command String
|
|
399
|
+
args String @default("[]")
|
|
400
|
+
workingDirectory String?
|
|
401
|
+
environment String @default("{}")
|
|
402
|
+
timeoutSeconds Int @default(600)
|
|
403
|
+
status CronJobStatus @default(ACTIVE)
|
|
404
|
+
lastRunAt DateTime?
|
|
405
|
+
lastRunExitCode Int?
|
|
406
|
+
nextRunAt DateTime?
|
|
407
|
+
createdBy String
|
|
408
|
+
createdAt DateTime @default(now())
|
|
409
|
+
updatedAt DateTime @updatedAt
|
|
410
|
+
|
|
411
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
412
|
+
executions CronJobExecution[]
|
|
413
|
+
|
|
414
|
+
@@unique([nodeId, name])
|
|
415
|
+
@@map("cron_jobs")
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
enum CronJobStatus {
|
|
419
|
+
ACTIVE
|
|
420
|
+
PAUSED
|
|
421
|
+
ERROR
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
model CronJobExecution {
|
|
425
|
+
id String @id @default(cuid())
|
|
426
|
+
cronJobId String
|
|
427
|
+
nodeId String
|
|
428
|
+
startedAt DateTime @default(now())
|
|
429
|
+
completedAt DateTime?
|
|
430
|
+
exitCode Int?
|
|
431
|
+
stdout String
|
|
432
|
+
stderr String
|
|
433
|
+
durationMs Int?
|
|
434
|
+
|
|
435
|
+
cronJob CronJob @relation(fields: [cronJobId], references: [id], onDelete: Cascade)
|
|
436
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
437
|
+
|
|
438
|
+
@@index([cronJobId, startedAt])
|
|
439
|
+
@@map("cron_job_executions")
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// ─── File Sync ───
|
|
443
|
+
|
|
444
|
+
model FilePatchTask {
|
|
445
|
+
id String @id @default(cuid())
|
|
446
|
+
nodeId String
|
|
447
|
+
filePath String
|
|
448
|
+
direction String @default("push")
|
|
449
|
+
content String?
|
|
450
|
+
checksum String?
|
|
451
|
+
previousChecksum String?
|
|
452
|
+
status String @default("pending")
|
|
453
|
+
error String?
|
|
454
|
+
createdBy String
|
|
455
|
+
createdAt DateTime @default(now())
|
|
456
|
+
completedAt DateTime?
|
|
457
|
+
|
|
458
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
459
|
+
|
|
460
|
+
@@index([nodeId, status])
|
|
461
|
+
@@map("file_patch_tasks")
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
// ─── Skills ───
|
|
465
|
+
|
|
466
|
+
model SkillRegistryEntry {
|
|
467
|
+
id String @id @default(cuid())
|
|
468
|
+
slug String @unique
|
|
469
|
+
displayName String
|
|
470
|
+
description String @default("")
|
|
471
|
+
author String @default("")
|
|
472
|
+
source String @default("local")
|
|
473
|
+
sourceUrl String?
|
|
474
|
+
entryPoint String @default("run.sh")
|
|
475
|
+
dependencies String @default("[]")
|
|
476
|
+
metadata String @default("{}")
|
|
477
|
+
latestVersion String?
|
|
478
|
+
status String @default("active")
|
|
479
|
+
createdAt DateTime @default(now())
|
|
480
|
+
updatedAt DateTime @updatedAt
|
|
481
|
+
|
|
482
|
+
versions SkillVersion[]
|
|
483
|
+
tags SkillTag[]
|
|
484
|
+
installations SkillInstallation[]
|
|
485
|
+
|
|
486
|
+
@@index([status])
|
|
487
|
+
@@index([source])
|
|
488
|
+
@@map("skill_registry_entries")
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
model SkillVersion {
|
|
492
|
+
id String @id @default(cuid())
|
|
493
|
+
skillId String
|
|
494
|
+
version String
|
|
495
|
+
changelog String @default("")
|
|
496
|
+
contentHash String
|
|
497
|
+
files String @default("[]")
|
|
498
|
+
entryPoint String @default("run.sh")
|
|
499
|
+
sizeBytes Int @default(0)
|
|
500
|
+
publishedBy String @default("system")
|
|
501
|
+
createdAt DateTime @default(now())
|
|
502
|
+
|
|
503
|
+
skill SkillRegistryEntry @relation(fields: [skillId], references: [id], onDelete: Cascade)
|
|
504
|
+
|
|
505
|
+
@@unique([skillId, version])
|
|
506
|
+
@@index([skillId, createdAt])
|
|
507
|
+
@@map("skill_versions")
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
model SkillTag {
|
|
511
|
+
id String @id @default(cuid())
|
|
512
|
+
skillId String
|
|
513
|
+
tag String
|
|
514
|
+
versionId String
|
|
515
|
+
createdAt DateTime @default(now())
|
|
516
|
+
updatedAt DateTime @updatedAt
|
|
517
|
+
|
|
518
|
+
skill SkillRegistryEntry @relation(fields: [skillId], references: [id], onDelete: Cascade)
|
|
519
|
+
|
|
520
|
+
@@unique([skillId, tag])
|
|
521
|
+
@@map("skill_tags")
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
model SkillInstallation {
|
|
525
|
+
id String @id @default(cuid())
|
|
526
|
+
skillName String
|
|
527
|
+
nodeId String
|
|
528
|
+
version String
|
|
529
|
+
status String @default("available")
|
|
530
|
+
registryEntryId String?
|
|
531
|
+
versionHash String?
|
|
532
|
+
bundleSha256 String?
|
|
533
|
+
treeSha256 String?
|
|
534
|
+
workflowCommandId String? @unique
|
|
535
|
+
workflowRequestSha256 String?
|
|
536
|
+
workflowReceiptSha256 String? @unique
|
|
537
|
+
installedAt DateTime?
|
|
538
|
+
error String?
|
|
539
|
+
|
|
540
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
541
|
+
registryEntry SkillRegistryEntry? @relation(fields: [registryEntryId], references: [id], onDelete: SetNull)
|
|
542
|
+
|
|
543
|
+
@@unique([skillName, nodeId])
|
|
544
|
+
@@index([registryEntryId])
|
|
545
|
+
@@map("skill_installations")
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// ─── Rollout / Execution Runs ───
|
|
549
|
+
|
|
550
|
+
model ExecutionRun {
|
|
551
|
+
id String @id @default(cuid())
|
|
552
|
+
type String
|
|
553
|
+
rolloutStrategy String @default("all_at_once")
|
|
554
|
+
status String @default("created")
|
|
555
|
+
totalNodes Int @default(0)
|
|
556
|
+
completedNodes Int @default(0)
|
|
557
|
+
failedNodes Int @default(0)
|
|
558
|
+
metadata String @default("{}")
|
|
559
|
+
createdBy String
|
|
560
|
+
createdAt DateTime @default(now())
|
|
561
|
+
startedAt DateTime?
|
|
562
|
+
completedAt DateTime?
|
|
563
|
+
|
|
564
|
+
targets RolloutTarget[]
|
|
565
|
+
|
|
566
|
+
@@index([status])
|
|
567
|
+
@@map("execution_runs")
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
model RolloutTarget {
|
|
571
|
+
id String @id @default(cuid())
|
|
572
|
+
rolloutId String
|
|
573
|
+
nodeId String
|
|
574
|
+
status String @default("pending")
|
|
575
|
+
error String?
|
|
576
|
+
startedAt DateTime?
|
|
577
|
+
completedAt DateTime?
|
|
578
|
+
|
|
579
|
+
commandId String? @unique
|
|
580
|
+
evidence String @default("{}")
|
|
581
|
+
|
|
582
|
+
rollout ExecutionRun @relation(fields: [rolloutId], references: [id], onDelete: Cascade)
|
|
583
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
584
|
+
|
|
585
|
+
@@unique([rolloutId, nodeId])
|
|
586
|
+
@@map("rollout_targets")
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// ─── Library ───
|
|
590
|
+
|
|
591
|
+
model LibraryCategory {
|
|
592
|
+
id String @id @default(cuid())
|
|
593
|
+
name String @unique
|
|
594
|
+
description String @default("")
|
|
595
|
+
color String @default("#6366f1")
|
|
596
|
+
sortOrder Int @default(0)
|
|
597
|
+
createdAt DateTime @default(now())
|
|
598
|
+
updatedAt DateTime @updatedAt
|
|
599
|
+
|
|
600
|
+
files LibraryFile[]
|
|
601
|
+
|
|
602
|
+
@@map("library_categories")
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
model LibraryFile {
|
|
606
|
+
id String @id @default(cuid())
|
|
607
|
+
name String
|
|
608
|
+
fileName String
|
|
609
|
+
mimeType String @default("text/markdown")
|
|
610
|
+
content String @default("")
|
|
611
|
+
sizeBytes Int @default(0)
|
|
612
|
+
categoryId String?
|
|
613
|
+
tags String @default("[]")
|
|
614
|
+
createdBy String
|
|
615
|
+
createdAt DateTime @default(now())
|
|
616
|
+
updatedAt DateTime @updatedAt
|
|
617
|
+
|
|
618
|
+
category LibraryCategory? @relation(fields: [categoryId], references: [id], onDelete: SetNull)
|
|
619
|
+
|
|
620
|
+
@@index([categoryId])
|
|
621
|
+
@@index([name])
|
|
622
|
+
@@map("library_files")
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// ─── Roles ───
|
|
626
|
+
|
|
627
|
+
model Role {
|
|
628
|
+
id String @id @default(cuid())
|
|
629
|
+
name String @unique
|
|
630
|
+
description String @default("")
|
|
631
|
+
libraryFileIds String @default("[]")
|
|
632
|
+
skillNames String @default("[]")
|
|
633
|
+
aptPackages String @default("[]")
|
|
634
|
+
npmPackages String @default("[]")
|
|
635
|
+
envConfig String @default("{}")
|
|
636
|
+
dockerEnabled Boolean @default(false)
|
|
637
|
+
dockerNonRoot Boolean @default(false)
|
|
638
|
+
dockerImage String?
|
|
639
|
+
dockerVolumes String @default("[]")
|
|
640
|
+
firewallEnabled Boolean @default(false)
|
|
641
|
+
firewallMode String @default("restrictive")
|
|
642
|
+
firewallAllowRules String @default("[]")
|
|
643
|
+
status String @default("active")
|
|
644
|
+
createdAt DateTime @default(now())
|
|
645
|
+
updatedAt DateTime @updatedAt
|
|
646
|
+
|
|
647
|
+
nodes Node[]
|
|
648
|
+
applications RoleApplication[]
|
|
649
|
+
|
|
650
|
+
@@map("roles")
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
model RoleApplication {
|
|
654
|
+
id String @id @default(cuid())
|
|
655
|
+
nodeId String
|
|
656
|
+
roleId String
|
|
657
|
+
action String
|
|
658
|
+
status String @default("pending")
|
|
659
|
+
steps String @default("[]")
|
|
660
|
+
error String?
|
|
661
|
+
startedAt DateTime?
|
|
662
|
+
completedAt DateTime?
|
|
663
|
+
createdAt DateTime @default(now())
|
|
664
|
+
|
|
665
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
666
|
+
role Role @relation(fields: [roleId], references: [id], onDelete: Cascade)
|
|
667
|
+
|
|
668
|
+
@@index([nodeId])
|
|
669
|
+
@@index([roleId])
|
|
670
|
+
@@index([status])
|
|
671
|
+
@@map("role_applications")
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
// ─── Notifications ───
|
|
675
|
+
|
|
676
|
+
model Notification {
|
|
677
|
+
id String @id @default(cuid())
|
|
678
|
+
type String // node.offline | node.degraded | node.recovered | command.failed | deploy.failed | upgrade.failed
|
|
679
|
+
severity String @default("warning") // info | warning | critical
|
|
680
|
+
title String
|
|
681
|
+
message String
|
|
682
|
+
nodeId String?
|
|
683
|
+
nodeName String?
|
|
684
|
+
sourceRef String? // e.g. commandId, deployId
|
|
685
|
+
metadata String @default("{}") // JSON blob for extra context
|
|
686
|
+
isRead Boolean @default(false)
|
|
687
|
+
readAt DateTime?
|
|
688
|
+
createdAt DateTime @default(now())
|
|
689
|
+
|
|
690
|
+
node Node? @relation(fields: [nodeId], references: [id], onDelete: SetNull)
|
|
691
|
+
|
|
692
|
+
@@index([isRead, createdAt])
|
|
693
|
+
@@index([nodeId, createdAt])
|
|
694
|
+
@@index([type, createdAt])
|
|
695
|
+
@@index([type, nodeId, sourceRef, createdAt])
|
|
696
|
+
@@map("notifications")
|
|
697
|
+
suppressedBy String?
|
|
698
|
+
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
// ─── Notification Preferences ───
|
|
702
|
+
|
|
703
|
+
model NotificationPreference {
|
|
704
|
+
id String @id @default(cuid())
|
|
705
|
+
userId String
|
|
706
|
+
channel String @default("in_app") // in_app | email | webhook
|
|
707
|
+
category String // node.offline | node.degraded | command.failed | deploy.* | ai.* | etc.
|
|
708
|
+
enabled Boolean @default(true)
|
|
709
|
+
minSeverity String @default("info") // info | warning | critical
|
|
710
|
+
createdAt DateTime @default(now())
|
|
711
|
+
updatedAt DateTime @updatedAt
|
|
712
|
+
|
|
713
|
+
@@unique([userId, channel, category])
|
|
714
|
+
@@index([userId])
|
|
715
|
+
@@map("notification_preferences")
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
// ─── Webhook Endpoints ───
|
|
719
|
+
|
|
720
|
+
model WebhookEndpoint {
|
|
721
|
+
id String @id @default(cuid())
|
|
722
|
+
name String
|
|
723
|
+
url String
|
|
724
|
+
type String @default("generic") // generic | slack | discord
|
|
725
|
+
secret String? // AES-256-GCM envelope containing the HMAC signing secret
|
|
726
|
+
events String @default("[]") // JSON array of event patterns
|
|
727
|
+
headers String // AES-256-GCM envelope containing JSON extra headers
|
|
728
|
+
active Boolean @default(true)
|
|
729
|
+
retries Int @default(3)
|
|
730
|
+
timeoutMs Int @default(10000)
|
|
731
|
+
createdBy String?
|
|
732
|
+
createdAt DateTime @default(now())
|
|
733
|
+
updatedAt DateTime @updatedAt
|
|
734
|
+
|
|
735
|
+
deliveries WebhookDelivery[]
|
|
736
|
+
|
|
737
|
+
@@index([active])
|
|
738
|
+
@@map("webhook_endpoints")
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
model WebhookDelivery {
|
|
742
|
+
id String @id @default(cuid())
|
|
743
|
+
endpointId String
|
|
744
|
+
event String
|
|
745
|
+
payload String // JSON
|
|
746
|
+
status String @default("pending") // pending | success | failed
|
|
747
|
+
httpStatus Int?
|
|
748
|
+
response String? // Response body (truncated)
|
|
749
|
+
error String?
|
|
750
|
+
attempts Int @default(0)
|
|
751
|
+
deliveredAt DateTime?
|
|
752
|
+
createdAt DateTime @default(now())
|
|
753
|
+
|
|
754
|
+
endpoint WebhookEndpoint @relation(fields: [endpointId], references: [id], onDelete: Cascade)
|
|
755
|
+
|
|
756
|
+
@@index([endpointId, createdAt])
|
|
757
|
+
@@index([status])
|
|
758
|
+
@@map("webhook_deliveries")
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
// ─── Health Alert Rules ───
|
|
762
|
+
|
|
763
|
+
model AlertRule {
|
|
764
|
+
id String @id @default(cuid())
|
|
765
|
+
name String
|
|
766
|
+
metric String // cpu | memory | disk | swap
|
|
767
|
+
operator String // gt | lt | gte | lte | eq
|
|
768
|
+
threshold Float
|
|
769
|
+
durationSeconds Int @default(0) // Must exceed for N seconds (0 = instant)
|
|
770
|
+
severity String @default("warning") // info | warning | critical
|
|
771
|
+
nodeFilter String @default("*") // "*" = all, or comma-separated node IDs/tags
|
|
772
|
+
active Boolean @default(true)
|
|
773
|
+
cooldownMinutes Int @default(15) // Don't re-fire for N minutes
|
|
774
|
+
createdBy String?
|
|
775
|
+
createdAt DateTime @default(now())
|
|
776
|
+
updatedAt DateTime @updatedAt
|
|
777
|
+
|
|
778
|
+
violations AlertViolation[]
|
|
779
|
+
conditionStates AlertConditionState[]
|
|
780
|
+
|
|
781
|
+
@@index([active])
|
|
782
|
+
@@index([metric])
|
|
783
|
+
@@map("alert_rules")
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
model AlertConditionState {
|
|
787
|
+
ruleId String
|
|
788
|
+
nodeId String
|
|
789
|
+
breachedAt DateTime
|
|
790
|
+
lastObservedAt DateTime
|
|
791
|
+
lastValue Float
|
|
792
|
+
|
|
793
|
+
rule AlertRule @relation(fields: [ruleId], references: [id], onDelete: Cascade)
|
|
794
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
795
|
+
|
|
796
|
+
@@id([ruleId, nodeId])
|
|
797
|
+
@@index([nodeId])
|
|
798
|
+
@@map("alert_condition_states")
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
model AlertViolation {
|
|
802
|
+
id String @id @default(cuid())
|
|
803
|
+
ruleId String
|
|
804
|
+
nodeId String
|
|
805
|
+
nodeName String?
|
|
806
|
+
metric String
|
|
807
|
+
value Float
|
|
808
|
+
threshold Float
|
|
809
|
+
severity String
|
|
810
|
+
status String @default("active") // active | resolved
|
|
811
|
+
resolvedAt DateTime?
|
|
812
|
+
createdAt DateTime @default(now())
|
|
813
|
+
|
|
814
|
+
rule AlertRule @relation(fields: [ruleId], references: [id], onDelete: Cascade)
|
|
815
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
816
|
+
|
|
817
|
+
@@index([ruleId, status])
|
|
818
|
+
@@index([nodeId, status])
|
|
819
|
+
@@index([status, createdAt])
|
|
820
|
+
@@map("alert_violations")
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
// ─── Batch Deploy Jobs ───
|
|
824
|
+
|
|
825
|
+
model DeployJob {
|
|
826
|
+
id String @id @default(cuid())
|
|
827
|
+
type String // 'deploy' | 'upgrade'
|
|
828
|
+
status String @default("running") // running | completed | partial_failure
|
|
829
|
+
concurrency Int @default(5)
|
|
830
|
+
targets String // JSON array of target configs
|
|
831
|
+
results String? // JSON array of per-target results
|
|
832
|
+
startedAt DateTime @default(now())
|
|
833
|
+
completedAt DateTime?
|
|
834
|
+
createdBy String
|
|
835
|
+
|
|
836
|
+
@@index([status])
|
|
837
|
+
@@index([createdBy])
|
|
838
|
+
@@map("deploy_jobs")
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
// ─── Drift Scans ───
|
|
842
|
+
|
|
843
|
+
model DriftScan {
|
|
844
|
+
id String @id @default(cuid())
|
|
845
|
+
nodeId String
|
|
846
|
+
roleId String?
|
|
847
|
+
status String // 'clean' | 'drifted' | 'error'
|
|
848
|
+
findings String // JSON array of drift items
|
|
849
|
+
scannedAt DateTime @default(now())
|
|
850
|
+
|
|
851
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
852
|
+
|
|
853
|
+
@@index([nodeId])
|
|
854
|
+
@@index([status])
|
|
855
|
+
@@map("drift_scans")
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
// ─── Anomaly Detection ───
|
|
859
|
+
|
|
860
|
+
model AnomalyEvent {
|
|
861
|
+
id String @id @default(cuid())
|
|
862
|
+
nodeId String
|
|
863
|
+
healthSnapshotId String?
|
|
864
|
+
metric String // 'cpu' | 'memory' | 'disk' | 'swap' | 'network_rx' | 'network_tx'
|
|
865
|
+
value Float
|
|
866
|
+
zScore Float
|
|
867
|
+
mean Float
|
|
868
|
+
stdDev Float
|
|
869
|
+
severity String @default("warning") // info | warning | critical (resource-pressure policy)
|
|
870
|
+
resolved Boolean @default(false)
|
|
871
|
+
resolvedAt DateTime?
|
|
872
|
+
firstSeenAt DateTime @default(now())
|
|
873
|
+
lastSeenAt DateTime @default(now())
|
|
874
|
+
occurrenceCount Int @default(1)
|
|
875
|
+
createdAt DateTime @default(now())
|
|
876
|
+
|
|
877
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
878
|
+
healthSnapshot HealthSnapshot? @relation(fields: [healthSnapshotId], references: [id], onDelete: Restrict)
|
|
879
|
+
|
|
880
|
+
@@index([nodeId, createdAt])
|
|
881
|
+
@@index([resolved, createdAt])
|
|
882
|
+
@@index([metric, createdAt])
|
|
883
|
+
@@index([nodeId, metric, resolved])
|
|
884
|
+
@@index([healthSnapshotId])
|
|
885
|
+
@@map("anomaly_events")
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
// ─── AI Fleet Assistant ───
|
|
889
|
+
|
|
890
|
+
model AiConversation {
|
|
891
|
+
id String @id @default(cuid())
|
|
892
|
+
title String @default("New conversation")
|
|
893
|
+
type String @default("chat") // 'chat' | 'heartbeat' | 'analysis'
|
|
894
|
+
nodeId String? // If analysis is node-specific
|
|
895
|
+
parentId String?
|
|
896
|
+
forkedFromMessageId String?
|
|
897
|
+
status String @default("active") // 'active' | 'archived'
|
|
898
|
+
summary String? // Auto-generated summary for context window management
|
|
899
|
+
createdBy String @default("system")
|
|
900
|
+
createdAt DateTime @default(now())
|
|
901
|
+
updatedAt DateTime @updatedAt
|
|
902
|
+
|
|
903
|
+
parent AiConversation? @relation("AiConversationForks", fields: [parentId], references: [id], onDelete: SetNull)
|
|
904
|
+
children AiConversation[] @relation("AiConversationForks")
|
|
905
|
+
messages AiMessage[]
|
|
906
|
+
|
|
907
|
+
@@index([type, createdAt])
|
|
908
|
+
@@index([status, createdAt])
|
|
909
|
+
@@index([nodeId])
|
|
910
|
+
@@index([parentId, updatedAt])
|
|
911
|
+
@@index([forkedFromMessageId])
|
|
912
|
+
@@map("ai_conversations")
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
model AiMessage {
|
|
916
|
+
id String @id @default(cuid())
|
|
917
|
+
conversationId String
|
|
918
|
+
role String // 'system' | 'user' | 'assistant' | 'tool'
|
|
919
|
+
content String
|
|
920
|
+
toolCalls String @default("[]") // JSON array of tool call results
|
|
921
|
+
thinking String?
|
|
922
|
+
structuredAnalysis String?
|
|
923
|
+
tokenCount Int @default(0)
|
|
924
|
+
isRead Boolean @default(false)
|
|
925
|
+
readAt DateTime?
|
|
926
|
+
pendingApproval String? // JSON: tool call awaiting human approval
|
|
927
|
+
createdAt DateTime @default(now())
|
|
928
|
+
|
|
929
|
+
conversation AiConversation @relation(fields: [conversationId], references: [id], onDelete: Cascade)
|
|
930
|
+
|
|
931
|
+
@@index([conversationId, createdAt])
|
|
932
|
+
@@index([role, isRead])
|
|
933
|
+
@@map("ai_messages")
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
// ─── AI Memory ───
|
|
937
|
+
|
|
938
|
+
model AiMemory {
|
|
939
|
+
id String @id @default(cuid())
|
|
940
|
+
key String @unique // Deduplication key (e.g. 'node:web-01:disk_pattern')
|
|
941
|
+
category String @default("general") // 'general' | 'node' | 'pattern' | 'preference'
|
|
942
|
+
content String // The memory content
|
|
943
|
+
source String @default("heartbeat") // Where it came from
|
|
944
|
+
relevance Float @default(1.0) // Decay over time
|
|
945
|
+
accessedAt DateTime? // Last time this memory was accessed/injected
|
|
946
|
+
createdAt DateTime @default(now())
|
|
947
|
+
updatedAt DateTime @updatedAt
|
|
948
|
+
|
|
949
|
+
@@index([category])
|
|
950
|
+
@@index([relevance])
|
|
951
|
+
@@map("ai_memories")
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
// Legacy persisted dashboard rows retained to avoid a destructive data migration.
|
|
955
|
+
// No runtime route or dashboard page uses this model.
|
|
956
|
+
|
|
957
|
+
model AiDashboard {
|
|
958
|
+
id String @id @default(cuid())
|
|
959
|
+
name String
|
|
960
|
+
description String?
|
|
961
|
+
layout String @default("[]") // JSON array of WidgetSpec objects
|
|
962
|
+
createdBy String @default("system")
|
|
963
|
+
isDefault Boolean @default(false)
|
|
964
|
+
createdAt DateTime @default(now())
|
|
965
|
+
updatedAt DateTime @updatedAt
|
|
966
|
+
|
|
967
|
+
@@index([createdBy])
|
|
968
|
+
@@map("ai_dashboards")
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
// ─── A2A (Agent-to-Agent) Tasks ───
|
|
972
|
+
|
|
973
|
+
model A2ATask {
|
|
974
|
+
id String @id @default(cuid())
|
|
975
|
+
title String @default("")
|
|
976
|
+
description String @default("")
|
|
977
|
+
status String @default("submitted") // submitted | working | input-required | completed | failed | canceled
|
|
978
|
+
fromAgent String @default("user") // Requesting agent/user
|
|
979
|
+
toAgent String @default("magnus") // Target agent
|
|
980
|
+
input String @default("{}") // JSON input payload
|
|
981
|
+
output String? // JSON output / result
|
|
982
|
+
artifacts String @default("[]") // JSON array of artifact references
|
|
983
|
+
history String @default("[]") // JSON array of status change log
|
|
984
|
+
metadata String @default("{}") // JSON extra context
|
|
985
|
+
createdAt DateTime @default(now())
|
|
986
|
+
updatedAt DateTime @updatedAt
|
|
987
|
+
|
|
988
|
+
@@index([status])
|
|
989
|
+
@@index([fromAgent])
|
|
990
|
+
@@index([toAgent])
|
|
991
|
+
@@map("a2a_tasks")
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
// ─── Auto-Remediation ───
|
|
995
|
+
|
|
996
|
+
model RemediationRule {
|
|
997
|
+
id String @id @default(cuid())
|
|
998
|
+
name String @unique
|
|
999
|
+
description String @default("")
|
|
1000
|
+
metric String @default("*") // cpu | memory | disk | swap | *
|
|
1001
|
+
severityThreshold String @default("critical") // warning | critical
|
|
1002
|
+
agentDefinitionId String // Versioned runbook; legacy values remain record-only
|
|
1003
|
+
input String @default("") // Reviewed runbook configuration JSON
|
|
1004
|
+
cooldownMinutes Int @default(60)
|
|
1005
|
+
maxConcurrentRuns Int @default(1)
|
|
1006
|
+
nodeFilter String? // Optional node ID or pattern filter
|
|
1007
|
+
enabled Boolean @default(true)
|
|
1008
|
+
createdBy String @default("system")
|
|
1009
|
+
createdAt DateTime @default(now())
|
|
1010
|
+
updatedAt DateTime @updatedAt
|
|
1011
|
+
|
|
1012
|
+
executions RemediationExecution[]
|
|
1013
|
+
|
|
1014
|
+
@@index([enabled, metric])
|
|
1015
|
+
@@map("remediation_rules")
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
model RemediationExecution {
|
|
1019
|
+
id String @id @default(cuid())
|
|
1020
|
+
ruleId String
|
|
1021
|
+
anomalyEventId String
|
|
1022
|
+
nodeId String
|
|
1023
|
+
orchestraRunId String? // Orchestra run ID (set after trigger)
|
|
1024
|
+
status String @default("triggered") // pending_approval | approving | running | completed | failed | skipped; legacy triggered
|
|
1025
|
+
input String @default("") // Immutable approval plan JSON
|
|
1026
|
+
output String? // Result/error message
|
|
1027
|
+
triggeredAt DateTime @default(now())
|
|
1028
|
+
completedAt DateTime?
|
|
1029
|
+
|
|
1030
|
+
rule RemediationRule @relation(fields: [ruleId], references: [id], onDelete: Cascade)
|
|
1031
|
+
|
|
1032
|
+
@@index([ruleId, triggeredAt])
|
|
1033
|
+
@@index([nodeId, triggeredAt])
|
|
1034
|
+
@@index([status])
|
|
1035
|
+
@@map("remediation_executions")
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
// ── Scheduled AI Operations ──
|
|
1039
|
+
|
|
1040
|
+
model AiScheduledOp {
|
|
1041
|
+
id String @id @default(cuid())
|
|
1042
|
+
name String
|
|
1043
|
+
description String @default("")
|
|
1044
|
+
cronExpr String // Cron expression (e.g. "0 */6 * * *")
|
|
1045
|
+
enabled Boolean @default(true)
|
|
1046
|
+
type String @default("chat") // chat | analysis | runbook
|
|
1047
|
+
prompt String // AI prompt to execute
|
|
1048
|
+
nodeId String? // Scope to specific node
|
|
1049
|
+
createdBy String
|
|
1050
|
+
lastRunAt DateTime?
|
|
1051
|
+
nextRunAt DateTime?
|
|
1052
|
+
runCount Int @default(0)
|
|
1053
|
+
lastResult String? // Last execution result (truncated)
|
|
1054
|
+
lastError String?
|
|
1055
|
+
createdAt DateTime @default(now())
|
|
1056
|
+
updatedAt DateTime @updatedAt
|
|
1057
|
+
|
|
1058
|
+
@@index([enabled, nextRunAt])
|
|
1059
|
+
@@map("ai_scheduled_ops")
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
1063
|
+
// Hermes Agent — fleet-managed resources (HERMESAGENT_PLAN.md §3)
|
|
1064
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
1065
|
+
|
|
1066
|
+
/// Per-installation skill pin — which skill bundles should be present on which
|
|
1067
|
+
/// installation/profile. Reconciled by magnus-agent via `hermes skills install`.
|
|
1068
|
+
model HermesSkillAssignment {
|
|
1069
|
+
id String @id @default(cuid())
|
|
1070
|
+
installationId String
|
|
1071
|
+
profileId String @default("")
|
|
1072
|
+
skillSlug String
|
|
1073
|
+
pinnedVersion String?
|
|
1074
|
+
source String @default("magnus-skills") // magnus-skills | upload | agentskills.io
|
|
1075
|
+
enabled Boolean @default(true)
|
|
1076
|
+
lastSyncedAt DateTime?
|
|
1077
|
+
status String @default("pending") // pending | applied | drifted | error
|
|
1078
|
+
error String?
|
|
1079
|
+
metadata String @default("{}")
|
|
1080
|
+
createdBy String
|
|
1081
|
+
createdAt DateTime @default(now())
|
|
1082
|
+
updatedAt DateTime @updatedAt
|
|
1083
|
+
|
|
1084
|
+
@@unique([installationId, profileId, skillSlug])
|
|
1085
|
+
@@index([installationId])
|
|
1086
|
+
@@index([profileId])
|
|
1087
|
+
@@index([status])
|
|
1088
|
+
@@map("hermes_skill_assignments")
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
/// Per-profile toolset policy — which Hermes toolsets are enabled and per-tool
|
|
1092
|
+
/// approval/hook configuration.
|
|
1093
|
+
model HermesToolsetPolicy {
|
|
1094
|
+
id String @id @default(cuid())
|
|
1095
|
+
installationId String
|
|
1096
|
+
profileId String @default("")
|
|
1097
|
+
toolset String // web_search | terminal | file_edit | delegation | browser | image_gen | ...
|
|
1098
|
+
enabled Boolean @default(true)
|
|
1099
|
+
approvalMode String @default("auto") // auto | confirm | block
|
|
1100
|
+
perToolHooks String @default("[]") // JSON array of {tool,event,target,...}
|
|
1101
|
+
allowList String @default("[]")
|
|
1102
|
+
denyList String @default("[]")
|
|
1103
|
+
lastSyncedAt DateTime?
|
|
1104
|
+
status String @default("pending")
|
|
1105
|
+
metadata String @default("{}")
|
|
1106
|
+
createdBy String
|
|
1107
|
+
createdAt DateTime @default(now())
|
|
1108
|
+
updatedAt DateTime @updatedAt
|
|
1109
|
+
|
|
1110
|
+
@@unique([installationId, profileId, toolset])
|
|
1111
|
+
@@index([installationId])
|
|
1112
|
+
@@index([profileId])
|
|
1113
|
+
@@map("hermes_toolset_policies")
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
/// Composite role bundle — SOUL.md personality + toolset selection + skill set
|
|
1117
|
+
/// + provider preference + cron + messaging. Reusable; applied per-profile.
|
|
1118
|
+
model HermesRole {
|
|
1119
|
+
id String @id @default(cuid())
|
|
1120
|
+
name String @unique
|
|
1121
|
+
description String @default("")
|
|
1122
|
+
personalityMd String @default("") // embedded SOUL.md content
|
|
1123
|
+
personalityRef String? // optional reference to a standalone personality (future)
|
|
1124
|
+
toolsetsJson String @default("[]")
|
|
1125
|
+
skillsJson String @default("[]")
|
|
1126
|
+
providerJson String @default("{}")
|
|
1127
|
+
cronJson String @default("[]")
|
|
1128
|
+
messagingJson String @default("[]")
|
|
1129
|
+
metadata String @default("{}")
|
|
1130
|
+
createdBy String
|
|
1131
|
+
createdAt DateTime @default(now())
|
|
1132
|
+
updatedAt DateTime @updatedAt
|
|
1133
|
+
|
|
1134
|
+
applications HermesRoleApplication[]
|
|
1135
|
+
|
|
1136
|
+
@@map("hermes_roles")
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
/// Tracks where a HermesRole has been applied (installation+profile pairs).
|
|
1140
|
+
model HermesRoleApplication {
|
|
1141
|
+
id String @id @default(cuid())
|
|
1142
|
+
roleId String
|
|
1143
|
+
installationId String
|
|
1144
|
+
profileId String @default("")
|
|
1145
|
+
status String @default("pending")
|
|
1146
|
+
appliedAt DateTime?
|
|
1147
|
+
error String?
|
|
1148
|
+
createdBy String
|
|
1149
|
+
createdAt DateTime @default(now())
|
|
1150
|
+
updatedAt DateTime @updatedAt
|
|
1151
|
+
|
|
1152
|
+
role HermesRole @relation(fields: [roleId], references: [id], onDelete: Cascade)
|
|
1153
|
+
|
|
1154
|
+
@@unique([roleId, installationId, profileId])
|
|
1155
|
+
@@index([installationId])
|
|
1156
|
+
@@index([profileId])
|
|
1157
|
+
@@map("hermes_role_applications")
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
/// Per-profile provider routing configuration (chain order, sort, white/blacklists).
|
|
1161
|
+
model HermesProviderConfig {
|
|
1162
|
+
id String @id @default(cuid())
|
|
1163
|
+
installationId String
|
|
1164
|
+
profileId String @default("")
|
|
1165
|
+
chainJson String @default("[]") // ordered provider list
|
|
1166
|
+
sortStrategy String @default("priority") // priority | cost | speed | quality
|
|
1167
|
+
whitelistJson String @default("[]")
|
|
1168
|
+
blacklistJson String @default("[]")
|
|
1169
|
+
visionOverride String?
|
|
1170
|
+
compressionOverride String?
|
|
1171
|
+
lastSyncedAt DateTime?
|
|
1172
|
+
status String @default("pending")
|
|
1173
|
+
metadata String @default("{}")
|
|
1174
|
+
createdBy String
|
|
1175
|
+
createdAt DateTime @default(now())
|
|
1176
|
+
updatedAt DateTime @updatedAt
|
|
1177
|
+
|
|
1178
|
+
@@unique([installationId, profileId])
|
|
1179
|
+
@@index([installationId])
|
|
1180
|
+
@@map("hermes_provider_configs")
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
/// Credential pool — multiple API keys per provider with rotation.
|
|
1184
|
+
model HermesCredentialPool {
|
|
1185
|
+
id String @id @default(cuid())
|
|
1186
|
+
name String @unique
|
|
1187
|
+
provider String // openrouter | anthropic | openai | google | magnus-router | ...
|
|
1188
|
+
rotationPolicy String @default("rate-limit") // rate-limit | round-robin | failure
|
|
1189
|
+
secretRefsJson String @default("[]") // references to IAM secret-store entries
|
|
1190
|
+
metadata String @default("{}")
|
|
1191
|
+
createdBy String
|
|
1192
|
+
createdAt DateTime @default(now())
|
|
1193
|
+
updatedAt DateTime @updatedAt
|
|
1194
|
+
|
|
1195
|
+
attachments HermesCredentialPoolAttachment[]
|
|
1196
|
+
|
|
1197
|
+
@@map("hermes_credential_pools")
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
model HermesCredentialPoolAttachment {
|
|
1201
|
+
id String @id @default(cuid())
|
|
1202
|
+
poolId String
|
|
1203
|
+
installationId String
|
|
1204
|
+
profileId String @default("")
|
|
1205
|
+
status String @default("pending")
|
|
1206
|
+
lastSyncedAt DateTime?
|
|
1207
|
+
createdBy String
|
|
1208
|
+
createdAt DateTime @default(now())
|
|
1209
|
+
updatedAt DateTime @updatedAt
|
|
1210
|
+
|
|
1211
|
+
pool HermesCredentialPool @relation(fields: [poolId], references: [id], onDelete: Cascade)
|
|
1212
|
+
|
|
1213
|
+
@@unique([poolId, installationId, profileId])
|
|
1214
|
+
@@index([installationId])
|
|
1215
|
+
@@map("hermes_credential_pool_attachments")
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
/// MCP server registry — per-installation attachments are tracked separately.
|
|
1219
|
+
model HermesMcpServer {
|
|
1220
|
+
id String @id @default(cuid())
|
|
1221
|
+
name String @unique
|
|
1222
|
+
transport String // stdio | http | sse
|
|
1223
|
+
endpoint String @default("") // path or URL depending on transport
|
|
1224
|
+
argsJson String @default("[]")
|
|
1225
|
+
envJson String @default("{}")
|
|
1226
|
+
toolFilterJson String @default("[]")
|
|
1227
|
+
samplingEnabled Boolean @default(false)
|
|
1228
|
+
metadata String @default("{}")
|
|
1229
|
+
createdBy String
|
|
1230
|
+
createdAt DateTime @default(now())
|
|
1231
|
+
updatedAt DateTime @updatedAt
|
|
1232
|
+
|
|
1233
|
+
attachments HermesMcpServerAttachment[]
|
|
1234
|
+
|
|
1235
|
+
@@map("hermes_mcp_servers")
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
model HermesMcpServerAttachment {
|
|
1239
|
+
id String @id @default(cuid())
|
|
1240
|
+
serverId String
|
|
1241
|
+
installationId String
|
|
1242
|
+
profileId String @default("")
|
|
1243
|
+
status String @default("pending")
|
|
1244
|
+
lastSyncedAt DateTime?
|
|
1245
|
+
createdBy String
|
|
1246
|
+
createdAt DateTime @default(now())
|
|
1247
|
+
updatedAt DateTime @updatedAt
|
|
1248
|
+
|
|
1249
|
+
server HermesMcpServer @relation(fields: [serverId], references: [id], onDelete: Cascade)
|
|
1250
|
+
|
|
1251
|
+
@@unique([serverId, installationId, profileId])
|
|
1252
|
+
@@index([installationId])
|
|
1253
|
+
@@map("hermes_mcp_server_attachments")
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
/// Messaging-platform binding (Discord/Slack/etc.) for a Hermes installation+profile.
|
|
1257
|
+
model HermesMessagingBinding {
|
|
1258
|
+
id String @id @default(cuid())
|
|
1259
|
+
installationId String
|
|
1260
|
+
profileId String @default("")
|
|
1261
|
+
platform String // discord | slack | telegram | ...
|
|
1262
|
+
channelIdsJson String @default("[]")
|
|
1263
|
+
voiceEnabled Boolean @default(false)
|
|
1264
|
+
voiceModel String?
|
|
1265
|
+
ttsProvider String?
|
|
1266
|
+
secretRef String? // pointer to IAM secret store
|
|
1267
|
+
metadata String @default("{}")
|
|
1268
|
+
status String @default("pending")
|
|
1269
|
+
lastSyncedAt DateTime?
|
|
1270
|
+
createdBy String
|
|
1271
|
+
createdAt DateTime @default(now())
|
|
1272
|
+
updatedAt DateTime @updatedAt
|
|
1273
|
+
|
|
1274
|
+
@@unique([installationId, profileId, platform])
|
|
1275
|
+
@@index([installationId])
|
|
1276
|
+
@@map("hermes_messaging_bindings")
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
/// Hermes scheduled task (distinct from fleet-wide CronJob).
|
|
1280
|
+
model HermesCronJob {
|
|
1281
|
+
id String @id @default(cuid())
|
|
1282
|
+
installationId String
|
|
1283
|
+
profileId String @default("")
|
|
1284
|
+
name String
|
|
1285
|
+
prompt String @default("")
|
|
1286
|
+
cronExpr String @default("")
|
|
1287
|
+
naturalLanguage String?
|
|
1288
|
+
attachedSkillsJson String @default("[]")
|
|
1289
|
+
deliveryJson String @default("{}") // {channel:'messaging|file|webhook', target:'...'}
|
|
1290
|
+
enabled Boolean @default(true)
|
|
1291
|
+
status String @default("pending")
|
|
1292
|
+
lastRunAt DateTime?
|
|
1293
|
+
metadata String @default("{}")
|
|
1294
|
+
createdBy String
|
|
1295
|
+
createdAt DateTime @default(now())
|
|
1296
|
+
updatedAt DateTime @updatedAt
|
|
1297
|
+
|
|
1298
|
+
@@unique([installationId, profileId, name])
|
|
1299
|
+
@@index([installationId])
|
|
1300
|
+
@@map("hermes_cron_jobs")
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
/// Per-installation Hermes plugin install records.
|
|
1304
|
+
model HermesPluginInstall {
|
|
1305
|
+
id String @id @default(cuid())
|
|
1306
|
+
installationId String
|
|
1307
|
+
profileId String @default("")
|
|
1308
|
+
pluginSlug String
|
|
1309
|
+
pluginType String @default("general") // general | memory-provider | context-engine
|
|
1310
|
+
pinnedVersion String?
|
|
1311
|
+
status String @default("pending")
|
|
1312
|
+
healthState String @default("unknown") // unknown | healthy | degraded | error
|
|
1313
|
+
lastSyncedAt DateTime?
|
|
1314
|
+
metadata String @default("{}")
|
|
1315
|
+
createdBy String
|
|
1316
|
+
createdAt DateTime @default(now())
|
|
1317
|
+
updatedAt DateTime @updatedAt
|
|
1318
|
+
|
|
1319
|
+
@@unique([installationId, profileId, pluginSlug])
|
|
1320
|
+
@@index([installationId])
|
|
1321
|
+
@@index([pluginType])
|
|
1322
|
+
@@map("hermes_plugin_installs")
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
/// A node's registry authority is independent of the shared heartbeat secret.
|
|
1326
|
+
/// The bearer itself is never stored; only its SHA-256 digest is retained.
|
|
1327
|
+
model HermesRegistryClient {
|
|
1328
|
+
id String @id @default(cuid())
|
|
1329
|
+
nodeId String
|
|
1330
|
+
installationId String
|
|
1331
|
+
tokenSha256 String @unique
|
|
1332
|
+
canPull Boolean @default(false)
|
|
1333
|
+
canSubmit Boolean @default(false)
|
|
1334
|
+
enabled Boolean @default(true)
|
|
1335
|
+
createdAt DateTime @default(now())
|
|
1336
|
+
revokedAt DateTime?
|
|
1337
|
+
|
|
1338
|
+
@@unique([nodeId, installationId])
|
|
1339
|
+
@@index([installationId])
|
|
1340
|
+
@@map("hermes_registry_clients")
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
/// Complete immutable bytes and provenance for a skill, plugin, or MCP release.
|
|
1344
|
+
model HermesRegistryRevision {
|
|
1345
|
+
id String @id @default(cuid())
|
|
1346
|
+
kind String
|
|
1347
|
+
slug String
|
|
1348
|
+
revision Int
|
|
1349
|
+
sha256 String
|
|
1350
|
+
artifactJson String
|
|
1351
|
+
metadataJson String @default("{}")
|
|
1352
|
+
status String @default("published")
|
|
1353
|
+
sourceHost String?
|
|
1354
|
+
publishedBy String
|
|
1355
|
+
createdAt DateTime @default(now())
|
|
1356
|
+
|
|
1357
|
+
@@unique([kind, slug, revision])
|
|
1358
|
+
@@index([kind, slug, status])
|
|
1359
|
+
@@map("hermes_registry_revisions")
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
/// A desired revision applies to one installation/profile; a null pin follows latest.
|
|
1363
|
+
model HermesRegistryTarget {
|
|
1364
|
+
id String @id @default(cuid())
|
|
1365
|
+
kind String
|
|
1366
|
+
slug String
|
|
1367
|
+
installationId String
|
|
1368
|
+
profileId String @default("")
|
|
1369
|
+
pinnedRevision Int?
|
|
1370
|
+
enabled Boolean @default(true)
|
|
1371
|
+
status String @default("pending")
|
|
1372
|
+
observedRevision Int?
|
|
1373
|
+
lastReceiptAt DateTime?
|
|
1374
|
+
error String?
|
|
1375
|
+
createdAt DateTime @default(now())
|
|
1376
|
+
updatedAt DateTime @updatedAt
|
|
1377
|
+
|
|
1378
|
+
@@unique([kind, slug, installationId, profileId])
|
|
1379
|
+
@@index([installationId, enabled])
|
|
1380
|
+
@@map("hermes_registry_targets")
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
model HermesRegistryReceipt {
|
|
1384
|
+
id String @id @default(cuid())
|
|
1385
|
+
nodeId String
|
|
1386
|
+
installationId String
|
|
1387
|
+
profileId String @default("")
|
|
1388
|
+
kind String
|
|
1389
|
+
slug String
|
|
1390
|
+
revision Int
|
|
1391
|
+
sha256 String
|
|
1392
|
+
status String
|
|
1393
|
+
detailsJson String @default("{}")
|
|
1394
|
+
createdAt DateTime @default(now())
|
|
1395
|
+
|
|
1396
|
+
@@index([installationId, kind, slug, createdAt])
|
|
1397
|
+
@@map("hermes_registry_receipts")
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
model HermesRegistryInventory {
|
|
1401
|
+
id String @id @default(cuid())
|
|
1402
|
+
installationId String
|
|
1403
|
+
profileId String @default("")
|
|
1404
|
+
kind String
|
|
1405
|
+
slug String
|
|
1406
|
+
pluginType String?
|
|
1407
|
+
sourceKind String @default("unknown")
|
|
1408
|
+
sourceUrl String?
|
|
1409
|
+
commit String?
|
|
1410
|
+
version String?
|
|
1411
|
+
status String @default("observed")
|
|
1412
|
+
observedAt DateTime @default(now())
|
|
1413
|
+
|
|
1414
|
+
@@unique([installationId, profileId, kind, slug])
|
|
1415
|
+
@@index([sourceKind, status])
|
|
1416
|
+
@@map("hermes_registry_inventory")
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
model HermesCoreRollout {
|
|
1420
|
+
id String @id
|
|
1421
|
+
tag String
|
|
1422
|
+
bootstrapScriptSha256 String
|
|
1423
|
+
status String @default("active")
|
|
1424
|
+
createdAt DateTime @default(now())
|
|
1425
|
+
updatedAt DateTime @updatedAt
|
|
1426
|
+
hosts HermesCoreRolloutHost[]
|
|
1427
|
+
|
|
1428
|
+
@@index([status, createdAt])
|
|
1429
|
+
@@map("hermes_core_rollouts")
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
model HermesCoreRolloutHost {
|
|
1433
|
+
id String @id @default(cuid())
|
|
1434
|
+
rolloutId String
|
|
1435
|
+
hostname String
|
|
1436
|
+
installationId String
|
|
1437
|
+
stage Int
|
|
1438
|
+
status String @default("pending")
|
|
1439
|
+
leaseExpiresAt DateTime?
|
|
1440
|
+
evidenceJson String @default("{}")
|
|
1441
|
+
updatedAt DateTime @updatedAt
|
|
1442
|
+
|
|
1443
|
+
rollout HermesCoreRollout @relation(fields: [rolloutId], references: [id], onDelete: Cascade)
|
|
1444
|
+
|
|
1445
|
+
@@unique([rolloutId, hostname])
|
|
1446
|
+
@@index([rolloutId, stage, status])
|
|
1447
|
+
@@map("hermes_core_rollout_hosts")
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
/// Global Hermes hook configuration (per-tool hooks live in HermesToolsetPolicy).
|
|
1451
|
+
model HermesHook {
|
|
1452
|
+
id String @id @default(cuid())
|
|
1453
|
+
installationId String
|
|
1454
|
+
profileId String @default("")
|
|
1455
|
+
event String // pre_gateway | post_gateway | metric | webhook | ...
|
|
1456
|
+
target String // url | logger | webhook-id
|
|
1457
|
+
configJson String @default("{}")
|
|
1458
|
+
enabled Boolean @default(true)
|
|
1459
|
+
status String @default("pending")
|
|
1460
|
+
lastSyncedAt DateTime?
|
|
1461
|
+
metadata String @default("{}")
|
|
1462
|
+
createdBy String
|
|
1463
|
+
createdAt DateTime @default(now())
|
|
1464
|
+
updatedAt DateTime @updatedAt
|
|
1465
|
+
|
|
1466
|
+
@@index([installationId])
|
|
1467
|
+
@@index([event])
|
|
1468
|
+
@@map("hermes_hooks")
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
// ─── Security Fusion ───
|
|
1472
|
+
|
|
1473
|
+
model SecurityFusionEvent {
|
|
1474
|
+
id String @id @default(cuid())
|
|
1475
|
+
eventId String @unique
|
|
1476
|
+
source String
|
|
1477
|
+
sourceEventId String
|
|
1478
|
+
kind String
|
|
1479
|
+
observedAt DateTime
|
|
1480
|
+
ingestedAt DateTime @default(now())
|
|
1481
|
+
severity String
|
|
1482
|
+
confidence Float
|
|
1483
|
+
summary String
|
|
1484
|
+
attributesJson String @default("{}")
|
|
1485
|
+
integritySha256 String
|
|
1486
|
+
collectorId String
|
|
1487
|
+
|
|
1488
|
+
@@unique([source, sourceEventId])
|
|
1489
|
+
@@index([observedAt])
|
|
1490
|
+
@@index([source, observedAt])
|
|
1491
|
+
@@index([kind, observedAt])
|
|
1492
|
+
@@index([severity, observedAt])
|
|
1493
|
+
@@map("security_fusion_events")
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
model SecurityFusionEntity {
|
|
1497
|
+
id String @id @default(cuid())
|
|
1498
|
+
type String
|
|
1499
|
+
canonical String
|
|
1500
|
+
label String
|
|
1501
|
+
aliasesJson String @default("[]")
|
|
1502
|
+
firstSeenAt DateTime
|
|
1503
|
+
lastSeenAt DateTime
|
|
1504
|
+
createdAt DateTime @default(now())
|
|
1505
|
+
updatedAt DateTime @updatedAt
|
|
1506
|
+
|
|
1507
|
+
@@unique([type, canonical])
|
|
1508
|
+
@@index([lastSeenAt])
|
|
1509
|
+
@@map("security_fusion_entities")
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
model SecurityFusionEventEntity {
|
|
1513
|
+
id String @id @default(cuid())
|
|
1514
|
+
eventId String
|
|
1515
|
+
entityId String
|
|
1516
|
+
|
|
1517
|
+
@@unique([eventId, entityId])
|
|
1518
|
+
@@index([entityId])
|
|
1519
|
+
@@map("security_fusion_event_entities")
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
model SecurityFusionEntityAlias {
|
|
1523
|
+
id String @id @default(cuid())
|
|
1524
|
+
entityId String
|
|
1525
|
+
source String
|
|
1526
|
+
value String
|
|
1527
|
+
canonical String
|
|
1528
|
+
firstSeenAt DateTime @default(now())
|
|
1529
|
+
lastSeenAt DateTime @default(now())
|
|
1530
|
+
|
|
1531
|
+
@@unique([source, canonical])
|
|
1532
|
+
@@index([entityId])
|
|
1533
|
+
@@map("security_fusion_entity_aliases")
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
model SecurityFusionCase {
|
|
1537
|
+
id String @id @default(cuid())
|
|
1538
|
+
fingerprint String @unique
|
|
1539
|
+
title String
|
|
1540
|
+
status String @default("new")
|
|
1541
|
+
severity String
|
|
1542
|
+
confidence Float
|
|
1543
|
+
summary String
|
|
1544
|
+
recommendedInvestigationJson String @default("[]")
|
|
1545
|
+
evidenceStepsJson String @default("[]")
|
|
1546
|
+
assignedTo String?
|
|
1547
|
+
firstSeenAt DateTime
|
|
1548
|
+
lastSeenAt DateTime
|
|
1549
|
+
resolvedAt DateTime?
|
|
1550
|
+
archivedAt DateTime?
|
|
1551
|
+
evidenceAcceptedCount Int @default(0)
|
|
1552
|
+
evidenceTruncatedCount Int @default(0)
|
|
1553
|
+
createdAt DateTime @default(now())
|
|
1554
|
+
updatedAt DateTime @updatedAt
|
|
1555
|
+
|
|
1556
|
+
@@index([status, severity, lastSeenAt])
|
|
1557
|
+
@@index([archivedAt, lastSeenAt])
|
|
1558
|
+
@@map("security_fusion_cases")
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
model SecurityFusionCaseEvent {
|
|
1562
|
+
id String @id @default(cuid())
|
|
1563
|
+
caseId String
|
|
1564
|
+
eventId String
|
|
1565
|
+
ruleId String @default("builtin-security-fusion")
|
|
1566
|
+
confidenceContribution Float @default(0)
|
|
1567
|
+
|
|
1568
|
+
@@unique([caseId, eventId])
|
|
1569
|
+
@@index([eventId])
|
|
1570
|
+
@@map("security_fusion_case_events")
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
model SecurityFusionCaseEntity {
|
|
1574
|
+
id String @id @default(cuid())
|
|
1575
|
+
caseId String
|
|
1576
|
+
entityId String
|
|
1577
|
+
|
|
1578
|
+
@@unique([caseId, entityId])
|
|
1579
|
+
@@index([entityId])
|
|
1580
|
+
@@map("security_fusion_case_entities")
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
model SecurityFusionCaseRelationship {
|
|
1584
|
+
id String @id @default(cuid())
|
|
1585
|
+
fromCaseId String
|
|
1586
|
+
toCaseId String
|
|
1587
|
+
kind String
|
|
1588
|
+
confidence Float
|
|
1589
|
+
rationaleJson String @default("{}")
|
|
1590
|
+
createdAt DateTime @default(now())
|
|
1591
|
+
|
|
1592
|
+
@@unique([fromCaseId, toCaseId, kind])
|
|
1593
|
+
@@index([toCaseId])
|
|
1594
|
+
@@map("security_fusion_case_relationships")
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
model SecurityFusionRuleVersion {
|
|
1598
|
+
id String @id @default(cuid())
|
|
1599
|
+
ruleId String
|
|
1600
|
+
version Int
|
|
1601
|
+
enabled Boolean @default(true)
|
|
1602
|
+
definitionJson String
|
|
1603
|
+
sha256 String
|
|
1604
|
+
createdAt DateTime @default(now())
|
|
1605
|
+
|
|
1606
|
+
@@unique([ruleId, version])
|
|
1607
|
+
@@index([enabled])
|
|
1608
|
+
@@map("security_fusion_rule_versions")
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
model SecurityFusionCaseActivity {
|
|
1612
|
+
id String @id @default(cuid())
|
|
1613
|
+
caseId String
|
|
1614
|
+
kind String
|
|
1615
|
+
actorId String
|
|
1616
|
+
detailJson String @default("{}")
|
|
1617
|
+
createdAt DateTime @default(now())
|
|
1618
|
+
|
|
1619
|
+
@@index([caseId, createdAt])
|
|
1620
|
+
@@map("security_fusion_case_activity")
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
model SecurityFusionEvidence {
|
|
1624
|
+
id String @id @default(cuid())
|
|
1625
|
+
caseId String
|
|
1626
|
+
eventId String?
|
|
1627
|
+
sourceLocator String
|
|
1628
|
+
mediaType String
|
|
1629
|
+
sha256 String
|
|
1630
|
+
storagePath String
|
|
1631
|
+
preservedBy String
|
|
1632
|
+
preservedAt DateTime @default(now())
|
|
1633
|
+
expiresAt DateTime
|
|
1634
|
+
byteSize Int @default(0)
|
|
1635
|
+
integrityStatus String @default("verified")
|
|
1636
|
+
quarantinedAt DateTime?
|
|
1637
|
+
quarantineReason String?
|
|
1638
|
+
|
|
1639
|
+
@@index([caseId, preservedAt])
|
|
1640
|
+
@@index([sha256])
|
|
1641
|
+
@@map("security_fusion_evidence")
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
model SecurityFusionSourceState {
|
|
1645
|
+
id String @id
|
|
1646
|
+
source String @unique
|
|
1647
|
+
status String @default("unknown")
|
|
1648
|
+
checkpoint String?
|
|
1649
|
+
lastEventAt DateTime?
|
|
1650
|
+
lastSuccessAt DateTime?
|
|
1651
|
+
lastErrorAt DateTime?
|
|
1652
|
+
lastError String?
|
|
1653
|
+
rejectedCount Int @default(0)
|
|
1654
|
+
truncatedCount Int @default(0)
|
|
1655
|
+
updatedAt DateTime @updatedAt
|
|
1656
|
+
|
|
1657
|
+
@@map("security_fusion_source_state")
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
model SecurityFusionDeletionReceipt {
|
|
1661
|
+
id String @id @default(cuid())
|
|
1662
|
+
resourceType String
|
|
1663
|
+
resourceIdHash String
|
|
1664
|
+
reason String
|
|
1665
|
+
outcome String
|
|
1666
|
+
bytesDeleted Int @default(0)
|
|
1667
|
+
detailJson String @default("{}")
|
|
1668
|
+
receiptSha256 String @unique
|
|
1669
|
+
previousReceiptSha256 String?
|
|
1670
|
+
chainSequence Int
|
|
1671
|
+
chainVersion Int @default(2)
|
|
1672
|
+
deletedAt DateTime @default(now())
|
|
1673
|
+
|
|
1674
|
+
@@unique([chainSequence])
|
|
1675
|
+
@@index([resourceType, deletedAt])
|
|
1676
|
+
@@index([deletedAt])
|
|
1677
|
+
@@map("security_fusion_deletion_receipts")
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
model SecurityFusionReceiptChainHead {
|
|
1681
|
+
id String @id
|
|
1682
|
+
headSha256 String?
|
|
1683
|
+
chainSequence Int @default(0)
|
|
1684
|
+
updatedAt DateTime @updatedAt
|
|
1685
|
+
|
|
1686
|
+
@@map("security_fusion_receipt_chain_heads")
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
model SecurityFusionCollector {
|
|
1690
|
+
id String @id
|
|
1691
|
+
displayName String
|
|
1692
|
+
credentialFingerprint String
|
|
1693
|
+
allowedSourcesJson String @default("[]")
|
|
1694
|
+
schemaVersion String @default("1.0")
|
|
1695
|
+
dataClassification String @default("restricted")
|
|
1696
|
+
status String @default("active")
|
|
1697
|
+
lastReceiptAt DateTime?
|
|
1698
|
+
lastSuccessAt DateTime?
|
|
1699
|
+
lastErrorAt DateTime?
|
|
1700
|
+
lastError String?
|
|
1701
|
+
revokedAt DateTime?
|
|
1702
|
+
createdAt DateTime @default(now())
|
|
1703
|
+
updatedAt DateTime @updatedAt
|
|
1704
|
+
|
|
1705
|
+
@@index([status, lastReceiptAt])
|
|
1706
|
+
@@map("security_fusion_collectors")
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
model SecurityFusionNonce {
|
|
1710
|
+
nonce String @id
|
|
1711
|
+
collectorId String
|
|
1712
|
+
expiresAt DateTime
|
|
1713
|
+
createdAt DateTime @default(now())
|
|
1714
|
+
|
|
1715
|
+
@@index([expiresAt])
|
|
1716
|
+
@@map("security_fusion_nonces")
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
model SecurityFusionInvestigation {
|
|
1720
|
+
id String @id @default(cuid())
|
|
1721
|
+
caseId String
|
|
1722
|
+
revision Int
|
|
1723
|
+
authorId String
|
|
1724
|
+
draftJson String
|
|
1725
|
+
createdAt DateTime @default(now())
|
|
1726
|
+
|
|
1727
|
+
@@unique([caseId, revision])
|
|
1728
|
+
@@index([caseId, createdAt])
|
|
1729
|
+
@@map("security_fusion_investigations")
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
model SecurityFusionAction {
|
|
1733
|
+
id String @id @default(cuid())
|
|
1734
|
+
caseId String
|
|
1735
|
+
nodeId String
|
|
1736
|
+
kind String
|
|
1737
|
+
serviceName String?
|
|
1738
|
+
isolationMinutes Int?
|
|
1739
|
+
rationale String
|
|
1740
|
+
rollbackPlan String
|
|
1741
|
+
previewJson String
|
|
1742
|
+
previewSha256 String
|
|
1743
|
+
status String @default("previewed")
|
|
1744
|
+
requestedBy String
|
|
1745
|
+
approvedBy String?
|
|
1746
|
+
approvalTokenHash String?
|
|
1747
|
+
approvalExpiresAt DateTime?
|
|
1748
|
+
executedAt DateTime?
|
|
1749
|
+
verificationDeadline DateTime?
|
|
1750
|
+
resultJson String?
|
|
1751
|
+
createdAt DateTime @default(now())
|
|
1752
|
+
updatedAt DateTime @updatedAt
|
|
1753
|
+
|
|
1754
|
+
@@index([caseId, createdAt])
|
|
1755
|
+
@@index([status, approvalExpiresAt])
|
|
1756
|
+
@@map("security_fusion_actions")
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
model SecurityFusionActionApproval {
|
|
1760
|
+
id String @id @default(cuid())
|
|
1761
|
+
actionId String @unique
|
|
1762
|
+
previewSha256 String
|
|
1763
|
+
tokenHash String
|
|
1764
|
+
status String @default("pending")
|
|
1765
|
+
requestedBy String
|
|
1766
|
+
decidedBy String?
|
|
1767
|
+
expiresAt DateTime
|
|
1768
|
+
decidedAt DateTime?
|
|
1769
|
+
createdAt DateTime @default(now())
|
|
1770
|
+
|
|
1771
|
+
@@index([expiresAt])
|
|
1772
|
+
@@map("security_fusion_action_approvals")
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
model SecurityFusionCommandOutbox {
|
|
1776
|
+
id String @id @default(cuid())
|
|
1777
|
+
actionId String
|
|
1778
|
+
operation String
|
|
1779
|
+
actorId String
|
|
1780
|
+
status String @default("pending")
|
|
1781
|
+
remoteCommandId String?
|
|
1782
|
+
attempts Int @default(0)
|
|
1783
|
+
nextAttemptAt DateTime @default(now())
|
|
1784
|
+
leaseExpiresAt DateTime?
|
|
1785
|
+
lastError String?
|
|
1786
|
+
createdAt DateTime @default(now())
|
|
1787
|
+
updatedAt DateTime @updatedAt
|
|
1788
|
+
dispatchedAt DateTime?
|
|
1789
|
+
|
|
1790
|
+
@@unique([actionId, operation])
|
|
1791
|
+
@@unique([remoteCommandId])
|
|
1792
|
+
@@index([status, nextAttemptAt])
|
|
1793
|
+
@@map("security_fusion_command_outbox")
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
model SecurityFusionDelivery {
|
|
1797
|
+
id String @id @default(cuid())
|
|
1798
|
+
caseId String
|
|
1799
|
+
revisionKey String @unique
|
|
1800
|
+
channel String
|
|
1801
|
+
status String
|
|
1802
|
+
externalId String?
|
|
1803
|
+
error String?
|
|
1804
|
+
createdAt DateTime @default(now())
|
|
1805
|
+
updatedAt DateTime @updatedAt
|
|
1806
|
+
|
|
1807
|
+
@@index([caseId, createdAt])
|
|
1808
|
+
@@map("security_fusion_deliveries")
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
// Read-only probes configured by the operator; credentials remain in server env.
|
|
1812
|
+
model ApplicationObservation {
|
|
1813
|
+
id String @id
|
|
1814
|
+
projectId String
|
|
1815
|
+
serviceId String
|
|
1816
|
+
nodeId String
|
|
1817
|
+
status String @default("unknown")
|
|
1818
|
+
resultJson String @default("{}")
|
|
1819
|
+
observedAt DateTime?
|
|
1820
|
+
@@index([nodeId])
|
|
1821
|
+
@@map("application_observations")
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
// Append-only samples emitted by Control API-owned collectors. Callers never
|
|
1825
|
+
// submit these rows through the engineering assessment API.
|
|
1826
|
+
model EngineeringMetricSample {
|
|
1827
|
+
id String @id @default(cuid())
|
|
1828
|
+
applicationId String
|
|
1829
|
+
nodeId String
|
|
1830
|
+
metric String
|
|
1831
|
+
sourceKey String
|
|
1832
|
+
unit String
|
|
1833
|
+
value Float
|
|
1834
|
+
observedAt DateTime
|
|
1835
|
+
probeContractSha256 String
|
|
1836
|
+
method String
|
|
1837
|
+
path String
|
|
1838
|
+
httpStatus Int
|
|
1839
|
+
evidenceSha256 String
|
|
1840
|
+
createdAt DateTime @default(now())
|
|
1841
|
+
|
|
1842
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
1843
|
+
|
|
1844
|
+
@@unique([applicationId, metric, sourceKey, observedAt])
|
|
1845
|
+
@@index([applicationId, metric, observedAt])
|
|
1846
|
+
@@index([nodeId, metric, observedAt])
|
|
1847
|
+
@@map("engineering_metric_samples")
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1850
|
+
// Control API-owned results from disposable recovery exercises. The collector
|
|
1851
|
+
// computes all digests; public engineering routes are read-only.
|
|
1852
|
+
model EngineeringRecoveryExercise {
|
|
1853
|
+
id String @id
|
|
1854
|
+
targetId String
|
|
1855
|
+
scenario String
|
|
1856
|
+
startedAt DateTime
|
|
1857
|
+
recoveredAt DateTime
|
|
1858
|
+
recoveryPointAt DateTime
|
|
1859
|
+
rtoObjectiveSeconds Int
|
|
1860
|
+
rpoObjectiveSeconds Int
|
|
1861
|
+
beforeStateSha256 String
|
|
1862
|
+
beforeTaskSha256 String
|
|
1863
|
+
beforeArtifactSha256 String
|
|
1864
|
+
afterStateSha256 String
|
|
1865
|
+
afterTaskSha256 String
|
|
1866
|
+
afterArtifactSha256 String
|
|
1867
|
+
beforeEvidenceJson String
|
|
1868
|
+
afterEvidenceJson String
|
|
1869
|
+
runtimeEvidenceJson String
|
|
1870
|
+
directEvidenceSha256 String
|
|
1871
|
+
runnerIssuer String
|
|
1872
|
+
runnerKeyId String
|
|
1873
|
+
runnerPublicKeySha256 String
|
|
1874
|
+
runnerNonce String @unique
|
|
1875
|
+
runnerIssuedAt DateTime
|
|
1876
|
+
runnerExpiresAt DateTime
|
|
1877
|
+
runnerExerciseContractSha256 String
|
|
1878
|
+
runnerReceiptJson String
|
|
1879
|
+
runnerReceiptSha256 String @unique
|
|
1880
|
+
inventorySnapshotSha256 String
|
|
1881
|
+
recordSha256 String
|
|
1882
|
+
createdAt DateTime @default(now())
|
|
1883
|
+
|
|
1884
|
+
@@index([targetId, createdAt])
|
|
1885
|
+
@@index([scenario, createdAt])
|
|
1886
|
+
@@map("engineering_recovery_exercises")
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
model MaintenanceWindow {
|
|
1890
|
+
id String @id @default(cuid())
|
|
1891
|
+
reason String
|
|
1892
|
+
nodeIds String
|
|
1893
|
+
serviceIds String @default("[]")
|
|
1894
|
+
actorId String
|
|
1895
|
+
startsAt DateTime
|
|
1896
|
+
endsAt DateTime
|
|
1897
|
+
cancelledAt DateTime?
|
|
1898
|
+
createdAt DateTime @default(now())
|
|
1899
|
+
@@index([startsAt, endsAt])
|
|
1900
|
+
@@map("maintenance_windows")
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
model IncidentLesson {
|
|
1904
|
+
id String @id @default(cuid())
|
|
1905
|
+
incidentId String
|
|
1906
|
+
nodeId String?
|
|
1907
|
+
symptom String
|
|
1908
|
+
cause String
|
|
1909
|
+
runbookVersion String
|
|
1910
|
+
evidenceIds String
|
|
1911
|
+
reviewedBy String
|
|
1912
|
+
expiresAt DateTime
|
|
1913
|
+
supersededAt DateTime?
|
|
1914
|
+
memoryId String?
|
|
1915
|
+
createdAt DateTime @default(now())
|
|
1916
|
+
@@index([incidentId, expiresAt])
|
|
1917
|
+
@@map("incident_lessons")
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
// Durable outbound security observations. Retained on Magnus after extraction.
|
|
1921
|
+
model SecurityExportOutbox {
|
|
1922
|
+
id String @id
|
|
1923
|
+
payload String
|
|
1924
|
+
createdAt DateTime @default(now())
|
|
1925
|
+
deliveredAt DateTime?
|
|
1926
|
+
attempts Int @default(0)
|
|
1927
|
+
nextAttemptAt DateTime @default(now())
|
|
1928
|
+
lastError String?
|
|
1929
|
+
@@index([deliveredAt, nextAttemptAt])
|
|
1930
|
+
@@map("security_export_outbox")
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1933
|
+
// Durable last observed service state; transition and outbox commit together.
|
|
1934
|
+
model SecurityServiceState {
|
|
1935
|
+
nodeId String
|
|
1936
|
+
serviceName String
|
|
1937
|
+
status String
|
|
1938
|
+
observationId String
|
|
1939
|
+
observedAt DateTime
|
|
1940
|
+
@@id([nodeId, serviceName])
|
|
1941
|
+
@@map("security_service_states")
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
/// Immutable native-Telegram decisions, committed with provider admission state.
|
|
1945
|
+
model TeamApprovalDecision {
|
|
1946
|
+
decisionId String @id
|
|
1947
|
+
proposalId String @unique
|
|
1948
|
+
proposalRevision Int
|
|
1949
|
+
planSha256 String
|
|
1950
|
+
decision String
|
|
1951
|
+
assertionSha256 String
|
|
1952
|
+
actorBindingSha256 String
|
|
1953
|
+
executionId String? @unique
|
|
1954
|
+
decidedAt DateTime
|
|
1955
|
+
expiresAt DateTime
|
|
1956
|
+
createdAt DateTime @default(now())
|
|
1957
|
+
|
|
1958
|
+
@@map("team_approval_decisions")
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
/// Monotonic fencing generations allocated by the service; node admission owns execution.
|
|
1962
|
+
model CommandResourceFence {
|
|
1963
|
+
resourceKey String @id
|
|
1964
|
+
generation BigInt @default(0)
|
|
1965
|
+
@@map("command_resource_fences")
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
/// Durable finite-command ownership. Expiry never releases uncertain effects.
|
|
1969
|
+
model CommandResourceLease {
|
|
1970
|
+
id String @id
|
|
1971
|
+
nodeId String
|
|
1972
|
+
resourceKey String
|
|
1973
|
+
serviceUnit String?
|
|
1974
|
+
commandId String @unique
|
|
1975
|
+
ownerActor String
|
|
1976
|
+
requestSha256 String
|
|
1977
|
+
coordinationJson String
|
|
1978
|
+
completionClass String?
|
|
1979
|
+
completionRegistryVersion Int?
|
|
1980
|
+
completionRegistrySha256 String?
|
|
1981
|
+
completionDescriptorId String?
|
|
1982
|
+
completionOccurrenceId String?
|
|
1983
|
+
completionSpecSha256 String?
|
|
1984
|
+
state String @default("reserved")
|
|
1985
|
+
directCommand Boolean @default(false)
|
|
1986
|
+
deadline DateTime
|
|
1987
|
+
acquiredAt DateTime @default(now())
|
|
1988
|
+
dispatchedAt DateTime?
|
|
1989
|
+
settledAt DateTime?
|
|
1990
|
+
settlement String?
|
|
1991
|
+
evidenceSha256 String?
|
|
1992
|
+
@@index([nodeId, state])
|
|
1993
|
+
@@index([resourceKey, state])
|
|
1994
|
+
@@map("command_resource_leases")
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
/// Global monotonic generations for repository, provider and GPU ownership.
|
|
1998
|
+
model SharedResourceFence {
|
|
1999
|
+
resourceKey String @id
|
|
2000
|
+
generation BigInt @default(1)
|
|
2001
|
+
updatedAt DateTime @updatedAt
|
|
2002
|
+
@@map("shared_resource_fences")
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
/// Durable cross-host ownership. Deadlines and unknown outcomes never release a lease.
|
|
2006
|
+
model SharedResourceLease {
|
|
2007
|
+
id String @id
|
|
2008
|
+
missionRootId String
|
|
2009
|
+
missionRevision Int
|
|
2010
|
+
taskId String
|
|
2011
|
+
operationId String @unique
|
|
2012
|
+
requestSha256 String
|
|
2013
|
+
actionClass String
|
|
2014
|
+
ownerActor String
|
|
2015
|
+
callerKind String
|
|
2016
|
+
delegationId String?
|
|
2017
|
+
missionIssuer String
|
|
2018
|
+
missionKeyId String
|
|
2019
|
+
missionAssertionSha256 String
|
|
2020
|
+
missionAssertionJson String
|
|
2021
|
+
resourceSetBinding String
|
|
2022
|
+
state String @default("reserved")
|
|
2023
|
+
deadline DateTime
|
|
2024
|
+
acquiredAt DateTime @default(now())
|
|
2025
|
+
startedAt DateTime?
|
|
2026
|
+
settledAt DateTime?
|
|
2027
|
+
settlement String?
|
|
2028
|
+
evidenceSha256 String?
|
|
2029
|
+
settlementRecordSha256 String? @unique
|
|
2030
|
+
terminalEvidenceJson String?
|
|
2031
|
+
reconciliationDecisionId String? @unique
|
|
2032
|
+
reconciliationJson String?
|
|
2033
|
+
resources SharedResourceLeaseResource[]
|
|
2034
|
+
@@index([missionRootId, missionRevision])
|
|
2035
|
+
@@index([taskId, state])
|
|
2036
|
+
@@map("shared_resource_leases")
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
/// Exact resources and generations acquired atomically for one shared operation.
|
|
2040
|
+
model SharedResourceLeaseResource {
|
|
2041
|
+
leaseId String
|
|
2042
|
+
resourceKey String
|
|
2043
|
+
fenceGeneration BigInt
|
|
2044
|
+
state String @default("reserved")
|
|
2045
|
+
lease SharedResourceLease @relation(fields: [leaseId], references: [id], onDelete: Restrict)
|
|
2046
|
+
@@id([leaseId, resourceKey])
|
|
2047
|
+
@@unique([resourceKey, fenceGeneration])
|
|
2048
|
+
@@index([resourceKey, state])
|
|
2049
|
+
@@map("shared_resource_lease_resources")
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
/// One-way admission barrier. Epoch and every reservation share the node advisory lock.
|
|
2053
|
+
model ResourceEnrollment {
|
|
2054
|
+
nodeId String @id
|
|
2055
|
+
nodeFqdn String
|
|
2056
|
+
state String @default("legacy")
|
|
2057
|
+
epoch Int @default(0)
|
|
2058
|
+
barrierId String?
|
|
2059
|
+
startedBy String?
|
|
2060
|
+
startedAt DateTime?
|
|
2061
|
+
enrolledAt DateTime?
|
|
2062
|
+
updatedAt DateTime @updatedAt
|
|
2063
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Restrict)
|
|
2064
|
+
participants ResourceDrainParticipant[]
|
|
2065
|
+
@@map("resource_enrollments")
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
/// One-way Ardent-only admission while whole-node scheduler drain remains open.
|
|
2069
|
+
model ArdentScopeEnrollment {
|
|
2070
|
+
nodeId String @id
|
|
2071
|
+
nodeFqdn String
|
|
2072
|
+
epoch Int
|
|
2073
|
+
barrierId String
|
|
2074
|
+
decisionId String @unique
|
|
2075
|
+
assertionJson String
|
|
2076
|
+
evidenceSha256 String
|
|
2077
|
+
activatedAt DateTime @default(now())
|
|
2078
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Restrict)
|
|
2079
|
+
@@map("ardent_scope_enrollments")
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
/// Node admission plus a conservative Control API global shared-lease pause.
|
|
2083
|
+
/// External writers and OS schedules remain outside coverage.
|
|
2084
|
+
model AdmissionFence {
|
|
2085
|
+
nodeId String @id
|
|
2086
|
+
nodeFqdn String
|
|
2087
|
+
releaseId String
|
|
2088
|
+
closedAt DateTime @default(now())
|
|
2089
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Restrict)
|
|
2090
|
+
@@map("council_admission_fences")
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
model ResourceDrainParticipant {
|
|
2094
|
+
nodeId String
|
|
2095
|
+
participant String
|
|
2096
|
+
epoch Int
|
|
2097
|
+
barrierId String
|
|
2098
|
+
challengeId String
|
|
2099
|
+
challengeExpiresAt DateTime
|
|
2100
|
+
status String @default("pending")
|
|
2101
|
+
evidenceSha256 String?
|
|
2102
|
+
receiptJson String?
|
|
2103
|
+
verifiedAt DateTime?
|
|
2104
|
+
enrollment ResourceEnrollment @relation(fields: [nodeId], references: [nodeId], onDelete: Restrict)
|
|
2105
|
+
@@id([nodeId, participant])
|
|
2106
|
+
@@map("resource_drain_participants")
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
/// No TTL release: a lost process or SSH close cannot prove descendant termination.
|
|
2110
|
+
model ResourceParticipantWork {
|
|
2111
|
+
workId String @id
|
|
2112
|
+
nodeId String
|
|
2113
|
+
participant String
|
|
2114
|
+
ownerId String
|
|
2115
|
+
kind String
|
|
2116
|
+
epoch Int
|
|
2117
|
+
barrierId String?
|
|
2118
|
+
/// Reservation-time canonical inventory identity. Historical rows remain null.
|
|
2119
|
+
nodeFqdn String?
|
|
2120
|
+
/// Immutable digest of reservation identity and action kind, not arbitrary
|
|
2121
|
+
/// shell contents. Historical rows remain null and cannot use v1 reconciliation.
|
|
2122
|
+
requestSha256 String?
|
|
2123
|
+
/// Exact operation/request bytes digest for bounded work. External sessions
|
|
2124
|
+
/// bind their admission descriptor but remain ineligible for terminal release.
|
|
2125
|
+
operationSha256 String?
|
|
2126
|
+
/// Monotonic generation allocated for this participant/node namespace.
|
|
2127
|
+
fence BigInt?
|
|
2128
|
+
/// Last instant at which a supervised descendant may begin.
|
|
2129
|
+
deadline DateTime?
|
|
2130
|
+
state String @default("reserved")
|
|
2131
|
+
createdAt DateTime @default(now())
|
|
2132
|
+
startedAt DateTime?
|
|
2133
|
+
settledAt DateTime?
|
|
2134
|
+
settlement String?
|
|
2135
|
+
evidenceSha256 String?
|
|
2136
|
+
reconciliationDecisionId String? @unique
|
|
2137
|
+
reconciliationJson String?
|
|
2138
|
+
nodeSessionReceiptSha256 String? @unique
|
|
2139
|
+
nodeSessionReceiptJson String?
|
|
2140
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Restrict)
|
|
2141
|
+
@@index([nodeId, participant, state])
|
|
2142
|
+
@@map("resource_participant_work")
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
// Explicit opt-in finite cron authority. Historical CronJob rows remain legacy.
|
|
2146
|
+
model ManagedCronDefinition {
|
|
2147
|
+
cronJobId String @id
|
|
2148
|
+
nodeId String
|
|
2149
|
+
jobId String
|
|
2150
|
+
revision Int
|
|
2151
|
+
specSha256 String
|
|
2152
|
+
specJson String
|
|
2153
|
+
enabled Boolean @default(false)
|
|
2154
|
+
acknowledgementProtocolVersion Int?
|
|
2155
|
+
stageCommandSha256 String?
|
|
2156
|
+
stageReceiptSha256 String?
|
|
2157
|
+
stageAcknowledgedAt DateTime?
|
|
2158
|
+
activationCommandSha256 String?
|
|
2159
|
+
activationReceiptSha256 String?
|
|
2160
|
+
activationAcknowledgedAt DateTime?
|
|
2161
|
+
acknowledgedJobId String?
|
|
2162
|
+
acknowledgedRevision Int?
|
|
2163
|
+
acknowledgedSpecSha256 String?
|
|
2164
|
+
acknowledgedSpecJson String?
|
|
2165
|
+
expiresAt DateTime
|
|
2166
|
+
createdAt DateTime @default(now())
|
|
2167
|
+
@@unique([nodeId, jobId])
|
|
2168
|
+
@@map("managed_cron_definitions")
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
model ManagedCronOccurrence {
|
|
2172
|
+
id String @id
|
|
2173
|
+
cronJobId String
|
|
2174
|
+
nodeId String
|
|
2175
|
+
revision Int
|
|
2176
|
+
specSha256 String
|
|
2177
|
+
scheduledAt DateTime
|
|
2178
|
+
deadline DateTime
|
|
2179
|
+
commandId String @unique
|
|
2180
|
+
state String @default("admitting")
|
|
2181
|
+
admissionJson String?
|
|
2182
|
+
createdAt DateTime @default(now())
|
|
2183
|
+
@@index([nodeId, state])
|
|
2184
|
+
@@map("managed_cron_occurrences")
|
|
2185
|
+
}
|