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:
@@ -15,7 +15,6 @@ import { AwarenessLayer } from './awareness.js';
|
||||
import { CronStore } from './cron-store.js';
|
||||
import { ExecutionTraceStore } from './execution-traces.js';
|
||||
import { IdentityLayer } from './identity.js';
|
||||
import { InstallAuditStore } from './install-audit.js';
|
||||
import { SkillHashStore } from './skill-hashes.js';
|
||||
import type { DataScope, WaggleDB } from './waggle-db.js';
|
||||
|
||||
@@ -121,13 +120,15 @@ function copyScopedTables(source: DatabaseType, target: DatabaseType, scope: Dat
|
||||
* Copies Waggle data from each legacy source into `waggleDb`, once per scope.
|
||||
* The personal source also brings the app-wide tables; workspace sources bring
|
||||
* their profile and awareness items.
|
||||
*
|
||||
* Tables owned outside core (install_audit, owned by the server) must be created
|
||||
* by their owner before this call; otherwise they take the legacy definition.
|
||||
*/
|
||||
export function importLegacyMindData(waggleDb: WaggleDB, sources: LegacyMindSource[]): LegacyImportReport[] {
|
||||
// Create every target table with its current schema first.
|
||||
// Create every core target table with its current schema first.
|
||||
new CronStore(waggleDb);
|
||||
new SkillHashStore(waggleDb);
|
||||
new ExecutionTraceStore(waggleDb);
|
||||
new InstallAuditStore(waggleDb);
|
||||
new IdentityLayer(waggleDb);
|
||||
new AwarenessLayer(waggleDb);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user