Track HiveGrid Cloud planning reference

This commit is contained in:
david committed 2026-06-26 20:48:01 +02:00
1 parent b3d5ea6764
commit e341c5938a
5784 files changed
+1104929 -3

No files matched your search

@@ -0,0 +1,30 @@
-- Phase 06 #23 — Per-capability-use audit table.
--
-- Every host-fn call inside a plugin invocation logs one row here so
-- tenant admins can answer "what did this plugin actually do?" — see
-- docs/improvement-plan/06-plugin-system/audit-docs.md.
--
-- Rows are batch-inserted from the outbox dispatcher via the worker
-- handler `plugin-capability-use.ts`; the capability-gateway never
-- writes here directly (keeps the plugin hot-path off the DB).
CREATE TABLE "PluginCapabilityUse" (
"id" TEXT NOT NULL,
"pluginInvocationId" TEXT NOT NULL,
"tenantId" TEXT NOT NULL,
"pluginId" TEXT NOT NULL,
"capability" TEXT NOT NULL,
"payloadHash" TEXT,
"outcome" TEXT NOT NULL,
"errorCode" TEXT,
"durationMs" INTEGER,
"timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "PluginCapabilityUse_pkey" PRIMARY KEY ("id")
);
CREATE INDEX "PluginCapabilityUse_tenantId_timestamp_idx"
ON "PluginCapabilityUse" ("tenantId", "timestamp" DESC);
CREATE INDEX "PluginCapabilityUse_tenantId_pluginId_timestamp_idx"
ON "PluginCapabilityUse" ("tenantId", "pluginId", "timestamp" DESC);
CREATE INDEX "PluginCapabilityUse_pluginInvocationId_idx"
ON "PluginCapabilityUse" ("pluginInvocationId");