feat(fleet): native Mosaic backlog on @mosaicstack/db (atomic claim + TTL)
Add Mosaic's own backlog-of-record on the existing Postgres storage layer, replacing the former Hermes adapter (no Hermes dependency) and the earlier sqlite idea (no sqlite, no new client). - packages/db: `backlog` table (drizzle) + enum + migration 0011; BacklogService taking a Db handle so it runs on both createDb (server PG) and createPgliteDb (embedded). Atomic claim via SELECT ... FOR UPDATE SKIP LOCKED inside one tx, TTL claims + reclaim of expired, deps DAG gate, idempotency-key dedup, stats. - packages/mosaic: `mosaic fleet backlog <sub> --json` (create/list/claim/ reclaim/link/stats/block/complete). Embedded PGlite default at <mosaicHome>/fleet/backlog; full Postgres via DATABASE_URL — same code. Migrations run on first use. - install.sh: preserve fleet/backlog across `mosaic update`. - docs/fleet/backlog-conventions.md: schema, phase convention, atomic-claim + TTL semantics, PGlite-default/Postgres-by-config, Mosaic-native (no Hermes). - Tests (in-memory PGlite, real PG semantics): create/list, exactly-one-winner concurrency (and N-card no-double-claim), deps gate, reclaim of expired, stats. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -30,10 +30,12 @@ INSTALL_MODE="${MOSAIC_INSTALL_MODE:-prompt}"
|
||||
# own fleet files MUST
|
||||
# survive `mosaic update` (which runs this sync automatically): the active
|
||||
# roster (`fleet/roster.yaml` + any other `fleet/*.yaml`), per-agent env
|
||||
# (`fleet/agents/`), and heartbeat run dir (`fleet/run/`). Without these, an
|
||||
# update wipes the operator's fleet. Glob entries are honored by both the rsync
|
||||
# path (`--exclude`) and the glob-aware cp fallback below.
|
||||
PRESERVE_PATHS=("CONSTITUTION.md" "AGENTS.md" "SOUL.md" "USER.md" "TOOLS.md" "STANDARDS.md" "memory" "sources" "credentials" "fleet/*.yaml" "fleet/agents" "fleet/run")
|
||||
# (`fleet/agents/`), heartbeat run dir (`fleet/run/`), and the Mosaic-native
|
||||
# backlog-of-record store (`fleet/backlog/` — embedded PGlite data dir; see
|
||||
# packages/mosaic/src/commands/fleet-backlog.ts). Without these, an update
|
||||
# wipes the operator's fleet AND their backlog. Glob entries are honored by
|
||||
# both the rsync path (`--exclude`) and the glob-aware cp fallback below.
|
||||
PRESERVE_PATHS=("CONSTITUTION.md" "AGENTS.md" "SOUL.md" "USER.md" "TOOLS.md" "STANDARDS.md" "memory" "sources" "credentials" "fleet/*.yaml" "fleet/agents" "fleet/run" "fleet/backlog")
|
||||
|
||||
# Framework-owned contract files: re-copied from defaults/ on every upgrade (the
|
||||
# user must not edit them; a divergent copy is backed up once before overwrite).
|
||||
|
||||
Reference in New Issue
Block a user