refactor(server): move the install audit trail from core to the server (P1.2, UF-040)
Core keeps only shared infrastructure, so InstallAuditStore leaves it and lives in packages/server/src/local/install-audit.ts. The trail itself stays: the Audit and Activity tabs, the extend and export routes, and the threat model entry keep working on the same waggle.db table. - @waggle/shared gets RecordAuditInput and the narrow InstallAuditRecorder (record only), which the agent's skill tools now depend on. - The server creates the audit table before the one-time legacy copy, which no longer constructs it in core. - UF-040: GET /api/debug/logs called prepare() on the store's private db wrapper, which has none, so the support bundle never carried recent installs. It now reads them through getRecentSummary().
This commit is contained in:
@@ -62,6 +62,26 @@ export type AuditCapabilityType = (typeof AUDIT_CAPABILITY_TYPES)[number];
|
||||
export const AUDIT_INITIATORS = ['agent', 'user', 'system'] as const;
|
||||
export type AuditInitiator = (typeof AUDIT_INITIATORS)[number];
|
||||
|
||||
/** One event for the install audit trail. */
|
||||
export interface RecordAuditInput {
|
||||
capabilityName: string;
|
||||
capabilityType: AuditCapabilityType;
|
||||
source: string;
|
||||
version?: string | null;
|
||||
riskLevel: RiskLevel;
|
||||
trustSource: TrustSource;
|
||||
approvalClass: ApprovalClass;
|
||||
action: AuditAction;
|
||||
initiator: AuditInitiator;
|
||||
detail?: string;
|
||||
}
|
||||
|
||||
/** Write side of the install audit trail. Producers such as the agent's skill
|
||||
* tools only record; the store that also reads the trail lives in the server. */
|
||||
export interface InstallAuditRecorder {
|
||||
record(input: RecordAuditInput): void;
|
||||
}
|
||||
|
||||
/** Ascending severity order — index = rank. Used to compare/sort risk levels so a
|
||||
* `critical` always outranks `low` (the team-governance bug was a `?? 0` that
|
||||
* sorted `critical` BELOW `low`). */
|
||||
|
||||
Reference in New Issue
Block a user