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

@@ -59,6 +59,8 @@ Baseline: commit `b20b138` of `git.os-dev.tech/oleg.m/waggle-os`.
| UF-028 | The Settings prompt-shape choice has no effect on chat | Open | Web UI, chat |
| UF-029 | The Settings "Import Data" button does nothing | Open | Web UI |
| UF-030 | WhatsApp setup hint suggests pairing from the "Message yourself" chat, which is never read | Fixed | Web UI, channels |
| UF-031 | Team sync shares the save_memory confirmation instead of the memory | Open | Team mode, memory |
| UF-032 | Team capability policies are always read from the team "default" | Open | Team mode, governance |
## Entries
@@ -304,3 +306,21 @@ Entries UF-010 to UF-019 come from the UI audit `anti-slop/audit-001-2026-10-14.
- Cause: messages the linked account sends, including those to itself, arrive with `fromMe` set, and the adapter drops every `fromMe` message (correctly, so the bot never reads its own replies).
- What we did: the hint now says to send `/pair <code>` to the linked number from another WhatsApp account and that messages to yourself are not read. The `whatsapp-web.js` adapter drops own messages the same way.
- Recommendation: change the hint in the main project the same way, or support the self-chat explicitly (accept `fromMe` messages in the account's own chat and skip the bot's replies there).
### UF-031. Team sync shares the save_memory confirmation instead of the memory
- Status: Open
- Found: 2026-10-24
- Where: at commit `f3eb6b6`, `packages/server/src/local/routes/chat.ts:2997-3027` (the `save_memory` TeamSync push in `onToolResult`)
- Symptom: in a team workspace, every `save_memory` call sends the team server a frame whose content is the tool's reply, for example "Memory saved to workspace mind (importance: normal, ...)", instead of the fact the agent saved. Replies to blocked, rate-limited and duplicate saves ("Memory save blocked: ...", "Memory already exists ... skipped duplicate save") are shared too, because only replies starting with "Error" are skipped.
- Cause: the push builds the frame from `result` (the tool output string) with a synthetic id, not from the frame that `save_memory` created.
- What we did: nothing in the old code. Team mode is postponed in the community edition (ADR-0003) and this push was removed with it in P1.1.
- Recommendation: push the frame that `save_memory` created (as the orchestrator's pattern write-back does), and only when the save succeeded.
### UF-032. Team capability policies are always read from the team "default"
- Status: Open
- Found: 2026-10-24
- Where: at commit `f3eb6b6`, `packages/server/src/local/routes/chat-governance.ts:46`, called from `packages/server/src/local/routes/chat.ts:2591`; the same fallback in `packages/server/src/local/routes/team.ts:416` (`GET /api/team/governance/permissions`)
- Symptom: tools blocked for a role in a team's capability policies stay available in that team's workspaces; the chat route applies the policies of a team with the slug "default", if one exists.
- Cause: the slug is read from `teamServer.teamSlug` in `config.json`, a field `TeamServerConfig` does not have and `POST /api/team/connect` never writes, so it always falls back to `'default'`. The workspace's `teamId` is not used.
- What we did: nothing in the old code. Team mode is postponed in the community edition (ADR-0003) and the lookup was removed with it in P1.1.
- Recommendation: fetch `/api/teams/<workspace teamId>/capability-policies` for the workspace the turn runs in, and cache per team rather than per workspace.