refactor(server): move the team runtime into a postponed package (P1.1)

Team mode stays in the repository but is not built or shipped (ADR-0003).

- The team server (index.ts, config, db, daemons, plugins, proactive,
  routes, scheduler, services, ws, drizzle migrations) and its tests move
  from @waggle/server to packages/team-server (@waggle/team-server,
  private). It keeps its own copies of the logger and the agent-group
  executor, so it does not import @waggle/server. @clerk/fastify, bullmq,
  ioredis, postgres, drizzle-orm, drizzle-kit, cron-parser and
  @waggle/waggle-dance leave @waggle/server; the launcher drops the same
  team-only dependencies.
- build:packages no longer builds waggle-dance or the worker: nothing in
  the community edition imports them, and the worker's project reference
  would otherwise build the team server. The worker now imports from
  team-server; the team Dockerfile builds both explicitly.
- The sidecar no longer starts the team server when DATABASE_URL is set,
  and loses the team routes (/api/team/*, /api/teams), the WaggleDance
  routes and bridge (/api/waggle-dance/*), the Team server binding and
  egress guard, the WebSocket team client, the TeamSync cache and pushes,
  team audit forwarding, team workspace registration and the team
  capability-policy lookup in chat. The in-process room signal bus stays:
  agent groups, fleet runs and external tool runs use it.
  middleware/audit.ts was dead and is deleted.
- @waggle/core loses TeamSync and the teamServer part of WaggleConfig. A
  teamServer key in config.json is ignored and kept on save, as P0.1 does
  for the tier keys. Workspaces lose teamServerUrl and teamUserId; teamId
  and teamRole stay because workspaces from a shared data directory still
  carry them and the viewer write guards read them. POST /api/workspaces
  ignores team fields.
- The sidecar bundle no longer marks the team packages as external.

The agent still references the TeamSync type in orchestrator.ts and
pattern-write-back.ts; those files are being rewritten in P1.5 and drop
it there.

Logs UF-030 and UF-031 (team sync and team policy defects found while
removing the code).
This commit is contained in:
shumeiko.it
2026-10-24 11:53:23 +02:00
parent 0cbde468a9
commit c25efe6c44
136 changed files with 450 additions and 4990 deletions

View File

@@ -62,7 +62,7 @@ npm workspaces with the root `package-lock.json`. Node `^20.19.0 || >=22.12.0`.
| `app/` | Keep. Tauri shell only (there is no `app/src/`). |
| `packages/agent`, `core`, `server`, `shared`, `sdk`, `weaver`, `marketplace`, `cli`, `launcher` | Keep. |
| `packages/memory-contract`, `packages/memory-mem0` | Keep. The memory contract and its mem0 implementation (ADR-0007). |
| `packages/waggle-dance`, `packages/worker` | Postponed: team mode stays in the repo, is not built or shipped (ADR-0003). |
| `packages/team-server`, `packages/waggle-dance`, `packages/worker` | Postponed: team mode stays in the repo, is not built or shipped (ADR-0003). |
| `packages/hive-mind-*`, `memory-mcp`, `wiki-compiler` | Excluded once P1.5 moves all memory access to the contract. |
| `packages/admin-web`, `apps/www` | Excluded. |
| `apps/browser-ext` | Not decided. Do not extend it. |
@@ -95,9 +95,10 @@ packages/shared/src/ # shared types, Zod schemas, MCP catalog
```
Already removed: tiers and Stripe (P0.1); KVARK, enterprise packs, the compliance
subsystem, self-learning and `packages/optimizer` (P1.4, P1.6, ADR-0004). Still to be
removed, so do not build on them: `install-audit.ts`, `team-sync` and `migration` in core
(P1.2), the team server runtime (P1.1).
subsystem, self-learning and `packages/optimizer` (P1.4, P1.6, ADR-0004); the team and
WaggleDance routes in the sidecar and `team-sync` in core, with the team server moved to
`packages/team-server` (P1.1). Still to be removed, so do not build on them:
`install-audit.ts` and `migration` in core (P1.2).
---
@@ -113,7 +114,7 @@ removed, so do not build on them: `install-audit.ts`, `team-sync` and `migration
`wiki-compiler`, and must not run SQL against a memory database (ADR-0007). Until P1.5 moves
the existing callers, keep changes to the old memory code minimal. The knowledge graph is
not in v1.
3. **Team mode is frozen.** Do not add features to team routes, WaggleDance or the worker.
3. **Team mode is frozen.** Do not add features to `packages/team-server`, WaggleDance or the worker.
4. **Self-learning is out.** Do not extend evolution, improvement signals, correction
learning, judge or eval loops, or `optimizer`. Cost tracking stays.
5. **Licenses.** Every new dependency must be compatible with MIT distribution. No GPL or