From 774b76447d8e9e2b6eef9a5d0e6f75d3537230e7 Mon Sep 17 00:00:00 2001 From: Jarvis Date: Sat, 4 Apr 2026 21:43:23 -0500 Subject: [PATCH] fix: rename all packages from @mosaic/* to @mosaicstack/* - Updated all package.json name fields and dependency references - Updated all TypeScript/JavaScript imports - Updated .woodpecker/publish.yml filters and registry paths - Updated tools/install.sh scope default - Updated .npmrc registry paths (worktree + host) - Enhanced update-checker.ts with checkForAllUpdates() multi-package support - Updated CLI update command to show table of all packages - Added KNOWN_PACKAGES, formatAllPackagesTable, getInstallAllCommand - Marked checkForUpdate() with @deprecated JSDoc Closes #391 --- .npmrc | 2 +- .woodpecker/ci.yml | 2 +- .woodpecker/publish.yml | 8 +- AGENTS.md | 10 +- CLAUDE.md | 8 +- README.md | 14 +- apps/gateway/package.json | 26 +-- .../conversation-persistence.test.ts | 2 +- .../__tests__/cross-user-isolation.test.ts | 14 +- .../src/admin/admin-health.controller.ts | 4 +- .../src/admin/admin-tokens.controller.ts | 2 +- apps/gateway/src/admin/admin.controller.ts | 4 +- apps/gateway/src/admin/admin.guard.ts | 6 +- .../gateway/src/admin/bootstrap.controller.ts | 4 +- .../agent/__tests__/routing.service.test.ts | 2 +- .../src/agent/adapters/anthropic.adapter.ts | 2 +- .../src/agent/adapters/ollama.adapter.ts | 2 +- .../src/agent/adapters/openai.adapter.ts | 2 +- .../src/agent/adapters/openrouter.adapter.ts | 2 +- .../gateway/src/agent/adapters/zai.adapter.ts | 2 +- .../src/agent/agent-configs.controller.ts | 2 +- apps/gateway/src/agent/agent.service.ts | 4 +- apps/gateway/src/agent/model-capabilities.ts | 2 +- .../src/agent/provider-credentials.service.ts | 4 +- apps/gateway/src/agent/provider.service.ts | 2 +- .../gateway/src/agent/providers.controller.ts | 2 +- apps/gateway/src/agent/routing.service.ts | 4 +- .../src/agent/routing/default-rules.ts | 2 +- .../agent/routing/routing-engine.service.ts | 2 +- .../src/agent/routing/routing.controller.ts | 2 +- .../src/agent/routing/routing.types.ts | 4 +- apps/gateway/src/agent/tools/brain-tools.ts | 2 +- apps/gateway/src/agent/tools/memory-tools.ts | 4 +- apps/gateway/src/auth/auth.controller.ts | 2 +- apps/gateway/src/auth/auth.guard.ts | 2 +- apps/gateway/src/auth/auth.module.ts | 4 +- apps/gateway/src/auth/sso.controller.ts | 2 +- apps/gateway/src/brain/brain.module.ts | 4 +- apps/gateway/src/chat/chat.gateway.ts | 6 +- .../commands/command-executor-p8012.spec.ts | 2 +- .../src/commands/command-executor.service.ts | 6 +- .../commands/command-registry.service.spec.ts | 2 +- .../src/commands/command-registry.service.ts | 2 +- .../src/commands/commands.integration.spec.ts | 2 +- apps/gateway/src/commands/commands.module.ts | 2 +- apps/gateway/src/config/config.module.ts | 2 +- .../conversations/conversations.controller.ts | 2 +- apps/gateway/src/coord/coord.service.ts | 2 +- apps/gateway/src/database/database.module.ts | 6 +- apps/gateway/src/gc/gc.module.ts | 2 +- .../gateway/src/gc/session-gc.service.spec.ts | 4 +- apps/gateway/src/gc/session-gc.service.ts | 4 +- apps/gateway/src/log/log.controller.ts | 2 +- apps/gateway/src/log/log.module.ts | 4 +- apps/gateway/src/log/summarization.service.ts | 8 +- apps/gateway/src/main.ts | 2 +- apps/gateway/src/mcp/mcp.controller.ts | 2 +- apps/gateway/src/mcp/mcp.service.ts | 4 +- apps/gateway/src/memory/embedding.service.ts | 2 +- apps/gateway/src/memory/memory.controller.ts | 2 +- apps/gateway/src/memory/memory.module.ts | 8 +- .../src/missions/missions.controller.ts | 2 +- apps/gateway/src/plugin/plugin.module.ts | 4 +- .../preferences/preferences.service.spec.ts | 2 +- .../src/preferences/preferences.service.ts | 2 +- .../preferences/system-override.service.ts | 2 +- .../src/projects/projects.controller.ts | 2 +- apps/gateway/src/queue/queue.module.ts | 4 +- apps/gateway/src/queue/queue.service.ts | 2 +- apps/gateway/src/reload/reload.controller.ts | 2 +- apps/gateway/src/reload/reload.service.ts | 2 +- apps/gateway/src/skills/skills.service.ts | 2 +- apps/gateway/src/tasks/tasks.controller.ts | 2 +- .../workspace/project-bootstrap.service.ts | 2 +- apps/gateway/src/workspace/teams.service.ts | 2 +- apps/gateway/tsconfig.typecheck.json | 18 +- apps/web/next.config.ts | 2 +- apps/web/package.json | 4 +- apps/web/playwright.config.ts | 2 +- docs/PERFORMANCE.md | 2 +- docs/PRD-TUI_Improvements.md | 2 +- docs/PRD.md | 164 +++++++------- docs/SSO-PROVIDERS.md | 2 +- docs/TASKS-TUI_Improvements.md | 8 +- docs/TASKS.md | 6 +- docs/design/storage-abstraction-middleware.md | 32 +-- docs/guides/deployment.md | 10 +- docs/guides/dev-guide.md | 16 +- docs/guides/user-guide.md | 4 +- .../2026-03-13-gateway-security-hardening.md | 4 +- .../2026-03-15-agent-platform-architecture.md | 42 ++-- .../2026-03-15-wave2-tui-layout-navigation.md | 24 +- docs/plans/task-queue-unification.md | 16 +- docs/reports/qa/gateway-security-20260313.md | 2 +- docs/reviews/consolidation-board-memo.md | 8 +- .../387-updater-wrapper-gitea-20260404.md | 16 +- docs/scratchpads/41-plugin-host.md | 8 +- .../scratchpads/ci-docker-publish-20260330.md | 2 +- docs/scratchpads/gateway-security-20260313.md | 2 +- docs/scratchpads/m3-001-provider-adapter.md | 4 +- docs/scratchpads/mvp-20260312.md | 26 +-- docs/scratchpads/p5-003-telegram-plugin.md | 8 +- docs/scratchpads/p5-004-authentik-sso.md | 18 +- docs/scratchpads/p8-001-sso-providers.md | 14 +- docs/scratchpads/p8-009-tui-slash-commands.md | 2 +- .../task-mission-ownership-20260313.md | 8 +- .../update-checker-package-20260404.md | 16 +- docs/tasks/WP1-forge-package.md | 8 +- docs/tasks/WP2-macp-package.md | 6 +- packages/agent/package.json | 4 +- packages/auth/package.json | 4 +- packages/auth/src/auth.test.ts | 6 +- packages/auth/src/auth.ts | 2 +- packages/auth/src/sso.ts | 6 +- packages/brain/package.json | 6 +- packages/brain/src/agents.ts | 2 +- packages/brain/src/brain.ts | 2 +- packages/brain/src/conversations.ts | 2 +- packages/brain/src/mission-tasks.ts | 2 +- packages/brain/src/missions.ts | 2 +- packages/brain/src/projects.ts | 2 +- packages/brain/src/tasks.ts | 2 +- packages/cli/package.json | 12 +- packages/cli/src/cli.ts | 42 ++-- packages/cli/src/commands/gateway/daemon.ts | 16 +- packages/cli/src/commands/gateway/install.ts | 2 +- packages/cli/src/commands/launch.ts | 4 +- packages/cli/src/commands/mission.ts | 2 +- packages/cli/src/commands/prdy.ts | 2 +- packages/cli/src/tui/app.tsx | 2 +- .../tui/commands/commands.integration.spec.ts | 2 +- packages/cli/src/tui/commands/local/help.ts | 2 +- packages/cli/src/tui/commands/local/status.ts | 2 +- packages/cli/src/tui/commands/parse.ts | 2 +- packages/cli/src/tui/commands/registry.ts | 2 +- .../cli/src/tui/components/bottom-bar.tsx | 2 +- .../tui/components/command-autocomplete.tsx | 2 +- packages/cli/src/tui/components/input-bar.tsx | 2 +- packages/cli/src/tui/hooks/use-socket.ts | 2 +- packages/config/package.json | 8 +- packages/config/src/mosaic-config.ts | 4 +- packages/coord/package.json | 4 +- .../coord/src/__tests__/tasks-file.test.ts | 4 +- packages/db/package.json | 2 +- packages/design-tokens/package.json | 2 +- .../forge/__tests__/pipeline-runner.test.ts | 2 +- packages/forge/package.json | 4 +- packages/forge/src/types.ts | 2 +- packages/log/package.json | 4 +- packages/log/src/agent-logs.ts | 2 +- packages/log/src/log-service.ts | 2 +- packages/macp/package.json | 2 +- packages/memory/package.json | 8 +- packages/memory/src/adapters/keyword.test.ts | 2 +- packages/memory/src/adapters/keyword.ts | 2 +- packages/memory/src/adapters/pgvector.ts | 2 +- packages/memory/src/insights.ts | 2 +- packages/memory/src/memory.ts | 2 +- packages/memory/src/preferences.ts | 2 +- packages/memory/src/types.ts | 2 +- .../mosaic/__tests__/update-checker.test.ts | 30 +-- packages/mosaic/framework/defaults/README.md | 2 +- packages/mosaic/package.json | 14 +- packages/mosaic/src/cli.ts | 42 ++-- .../mosaic/src/commands/gateway/daemon.ts | 16 +- .../mosaic/src/commands/gateway/install.ts | 2 +- packages/mosaic/src/commands/launch.ts | 4 +- packages/mosaic/src/commands/mission.ts | 2 +- packages/mosaic/src/commands/prdy.ts | 2 +- packages/mosaic/src/index.ts | 5 + packages/mosaic/src/runtime/update-checker.ts | 208 +++++++++++++++++- packages/mosaic/src/tui/app.tsx | 2 +- .../tui/commands/commands.integration.spec.ts | 2 +- .../mosaic/src/tui/commands/local/help.ts | 2 +- .../mosaic/src/tui/commands/local/status.ts | 2 +- packages/mosaic/src/tui/commands/parse.ts | 2 +- packages/mosaic/src/tui/commands/registry.ts | 2 +- .../mosaic/src/tui/components/bottom-bar.tsx | 2 +- .../tui/components/command-autocomplete.tsx | 2 +- .../mosaic/src/tui/components/input-bar.tsx | 2 +- packages/mosaic/src/tui/hooks/use-socket.ts | 2 +- packages/prdy/package.json | 2 +- packages/quality-rails/package.json | 2 +- packages/queue/package.json | 4 +- packages/storage/package.json | 6 +- packages/storage/src/adapters/postgres.ts | 4 +- packages/types/package.json | 2 +- plugins/discord/package.json | 2 +- plugins/macp/README.md | 2 +- plugins/macp/package.json | 2 +- plugins/mosaic-framework/package.json | 2 +- plugins/telegram/README.md | 4 +- plugins/telegram/package.json | 2 +- pnpm-lock.yaml | 70 +++--- pnpm-workspace.yaml | 2 +- scratchpads/cli-tui-tools-enhancement.md | 2 +- scripts/publish-npmjs.sh | 10 +- skills/mosaic-board/SKILL.md | 2 +- skills/mosaic-forge/SKILL.md | 2 +- tools/install.sh | 10 +- 200 files changed, 828 insertions(+), 641 deletions(-) diff --git a/.npmrc b/.npmrc index 95b2744..35cdb76 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1 @@ -@mosaic:registry=https://git.mosaicstack.dev/api/packages/mosaic/npm/ +@mosaicstack:registry=https://git.mosaicstack.dev/api/packages/mosaicstack/npm/ diff --git a/.woodpecker/ci.yml b/.woodpecker/ci.yml index e2d2c10..aaf47db 100644 --- a/.woodpecker/ci.yml +++ b/.woodpecker/ci.yml @@ -59,7 +59,7 @@ steps: sleep 1 done # Run migrations (DATABASE_URL is set in environment above) - - pnpm --filter @mosaic/db run db:migrate + - pnpm --filter @mosaicstack/db run db:migrate # Run all tests - pnpm test depends_on: diff --git a/.woodpecker/publish.yml b/.woodpecker/publish.yml index a700d4e..418bdec 100644 --- a/.woodpecker/publish.yml +++ b/.woodpecker/publish.yml @@ -33,13 +33,13 @@ steps: - *enable_pnpm # Configure auth for Gitea npm registry - | - echo "//git.mosaicstack.dev/api/packages/mosaic/npm/:_authToken=$NPM_TOKEN" > ~/.npmrc - echo "@mosaic:registry=https://git.mosaicstack.dev/api/packages/mosaic/npm/" >> ~/.npmrc + echo "//git.mosaicstack.dev/api/packages/mosaicstack/npm/:_authToken=$NPM_TOKEN" > ~/.npmrc + echo "@mosaicstack:registry=https://git.mosaicstack.dev/api/packages/mosaicstack/npm/" >> ~/.npmrc # Publish non-private packages to Gitea (--no-git-checks skips dirty/branch checks in CI) # --filter excludes web (private) - > - pnpm --filter "@mosaic/*" - --filter "!@mosaic/web" + pnpm --filter "@mosaicstack/*" + --filter "!@mosaicstack/web" publish --no-git-checks --access public || echo "[publish] Some packages may already exist at this version — continuing" depends_on: diff --git a/AGENTS.md b/AGENTS.md index d864846..1dc4e37 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -21,10 +21,10 @@ Mosaic Stack is a self-hosted, multi-user AI agent platform. TypeScript monorepo | `apps/web` | Next.js dashboard | React 19, Tailwind | | `packages/types` | Shared TypeScript contracts | class-validator | | `packages/db` | Drizzle ORM schema + migrations | drizzle-orm, postgres | -| `packages/auth` | BetterAuth configuration | better-auth, @mosaic/db | -| `packages/brain` | Data layer (PG-backed) | @mosaic/db | +| `packages/auth` | BetterAuth configuration | better-auth, @mosaicstack/db | +| `packages/brain` | Data layer (PG-backed) | @mosaicstack/db | | `packages/queue` | Valkey task queue + MCP | ioredis | -| `packages/coord` | Mission coordination | @mosaic/queue | +| `packages/coord` | Mission coordination | @mosaicstack/queue | | `packages/cli` | Unified CLI + Pi TUI | Ink, Pi SDK | | `plugins/discord` | Discord channel plugin | discord.js | | `plugins/telegram` | Telegram channel plugin | Telegraf | @@ -33,9 +33,9 @@ Mosaic Stack is a self-hosted, multi-user AI agent platform. TypeScript monorepo 1. Gateway is the single API surface — all clients connect through it 2. Pi SDK is ESM-only — gateway and CLI must use ESM -3. Socket.IO typed events defined in `@mosaic/types` enforce compile-time contracts +3. Socket.IO typed events defined in `@mosaicstack/types` enforce compile-time contracts 4. OTEL auto-instrumentation loads before NestJS bootstrap -5. BetterAuth manages auth tables; schema defined in `@mosaic/db` +5. BetterAuth manages auth tables; schema defined in `@mosaicstack/db` 6. Docker Compose provides PG (5433), Valkey (6380), OTEL Collector (4317/4318), Jaeger (16686) 7. Explicit `@Inject()` decorators required in NestJS (tsx/esbuild doesn't emit decorator metadata) diff --git a/CLAUDE.md b/CLAUDE.md index a5502aa..d9fbbc3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -26,13 +26,13 @@ pnpm test # Vitest (all packages) pnpm build # Build all packages # Database -pnpm --filter @mosaic/db db:push # Push schema to PG (dev) -pnpm --filter @mosaic/db db:generate # Generate migrations -pnpm --filter @mosaic/db db:migrate # Run migrations +pnpm --filter @mosaicstack/db db:push # Push schema to PG (dev) +pnpm --filter @mosaicstack/db db:generate # Generate migrations +pnpm --filter @mosaicstack/db db:migrate # Run migrations # Dev docker compose up -d # Start PG, Valkey, OTEL, Jaeger -pnpm --filter @mosaic/gateway exec tsx src/main.ts # Start gateway +pnpm --filter @mosaicstack/gateway exec tsx src/main.ts # Start gateway ``` ## Conventions diff --git a/README.md b/README.md index 5c907c2..9b8dd6b 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,10 @@ bash <(curl -fsSL https://git.mosaicstack.dev/mosaic/mosaic-stack/raw/branch/mai This installs both components: -| Component | What | Where | -| --------------- | ----------------------------------------------------- | -------------------- | -| **Framework** | Bash launcher, guides, runtime configs, tools, skills | `~/.config/mosaic/` | -| **@mosaic/cli** | TUI, gateway client, wizard, auto-updater | `~/.npm-global/bin/` | +| Component | What | Where | +| -------------------- | ----------------------------------------------------- | -------------------- | +| **Framework** | Bash launcher, guides, runtime configs, tools, skills | `~/.config/mosaic/` | +| **@mosaicstack/cli** | TUI, gateway client, wizard, auto-updater | `~/.npm-global/bin/` | After install, set up your agent identity: @@ -26,7 +26,7 @@ mosaic init # Interactive wizard ### Requirements - Node.js ≥ 20 -- npm (for global @mosaic/cli install) +- npm (for global @mosaicstack/cli install) - One or more runtimes: [Claude Code](https://docs.anthropic.com/en/docs/claude-code), [Codex](https://github.com/openai/codex), [OpenCode](https://opencode.ai), or [Pi](https://github.com/mariozechner/pi-coding-agent) ## Usage @@ -86,7 +86,7 @@ docker compose up -d pnpm install # Run migrations -pnpm --filter @mosaic/db run db:migrate +pnpm --filter @mosaicstack/db run db:migrate # Start all services in dev mode pnpm dev @@ -163,7 +163,7 @@ mosaic-stack/ - **Gateway is the single API surface** — all clients (TUI, web, Discord, Telegram) connect through it - **ESM everywhere** — `"type": "module"`, `.js` extensions in imports, NodeNext resolution -- **Socket.IO typed events** — defined in `@mosaic/types`, enforced at compile time +- **Socket.IO typed events** — defined in `@mosaicstack/types`, enforced at compile time - **OTEL auto-instrumentation** — loads before NestJS bootstrap - **Explicit `@Inject()` decorators** — required since tsx/esbuild doesn't emit decorator metadata diff --git a/apps/gateway/package.json b/apps/gateway/package.json index 566b6ed..0991f5b 100644 --- a/apps/gateway/package.json +++ b/apps/gateway/package.json @@ -1,5 +1,5 @@ { - "name": "@mosaic/gateway", + "name": "@mosaicstack/gateway", "version": "0.0.6", "repository": { "type": "git", @@ -31,18 +31,18 @@ "@mariozechner/pi-ai": "^0.65.0", "@mariozechner/pi-coding-agent": "^0.65.0", "@modelcontextprotocol/sdk": "^1.27.1", - "@mosaic/auth": "workspace:^", - "@mosaic/brain": "workspace:^", - "@mosaic/config": "workspace:^", - "@mosaic/coord": "workspace:^", - "@mosaic/db": "workspace:^", - "@mosaic/discord-plugin": "workspace:^", - "@mosaic/log": "workspace:^", - "@mosaic/memory": "workspace:^", - "@mosaic/queue": "workspace:^", - "@mosaic/storage": "workspace:^", - "@mosaic/telegram-plugin": "workspace:^", - "@mosaic/types": "workspace:^", + "@mosaicstack/auth": "workspace:^", + "@mosaicstack/brain": "workspace:^", + "@mosaicstack/config": "workspace:^", + "@mosaicstack/coord": "workspace:^", + "@mosaicstack/db": "workspace:^", + "@mosaicstack/discord-plugin": "workspace:^", + "@mosaicstack/log": "workspace:^", + "@mosaicstack/memory": "workspace:^", + "@mosaicstack/queue": "workspace:^", + "@mosaicstack/storage": "workspace:^", + "@mosaicstack/telegram-plugin": "workspace:^", + "@mosaicstack/types": "workspace:^", "@nestjs/common": "^11.0.0", "@nestjs/core": "^11.0.0", "@nestjs/platform-fastify": "^11.0.0", diff --git a/apps/gateway/src/__tests__/conversation-persistence.test.ts b/apps/gateway/src/__tests__/conversation-persistence.test.ts index ca16375..781d295 100644 --- a/apps/gateway/src/__tests__/conversation-persistence.test.ts +++ b/apps/gateway/src/__tests__/conversation-persistence.test.ts @@ -12,7 +12,7 @@ import { BadRequestException, NotFoundException } from '@nestjs/common'; import { describe, expect, it, vi, beforeEach } from 'vitest'; import type { ConversationHistoryMessage } from '../agent/agent.service.js'; import { ConversationsController } from '../conversations/conversations.controller.js'; -import type { Message } from '@mosaic/brain'; +import type { Message } from '@mosaicstack/brain'; // --------------------------------------------------------------------------- // Shared test data diff --git a/apps/gateway/src/__tests__/cross-user-isolation.test.ts b/apps/gateway/src/__tests__/cross-user-isolation.test.ts index f10a120..439b750 100644 --- a/apps/gateway/src/__tests__/cross-user-isolation.test.ts +++ b/apps/gateway/src/__tests__/cross-user-isolation.test.ts @@ -18,13 +18,13 @@ */ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'; -import { createDb } from '@mosaic/db'; -import { createConversationsRepo } from '@mosaic/brain'; -import { createAgentsRepo } from '@mosaic/brain'; -import { createPreferencesRepo, createInsightsRepo } from '@mosaic/memory'; -import { users, conversations, messages, agents, preferences, insights } from '@mosaic/db'; -import { eq } from '@mosaic/db'; -import type { DbHandle } from '@mosaic/db'; +import { createDb } from '@mosaicstack/db'; +import { createConversationsRepo } from '@mosaicstack/brain'; +import { createAgentsRepo } from '@mosaicstack/brain'; +import { createPreferencesRepo, createInsightsRepo } from '@mosaicstack/memory'; +import { users, conversations, messages, agents, preferences, insights } from '@mosaicstack/db'; +import { eq } from '@mosaicstack/db'; +import type { DbHandle } from '@mosaicstack/db'; // ─── Fixed IDs so the afterAll cleanup is deterministic ────────────────────── diff --git a/apps/gateway/src/admin/admin-health.controller.ts b/apps/gateway/src/admin/admin-health.controller.ts index 96ce18e..2331143 100644 --- a/apps/gateway/src/admin/admin-health.controller.ts +++ b/apps/gateway/src/admin/admin-health.controller.ts @@ -1,6 +1,6 @@ import { Controller, Get, Inject, UseGuards } from '@nestjs/common'; -import { sql, type Db } from '@mosaic/db'; -import { createQueue } from '@mosaic/queue'; +import { sql, type Db } from '@mosaicstack/db'; +import { createQueue } from '@mosaicstack/queue'; import { DB } from '../database/database.module.js'; import { AgentService } from '../agent/agent.service.js'; import { ProviderService } from '../agent/provider.service.js'; diff --git a/apps/gateway/src/admin/admin-tokens.controller.ts b/apps/gateway/src/admin/admin-tokens.controller.ts index 94f27a7..9c31bac 100644 --- a/apps/gateway/src/admin/admin-tokens.controller.ts +++ b/apps/gateway/src/admin/admin-tokens.controller.ts @@ -11,7 +11,7 @@ import { UseGuards, } from '@nestjs/common'; import { randomBytes, createHash } from 'node:crypto'; -import { eq, type Db, adminTokens } from '@mosaic/db'; +import { eq, type Db, adminTokens } from '@mosaicstack/db'; import { v4 as uuid } from 'uuid'; import { DB } from '../database/database.module.js'; import { AdminGuard } from './admin.guard.js'; diff --git a/apps/gateway/src/admin/admin.controller.ts b/apps/gateway/src/admin/admin.controller.ts index f1806ce..4216c14 100644 --- a/apps/gateway/src/admin/admin.controller.ts +++ b/apps/gateway/src/admin/admin.controller.ts @@ -13,8 +13,8 @@ import { Post, UseGuards, } from '@nestjs/common'; -import { eq, type Db, users as usersTable } from '@mosaic/db'; -import type { Auth } from '@mosaic/auth'; +import { eq, type Db, users as usersTable } from '@mosaicstack/db'; +import type { Auth } from '@mosaicstack/auth'; import { AUTH } from '../auth/auth.tokens.js'; import { DB } from '../database/database.module.js'; import { AdminGuard } from './admin.guard.js'; diff --git a/apps/gateway/src/admin/admin.guard.ts b/apps/gateway/src/admin/admin.guard.ts index c6c0646..f323a35 100644 --- a/apps/gateway/src/admin/admin.guard.ts +++ b/apps/gateway/src/admin/admin.guard.ts @@ -8,9 +8,9 @@ import { } from '@nestjs/common'; import { createHash } from 'node:crypto'; import { fromNodeHeaders } from 'better-auth/node'; -import type { Auth } from '@mosaic/auth'; -import type { Db } from '@mosaic/db'; -import { eq, adminTokens, users as usersTable } from '@mosaic/db'; +import type { Auth } from '@mosaicstack/auth'; +import type { Db } from '@mosaicstack/db'; +import { eq, adminTokens, users as usersTable } from '@mosaicstack/db'; import type { FastifyRequest } from 'fastify'; import { AUTH } from '../auth/auth.tokens.js'; import { DB } from '../database/database.module.js'; diff --git a/apps/gateway/src/admin/bootstrap.controller.ts b/apps/gateway/src/admin/bootstrap.controller.ts index db087ef..3d8b1a9 100644 --- a/apps/gateway/src/admin/bootstrap.controller.ts +++ b/apps/gateway/src/admin/bootstrap.controller.ts @@ -8,8 +8,8 @@ import { Post, } from '@nestjs/common'; import { randomBytes, createHash } from 'node:crypto'; -import { count, eq, type Db, users as usersTable, adminTokens } from '@mosaic/db'; -import type { Auth } from '@mosaic/auth'; +import { count, eq, type Db, users as usersTable, adminTokens } from '@mosaicstack/db'; +import type { Auth } from '@mosaicstack/auth'; import { v4 as uuid } from 'uuid'; import { AUTH } from '../auth/auth.tokens.js'; import { DB } from '../database/database.module.js'; diff --git a/apps/gateway/src/agent/__tests__/routing.service.test.ts b/apps/gateway/src/agent/__tests__/routing.service.test.ts index 0960777..bc280e7 100644 --- a/apps/gateway/src/agent/__tests__/routing.service.test.ts +++ b/apps/gateway/src/agent/__tests__/routing.service.test.ts @@ -1,6 +1,6 @@ import { describe, it, expect, beforeEach, vi } from 'vitest'; import { RoutingService } from '../routing.service.js'; -import type { ModelInfo } from '@mosaic/types'; +import type { ModelInfo } from '@mosaicstack/types'; const mockModels: ModelInfo[] = [ { diff --git a/apps/gateway/src/agent/adapters/anthropic.adapter.ts b/apps/gateway/src/agent/adapters/anthropic.adapter.ts index df68c56..b6ae891 100644 --- a/apps/gateway/src/agent/adapters/anthropic.adapter.ts +++ b/apps/gateway/src/agent/adapters/anthropic.adapter.ts @@ -7,7 +7,7 @@ import type { IProviderAdapter, ModelInfo, ProviderHealth, -} from '@mosaic/types'; +} from '@mosaicstack/types'; /** * Anthropic provider adapter. diff --git a/apps/gateway/src/agent/adapters/ollama.adapter.ts b/apps/gateway/src/agent/adapters/ollama.adapter.ts index 1a5e52a..88ded12 100644 --- a/apps/gateway/src/agent/adapters/ollama.adapter.ts +++ b/apps/gateway/src/agent/adapters/ollama.adapter.ts @@ -6,7 +6,7 @@ import type { IProviderAdapter, ModelInfo, ProviderHealth, -} from '@mosaic/types'; +} from '@mosaicstack/types'; /** Embedding models that Ollama ships with out of the box */ const OLLAMA_EMBEDDING_MODELS: ReadonlyArray<{ diff --git a/apps/gateway/src/agent/adapters/openai.adapter.ts b/apps/gateway/src/agent/adapters/openai.adapter.ts index 875ef8f..93966f0 100644 --- a/apps/gateway/src/agent/adapters/openai.adapter.ts +++ b/apps/gateway/src/agent/adapters/openai.adapter.ts @@ -7,7 +7,7 @@ import type { IProviderAdapter, ModelInfo, ProviderHealth, -} from '@mosaic/types'; +} from '@mosaicstack/types'; /** * OpenAI provider adapter. diff --git a/apps/gateway/src/agent/adapters/openrouter.adapter.ts b/apps/gateway/src/agent/adapters/openrouter.adapter.ts index 36f1760..6d26252 100644 --- a/apps/gateway/src/agent/adapters/openrouter.adapter.ts +++ b/apps/gateway/src/agent/adapters/openrouter.adapter.ts @@ -6,7 +6,7 @@ import type { IProviderAdapter, ModelInfo, ProviderHealth, -} from '@mosaic/types'; +} from '@mosaicstack/types'; const OPENROUTER_BASE_URL = 'https://openrouter.ai/api/v1'; diff --git a/apps/gateway/src/agent/adapters/zai.adapter.ts b/apps/gateway/src/agent/adapters/zai.adapter.ts index 8664356..2a7f432 100644 --- a/apps/gateway/src/agent/adapters/zai.adapter.ts +++ b/apps/gateway/src/agent/adapters/zai.adapter.ts @@ -6,7 +6,7 @@ import type { IProviderAdapter, ModelInfo, ProviderHealth, -} from '@mosaic/types'; +} from '@mosaicstack/types'; import { getModelCapability } from '../model-capabilities.js'; /** diff --git a/apps/gateway/src/agent/agent-configs.controller.ts b/apps/gateway/src/agent/agent-configs.controller.ts index aa59d81..2470b67 100644 --- a/apps/gateway/src/agent/agent-configs.controller.ts +++ b/apps/gateway/src/agent/agent-configs.controller.ts @@ -13,7 +13,7 @@ import { Post, UseGuards, } from '@nestjs/common'; -import type { Brain } from '@mosaic/brain'; +import type { Brain } from '@mosaicstack/brain'; import { BRAIN } from '../brain/brain.tokens.js'; import { AuthGuard } from '../auth/auth.guard.js'; import { CurrentUser } from '../auth/current-user.decorator.js'; diff --git a/apps/gateway/src/agent/agent.service.ts b/apps/gateway/src/agent/agent.service.ts index ead3279..83cb057 100644 --- a/apps/gateway/src/agent/agent.service.ts +++ b/apps/gateway/src/agent/agent.service.ts @@ -7,8 +7,8 @@ import { type AgentSessionEvent, type ToolDefinition, } from '@mariozechner/pi-coding-agent'; -import type { Brain } from '@mosaic/brain'; -import type { Memory } from '@mosaic/memory'; +import type { Brain } from '@mosaicstack/brain'; +import type { Memory } from '@mosaicstack/memory'; import { BRAIN } from '../brain/brain.tokens.js'; import { MEMORY } from '../memory/memory.tokens.js'; import { EmbeddingService } from '../memory/embedding.service.js'; diff --git a/apps/gateway/src/agent/model-capabilities.ts b/apps/gateway/src/agent/model-capabilities.ts index c0fc36e..ee16adb 100644 --- a/apps/gateway/src/agent/model-capabilities.ts +++ b/apps/gateway/src/agent/model-capabilities.ts @@ -1,4 +1,4 @@ -import type { ModelCapability } from '@mosaic/types'; +import type { ModelCapability } from '@mosaicstack/types'; /** * Comprehensive capability matrix for all target models. diff --git a/apps/gateway/src/agent/provider-credentials.service.ts b/apps/gateway/src/agent/provider-credentials.service.ts index 5636edf..60fdb9c 100644 --- a/apps/gateway/src/agent/provider-credentials.service.ts +++ b/apps/gateway/src/agent/provider-credentials.service.ts @@ -1,7 +1,7 @@ import { Inject, Injectable, Logger } from '@nestjs/common'; import { createCipheriv, createDecipheriv, createHash, randomBytes } from 'node:crypto'; -import type { Db } from '@mosaic/db'; -import { providerCredentials, eq, and } from '@mosaic/db'; +import type { Db } from '@mosaicstack/db'; +import { providerCredentials, eq, and } from '@mosaicstack/db'; import { DB } from '../database/database.module.js'; import type { ProviderCredentialSummaryDto } from './provider-credentials.dto.js'; diff --git a/apps/gateway/src/agent/provider.service.ts b/apps/gateway/src/agent/provider.service.ts index 6bbae4d..a1d6dfa 100644 --- a/apps/gateway/src/agent/provider.service.ts +++ b/apps/gateway/src/agent/provider.service.ts @@ -14,7 +14,7 @@ import type { ModelInfo, ProviderHealth, ProviderInfo, -} from '@mosaic/types'; +} from '@mosaicstack/types'; import { AnthropicAdapter, OllamaAdapter, diff --git a/apps/gateway/src/agent/providers.controller.ts b/apps/gateway/src/agent/providers.controller.ts index a1a1884..60d5bed 100644 --- a/apps/gateway/src/agent/providers.controller.ts +++ b/apps/gateway/src/agent/providers.controller.ts @@ -1,5 +1,5 @@ import { Body, Controller, Delete, Get, Inject, Param, Post, UseGuards } from '@nestjs/common'; -import type { RoutingCriteria } from '@mosaic/types'; +import type { RoutingCriteria } from '@mosaicstack/types'; import { AuthGuard } from '../auth/auth.guard.js'; import { CurrentUser } from '../auth/current-user.decorator.js'; import { ProviderService } from './provider.service.js'; diff --git a/apps/gateway/src/agent/routing.service.ts b/apps/gateway/src/agent/routing.service.ts index c73401b..1c86214 100644 --- a/apps/gateway/src/agent/routing.service.ts +++ b/apps/gateway/src/agent/routing.service.ts @@ -1,6 +1,6 @@ import { Inject, Injectable, Logger } from '@nestjs/common'; -import type { ModelInfo } from '@mosaic/types'; -import type { RoutingCriteria, RoutingResult, CostTier } from '@mosaic/types'; +import type { ModelInfo } from '@mosaicstack/types'; +import type { RoutingCriteria, RoutingResult, CostTier } from '@mosaicstack/types'; import { ProviderService } from './provider.service.js'; /** Per-million-token cost thresholds for tier classification */ diff --git a/apps/gateway/src/agent/routing/default-rules.ts b/apps/gateway/src/agent/routing/default-rules.ts index 63a6f67..467df1e 100644 --- a/apps/gateway/src/agent/routing/default-rules.ts +++ b/apps/gateway/src/agent/routing/default-rules.ts @@ -1,5 +1,5 @@ import { Inject, Injectable, Logger, type OnModuleInit } from '@nestjs/common'; -import { routingRules, type Db, sql } from '@mosaic/db'; +import { routingRules, type Db, sql } from '@mosaicstack/db'; import { DB } from '../../database/database.module.js'; import type { RoutingCondition, RoutingAction } from './routing.types.js'; diff --git a/apps/gateway/src/agent/routing/routing-engine.service.ts b/apps/gateway/src/agent/routing/routing-engine.service.ts index 57ec793..ad7c5a2 100644 --- a/apps/gateway/src/agent/routing/routing-engine.service.ts +++ b/apps/gateway/src/agent/routing/routing-engine.service.ts @@ -1,5 +1,5 @@ import { Inject, Injectable, Logger } from '@nestjs/common'; -import { routingRules, type Db, and, asc, eq, or } from '@mosaic/db'; +import { routingRules, type Db, and, asc, eq, or } from '@mosaicstack/db'; import { DB } from '../../database/database.module.js'; import { ProviderService } from '../provider.service.js'; import { classifyTask } from './task-classifier.js'; diff --git a/apps/gateway/src/agent/routing/routing.controller.ts b/apps/gateway/src/agent/routing/routing.controller.ts index 4870a1f..3be5420 100644 --- a/apps/gateway/src/agent/routing/routing.controller.ts +++ b/apps/gateway/src/agent/routing/routing.controller.ts @@ -13,7 +13,7 @@ import { Post, UseGuards, } from '@nestjs/common'; -import { routingRules, type Db, and, asc, eq, or, inArray } from '@mosaic/db'; +import { routingRules, type Db, and, asc, eq, or, inArray } from '@mosaicstack/db'; import { DB } from '../../database/database.module.js'; import { AuthGuard } from '../../auth/auth.guard.js'; import { CurrentUser } from '../../auth/current-user.decorator.js'; diff --git a/apps/gateway/src/agent/routing/routing.types.ts b/apps/gateway/src/agent/routing/routing.types.ts index c56057a..c359d2a 100644 --- a/apps/gateway/src/agent/routing/routing.types.ts +++ b/apps/gateway/src/agent/routing/routing.types.ts @@ -1,7 +1,7 @@ /** * Routing engine types — M4-002 (condition types) and M4-003 (action types). * - * These types are re-exported from `@mosaic/types` for shared use across packages. + * These types are re-exported from `@mosaicstack/types` for shared use across packages. */ // ─── Classification primitives ─────────────────────────────────────────────── @@ -23,7 +23,7 @@ export type Domain = 'frontend' | 'backend' | 'devops' | 'docs' | 'general'; /** * Cost tier for model selection. - * Extends the existing `CostTier` in `@mosaic/types` with `local` for self-hosted models. + * Extends the existing `CostTier` in `@mosaicstack/types` with `local` for self-hosted models. */ export type CostTier = 'cheap' | 'standard' | 'premium' | 'local'; diff --git a/apps/gateway/src/agent/tools/brain-tools.ts b/apps/gateway/src/agent/tools/brain-tools.ts index c6b040c..2764653 100644 --- a/apps/gateway/src/agent/tools/brain-tools.ts +++ b/apps/gateway/src/agent/tools/brain-tools.ts @@ -1,6 +1,6 @@ import { Type } from '@sinclair/typebox'; import type { ToolDefinition } from '@mariozechner/pi-coding-agent'; -import type { Brain } from '@mosaic/brain'; +import type { Brain } from '@mosaicstack/brain'; export function createBrainTools(brain: Brain): ToolDefinition[] { const listProjects: ToolDefinition = { diff --git a/apps/gateway/src/agent/tools/memory-tools.ts b/apps/gateway/src/agent/tools/memory-tools.ts index c420c89..ab1809a 100644 --- a/apps/gateway/src/agent/tools/memory-tools.ts +++ b/apps/gateway/src/agent/tools/memory-tools.ts @@ -1,7 +1,7 @@ import { Type } from '@sinclair/typebox'; import type { ToolDefinition } from '@mariozechner/pi-coding-agent'; -import type { Memory } from '@mosaic/memory'; -import type { EmbeddingProvider } from '@mosaic/memory'; +import type { Memory } from '@mosaicstack/memory'; +import type { EmbeddingProvider } from '@mosaicstack/memory'; /** * Create memory tools bound to the session's authenticated userId. diff --git a/apps/gateway/src/auth/auth.controller.ts b/apps/gateway/src/auth/auth.controller.ts index f7ec539..ed924d5 100644 --- a/apps/gateway/src/auth/auth.controller.ts +++ b/apps/gateway/src/auth/auth.controller.ts @@ -1,6 +1,6 @@ import type { IncomingMessage, ServerResponse } from 'node:http'; import { toNodeHandler } from 'better-auth/node'; -import type { Auth } from '@mosaic/auth'; +import type { Auth } from '@mosaicstack/auth'; import type { NestFastifyApplication } from '@nestjs/platform-fastify'; import { AUTH } from './auth.tokens.js'; diff --git a/apps/gateway/src/auth/auth.guard.ts b/apps/gateway/src/auth/auth.guard.ts index 0920a86..3c0b8b9 100644 --- a/apps/gateway/src/auth/auth.guard.ts +++ b/apps/gateway/src/auth/auth.guard.ts @@ -6,7 +6,7 @@ import { UnauthorizedException, } from '@nestjs/common'; import { fromNodeHeaders } from 'better-auth/node'; -import type { Auth } from '@mosaic/auth'; +import type { Auth } from '@mosaicstack/auth'; import type { FastifyRequest } from 'fastify'; import { AUTH } from './auth.tokens.js'; diff --git a/apps/gateway/src/auth/auth.module.ts b/apps/gateway/src/auth/auth.module.ts index abee1d0..83564c1 100644 --- a/apps/gateway/src/auth/auth.module.ts +++ b/apps/gateway/src/auth/auth.module.ts @@ -1,6 +1,6 @@ import { Global, Module } from '@nestjs/common'; -import { createAuth, type Auth } from '@mosaic/auth'; -import type { Db } from '@mosaic/db'; +import { createAuth, type Auth } from '@mosaicstack/auth'; +import type { Db } from '@mosaicstack/db'; import { DB } from '../database/database.module.js'; import { AUTH } from './auth.tokens.js'; import { SsoController } from './sso.controller.js'; diff --git a/apps/gateway/src/auth/sso.controller.ts b/apps/gateway/src/auth/sso.controller.ts index 6f9ef58..f71a062 100644 --- a/apps/gateway/src/auth/sso.controller.ts +++ b/apps/gateway/src/auth/sso.controller.ts @@ -1,5 +1,5 @@ import { Controller, Get } from '@nestjs/common'; -import { buildSsoDiscovery, type SsoProviderDiscovery } from '@mosaic/auth'; +import { buildSsoDiscovery, type SsoProviderDiscovery } from '@mosaicstack/auth'; @Controller('api/sso/providers') export class SsoController { diff --git a/apps/gateway/src/brain/brain.module.ts b/apps/gateway/src/brain/brain.module.ts index 93a730f..e11958a 100644 --- a/apps/gateway/src/brain/brain.module.ts +++ b/apps/gateway/src/brain/brain.module.ts @@ -1,6 +1,6 @@ import { Global, Module } from '@nestjs/common'; -import { createBrain, type Brain } from '@mosaic/brain'; -import type { Db } from '@mosaic/db'; +import { createBrain, type Brain } from '@mosaicstack/brain'; +import type { Db } from '@mosaicstack/db'; import { DB } from '../database/database.module.js'; import { BRAIN } from './brain.tokens.js'; diff --git a/apps/gateway/src/chat/chat.gateway.ts b/apps/gateway/src/chat/chat.gateway.ts index 7543fb4..fe0758c 100644 --- a/apps/gateway/src/chat/chat.gateway.ts +++ b/apps/gateway/src/chat/chat.gateway.ts @@ -11,15 +11,15 @@ import { } from '@nestjs/websockets'; import { Server, Socket } from 'socket.io'; import type { AgentSessionEvent } from '@mariozechner/pi-coding-agent'; -import type { Auth } from '@mosaic/auth'; -import type { Brain } from '@mosaic/brain'; +import type { Auth } from '@mosaicstack/auth'; +import type { Brain } from '@mosaicstack/brain'; import type { SetThinkingPayload, SlashCommandPayload, SystemReloadPayload, RoutingDecisionInfo, AbortPayload, -} from '@mosaic/types'; +} from '@mosaicstack/types'; import { AgentService, type ConversationHistoryMessage } from '../agent/agent.service.js'; import { AUTH } from '../auth/auth.tokens.js'; import { BRAIN } from '../brain/brain.tokens.js'; diff --git a/apps/gateway/src/commands/command-executor-p8012.spec.ts b/apps/gateway/src/commands/command-executor-p8012.spec.ts index 73b83ba..d098682 100644 --- a/apps/gateway/src/commands/command-executor-p8012.spec.ts +++ b/apps/gateway/src/commands/command-executor-p8012.spec.ts @@ -1,6 +1,6 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'; import { CommandExecutorService } from './command-executor.service.js'; -import type { SlashCommandPayload } from '@mosaic/types'; +import type { SlashCommandPayload } from '@mosaicstack/types'; // Minimal mock implementations const mockRegistry = { diff --git a/apps/gateway/src/commands/command-executor.service.ts b/apps/gateway/src/commands/command-executor.service.ts index e46b2b2..678f0c1 100644 --- a/apps/gateway/src/commands/command-executor.service.ts +++ b/apps/gateway/src/commands/command-executor.service.ts @@ -1,7 +1,7 @@ import { forwardRef, Inject, Injectable, Logger, Optional } from '@nestjs/common'; -import type { QueueHandle } from '@mosaic/queue'; -import type { Brain } from '@mosaic/brain'; -import type { SlashCommandPayload, SlashCommandResultPayload } from '@mosaic/types'; +import type { QueueHandle } from '@mosaicstack/queue'; +import type { Brain } from '@mosaicstack/brain'; +import type { SlashCommandPayload, SlashCommandResultPayload } from '@mosaicstack/types'; import { AgentService } from '../agent/agent.service.js'; import { ChatGateway } from '../chat/chat.gateway.js'; import { SessionGCService } from '../gc/session-gc.service.js'; diff --git a/apps/gateway/src/commands/command-registry.service.spec.ts b/apps/gateway/src/commands/command-registry.service.spec.ts index 5e92888..13d12dc 100644 --- a/apps/gateway/src/commands/command-registry.service.spec.ts +++ b/apps/gateway/src/commands/command-registry.service.spec.ts @@ -1,6 +1,6 @@ import { describe, it, expect, beforeEach } from 'vitest'; import { CommandRegistryService } from './command-registry.service.js'; -import type { CommandDef } from '@mosaic/types'; +import type { CommandDef } from '@mosaicstack/types'; const mockCmd: CommandDef = { name: 'test', diff --git a/apps/gateway/src/commands/command-registry.service.ts b/apps/gateway/src/commands/command-registry.service.ts index 5add850..ad5a316 100644 --- a/apps/gateway/src/commands/command-registry.service.ts +++ b/apps/gateway/src/commands/command-registry.service.ts @@ -1,5 +1,5 @@ import { Injectable, type OnModuleInit } from '@nestjs/common'; -import type { CommandDef, CommandManifest } from '@mosaic/types'; +import type { CommandDef, CommandManifest } from '@mosaicstack/types'; @Injectable() export class CommandRegistryService implements OnModuleInit { diff --git a/apps/gateway/src/commands/commands.integration.spec.ts b/apps/gateway/src/commands/commands.integration.spec.ts index 107d578..6571319 100644 --- a/apps/gateway/src/commands/commands.integration.spec.ts +++ b/apps/gateway/src/commands/commands.integration.spec.ts @@ -13,7 +13,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'; import { CommandRegistryService } from './command-registry.service.js'; import { CommandExecutorService } from './command-executor.service.js'; -import type { SlashCommandPayload } from '@mosaic/types'; +import type { SlashCommandPayload } from '@mosaicstack/types'; // ─── Mocks ─────────────────────────────────────────────────────────────────── diff --git a/apps/gateway/src/commands/commands.module.ts b/apps/gateway/src/commands/commands.module.ts index 08efcc4..1c3a82c 100644 --- a/apps/gateway/src/commands/commands.module.ts +++ b/apps/gateway/src/commands/commands.module.ts @@ -1,5 +1,5 @@ import { forwardRef, Inject, Module, type OnApplicationShutdown } from '@nestjs/common'; -import { createQueue, type QueueHandle } from '@mosaic/queue'; +import { createQueue, type QueueHandle } from '@mosaicstack/queue'; import { ChatModule } from '../chat/chat.module.js'; import { GCModule } from '../gc/gc.module.js'; import { ReloadModule } from '../reload/reload.module.js'; diff --git a/apps/gateway/src/config/config.module.ts b/apps/gateway/src/config/config.module.ts index 77e393c..5b65137 100644 --- a/apps/gateway/src/config/config.module.ts +++ b/apps/gateway/src/config/config.module.ts @@ -1,5 +1,5 @@ import { Global, Module } from '@nestjs/common'; -import { loadConfig, type MosaicConfig } from '@mosaic/config'; +import { loadConfig, type MosaicConfig } from '@mosaicstack/config'; export const MOSAIC_CONFIG = 'MOSAIC_CONFIG'; diff --git a/apps/gateway/src/conversations/conversations.controller.ts b/apps/gateway/src/conversations/conversations.controller.ts index 040be50..69dc869 100644 --- a/apps/gateway/src/conversations/conversations.controller.ts +++ b/apps/gateway/src/conversations/conversations.controller.ts @@ -15,7 +15,7 @@ import { Query, UseGuards, } from '@nestjs/common'; -import type { Brain } from '@mosaic/brain'; +import type { Brain } from '@mosaicstack/brain'; import { BRAIN } from '../brain/brain.tokens.js'; import { AuthGuard } from '../auth/auth.guard.js'; import { CurrentUser } from '../auth/current-user.decorator.js'; diff --git a/apps/gateway/src/coord/coord.service.ts b/apps/gateway/src/coord/coord.service.ts index 485e618..7ce7a9c 100644 --- a/apps/gateway/src/coord/coord.service.ts +++ b/apps/gateway/src/coord/coord.service.ts @@ -8,7 +8,7 @@ import { type MissionStatusSummary, type MissionTask, type TaskDetail, -} from '@mosaic/coord'; +} from '@mosaicstack/coord'; import { promises as fs } from 'node:fs'; import path from 'node:path'; diff --git a/apps/gateway/src/database/database.module.ts b/apps/gateway/src/database/database.module.ts index 530184c..bbd61de 100644 --- a/apps/gateway/src/database/database.module.ts +++ b/apps/gateway/src/database/database.module.ts @@ -2,9 +2,9 @@ import { mkdirSync } from 'node:fs'; import { homedir } from 'node:os'; import { join } from 'node:path'; import { Global, Inject, Module, type OnApplicationShutdown } from '@nestjs/common'; -import { createDb, createPgliteDb, type Db, type DbHandle } from '@mosaic/db'; -import { createStorageAdapter, type StorageAdapter } from '@mosaic/storage'; -import type { MosaicConfig } from '@mosaic/config'; +import { createDb, createPgliteDb, type Db, type DbHandle } from '@mosaicstack/db'; +import { createStorageAdapter, type StorageAdapter } from '@mosaicstack/storage'; +import type { MosaicConfig } from '@mosaicstack/config'; import { MOSAIC_CONFIG } from '../config/config.module.js'; export const DB_HANDLE = 'DB_HANDLE'; diff --git a/apps/gateway/src/gc/gc.module.ts b/apps/gateway/src/gc/gc.module.ts index bbd27ec..1f426d1 100644 --- a/apps/gateway/src/gc/gc.module.ts +++ b/apps/gateway/src/gc/gc.module.ts @@ -1,5 +1,5 @@ import { Module, type OnApplicationShutdown, Inject } from '@nestjs/common'; -import { createQueue, type QueueHandle } from '@mosaic/queue'; +import { createQueue, type QueueHandle } from '@mosaicstack/queue'; import { SessionGCService } from './session-gc.service.js'; import { REDIS } from './gc.tokens.js'; diff --git a/apps/gateway/src/gc/session-gc.service.spec.ts b/apps/gateway/src/gc/session-gc.service.spec.ts index 88e29e4..d92ac6a 100644 --- a/apps/gateway/src/gc/session-gc.service.spec.ts +++ b/apps/gateway/src/gc/session-gc.service.spec.ts @@ -1,7 +1,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'; import { Logger } from '@nestjs/common'; -import type { QueueHandle } from '@mosaic/queue'; -import type { LogService } from '@mosaic/log'; +import type { QueueHandle } from '@mosaicstack/queue'; +import type { LogService } from '@mosaicstack/log'; import { SessionGCService } from './session-gc.service.js'; type MockRedis = { diff --git a/apps/gateway/src/gc/session-gc.service.ts b/apps/gateway/src/gc/session-gc.service.ts index 67309b8..18d1e39 100644 --- a/apps/gateway/src/gc/session-gc.service.ts +++ b/apps/gateway/src/gc/session-gc.service.ts @@ -1,6 +1,6 @@ import { Inject, Injectable, Logger, type OnModuleInit } from '@nestjs/common'; -import type { QueueHandle } from '@mosaic/queue'; -import type { LogService } from '@mosaic/log'; +import type { QueueHandle } from '@mosaicstack/queue'; +import type { LogService } from '@mosaicstack/log'; import { LOG_SERVICE } from '../log/log.tokens.js'; import { REDIS } from './gc.tokens.js'; diff --git a/apps/gateway/src/log/log.controller.ts b/apps/gateway/src/log/log.controller.ts index 91ad6da..4aa8623 100644 --- a/apps/gateway/src/log/log.controller.ts +++ b/apps/gateway/src/log/log.controller.ts @@ -1,5 +1,5 @@ import { Body, Controller, Get, Inject, Param, Post, Query, UseGuards } from '@nestjs/common'; -import type { LogService } from '@mosaic/log'; +import type { LogService } from '@mosaicstack/log'; import { LOG_SERVICE } from './log.tokens.js'; import { AuthGuard } from '../auth/auth.guard.js'; import type { IngestLogDto, QueryLogsDto } from './log.dto.js'; diff --git a/apps/gateway/src/log/log.module.ts b/apps/gateway/src/log/log.module.ts index 6351784..38e3185 100644 --- a/apps/gateway/src/log/log.module.ts +++ b/apps/gateway/src/log/log.module.ts @@ -1,6 +1,6 @@ import { Global, Module } from '@nestjs/common'; -import { createLogService, type LogService } from '@mosaic/log'; -import type { Db } from '@mosaic/db'; +import { createLogService, type LogService } from '@mosaicstack/log'; +import type { Db } from '@mosaicstack/db'; import { DB } from '../database/database.module.js'; import { LOG_SERVICE } from './log.tokens.js'; import { LogController } from './log.controller.js'; diff --git a/apps/gateway/src/log/summarization.service.ts b/apps/gateway/src/log/summarization.service.ts index d53fb7d..87133c2 100644 --- a/apps/gateway/src/log/summarization.service.ts +++ b/apps/gateway/src/log/summarization.service.ts @@ -1,11 +1,11 @@ import { Inject, Injectable, Logger } from '@nestjs/common'; -import type { LogService } from '@mosaic/log'; -import type { Memory } from '@mosaic/memory'; +import type { LogService } from '@mosaicstack/log'; +import type { Memory } from '@mosaicstack/memory'; import { LOG_SERVICE } from './log.tokens.js'; import { MEMORY } from '../memory/memory.tokens.js'; import { EmbeddingService } from '../memory/embedding.service.js'; -import type { Db } from '@mosaic/db'; -import { sql, summarizationJobs } from '@mosaic/db'; +import type { Db } from '@mosaicstack/db'; +import { sql, summarizationJobs } from '@mosaicstack/db'; import { DB } from '../database/database.module.js'; const SUMMARIZATION_PROMPT = `You are a knowledge extraction assistant. Given the following agent interaction logs, extract the key decisions, learnings, and patterns. Output a concise summary (2-4 sentences) that captures the most important information for future reference. Focus on actionable insights, not raw events. diff --git a/apps/gateway/src/main.ts b/apps/gateway/src/main.ts index 701203e..571bdba 100644 --- a/apps/gateway/src/main.ts +++ b/apps/gateway/src/main.ts @@ -19,7 +19,7 @@ import { NestFactory } from '@nestjs/core'; import { Logger, ValidationPipe } from '@nestjs/common'; import { FastifyAdapter, type NestFastifyApplication } from '@nestjs/platform-fastify'; import helmet from '@fastify/helmet'; -import { listSsoStartupWarnings } from '@mosaic/auth'; +import { listSsoStartupWarnings } from '@mosaicstack/auth'; import { AppModule } from './app.module.js'; import { mountAuthHandler } from './auth/auth.controller.js'; import { mountMcpHandler } from './mcp/mcp.controller.js'; diff --git a/apps/gateway/src/mcp/mcp.controller.ts b/apps/gateway/src/mcp/mcp.controller.ts index b6a162d..55ad75e 100644 --- a/apps/gateway/src/mcp/mcp.controller.ts +++ b/apps/gateway/src/mcp/mcp.controller.ts @@ -1,7 +1,7 @@ import type { IncomingMessage, ServerResponse } from 'node:http'; import { Logger } from '@nestjs/common'; import { fromNodeHeaders } from 'better-auth/node'; -import type { Auth } from '@mosaic/auth'; +import type { Auth } from '@mosaicstack/auth'; import type { NestFastifyApplication } from '@nestjs/platform-fastify'; import type { McpService } from './mcp.service.js'; import { AUTH } from '../auth/auth.tokens.js'; diff --git a/apps/gateway/src/mcp/mcp.service.ts b/apps/gateway/src/mcp/mcp.service.ts index 65d0498..c32dfc0 100644 --- a/apps/gateway/src/mcp/mcp.service.ts +++ b/apps/gateway/src/mcp/mcp.service.ts @@ -3,8 +3,8 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js'; import { randomUUID } from 'node:crypto'; import { z } from 'zod'; -import type { Brain } from '@mosaic/brain'; -import type { Memory } from '@mosaic/memory'; +import type { Brain } from '@mosaicstack/brain'; +import type { Memory } from '@mosaicstack/memory'; import { BRAIN } from '../brain/brain.tokens.js'; import { MEMORY } from '../memory/memory.tokens.js'; import { EmbeddingService } from '../memory/embedding.service.js'; diff --git a/apps/gateway/src/memory/embedding.service.ts b/apps/gateway/src/memory/embedding.service.ts index 42e77b6..0ff15f1 100644 --- a/apps/gateway/src/memory/embedding.service.ts +++ b/apps/gateway/src/memory/embedding.service.ts @@ -1,5 +1,5 @@ import { Injectable, Logger } from '@nestjs/common'; -import type { EmbeddingProvider } from '@mosaic/memory'; +import type { EmbeddingProvider } from '@mosaicstack/memory'; // --------------------------------------------------------------------------- // Environment-driven configuration diff --git a/apps/gateway/src/memory/memory.controller.ts b/apps/gateway/src/memory/memory.controller.ts index b2179ed..fb0a913 100644 --- a/apps/gateway/src/memory/memory.controller.ts +++ b/apps/gateway/src/memory/memory.controller.ts @@ -12,7 +12,7 @@ import { Query, UseGuards, } from '@nestjs/common'; -import type { Memory } from '@mosaic/memory'; +import type { Memory } from '@mosaicstack/memory'; import { MEMORY } from './memory.tokens.js'; import { AuthGuard } from '../auth/auth.guard.js'; import { CurrentUser } from '../auth/current-user.decorator.js'; diff --git a/apps/gateway/src/memory/memory.module.ts b/apps/gateway/src/memory/memory.module.ts index 31aeef0..779ad40 100644 --- a/apps/gateway/src/memory/memory.module.ts +++ b/apps/gateway/src/memory/memory.module.ts @@ -5,10 +5,10 @@ import { createMemoryAdapter, type MemoryAdapter, type MemoryConfig, -} from '@mosaic/memory'; -import type { Db } from '@mosaic/db'; -import type { StorageAdapter } from '@mosaic/storage'; -import type { MosaicConfig } from '@mosaic/config'; +} from '@mosaicstack/memory'; +import type { Db } from '@mosaicstack/db'; +import type { StorageAdapter } from '@mosaicstack/storage'; +import type { MosaicConfig } from '@mosaicstack/config'; import { MOSAIC_CONFIG } from '../config/config.module.js'; import { DB, STORAGE_ADAPTER } from '../database/database.module.js'; import { MEMORY } from './memory.tokens.js'; diff --git a/apps/gateway/src/missions/missions.controller.ts b/apps/gateway/src/missions/missions.controller.ts index 7480fed..f422d90 100644 --- a/apps/gateway/src/missions/missions.controller.ts +++ b/apps/gateway/src/missions/missions.controller.ts @@ -12,7 +12,7 @@ import { Post, UseGuards, } from '@nestjs/common'; -import type { Brain } from '@mosaic/brain'; +import type { Brain } from '@mosaicstack/brain'; import { BRAIN } from '../brain/brain.tokens.js'; import { AuthGuard } from '../auth/auth.guard.js'; import { CurrentUser } from '../auth/current-user.decorator.js'; diff --git a/apps/gateway/src/plugin/plugin.module.ts b/apps/gateway/src/plugin/plugin.module.ts index b858728..3991c9b 100644 --- a/apps/gateway/src/plugin/plugin.module.ts +++ b/apps/gateway/src/plugin/plugin.module.ts @@ -6,8 +6,8 @@ import { type OnModuleDestroy, type OnModuleInit, } from '@nestjs/common'; -import { DiscordPlugin } from '@mosaic/discord-plugin'; -import { TelegramPlugin } from '@mosaic/telegram-plugin'; +import { DiscordPlugin } from '@mosaicstack/discord-plugin'; +import { TelegramPlugin } from '@mosaicstack/telegram-plugin'; import { PluginService } from './plugin.service.js'; import type { IChannelPlugin } from './plugin.interface.js'; import { PLUGIN_REGISTRY } from './plugin.tokens.js'; diff --git a/apps/gateway/src/preferences/preferences.service.spec.ts b/apps/gateway/src/preferences/preferences.service.spec.ts index 771bd65..06d2c64 100644 --- a/apps/gateway/src/preferences/preferences.service.spec.ts +++ b/apps/gateway/src/preferences/preferences.service.spec.ts @@ -1,6 +1,6 @@ import { describe, it, expect, vi } from 'vitest'; import { PreferencesService, PLATFORM_DEFAULTS, IMMUTABLE_KEYS } from './preferences.service.js'; -import type { Db } from '@mosaic/db'; +import type { Db } from '@mosaicstack/db'; /** * Build a mock Drizzle DB where the select chain supports: diff --git a/apps/gateway/src/preferences/preferences.service.ts b/apps/gateway/src/preferences/preferences.service.ts index 7df4fd0..efc51de 100644 --- a/apps/gateway/src/preferences/preferences.service.ts +++ b/apps/gateway/src/preferences/preferences.service.ts @@ -1,5 +1,5 @@ import { Inject, Injectable, Logger } from '@nestjs/common'; -import { eq, and, sql, type Db, preferences as preferencesTable } from '@mosaic/db'; +import { eq, and, sql, type Db, preferences as preferencesTable } from '@mosaicstack/db'; import { DB } from '../database/database.module.js'; export const PLATFORM_DEFAULTS: Record = { diff --git a/apps/gateway/src/preferences/system-override.service.ts b/apps/gateway/src/preferences/system-override.service.ts index e8ec51d..5fa48da 100644 --- a/apps/gateway/src/preferences/system-override.service.ts +++ b/apps/gateway/src/preferences/system-override.service.ts @@ -1,5 +1,5 @@ import { Injectable, Logger } from '@nestjs/common'; -import { createQueue, type QueueHandle } from '@mosaic/queue'; +import { createQueue, type QueueHandle } from '@mosaicstack/queue'; const SESSION_SYSTEM_KEY = (sessionId: string) => `mosaic:session:${sessionId}:system`; const SESSION_SYSTEM_FRAGMENTS_KEY = (sessionId: string) => diff --git a/apps/gateway/src/projects/projects.controller.ts b/apps/gateway/src/projects/projects.controller.ts index 4b98765..6bad982 100644 --- a/apps/gateway/src/projects/projects.controller.ts +++ b/apps/gateway/src/projects/projects.controller.ts @@ -13,7 +13,7 @@ import { Post, UseGuards, } from '@nestjs/common'; -import type { Brain } from '@mosaic/brain'; +import type { Brain } from '@mosaicstack/brain'; import { BRAIN } from '../brain/brain.tokens.js'; import { AuthGuard } from '../auth/auth.guard.js'; import { CurrentUser } from '../auth/current-user.decorator.js'; diff --git a/apps/gateway/src/queue/queue.module.ts b/apps/gateway/src/queue/queue.module.ts index 57bbcfd..39cc8ee 100644 --- a/apps/gateway/src/queue/queue.module.ts +++ b/apps/gateway/src/queue/queue.module.ts @@ -1,6 +1,6 @@ import { Global, Module } from '@nestjs/common'; -import { createQueueAdapter, type QueueAdapter } from '@mosaic/queue'; -import type { MosaicConfig } from '@mosaic/config'; +import { createQueueAdapter, type QueueAdapter } from '@mosaicstack/queue'; +import type { MosaicConfig } from '@mosaicstack/config'; import { MOSAIC_CONFIG } from '../config/config.module.js'; import { QueueService } from './queue.service.js'; diff --git a/apps/gateway/src/queue/queue.service.ts b/apps/gateway/src/queue/queue.service.ts index a807a75..a50a773 100644 --- a/apps/gateway/src/queue/queue.service.ts +++ b/apps/gateway/src/queue/queue.service.ts @@ -7,7 +7,7 @@ import { type OnModuleDestroy, } from '@nestjs/common'; import { Queue, Worker, type Job, type ConnectionOptions } from 'bullmq'; -import type { LogService } from '@mosaic/log'; +import type { LogService } from '@mosaicstack/log'; import { LOG_SERVICE } from '../log/log.tokens.js'; import type { JobDto, JobStatus } from './queue-admin.dto.js'; diff --git a/apps/gateway/src/reload/reload.controller.ts b/apps/gateway/src/reload/reload.controller.ts index 4b04e4c..98b5467 100644 --- a/apps/gateway/src/reload/reload.controller.ts +++ b/apps/gateway/src/reload/reload.controller.ts @@ -1,5 +1,5 @@ import { Controller, HttpCode, HttpStatus, Inject, Post, UseGuards } from '@nestjs/common'; -import type { SystemReloadPayload } from '@mosaic/types'; +import type { SystemReloadPayload } from '@mosaicstack/types'; import { AdminGuard } from '../admin/admin.guard.js'; import { ChatGateway } from '../chat/chat.gateway.js'; import { ReloadService } from './reload.service.js'; diff --git a/apps/gateway/src/reload/reload.service.ts b/apps/gateway/src/reload/reload.service.ts index c4ba60f..1d84e27 100644 --- a/apps/gateway/src/reload/reload.service.ts +++ b/apps/gateway/src/reload/reload.service.ts @@ -5,7 +5,7 @@ import { type OnApplicationBootstrap, type OnApplicationShutdown, } from '@nestjs/common'; -import type { SystemReloadPayload } from '@mosaic/types'; +import type { SystemReloadPayload } from '@mosaicstack/types'; import { CommandRegistryService } from '../commands/command-registry.service.js'; import { isMosaicPlugin } from './mosaic-plugin.interface.js'; diff --git a/apps/gateway/src/skills/skills.service.ts b/apps/gateway/src/skills/skills.service.ts index b015e0d..5e870ed 100644 --- a/apps/gateway/src/skills/skills.service.ts +++ b/apps/gateway/src/skills/skills.service.ts @@ -1,5 +1,5 @@ import { Inject, Injectable } from '@nestjs/common'; -import { eq, type Db, skills } from '@mosaic/db'; +import { eq, type Db, skills } from '@mosaicstack/db'; import { DB } from '../database/database.module.js'; type Skill = typeof skills.$inferSelect; diff --git a/apps/gateway/src/tasks/tasks.controller.ts b/apps/gateway/src/tasks/tasks.controller.ts index 7796715..2cd1593 100644 --- a/apps/gateway/src/tasks/tasks.controller.ts +++ b/apps/gateway/src/tasks/tasks.controller.ts @@ -14,7 +14,7 @@ import { Query, UseGuards, } from '@nestjs/common'; -import type { Brain } from '@mosaic/brain'; +import type { Brain } from '@mosaicstack/brain'; import { BRAIN } from '../brain/brain.tokens.js'; import { AuthGuard } from '../auth/auth.guard.js'; import { CurrentUser } from '../auth/current-user.decorator.js'; diff --git a/apps/gateway/src/workspace/project-bootstrap.service.ts b/apps/gateway/src/workspace/project-bootstrap.service.ts index c803239..e565590 100644 --- a/apps/gateway/src/workspace/project-bootstrap.service.ts +++ b/apps/gateway/src/workspace/project-bootstrap.service.ts @@ -1,5 +1,5 @@ import { Inject, Injectable, Logger } from '@nestjs/common'; -import type { Brain } from '@mosaic/brain'; +import type { Brain } from '@mosaicstack/brain'; import { BRAIN } from '../brain/brain.tokens.js'; import { PluginService } from '../plugin/plugin.service.js'; import { WorkspaceService } from './workspace.service.js'; diff --git a/apps/gateway/src/workspace/teams.service.ts b/apps/gateway/src/workspace/teams.service.ts index 597e36e..77d2ccb 100644 --- a/apps/gateway/src/workspace/teams.service.ts +++ b/apps/gateway/src/workspace/teams.service.ts @@ -1,5 +1,5 @@ import { Inject, Injectable, Logger } from '@nestjs/common'; -import { eq, and, type Db, teams, teamMembers, projects } from '@mosaic/db'; +import { eq, and, type Db, teams, teamMembers, projects } from '@mosaicstack/db'; import { DB } from '../database/database.module.js'; @Injectable() diff --git a/apps/gateway/tsconfig.typecheck.json b/apps/gateway/tsconfig.typecheck.json index 7db24a7..1eadff8 100644 --- a/apps/gateway/tsconfig.typecheck.json +++ b/apps/gateway/tsconfig.typecheck.json @@ -4,15 +4,15 @@ "rootDir": "../..", "baseUrl": ".", "paths": { - "@mosaic/auth": ["../../packages/auth/src/index.ts"], - "@mosaic/brain": ["../../packages/brain/src/index.ts"], - "@mosaic/coord": ["../../packages/coord/src/index.ts"], - "@mosaic/db": ["../../packages/db/src/index.ts"], - "@mosaic/log": ["../../packages/log/src/index.ts"], - "@mosaic/memory": ["../../packages/memory/src/index.ts"], - "@mosaic/types": ["../../packages/types/src/index.ts"], - "@mosaic/discord-plugin": ["../../plugins/discord/src/index.ts"], - "@mosaic/telegram-plugin": ["../../plugins/telegram/src/index.ts"] + "@mosaicstack/auth": ["../../packages/auth/src/index.ts"], + "@mosaicstack/brain": ["../../packages/brain/src/index.ts"], + "@mosaicstack/coord": ["../../packages/coord/src/index.ts"], + "@mosaicstack/db": ["../../packages/db/src/index.ts"], + "@mosaicstack/log": ["../../packages/log/src/index.ts"], + "@mosaicstack/memory": ["../../packages/memory/src/index.ts"], + "@mosaicstack/types": ["../../packages/types/src/index.ts"], + "@mosaicstack/discord-plugin": ["../../plugins/discord/src/index.ts"], + "@mosaicstack/telegram-plugin": ["../../plugins/telegram/src/index.ts"] } } } diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts index 316492d..58479de 100644 --- a/apps/web/next.config.ts +++ b/apps/web/next.config.ts @@ -2,7 +2,7 @@ import type { NextConfig } from 'next'; const nextConfig: NextConfig = { output: 'standalone', - transpilePackages: ['@mosaic/design-tokens'], + transpilePackages: ['@mosaicstack/design-tokens'], // Enable gzip/brotli compression for all responses. compress: true, diff --git a/apps/web/package.json b/apps/web/package.json index c7e9f4a..519f64a 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -1,5 +1,5 @@ { - "name": "@mosaic/web", + "name": "@mosaicstack/web", "version": "0.0.2", "private": true, "scripts": { @@ -12,7 +12,7 @@ "start": "next start" }, "dependencies": { - "@mosaic/design-tokens": "workspace:^", + "@mosaicstack/design-tokens": "workspace:^", "better-auth": "^1.5.5", "clsx": "^2.1.0", "next": "^16.0.0", diff --git a/apps/web/playwright.config.ts b/apps/web/playwright.config.ts index 372a3ad..aaf0420 100644 --- a/apps/web/playwright.config.ts +++ b/apps/web/playwright.config.ts @@ -7,7 +7,7 @@ import { defineConfig, devices } from '@playwright/test'; * - Next.js web app running on http://localhost:3000 * - NestJS gateway running on http://localhost:14242 * - * Run with: pnpm --filter @mosaic/web test:e2e + * Run with: pnpm --filter @mosaicstack/web test:e2e */ export default defineConfig({ testDir: './e2e', diff --git a/docs/PERFORMANCE.md b/docs/PERFORMANCE.md index ca9b1b0..499320a 100644 --- a/docs/PERFORMANCE.md +++ b/docs/PERFORMANCE.md @@ -153,7 +153,7 @@ for any `` components added in the future. ```bash # Run the DB migration (requires a live DB) -pnpm --filter @mosaic/db exec drizzle-kit migrate +pnpm --filter @mosaicstack/db exec drizzle-kit migrate # Or, in Docker/Swarm — migrations run automatically on gateway startup # via runMigrations() in packages/db/src/migrate.ts diff --git a/docs/PRD-TUI_Improvements.md b/docs/PRD-TUI_Improvements.md index 49c57d0..e190b5b 100644 --- a/docs/PRD-TUI_Improvements.md +++ b/docs/PRD-TUI_Improvements.md @@ -57,7 +57,7 @@ Multi-panel layout with keyboard navigation. - **Ink 5** (React for CLI) — already in deps - **Component architecture** — break monolithic `app.tsx` into composable components -- **Typed Socket.IO events** — leverage `@mosaic/types` `ServerToClientEvents` / `ClientToServerEvents` +- **Typed Socket.IO events** — leverage `@mosaicstack/types` `ServerToClientEvents` / `ClientToServerEvents` - **Local state only** (Wave 1) — cwd/branch read from `process.cwd()` and `git` at startup - **Gateway metadata** (future) — extend socket handshake or add REST endpoint for model info, token usage diff --git a/docs/PRD.md b/docs/PRD.md index 0a81554..6f204bb 100644 --- a/docs/PRD.md +++ b/docs/PRD.md @@ -8,7 +8,7 @@ - **Best-Guess Mode:** true - Repo (target): `git.mosaicstack.dev/mosaic/mosaic-stack` - Baseline: `~/src/jarvis-old` (jarvis v0.2.0) -- Package source: `~/src/mosaic-mono-v0` (@mosaic/\* packages) +- Package source: `~/src/mosaic-mono-v0` (@mosaicstack/\* packages) - Agent harness: [pi](https://github.com/badlogic/pi-mono) (v0.57.1) - Remote control reference: [OpenClaw](https://github.com/openclaw/openclaw) (upstream, canonical) @@ -16,7 +16,7 @@ ## Problem Statement -Jarvis (v0.2.0) is a self-hosted AI assistant with a Python FastAPI backend and Next.js frontend. It handles chat, projects, tasks, and LLM routing but lacks orchestration depth, agent coordination, shared memory, and remote access. The Mosaic framework (`~/.config/mosaic`) provides agent guides, shell-based orchestration tools, and quality rails — but these are loose scripts, not an integrated platform. The `@mosaic/*` packages in mosaic-mono-v0 began consolidating these into TypeScript packages (brain, queue, coord, cli, prdy, quality-rails) but have no UI, no auth, and no agent runtime integration. +Jarvis (v0.2.0) is a self-hosted AI assistant with a Python FastAPI backend and Next.js frontend. It handles chat, projects, tasks, and LLM routing but lacks orchestration depth, agent coordination, shared memory, and remote access. The Mosaic framework (`~/.config/mosaic`) provides agent guides, shell-based orchestration tools, and quality rails — but these are loose scripts, not an integrated platform. The `@mosaicstack/*` packages in mosaic-mono-v0 began consolidating these into TypeScript packages (brain, queue, coord, cli, prdy, quality-rails) but have no UI, no auth, and no agent runtime integration. **The gap:** Three codebases with overlapping concerns, no unified runtime, no remote control surface (Discord/Telegram), no gateway orchestrator, and a Python backend that doesn't align with the target TypeScript-everywhere stack. @@ -32,7 +32,7 @@ Jarvis (v0.2.0) is a self-hosted AI assistant with a Python FastAPI backend and 4. **Gateway orchestrator** — Central routing layer that dispatches tasks to appropriate agents based on capability, cost, and context 5. **Shared memory** — PostgreSQL canonical store + vector DB for semantic search + tiered log summarization to prevent context creep 6. **Multi-user with SSO** — BetterAuth with Authentik/WorkOS/Keycloak SSO, RBAC for family/team/business use -7. **Full @mosaic/\* package integration** — brain, queue, coord, mosaic, prdy, quality-rails, cli all integrated +7. **Full @mosaicstack/\* package integration** — brain, queue, coord, mosaic, prdy, quality-rails, cli all integrated 8. **Extensible** — MCP capability, skill import interface, plugin architecture for LLM providers and remote channels --- @@ -44,7 +44,7 @@ Jarvis (v0.2.0) is a self-hosted AI assistant with a Python FastAPI backend and 1. Chat/conversation UI (web) — carry forward from jarvis-old, rewrite frontend to work with new backend 2. Pi TUI integration — terminal-based agent interaction using Pi SDK 3. Web dashboard — settings, task management, projects, PRDs, missions, agent status -4. Gateway orchestrator (`@mosaic/gateway`) — central dispatch for agent tasks with routing logic +4. Gateway orchestrator (`@mosaicstack/gateway`) — central dispatch for agent tasks with routing logic 5. Task management — CRUD, kanban, mission-scoped tasks, dependency tracking 6. Project management — projects, milestones, PRDs linked to missions 7. Shared memory system — learned preferences, behaviors, defaults; tiered storage with summarization @@ -55,13 +55,13 @@ Jarvis (v0.2.0) is a self-hosted AI assistant with a Python FastAPI backend and 12. Agent routing — task-based model/provider selection (cost/capability matrix) 13. MCP capability — server and client, tool registration 14. Skill import interface — browse, install, manage agent skills -15. `@mosaic/brain` — structured data layer (migrated to PG + vector DB backend) -16. `@mosaic/queue` — Valkey-backed task queue with MCP tools -17. `@mosaic/coord` — mission coordination engine -18. `@mosaic/mosaic` — install wizard / bootstrap -19. `@mosaic/prdy` — PRD wizard -20. `@mosaic/quality-rails` — code quality scaffolder -21. `@mosaic/cli` — unified `mosaic` CLI +15. `@mosaicstack/brain` — structured data layer (migrated to PG + vector DB backend) +16. `@mosaicstack/queue` — Valkey-backed task queue with MCP tools +17. `@mosaicstack/coord` — mission coordination engine +18. `@mosaicstack/mosaic` — install wizard / bootstrap +19. `@mosaicstack/prdy` — PRD wizard +20. `@mosaicstack/quality-rails` — code quality scaffolder +21. `@mosaicstack/cli` — unified `mosaic` CLI 22. Docker Compose deployment + bare-metal capability 23. Agent log service — ingest, parse, tier, summarize agent interaction logs @@ -94,14 +94,14 @@ Jarvis (v0.2.0) is a self-hosted AI assistant with a Python FastAPI backend and │ └──────────────┴───────┬───────┴────────────────┘ │ │ │ │ │ ┌─────────▼──────────┐ │ -│ │ @mosaic/gateway │ ← Central Orchestrator│ +│ │ @mosaicstack/gateway │ ← Central Orchestrator│ │ │ (NestJS+Fastify) │ │ │ └────┬────┬────┬─────┘ │ │ │ │ │ │ │ ┌──────────────┤ │ ├──────────────┐ │ │ │ │ │ │ │ │ │ ┌───────▼──────┐ ┌────▼────▼──┐ │ ┌───────────▼────────┐ │ -│ │ @mosaic/brain│ │ @mosaic/ │ │ │ Agent Pool │ │ +│ │ @mosaicstack/brain│ │ @mosaicstack/ │ │ │ Agent Pool │ │ │ │ (Data Layer) │ │ queue │ │ │ (Pi SDK sessions) │ │ │ └───────┬──────┘ └────────────┘ │ │ - Anthropic │ │ │ │ │ │ - Codex │ │ @@ -111,12 +111,12 @@ Jarvis (v0.2.0) is a self-hosted AI assistant with a Python FastAPI backend and │ └──────────────┴───────────┘ │ │ - llama.cpp │ │ │ │ └────────────────────┘ │ │ ┌─────────────▼──────┐ │ -│ │ @mosaic/coord │ │ +│ │ @mosaicstack/coord │ │ │ │ Mission lifecycle │ │ │ └────────────────────┘ │ │ │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ │ -│ │ @mosaic/cli │ │ @mosaic/prdy │ │ @mosaic/ │ │ +│ │ @mosaicstack/cli │ │ @mosaicstack/prdy │ │ @mosaicstack/ │ │ │ │ │ │ │ │ quality-rails │ │ │ └──────────────┘ └──────────────┘ └──────────────────┘ │ │ │ @@ -130,20 +130,20 @@ Jarvis (v0.2.0) is a self-hosted AI assistant with a Python FastAPI backend and | Layer | Technology | Rationale | | ------------------ | ------------------------------------ | ----------------------------------------------------------------------------------------------------------- | -| **Web Frontend** | Next.js 16 + React 19 + Tailwind CSS | SSR, RSC; design tokens from @mosaic/design-tokens (mosaic-stack-website) | +| **Web Frontend** | Next.js 16 + React 19 + Tailwind CSS | SSR, RSC; design tokens from @mosaicstack/design-tokens (mosaic-stack-website) | | **API / Gateway** | NestJS + Fastify adapter | Module system, DI, guards/interceptors for complex gateway; Fastify performance underneath | | **Agent Runtime** | Pi SDK (embedded) | Extensible harness with tools, skills, session management | | **TUI** | Pi interactive mode | Native terminal agent interaction | | **Auth** | BetterAuth + SSO adapters | Multi-user RBAC with Authentik/WorkOS/Keycloak | | **Database** | PostgreSQL 17 + pgvector | Canonical store; pgvector for embedding search | -| **Vector DB** | pgvector + VectorStore interface | pgvector for v0.1.0; `VectorStore` abstraction in @mosaic/memory makes Qdrant a drop-in later | -| **Cache / Queue** | Valkey 8 | Redis-compatible; proven in @mosaic/queue | +| **Vector DB** | pgvector + VectorStore interface | pgvector for v0.1.0; `VectorStore` abstraction in @mosaicstack/memory makes Qdrant a drop-in later | +| **Cache / Queue** | Valkey 8 | Redis-compatible; proven in @mosaicstack/queue | | **ORM** | Drizzle ORM | TypeScript-native, lightweight, good migration story | -| **Validation** | Zod | Already used across @mosaic/\* packages | +| **Validation** | Zod | Already used across @mosaicstack/\* packages | | **Build** | pnpm workspaces + Turborepo | Proven in both jarvis-old and mosaic-mono-v0 | | **Testing** | Vitest + Playwright | Unit/integration via Vitest, E2E via Playwright | | **Remote Control** | Discord.js + Telegraf | Inspired by OpenClaw plugin architecture | -| **MCP** | @modelcontextprotocol/sdk | Already used in @mosaic/brain and @mosaic/queue | +| **MCP** | @modelcontextprotocol/sdk | Already used in @mosaicstack/brain and @mosaicstack/queue | | **Container** | Docker Compose | Self-hosted; bare-metal also supported | | **CI** | Woodpecker CI | Existing infrastructure at git.mosaicstack.dev | | **Observability** | OpenTelemetry + SigNoz | Wide-event logging from day one; OTEL auto-instrumentation for NestJS/PG/HTTP; SigNoz as all-in-one backend | @@ -158,12 +158,12 @@ The jarvis-old FastAPI backend is not carried forward as code. Its domain logic Instead of a custom LLM provider abstraction (jarvis-old's `BaseLLMProvider`), Pi SDK manages agent sessions. Pi handles model selection, tool calling, context management, and compaction. The gateway dispatches work to Pi sessions configured with appropriate providers. **AD-3: Gateway as the central nervous system (NestJS + Fastify adapter)** -`@mosaic/gateway` is the single API surface. The web app, TUI, Discord, and Telegram all talk to the gateway. The gateway routes to brain (data), queue (coordination), agent pool (LLM work), and coord (mission lifecycle). This replaces the direct FastAPI-to-DB pattern from jarvis-old. +`@mosaicstack/gateway` is the single API surface. The web app, TUI, Discord, and Telegram all talk to the gateway. The gateway routes to brain (data), queue (coordination), agent pool (LLM work), and coord (mission lifecycle). This replaces the direct FastAPI-to-DB pattern from jarvis-old. -NestJS was chosen over raw Fastify because the gateway is inherently complex — it hosts channel plugins, agent pool management, routing engine, WebSocket hub, MCP server, auth middleware, and integrates brain, queue, memory, and log services. NestJS provides the module system, dependency injection, guards, and interceptors needed to organize this cleanly. NestJS uses Fastify as its HTTP adapter, so Fastify's performance is preserved. This also aligns with the stated stack preference in USER.md ("NestJS API + Next.js web"). @mosaic/brain's existing Fastify code migrates naturally into a NestJS module with Fastify adapter. +NestJS was chosen over raw Fastify because the gateway is inherently complex — it hosts channel plugins, agent pool management, routing engine, WebSocket hub, MCP server, auth middleware, and integrates brain, queue, memory, and log services. NestJS provides the module system, dependency injection, guards, and interceptors needed to organize this cleanly. NestJS uses Fastify as its HTTP adapter, so Fastify's performance is preserved. This also aligns with the stated stack preference in USER.md ("NestJS API + Next.js web"). @mosaicstack/brain's existing Fastify code migrates naturally into a NestJS module with Fastify adapter. **AD-4: Brain migrates from JSON files to PostgreSQL** -`@mosaic/brain` currently uses a JSON file store. For Mosaic Stack, brain's data model (tasks, projects, events, agents, missions, tickets) moves to PostgreSQL via Drizzle ORM. Brain's REST + MCP interface is preserved — only the storage backend changes. +`@mosaicstack/brain` currently uses a JSON file store. For Mosaic Stack, brain's data model (tasks, projects, events, agents, missions, tickets) moves to PostgreSQL via Drizzle ORM. Brain's REST + MCP interface is preserved — only the storage backend changes. **AD-5: Tiered memory with summarization** Agent interaction logs are ingested into a log service. Raw logs are stored short-term. A summarization pipeline (using a cheap LLM) periodically compresses logs into structured insights stored in the vector DB. This prevents unbounded log growth while preserving searchable context. @@ -189,8 +189,8 @@ The gateway includes a cron scheduler for recurring tasks: log summarization run **AD-12: Web search tool (DuckDuckGo MCP)** Agent sessions include a web search tool for information retrieval. DuckDuckGo via MCP server is the primary option (privacy-respecting, no API key required). Falls back to other search MCP providers if configured. Registered as a standard MCP tool available to all agent sessions. -**AD-13: Design system from @mosaic/design-tokens** -The web dashboard uses the Mosaic Stack design system established in `mosaic-stack-website`. The `@mosaic/design-tokens` package provides CSS custom properties, Tailwind preset, and TS color/font/radius exports. Dark theme default with light theme support. Fonts: Outfit (sans), Fira Code (mono). Color palette: deep blue-grays with blue/purple/teal accents. +**AD-13: Design system from @mosaicstack/design-tokens** +The web dashboard uses the Mosaic Stack design system established in `mosaic-stack-website`. The `@mosaicstack/design-tokens` package provides CSS custom properties, Tailwind preset, and TS color/font/radius exports. Dark theme default with light theme support. Fonts: Outfit (sans), Fira Code (mono). Color palette: deep blue-grays with blue/purple/teal accents. **AD-14: Multi-tier deployment readiness** Code is structured assuming eventual multi-node deployment with dedicated roles (gateway nodes, agent worker nodes, brain/DB nodes). Packages communicate via well-defined APIs (HTTP/WS/MCP), not in-process calls where avoidable. Service boundaries are clean: gateway is stateless (state in PG/Valkey), agent pool can scale independently, brain is a separate service. v0.1.0 runs single-node; the architecture doesn't fight horizontal scaling later. @@ -205,25 +205,25 @@ Code is structured assuming eventual multi-node deployment with dedicated roles mosaic-mono-v1/ ├── apps/ │ ├── web/ Next.js 16 web dashboard -│ └── gateway/ @mosaic/gateway — NestJS API + WebSocket +│ └── gateway/ @mosaicstack/gateway — NestJS API + WebSocket ├── packages/ -│ ├── types/ @mosaic/types — shared type contracts -│ ├── brain/ @mosaic/brain — data layer (PG-backed) -│ ├── queue/ @mosaic/queue — Valkey task queue + MCP -│ ├── coord/ @mosaic/coord — mission coordination -│ ├── mosaic/ @mosaic/mosaic — install wizard -│ ├── prdy/ @mosaic/prdy — PRD wizard -│ ├── quality-rails/ @mosaic/quality-rails — code quality scaffolder -│ ├── cli/ @mosaic/cli — unified CLI -│ ├── auth/ @mosaic/auth — BetterAuth config + SSO adapters -│ ├── db/ @mosaic/db — Drizzle schema, migrations, connection -│ ├── agent/ @mosaic/agent — Pi SDK integration, agent pool manager -│ ├── memory/ @mosaic/memory — tiered memory + summarization service -│ ├── log/ @mosaic/log — agent log ingest + processing -│ └── design-tokens/ @mosaic/design-tokens — CSS vars, Tailwind preset, colors +│ ├── types/ @mosaicstack/types — shared type contracts +│ ├── brain/ @mosaicstack/brain — data layer (PG-backed) +│ ├── queue/ @mosaicstack/queue — Valkey task queue + MCP +│ ├── coord/ @mosaicstack/coord — mission coordination +│ ├── mosaic/ @mosaicstack/mosaic — install wizard +│ ├── prdy/ @mosaicstack/prdy — PRD wizard +│ ├── quality-rails/ @mosaicstack/quality-rails — code quality scaffolder +│ ├── cli/ @mosaicstack/cli — unified CLI +│ ├── auth/ @mosaicstack/auth — BetterAuth config + SSO adapters +│ ├── db/ @mosaicstack/db — Drizzle schema, migrations, connection +│ ├── agent/ @mosaicstack/agent — Pi SDK integration, agent pool manager +│ ├── memory/ @mosaicstack/memory — tiered memory + summarization service +│ ├── log/ @mosaicstack/log — agent log ingest + processing +│ └── design-tokens/ @mosaicstack/design-tokens — CSS vars, Tailwind preset, colors ├── plugins/ -│ ├── discord/ @mosaic/discord-plugin — Discord channel -│ └── telegram/ @mosaic/telegram-plugin — Telegram channel +│ ├── discord/ @mosaicstack/discord-plugin — Discord channel +│ └── telegram/ @mosaicstack/telegram-plugin — Telegram channel ├── docker/ │ ├── gateway.Dockerfile │ ├── web.Dockerfile @@ -244,7 +244,7 @@ mosaic-mono-v1/ ### Package Responsibilities -#### `apps/gateway` — @mosaic/gateway (NEW — critical path) +#### `apps/gateway` — @mosaicstack/gateway (NEW — critical path) The central nervous system. All clients connect here. Built with NestJS (Fastify adapter). @@ -303,7 +303,7 @@ Carried forward from jarvis-old with significant refactoring. - User management (admin RBAC panel) - Auth pages (login, SSO redirect, registration) -#### `packages/types` — @mosaic/types +#### `packages/types` — @mosaicstack/types Migrated from mosaic-mono-v0. Extended with: @@ -313,7 +313,7 @@ Migrated from mosaic-mono-v0. Extended with: - Memory types (preference, insight, summary) - Plugin channel types (Discord, Telegram message mapping) -#### `packages/brain` — @mosaic/brain +#### `packages/brain` — @mosaicstack/brain Migrated from mosaic-mono-v0. **Storage backend changes from JSON to PostgreSQL.** @@ -324,7 +324,7 @@ Migrated from mosaic-mono-v0. **Storage backend changes from JSON to PostgreSQL. - New: computed endpoints (today, stale, stats, search, audit) run against PG - New: appreciation collection preserved for family use -#### `packages/queue` — @mosaic/queue +#### `packages/queue` — @mosaicstack/queue Migrated from mosaic-mono-v0 with minimal changes. @@ -332,7 +332,7 @@ Migrated from mosaic-mono-v0 with minimal changes. - MCP server with 8 tools - Used by gateway for agent task dispatch and coordination -#### `packages/coord` — @mosaic/coord +#### `packages/coord` — @mosaicstack/coord Migrated from mosaic-mono-v0. @@ -342,7 +342,7 @@ Migrated from mosaic-mono-v0. - Continuation prompt generation - Integration with gateway for mission-driven orchestration -#### `packages/db` — @mosaic/db (NEW) +#### `packages/db` — @mosaicstack/db (NEW) Shared database package. @@ -351,7 +351,7 @@ Shared database package. - Connection pool configuration - Shared by gateway, brain, auth, memory -#### `packages/auth` — @mosaic/auth (NEW) +#### `packages/auth` — @mosaicstack/auth (NEW) Authentication and authorization. @@ -361,7 +361,7 @@ Authentication and authorization. - API key generation for brain/MCP access - Session management middleware -#### `packages/agent` — @mosaic/agent (NEW — critical path) +#### `packages/agent` — @mosaicstack/agent (NEW — critical path) Pi SDK integration layer. @@ -372,7 +372,7 @@ Pi SDK integration layer. - Skill management — loads and configures Pi skills for agent sessions - Session lifecycle — create, monitor, complete, fail, timeout -#### `packages/memory` — @mosaic/memory (NEW) +#### `packages/memory` — @mosaicstack/memory (NEW) Tiered memory system. @@ -382,7 +382,7 @@ Tiered memory system. - Summarization pipeline — compress raw logs into structured insights - Memory API — used by gateway and agent sessions -#### `packages/log` — @mosaic/log (NEW) +#### `packages/log` — @mosaicstack/log (NEW) Agent log service. @@ -392,7 +392,7 @@ Agent log service. - Summarization trigger — invokes cheap LLM to compress aging logs - Retention policy — configurable TTLs per tier -#### `packages/mosaic` — @mosaic/mosaic +#### `packages/mosaic` — @mosaicstack/mosaic Migrated from mosaic-mono-v0, updated for v1. @@ -400,7 +400,7 @@ Migrated from mosaic-mono-v0, updated for v1. - Detects existing installations, offers upgrade path - Configures `~/.config/mosaic/` with guides, tools, runtime configs -#### `packages/prdy` — @mosaic/prdy +#### `packages/prdy` — @mosaicstack/prdy Migrated from mosaic-mono-v0. @@ -408,7 +408,7 @@ Migrated from mosaic-mono-v0. - Template-based PRD creation with Zod validation - CLI integration via `mosaic prdy` -#### `packages/quality-rails` — @mosaic/quality-rails +#### `packages/quality-rails` — @mosaicstack/quality-rails Migrated from mosaic-mono-v0. @@ -416,15 +416,15 @@ Migrated from mosaic-mono-v0. - Generates ESLint, tsconfig, Woodpecker, husky, lint-staged configs - Supports project types: monorepo, typescript-node, nextjs -#### `packages/cli` — @mosaic/cli +#### `packages/cli` — @mosaicstack/cli Migrated from mosaic-mono-v0, extended. - Unified `mosaic` binary - Subcommands: `mosaic coord`, `mosaic prdy`, `mosaic queue`, `mosaic quality`, `mosaic gateway`, `mosaic brain` -- Plugin discovery for installed @mosaic/\* packages +- Plugin discovery for installed @mosaicstack/\* packages -#### `plugins/discord` — @mosaic/discord-plugin (NEW — high priority) +#### `plugins/discord` — @mosaicstack/discord-plugin (NEW — high priority) Discord remote control channel. Architecture inspired by OpenClaw (https://github.com/openclaw/openclaw). @@ -436,7 +436,7 @@ Discord remote control channel. Architecture inspired by OpenClaw (https://githu - Bot pairing and permission management (Discord user → Mosaic user mapping) - DM support for private conversations -#### `plugins/telegram` — @mosaic/telegram-plugin (NEW) +#### `plugins/telegram` — @mosaicstack/telegram-plugin (NEW) Telegram remote control channel. @@ -547,7 +547,7 @@ Telegram remote control channel. - WebSocket hub — real-time updates for chat, agent status, notifications - Rate limiting and request validation -### FR-3: Agent Pool (@mosaic/agent) +### FR-3: Agent Pool (@mosaicstack/agent) - Manage concurrent Pi SDK sessions - Provider configuration: API key management, endpoint URLs, model lists @@ -582,7 +582,7 @@ Telegram remote control channel. - Mission CRUD (linked to project and PRD) - Mission tasks with phases, dependencies, ordering - Mission summary with computed progress -- Mission coordination via @mosaic/coord +- Mission coordination via @mosaicstack/coord - Active mission dashboard in web UI ### FR-7: Memory System @@ -844,7 +844,7 @@ Telegram remote control channel. - [ ] Database migrations run automatically on first start - [ ] `.env.example` documents all required configuration -### AC-11: @mosaic/\* Packages +### AC-11: @mosaicstack/\* Packages - [ ] All 7 migrated packages build, pass tests, and integrate with gateway - [ ] `mosaic` CLI provides subcommands for each package @@ -870,7 +870,7 @@ Telegram remote control channel. | Risk | Likelihood | Impact | Mitigation | | -------------------------------------------------- | ---------- | ------ | ---------------------------------------------------------------------------------------- | -| Pi SDK API instability (pre-1.0) | Medium | High | Pin version, abstract behind @mosaic/agent interface | +| Pi SDK API instability (pre-1.0) | Medium | High | Pin version, abstract behind @mosaicstack/agent interface | | Brain PG migration complexity | Medium | Medium | Preserve Brain REST/MCP API contract; only storage changes | | Discord plugin complexity (OpenClaw has ~60 files) | Medium | Medium | Start minimal (DM + mention in channel), single-guild only; expand iteratively post-beta | | LLM provider subscription auth varies by provider | Medium | Medium | Abstract behind provider interface; implement per-provider adapters | @@ -882,7 +882,7 @@ Telegram remote control channel. | # | Question | Priority | Status | | --- | ------------------------------------------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| 1 | Pi SDK version to pin for v0.1.0? | High | ✅ Resolved — Pin `@mariozechner/pi-coding-agent@~0.57.1` (current stable). Abstract behind `@mosaic/agent` interface to insulate from breaking changes. Bump deliberately after testing. | +| 1 | Pi SDK version to pin for v0.1.0? | High | ✅ Resolved — Pin `@mariozechner/pi-coding-agent@~0.57.1` (current stable). Abstract behind `@mosaicstack/agent` interface to insulate from breaking changes. Bump deliberately after testing. | | 2 | Authentik vs WorkOS vs Keycloak — which SSO provider to implement first? | Medium | ✅ Resolved — Authentik first (already in Jason's infrastructure) | | 3 | Vector DB: pgvector sufficient or need Qdrant from the start? | Medium | ✅ Resolved — pgvector with VectorStore interface abstraction. Qdrant drops in later if needed. | | 4 | Summarization LLM: which model for log compression? | Medium | ✅ Resolved — Haiku-tier default with structured output guardrails, configurable via routing engine. | @@ -910,9 +910,9 @@ All work is **alpha** (< 0.1.0) until Jason approves 0.1.0 beta release. ### Phase 0: Foundation (v0.0.1) - Scaffold monorepo (pnpm + turbo + tsconfig + eslint + vitest) -- `@mosaic/types` — migrate and extend from v0 -- `@mosaic/db` — Drizzle schema, PG connection, migrations -- `@mosaic/auth` — BetterAuth setup with email/password +- `@mosaicstack/types` — migrate and extend from v0 +- `@mosaicstack/db` — Drizzle schema, PG connection, migrations +- `@mosaicstack/auth` — BetterAuth setup with email/password - OTEL foundation — `@opentelemetry/sdk-node` setup, SigNoz in docker-compose, trace propagation wired - Docker Compose (PG 17 + Valkey + SigNoz) - CI pipeline (Woodpecker) @@ -921,19 +921,19 @@ All work is **alpha** (< 0.1.0) until Jason approves 0.1.0 beta release. ### Phase 1: Core API (v0.0.2) - `apps/gateway` — NestJS server (Fastify adapter), auth middleware, health endpoints -- `@mosaic/brain` — migrate from v0, swap JSON store for PG via @mosaic/db -- `@mosaic/queue` — migrate from v0 (minimal changes) +- `@mosaicstack/brain` — migrate from v0, swap JSON store for PG via @mosaicstack/db +- `@mosaicstack/queue` — migrate from v0 (minimal changes) - Gateway routes: conversations, tasks, projects, missions - WebSocket server for chat streaming - Basic agent dispatch (single provider, no routing) ### Phase 2: Agent Layer (v0.0.3) -- `@mosaic/agent` — Pi SDK integration, agent pool manager +- `@mosaicstack/agent` — Pi SDK integration, agent pool manager - Multi-provider support (Anthropic + Ollama minimum) - Agent routing engine (cost/capability matrix) - Tool registration (brain, queue, memory tools injected into agent sessions) -- `@mosaic/coord` — migrate from v0, integrate with gateway +- `@mosaicstack/coord` — migrate from v0, integrate with gateway ### Phase 3: Web Dashboard (v0.0.4) @@ -946,25 +946,25 @@ All work is **alpha** (< 0.1.0) until Jason approves 0.1.0 beta release. ### Phase 4: Memory & Intelligence (v0.0.5) -- `@mosaic/memory` — preference store, insight store, semantic search -- `@mosaic/log` — log ingest, parsing, tiered storage +- `@mosaicstack/memory` — preference store, insight store, semantic search +- `@mosaicstack/log` — log ingest, parsing, tiered storage - Summarization pipeline - Memory integration into agent sessions - Skill management interface (web UI + CLI) ### Phase 5: Remote Control (v0.0.6) -- `@mosaic/discord-plugin` — Discord channel plugin -- `@mosaic/telegram-plugin` — Telegram channel plugin +- `@mosaicstack/discord-plugin` — Discord channel plugin +- `@mosaicstack/telegram-plugin` — Telegram channel plugin - Plugin host in gateway - SSO configuration (Authentik) ### Phase 6: CLI & Tools (v0.0.7) -- `@mosaic/cli` — unified CLI with all subcommands -- `@mosaic/prdy` — migrate from v0 -- `@mosaic/quality-rails` — migrate from v0 -- `@mosaic/mosaic` — install wizard updated for v1 +- `@mosaicstack/cli` — unified CLI with all subcommands +- `@mosaicstack/prdy` — migrate from v0 +- `@mosaicstack/quality-rails` — migrate from v0 +- `@mosaicstack/mosaic` — install wizard updated for v1 - Pi TUI integration (`mosaic tui`) ### Phase 7: Polish & Beta (v0.0.8 → v0.1.0) @@ -982,11 +982,11 @@ All work is **alpha** (< 0.1.0) until Jason approves 0.1.0 beta release. ## Assumptions -1. RESOLVED: **pgvector is sufficient** for semantic search at v0.1.0 scale (personal/family/team = thousands to low hundreds-of-thousands of vectors). `@mosaic/memory` defines a `VectorStore` interface with pgvector as the default adapter. The interface boundary makes Qdrant a drop-in migration if PG resource contention or scale demands it later. Zero additional infrastructure for v0.1.0. Rationale: Reduces ops burden; pgvector HNSW indexes are fast at this scale; interface abstraction costs almost nothing now. +1. RESOLVED: **pgvector is sufficient** for semantic search at v0.1.0 scale (personal/family/team = thousands to low hundreds-of-thousands of vectors). `@mosaicstack/memory` defines a `VectorStore` interface with pgvector as the default adapter. The interface boundary makes Qdrant a drop-in migration if PG resource contention or scale demands it later. Zero additional infrastructure for v0.1.0. Rationale: Reduces ops burden; pgvector HNSW indexes are fast at this scale; interface abstraction costs almost nothing now. 2. RESOLVED: **Authentik is the first SSO provider** — confirmed, already running in Jason's infrastructure. WorkOS and Keycloak adapters follow in Phase 7. -3. RESOLVED: **NestJS with Fastify adapter for the gateway.** The gateway's complexity (plugin host, agent pool, routing engine, WebSocket hub, MCP server, auth, brain/queue/memory/log integration) warrants NestJS's module system, DI, and guards. Fastify performance preserved via adapter. Aligns with USER.md stated stack ("NestJS API + Next.js web"). @mosaic/brain's Fastify code migrates into a NestJS module. +3. RESOLVED: **NestJS with Fastify adapter for the gateway.** The gateway's complexity (plugin host, agent pool, routing engine, WebSocket hub, MCP server, auth, brain/queue/memory/log integration) warrants NestJS's module system, DI, and guards. Fastify performance preserved via adapter. Aligns with USER.md stated stack ("NestJS API + Next.js web"). @mosaicstack/brain's Fastify code migrates into a NestJS module. 4. RESOLVED: **OpenTelemetry from Phase 0.** Wide-event logging is required from the start. OTEL auto-instrumentation for NestJS/PG/HTTP via `@opentelemetry/sdk-node`. SigNoz as the all-in-one OTEL backend (single Docker service). Every significant operation emits structured events with rich context. Custom spans for agent dispatch, routing decisions, memory writes. Rationale: Retrofitting observability is painful; baking it in from day one means consistent instrumentation across all services. @@ -1002,4 +1002,4 @@ All work is **alpha** (< 0.1.0) until Jason approves 0.1.0 beta release. 10. ASSUMPTION: **Conversations and messages get their own PG tables** (not stored in brain's entity model). They follow a chat-specific schema with proper foreign keys to users and projects. Rationale: Chat has different access patterns (streaming, pagination, search) than brain entities. -11. RESOLVED: **Pi handles all target LLM providers natively.** Anthropic, OpenAI/Codex, Z.ai, Ollama, LM Studio, and llama.cpp are all supported via Pi's built-in providers or `models.json` configuration with `openai-completions` API type. No custom provider adapters needed in @mosaic/agent — only configuration management. +11. RESOLVED: **Pi handles all target LLM providers natively.** Anthropic, OpenAI/Codex, Z.ai, Ollama, LM Studio, and llama.cpp are all supported via Pi's built-in providers or `models.json` configuration with `openai-completions` API type. No custom provider adapters needed in @mosaicstack/agent — only configuration management. diff --git a/docs/SSO-PROVIDERS.md b/docs/SSO-PROVIDERS.md index 14c8cc5..2cc6981 100644 --- a/docs/SSO-PROVIDERS.md +++ b/docs/SSO-PROVIDERS.md @@ -108,4 +108,4 @@ The web login page renders provider buttons from `NEXT_PUBLIC_*_ENABLED` flags. ## Failure mode -Provider config is optional, but partial config is rejected at startup. If any provider-specific env var is present without the full required set, `@mosaic/auth` throws a bootstrap error with the missing keys instead of silently registering a broken provider. +Provider config is optional, but partial config is rejected at startup. If any provider-specific env var is present without the full required set, `@mosaicstack/auth` throws a bootstrap error with the missing keys instead of silently registering a broken provider. diff --git a/docs/TASKS-TUI_Improvements.md b/docs/TASKS-TUI_Improvements.md index f3d9757..93659c9 100644 --- a/docs/TASKS-TUI_Improvements.md +++ b/docs/TASKS-TUI_Improvements.md @@ -91,7 +91,7 @@ packages/cli/src/tui/ ```bash cd /home/jwoltje/src/mosaic-mono-v1-worktrees/tui-improvements -pnpm --filter @mosaic/cli exec tsx src/cli.ts tui +pnpm --filter @mosaicstack/cli exec tsx src/cli.ts tui # or after build: node packages/cli/dist/cli.js tui --gateway http://localhost:14242 ``` @@ -99,7 +99,7 @@ node packages/cli/dist/cli.js tui --gateway http://localhost:14242 ### Quality Gates ```bash -pnpm --filter @mosaic/cli typecheck && pnpm --filter @mosaic/cli lint -pnpm --filter @mosaic/gateway typecheck && pnpm --filter @mosaic/gateway lint -pnpm --filter @mosaic/types typecheck +pnpm --filter @mosaicstack/cli typecheck && pnpm --filter @mosaicstack/cli lint +pnpm --filter @mosaicstack/gateway typecheck && pnpm --filter @mosaicstack/gateway lint +pnpm --filter @mosaicstack/types typecheck ``` diff --git a/docs/TASKS.md b/docs/TASKS.md index 326585b..27f0140 100644 --- a/docs/TASKS.md +++ b/docs/TASKS.md @@ -12,9 +12,9 @@ | SA-P1-002 | done | sonnet | Define StorageAdapter interface in packages/storage/src/types.ts | 3K | | SA-P1-003 | done | sonnet | Define MemoryAdapter interface in packages/memory/src/types.ts | 3K | | SA-P1-004 | done | sonnet | Create adapter factory pattern + config types | 3K | -| SA-P2-001 | done | sonnet | Refactor @mosaic/queue: wrap ioredis as BullMQ adapter | 3K | -| SA-P2-002 | done | sonnet | Create @mosaic/storage: wrap Drizzle as Postgres adapter | 6K | -| SA-P2-003 | done | sonnet | Refactor @mosaic/memory: extract pgvector adapter | 4K | +| SA-P2-001 | done | sonnet | Refactor @mosaicstack/queue: wrap ioredis as BullMQ adapter | 3K | +| SA-P2-002 | done | sonnet | Create @mosaicstack/storage: wrap Drizzle as Postgres adapter | 6K | +| SA-P2-003 | done | sonnet | Refactor @mosaicstack/memory: extract pgvector adapter | 4K | | SA-P2-004 | done | sonnet | Update gateway modules to use factories + DI tokens | 5K | | SA-P2-005 | done | opus | Verify Phase 2: all tests pass, typecheck clean | — | | SA-P3-001 | done | sonnet | Implement local queue adapter: JSON file persistence | 5K | diff --git a/docs/design/storage-abstraction-middleware.md b/docs/design/storage-abstraction-middleware.md index 82db7fc..0d2232b 100644 --- a/docs/design/storage-abstraction-middleware.md +++ b/docs/design/storage-abstraction-middleware.md @@ -12,9 +12,9 @@ context: Agents coupled directly to infrastructure backends, bypassing intended Current packages are **direct adapters**, not **middleware**: | Package | Current State | Intended Design | |---------|---------------|-----------------| -| `@mosaic/queue` | `ioredis` hardcoded | Interface → BullMQ OR local-files | -| `@mosaic/db` | Drizzle + Postgres hardcoded | Interface → Postgres OR SQLite OR JSON/MD | -| `@mosaic/memory` | pgvector required | Interface → pgvector OR sqlite-vec OR keyword-search | +| `@mosaicstack/queue` | `ioredis` hardcoded | Interface → BullMQ OR local-files | +| `@mosaicstack/db` | Drizzle + Postgres hardcoded | Interface → Postgres OR SQLite OR JSON/MD | +| `@mosaicstack/memory` | pgvector required | Interface → pgvector OR sqlite-vec OR keyword-search | ## The gateway and TUI import these packages directly, which means they they're coupled to specific infrastructure. Users cannot run Mosaic Stack without Postgres + Valkey. @@ -46,15 +46,15 @@ The gateway imports the interface, not the backend. At startup it reads config a ```typescript // What should have happened: -gateway/queue.service.ts → @mosaic/queue (interface) → queue.adapter.ts +gateway/queue.service.ts → @mosaicstack/queue (interface) → queue.adapter.ts // What actually happened: -gateway/queue.service.ts → @mosaic/queue → ioredis (hardcoded) +gateway/queue.service.ts → @mosaicstack/queue → ioredis (hardcoded) ``` ## The Current State Analysis -### `@mosaic/queue` (packages/queue/src/queue.ts) +### `@mosaicstack/queue` (packages/queue/src/queue.ts) ```typescript import Redis from 'ioredis'; // ← Direct import of backend @@ -68,7 +68,7 @@ export function createQueue(config?: QueueConfig): QueueHandle { **Problem:** `ioredis` is imported in the package, not the adapter interface. Consumers cannot swap backends. -### `@mosaic/db` (packages/db/src/client.ts) +### `@mosaicstack/db` (packages/db/src/client.ts) ```typescript import { drizzle, type PostgresJsDatabase } from 'drizzle-orm/postgres-js'; @@ -84,10 +84,10 @@ export function createDb(url?: string): DbHandle { **Problem:** Drizzle + Postgres is hardcoded. No SQLite, JSON, or file-based options. -### `@mosaic/memory` (packages/memory/src/memory.ts) +### `@mosaicstack/memory` (packages/memory/src/memory.ts) ```typescript -import type { Db } from '@mosaic/db'; // ← Depends on Drizzle/PG +import type { Db } from '@mosaicstack/db'; // ← Depends on Drizzle/PG export function createMemory(db: Db): Memory { return { @@ -97,7 +97,7 @@ export function createMemory(db: Db): Memory { } ``` -**Problem:** Memory package is tightly coupled to `@mosaic/db` (which is Postgres-only). No alternative storage backends. +**Problem:** Memory package is tightly coupled to `@mosaicstack/db` (which is Postgres-only). No alternative storage backends. ## The Target Interfaces @@ -361,7 +361,7 @@ Automated equivalent to Claude Code's "Dream: Memory Consolidation" cycle **Implementation:** ```typescript -// In @mosaic/dream (new package) +// In @mosaicstack/dream (new package) export async function runDreamCycle(config: DreamConfig): Promise { const memory = await loadMemoryAdapter(config.storage); @@ -420,7 +420,7 @@ export async function runDreamCycle(config: DreamConfig): Promise { 2. Move Drizzle logic to `packages/storage/src/adapters/postgres.ts` 3. Create SQLite adapter in `packages/storage/src/adapters/sqlite.ts` 4. Update gateway to use storage factory -5. Deprecate direct `@mosaic/db` imports +5. Deprecate direct `@mosaicstack/db` imports #### 2.3 Memory Refactor @@ -488,7 +488,7 @@ packages/ │ │ ├── types.ts # StorageAdapter interface │ │ ├── index.ts # Factory function │ │ └── adapters/ -│ │ ├── postgres.ts # MOVED from @mosaic/db +│ │ ├── postgres.ts # MOVED from @mosaicstack/db │ │ ├── sqlite.ts # NEW: SQLite adapter │ │ └── files.ts # NEW: JSON/MD adapter │ └── package.json @@ -530,9 +530,9 @@ packages/ ## Breaking Changes -1. **`@mosaic/db`** → **`@mosaic/storage`** (with migration guide) -2. Direct `ioredis` imports → Use `@mosaic/queue` factory -3. Direct `pgvector` queries → Use `@mosaic/memory` factory +1. **`@mosaicstack/db`** → **`@mosaicstack/storage`** (with migration guide) +2. Direct `ioredis` imports → Use `@mosaicstack/queue` factory +3. Direct `pgvector` queries → Use `@mosaicstack/memory` factory 4. Gateway startup now requires storage config (defaults to local) ## Non-Breaking Migration Path diff --git a/docs/guides/deployment.md b/docs/guides/deployment.md index fb64393..1ea0f6c 100644 --- a/docs/guides/deployment.md +++ b/docs/guides/deployment.md @@ -61,7 +61,7 @@ pnpm install ### 4. Initialize the database ```bash -pnpm --filter @mosaic/db db:migrate +pnpm --filter @mosaicstack/db db:migrate ``` ### 5. Build all packages @@ -73,7 +73,7 @@ pnpm build ### 6. Start the gateway ```bash -pnpm --filter @mosaic/gateway dev +pnpm --filter @mosaicstack/gateway dev ``` Or for production (after build): @@ -86,10 +86,10 @@ node apps/gateway/dist/main.js ```bash # Development -pnpm --filter @mosaic/web dev +pnpm --filter @mosaicstack/web dev # Production (after build) -pnpm --filter @mosaic/web start +pnpm --filter @mosaicstack/web start ``` The web app runs on port `3000` by default. @@ -157,7 +157,7 @@ pnpm build ### Step 5 — Run database migrations ```bash -pnpm --filter @mosaic/db db:migrate +pnpm --filter @mosaicstack/db db:migrate ``` ### Step 6 — Start the gateway diff --git a/docs/guides/dev-guide.md b/docs/guides/dev-guide.md index a8249a4..3f317bd 100644 --- a/docs/guides/dev-guide.md +++ b/docs/guides/dev-guide.md @@ -129,7 +129,7 @@ The gateway loads `.env` from the monorepo root via `dotenv` at startup ### 4. Push the Database Schema ```bash -pnpm --filter @mosaic/db db:push +pnpm --filter @mosaicstack/db db:push ``` This applies the Drizzle schema directly to the database (development only; use @@ -138,7 +138,7 @@ migrations in production). ### 5. Start the Gateway ```bash -pnpm --filter @mosaic/gateway exec tsx src/main.ts +pnpm --filter @mosaicstack/gateway exec tsx src/main.ts ``` The gateway starts on port `14242` by default. @@ -146,7 +146,7 @@ The gateway starts on port `14242` by default. ### 6. Start the Web App ```bash -pnpm --filter @mosaic/web dev +pnpm --filter @mosaicstack/web dev ``` The web app starts on port `3000` by default. @@ -359,7 +359,7 @@ The `insights` table uses a `vector(1536)` column (pgvector) for semantic search Apply schema changes directly to the dev database (no migration files created): ```bash -pnpm --filter @mosaic/db db:push +pnpm --filter @mosaicstack/db db:push ``` ### Generating Migrations @@ -367,7 +367,7 @@ pnpm --filter @mosaic/db db:push For production-safe, versioned changes: ```bash -pnpm --filter @mosaic/db db:generate +pnpm --filter @mosaicstack/db db:generate ``` This creates a new SQL migration file in `packages/db/drizzle/`. @@ -375,7 +375,7 @@ This creates a new SQL migration file in `packages/db/drizzle/`. ### Running Migrations ```bash -pnpm --filter @mosaic/db db:migrate +pnpm --filter @mosaicstack/db db:migrate ``` ### Drizzle Config @@ -387,8 +387,8 @@ directory are defined there. 1. Add the table definition to `packages/db/src/schema.ts`. 2. Export it from `packages/db/src/index.ts`. -3. Run `pnpm --filter @mosaic/db db:push` (dev) or - `pnpm --filter @mosaic/db db:generate && pnpm --filter @mosaic/db db:migrate` +3. Run `pnpm --filter @mosaicstack/db db:push` (dev) or + `pnpm --filter @mosaicstack/db db:generate && pnpm --filter @mosaicstack/db db:migrate` (production). --- diff --git a/docs/guides/user-guide.md b/docs/guides/user-guide.md index 8e9029c..2e09fd7 100644 --- a/docs/guides/user-guide.md +++ b/docs/guides/user-guide.md @@ -160,11 +160,11 @@ The `mosaic` CLI provides a terminal interface to the same gateway API. ### Installation -The CLI ships as part of the `@mosaic/cli` package: +The CLI ships as part of the `@mosaicstack/cli` package: ```bash # From the monorepo root -pnpm --filter @mosaic/cli build +pnpm --filter @mosaicstack/cli build node packages/cli/dist/cli.js --help ``` diff --git a/docs/plans/2026-03-13-gateway-security-hardening.md b/docs/plans/2026-03-13-gateway-security-hardening.md index d7dacf1..016a2b8 100644 --- a/docs/plans/2026-03-13-gateway-security-hardening.md +++ b/docs/plans/2026-03-13-gateway-security-hardening.md @@ -23,7 +23,7 @@ **Step 2: Run test to verify it fails** -Run: `pnpm --filter @mosaic/gateway test -- src/chat/__tests__/chat-security.test.ts src/__tests__/resource-ownership.test.ts` +Run: `pnpm --filter @mosaicstack/gateway test -- src/chat/__tests__/chat-security.test.ts src/__tests__/resource-ownership.test.ts` Expected: FAIL on current DTO/helper mismatch. @@ -56,7 +56,7 @@ Run the same command and require green. **Step 3: Run targeted tests** -Run: `pnpm --filter @mosaic/gateway test -- src/chat/__tests__/chat-security.test.ts src/__tests__/resource-ownership.test.ts` +Run: `pnpm --filter @mosaicstack/gateway test -- src/chat/__tests__/chat-security.test.ts src/__tests__/resource-ownership.test.ts` Expected: PASS. diff --git a/docs/plans/2026-03-15-agent-platform-architecture.md b/docs/plans/2026-03-15-agent-platform-architecture.md index adb632c..889ce53 100644 --- a/docs/plans/2026-03-15-agent-platform-architecture.md +++ b/docs/plans/2026-03-15-agent-platform-architecture.md @@ -26,7 +26,7 @@ This plan establishes the foundational architecture for these systems. 4. **Hot reload** — soft-restart the gateway to load new plugins/skills/commands without dropping connections 5. **Local primitives** — baseline commands that work even when disconnected from the gateway 6. **Workspaces** — structured, git-backed, per-user/per-project filesystem layout with chroot isolation -7. **Task orchestration** — unified `@mosaic/queue` layer bridging PG, workspace files, and Valkey for agent task assignment +7. **Task orchestration** — unified `@mosaicstack/queue` layer bridging PG, workspace files, and Valkey for agent task assignment 8. **Session garbage collection** — three-tier GC (session, sweep, full cold-start) across Valkey, PG, and filesystem --- @@ -220,7 +220,7 @@ Without `onUnload`, hot-reload is impossible — would leak listeners, duplicate --- -## Type Contracts (`@mosaic/types`) +## Type Contracts (`@mosaicstack/types`) ### CommandDef — Gateway Command Manifest Entry @@ -407,7 +407,7 @@ The condensation step is a lightweight LLM call (cheap model, small context) tha ### Using Existing Queue Package -The `@mosaic/queue` package already provides `createQueue()` returning an ioredis handle on `redis://localhost:6380`. The `/system` storage will use the same Valkey instance directly via the redis handle — no queue semantics needed, just `SET`/`GET`/`DEL`/`EXPIRE`. +The `@mosaicstack/queue` package already provides `createQueue()` returning an ioredis handle on `redis://localhost:6380`. The `/system` storage will use the same Valkey instance directly via the redis handle — no queue semantics needed, just `SET`/`GET`/`DEL`/`EXPIRE`. --- @@ -415,7 +415,7 @@ The `@mosaic/queue` package already provides `createQueue()` returning an ioredi ### Storage -Postgres via `@mosaic/db`. The `preferences` table already exists in `packages/db/src/schema.ts` with the right shape: +Postgres via `@mosaicstack/db`. The `preferences` table already exists in `packages/db/src/schema.ts` with the right shape: ```typescript // Existing schema — already has category + key + value JSONB @@ -620,7 +620,7 @@ Aliases are resolved in `findCommand()` before manifest lookup. ### Phase 1: Types + Local Command Parsing (no gateway changes) -1. Add `CommandDef`, `CommandManifest`, new socket events to `@mosaic/types` +1. Add `CommandDef`, `CommandManifest`, new socket events to `@mosaicstack/types` 2. Add `parseSlashCommand()` utility to `packages/cli` 3. Add `role: 'system'` to `Message` type, render system messages in `MessageList` 4. Implement local-only commands: `/help`, `/stop`, `/cost`, `/status` (local state only) @@ -639,7 +639,7 @@ Aliases are resolved in `findCommand()` before manifest lookup. ### Phase 3: Preferences & System Overrides -1. Create `user_preferences` table in `@mosaic/db`, Drizzle schema + migration +1. Create `user_preferences` table in `@mosaicstack/db`, Drizzle schema + migration 2. Create `PreferencesService` in gateway — CRUD + defaults + enforcement logic 3. Implement `/preferences` command (REST-executed) 4. Implement `/system` command — Valkey storage, session-scoped @@ -1159,7 +1159,7 @@ Additional tool sets needed for workspace workflows: - **Docker/Portainer tools** — container management, deployment - These are registered as additional `ToolDefinition[]` sets, same pattern as existing tools -`@mosaic/prdy` already provides the PRD wizard tooling — the workspace structure gives it a canonical output location (`docs/PRD-.md`). +`@mosaicstack/prdy` already provides the PRD wizard tooling — the workspace structure gives it a canonical output location (`docs/PRD-.md`). ### Task Queue & Orchestration @@ -1167,19 +1167,19 @@ Additional tool sets needed for workspace workflows: There are currently two parallel systems for task management: -1. **`@mosaic/coord`** (file-based) — missions stored as `mission.json`, tasks in `TASKS.md`, file locks, session tracking, subprocess spawning. Built for single-machine orchestrator pattern. +1. **`@mosaicstack/coord`** (file-based) — missions stored as `mission.json`, tasks in `TASKS.md`, file locks, session tracking, subprocess spawning. Built for single-machine orchestrator pattern. 2. **PG tables** (`tasks`, `mission_tasks`, `missions`) — DB-backed CRUD with status, priority, assignee, project/mission FKs. Exposed via REST API and Brain repos. -These are not connected. `@mosaic/coord` reads/writes files. The DB tables are managed via MissionsController. An agent using `coord_mission_status` gets file-based data; the dashboard shows DB data. +These are not connected. `@mosaicstack/coord` reads/writes files. The DB tables are managed via MissionsController. An agent using `coord_mission_status` gets file-based data; the dashboard shows DB data. -#### Vision: `@mosaic/queue` as the Unified Task Layer +#### Vision: `@mosaicstack/queue` as the Unified Task Layer -`@mosaic/queue` becomes the task orchestration service — not just a Valkey queue primitive, but the coordinator between agents, DB, and workspace files: +`@mosaicstack/queue` becomes the task orchestration service — not just a Valkey queue primitive, but the coordinator between agents, DB, and workspace files: ``` ┌──────────────────────────────────────────────┐ -│ @mosaic/queue │ +│ @mosaicstack/queue │ │ (Task Orchestration Service) │ │ │ │ ┌─────────────────┐ ┌──────────────────┐ │ @@ -1217,21 +1217,21 @@ These are not connected. `@mosaic/coord` reads/writes files. The DB tables are m 6. Agent completes → updates status via queue service → PG updated + file synced + lock released 7. Gateway/orchestrator monitors progress, assigns next based on dependencies -**Flatfile fallback:** If no PG configured, queue service writes to flatfiles in workspace (JSON task manifests). Preserves the `@mosaic/coord` file-based pattern for single-machine, no-DB deployments. +**Flatfile fallback:** If no PG configured, queue service writes to flatfiles in workspace (JSON task manifests). Preserves the `@mosaicstack/coord` file-based pattern for single-machine, no-DB deployments. **What this replaces:** -- `@mosaic/coord`'s file-only task tracking → unified DB+file via queue service +- `@mosaicstack/coord`'s file-only task tracking → unified DB+file via queue service - Direct PG CRUD for task status → routed through queue service for consistency - Manual task assignment → queue-based distribution with agent claiming **What this preserves:** - `TASKS.md` file format — still the agent-readable working copy -- Mission structure from `@mosaic/coord` — creation, milestones, sessions -- `@mosaic/prdy` PRD workflow — writes to `docs/`, syncs metadata to DB +- Mission structure from `@mosaicstack/coord` — creation, milestones, sessions +- `@mosaicstack/prdy` PRD workflow — writes to `docs/`, syncs metadata to DB -> **Note:** This is a significant refactor of `@mosaic/coord` + `@mosaic/queue`. Warrants its own dedicated plan alongside the Gatekeeper plan. +> **Note:** This is a significant refactor of `@mosaicstack/coord` + `@mosaicstack/queue`. Warrants its own dedicated plan alongside the Gatekeeper plan. ### Chroot Agent Sandboxing @@ -1271,7 +1271,7 @@ The following topics are significant enough to warrant their own dedicated plan | Plan | Stub File | Scope | | -------------------------- | -------------------------------------- | -------------------------------------------------------------------------------------------------- | | **Gatekeeper Service** | `docs/plans/gatekeeper-service.md` | PR review/merge agent, quality gates, CI integration, trust boundary design | -| **Task Queue Unification** | `docs/plans/task-queue-unification.md` | `@mosaic/queue` refactor, `@mosaic/coord` consolidation, DB+file sync, flatfile fallback | +| **Task Queue Unification** | `docs/plans/task-queue-unification.md` | `@mosaicstack/queue` refactor, `@mosaicstack/coord` consolidation, DB+file sync, flatfile fallback | | **Chroot Sandboxing** | `docs/plans/chroot-sandboxing.md` | Chroot environment provisioning, capability management, Docker integration, namespace alternatives | --- @@ -1447,7 +1447,7 @@ TUI requests fresh commands:manifest (reflects new provider availability) ### Implementation Notes - Gateway stores poll state in Valkey: `mosaic:auth:poll:` with 5-min TTL -- `clipboardy` used for clipboard write in TUI (add as dep to `@mosaic/cli` if not already present) +- `clipboardy` used for clipboard write in TUI (add as dep to `@mosaicstack/cli` if not already present) - On success, gateway emits a fresh `commands:manifest` via socket (reflects provider now connected) --- @@ -1463,8 +1463,8 @@ mutable: boolean('mutable').notNull().default(true), Generate and apply: ```bash -pnpm --filter @mosaic/db db:generate # generates migration SQL -pnpm --filter @mosaic/db db:migrate # applies to PG +pnpm --filter @mosaicstack/db db:generate # generates migration SQL +pnpm --filter @mosaicstack/db db:migrate # applies to PG ``` Platform enforcement keys (seeded with `mutable = false` by gateway `PreferencesService.onModuleInit()`): diff --git a/docs/plans/2026-03-15-wave2-tui-layout-navigation.md b/docs/plans/2026-03-15-wave2-tui-layout-navigation.md index cb33414..791e63b 100644 --- a/docs/plans/2026-03-15-wave2-tui-layout-navigation.md +++ b/docs/plans/2026-03-15-wave2-tui-layout-navigation.md @@ -6,7 +6,7 @@ **Architecture:** The TUI gains a sidebar panel for conversation management (list/create/switch) fetched via REST from the gateway. A `useConversations` hook manages REST calls. A `useScrollableViewport` hook wraps the message list with virtual viewport logic. An app-level focus/mode state machine (`useAppMode`) controls which panel receives input. All new socket events for conversation listing use the existing REST API (`GET /api/conversations`). -**Tech Stack:** Ink 5, React 18, socket.io-client, fetch (for REST), @mosaic/types +**Tech Stack:** Ink 5, React 18, socket.io-client, fetch (for REST), @mosaicstack/types --- @@ -125,7 +125,7 @@ export function useViewport(opts: UseViewportOptions): UseViewportReturn { **Step 2: Typecheck** -Run: `pnpm --filter @mosaic/cli typecheck` +Run: `pnpm --filter @mosaicstack/cli typecheck` Expected: PASS **Step 3: Commit** @@ -195,7 +195,7 @@ Note: Ink's `useInput` key object supports `pageUp`, `pageDown`. For Home/End, c **Step 3: Typecheck and lint** -Run: `pnpm --filter @mosaic/cli typecheck && pnpm --filter @mosaic/cli lint` +Run: `pnpm --filter @mosaicstack/cli typecheck && pnpm --filter @mosaicstack/cli lint` Expected: PASS **Step 4: Commit** @@ -354,7 +354,7 @@ export function useConversations(opts: UseConversationsOptions): UseConversation **Step 2: Typecheck** -Run: `pnpm --filter @mosaic/cli typecheck` +Run: `pnpm --filter @mosaicstack/cli typecheck` Expected: PASS **Step 3: Commit** @@ -415,7 +415,7 @@ export function useAppMode(): UseAppModeReturn { **Step 2: Typecheck** -Run: `pnpm --filter @mosaic/cli typecheck` +Run: `pnpm --filter @mosaicstack/cli typecheck` Expected: PASS **Step 3: Commit** @@ -555,7 +555,7 @@ export function Sidebar({ **Step 2: Typecheck** -Run: `pnpm --filter @mosaic/cli typecheck` +Run: `pnpm --filter @mosaicstack/cli typecheck` Expected: PASS **Step 3: Commit** @@ -636,7 +636,7 @@ const clearMessages = useCallback(() => { **Step 3: Typecheck and lint** -Run: `pnpm --filter @mosaic/cli typecheck && pnpm --filter @mosaic/cli lint` +Run: `pnpm --filter @mosaicstack/cli typecheck && pnpm --filter @mosaicstack/cli lint` Expected: PASS **Step 4: Commit** @@ -739,7 +739,7 @@ In `bottom-bar.tsx`, add a hints line above the status lines (or integrate into **Step 3: Typecheck and lint** -Run: `pnpm --filter @mosaic/cli typecheck && pnpm --filter @mosaic/cli lint` +Run: `pnpm --filter @mosaicstack/cli typecheck && pnpm --filter @mosaicstack/cli lint` Expected: PASS **Step 4: Commit** @@ -919,7 +919,7 @@ In `message-list.tsx`: **Step 2: Typecheck and lint** -Run: `pnpm --filter @mosaic/cli typecheck && pnpm --filter @mosaic/cli lint` +Run: `pnpm --filter @mosaicstack/cli typecheck && pnpm --filter @mosaicstack/cli lint` Expected: PASS **Step 3: Commit** @@ -940,8 +940,8 @@ git commit -m "feat(cli): wire message search with highlight and viewport scroll **Step 1: Full typecheck across all affected packages** ```bash -pnpm --filter @mosaic/cli typecheck && pnpm --filter @mosaic/cli lint -pnpm --filter @mosaic/types typecheck +pnpm --filter @mosaicstack/cli typecheck && pnpm --filter @mosaicstack/cli lint +pnpm --filter @mosaicstack/types typecheck ``` Expected: All PASS @@ -951,7 +951,7 @@ Expected: All PASS ```bash cd /home/jwoltje/src/mosaic-mono-v1-worktrees/tui-improvements docker compose up -d -pnpm --filter @mosaic/cli exec tsx src/cli.ts tui +pnpm --filter @mosaicstack/cli exec tsx src/cli.ts tui ``` Verify: diff --git a/docs/plans/task-queue-unification.md b/docs/plans/task-queue-unification.md index 247a78f..e61401a 100644 --- a/docs/plans/task-queue-unification.md +++ b/docs/plans/task-queue-unification.md @@ -1,4 +1,4 @@ -# Task Queue Unification — @mosaic/queue as Unified Orchestration Layer +# Task Queue Unification — @mosaicstack/queue as Unified Orchestration Layer > **Status:** Stub — deferred. Referenced from `2026-03-15-agent-platform-architecture.md` (Task Queue & Orchestration section). > Implement after Workspaces (P8-015) is complete. Requires workspace file structure to be in place. @@ -12,7 +12,7 @@ Two disconnected task systems exist: -1. **`@mosaic/coord`** — file-based missions (`mission.json`, `TASKS.md`), file locks, subprocess spawning. Single-machine orchestrator pattern. +1. **`@mosaicstack/coord`** — file-based missions (`mission.json`, `TASKS.md`), file locks, subprocess spawning. Single-machine orchestrator pattern. 2. **PG tables** (`tasks`, `mission_tasks`, `missions`) — DB-backed CRUD, REST API, Brain repos. An agent using `coord_mission_status` gets file data. The dashboard shows DB data. They are never in sync. @@ -21,22 +21,22 @@ An agent using `coord_mission_status` gets file data. The dashboard shows DB dat ## Vision -`@mosaic/queue` becomes the unified task orchestration service bridging PG, workspace files, and Valkey: +`@mosaicstack/queue` becomes the unified task orchestration service bridging PG, workspace files, and Valkey: - DB is source of truth for structured state (status, assignees, timestamps) - Workspace files (`TASKS.md`, PRDs) are working copies for agent interaction - Valkey handles real-time assignment queues and agent claim locks -- Flatfile fallback for no-DB single-machine deployments (preserves `@mosaic/coord` pattern) +- Flatfile fallback for no-DB single-machine deployments (preserves `@mosaicstack/coord` pattern) --- ## Scope (To Be Designed) -- [ ] `@mosaic/queue` refactor — elevate from ioredis primitive to task orchestration service +- [ ] `@mosaicstack/queue` refactor — elevate from ioredis primitive to task orchestration service - [ ] DB ↔ file sync layer — writes to PG propagate to `TASKS.md`; file edits by agents sync back - [ ] Task assignment queue — Valkey-backed RPUSH/BLPOP for agent task claiming - [ ] Agent claim locks — `mosaic:queue:project:{id}:lock:{taskId}` with TTL -- [ ] `@mosaic/coord` consolidation — file-based ops ported into queue service; `@mosaic/coord` becomes thin adapter or deprecated +- [ ] `@mosaicstack/coord` consolidation — file-based ops ported into queue service; `@mosaicstack/coord` becomes thin adapter or deprecated - [ ] Flatfile fallback — queue service writes JSON manifests when PG unavailable - [ ] Status pub/sub — real-time task status updates via Valkey pub/sub - [ ] Dependency resolution — block task assignment until dependencies are met @@ -56,5 +56,5 @@ An agent using `coord_mission_status` gets file data. The dashboard shows DB dat ## References - Original design context: `docs/plans/2026-03-15-agent-platform-architecture.md` → "Task Queue & Orchestration" section -- Current `@mosaic/coord` implementation: `packages/coord/src/` -- Current `@mosaic/queue` implementation: `packages/queue/src/` +- Current `@mosaicstack/coord` implementation: `packages/coord/src/` +- Current `@mosaicstack/queue` implementation: `packages/queue/src/` diff --git a/docs/reports/qa/gateway-security-20260313.md b/docs/reports/qa/gateway-security-20260313.md index 736f953..9de4905 100644 --- a/docs/reports/qa/gateway-security-20260313.md +++ b/docs/reports/qa/gateway-security-20260313.md @@ -18,7 +18,7 @@ | Command | Result | Evidence | | --- | --- | --- | -| `pnpm --filter @mosaic/gateway test -- src/chat/__tests__/chat-security.test.ts src/__tests__/resource-ownership.test.ts` | pass | 3 test files passed, 20 tests passed | +| `pnpm --filter @mosaicstack/gateway test -- src/chat/__tests__/chat-security.test.ts src/__tests__/resource-ownership.test.ts` | pass | 3 test files passed, 20 tests passed | | `pnpm typecheck` | pass | turbo completed 18/18 package typecheck tasks | | `pnpm lint` | pass | turbo completed 18/18 package lint tasks | | `pnpm format:check` | pass | `All matched files use Prettier code style!` | diff --git a/docs/reviews/consolidation-board-memo.md b/docs/reviews/consolidation-board-memo.md index 8cffed0..c01c06d 100644 --- a/docs/reviews/consolidation-board-memo.md +++ b/docs/reviews/consolidation-board-memo.md @@ -302,7 +302,7 @@ a fully open-source, self-contained AI development pipeline framework. The Forge pipeline, MACP protocol, and credential resolver together form a complete agentic development system. Packaged correctly, this could be published as -@mosaic/forge + @mosaic/macp — reusable by any team building +@mosaicstack/forge + @mosaicstack/macp — reusable by any team building AI-native development workflows. The mosaic-stack repo becomes a reference implementation. Other organizations adopt the protocol. MACP becomes a standard. @@ -335,7 +335,7 @@ runtime; packages/forge becomes the brain. These should be designed as separable concerns from the start. DEFERRED OPPORTUNITIES: -- Publish @mosaic/forge to npm (after consolidation stabilizes) +- Publish @mosaicstack/forge to npm (after consolidation stabilizes) - MACP as an open protocol spec with multiple implementations - Forge pipeline as a configurable product (enterprise personas, custom stage sequences, SLA-based gate configuration) @@ -539,7 +539,7 @@ is listed in WP2's scope (`learning_capture.py` + `learning_recall.py`). If OpenBrain's interface is undefined, why is it in WP2 either? Cut it from both WP2 and WP1. Make it a separate brief. -To the Moonshot: The "publish @mosaic/forge to npm" idea is +To the Moonshot: The "publish @mosaicstack/forge to npm" idea is premature. Publishing a package externally means committing to a public API and semver guarantees. Mosaic's pipeline is actively evolving. Publishing now creates external consumers @@ -1223,7 +1223,7 @@ consideration. They are NOT in scope for this consolidation. memory capture/recall. Requires a standalone brief once the interface is defined. High long-term value. -- @mosaic/forge external publication: After the consolidated +- @mosaicstack/forge external publication: After the consolidated package stabilizes, evaluate publishing as an open-source framework. Requires API freeze and semver commitment. diff --git a/docs/scratchpads/387-updater-wrapper-gitea-20260404.md b/docs/scratchpads/387-updater-wrapper-gitea-20260404.md index f2dd9da..c38798d 100644 --- a/docs/scratchpads/387-updater-wrapper-gitea-20260404.md +++ b/docs/scratchpads/387-updater-wrapper-gitea-20260404.md @@ -1,16 +1,16 @@ # Scratchpad — issue #387 updater simplification + Gitea wrapper repo context -- Objective: simplify updater behavior to `@mosaic/mosaic` only, and fix Gitea wrapper scripts so merge/CI/issue operations work reliably when tea needs explicit repo/login context. +- Objective: simplify updater behavior to `@mosaicstack/mosaic` only, and fix Gitea wrapper scripts so merge/CI/issue operations work reliably when tea needs explicit repo/login context. - Scope: - `packages/mosaic/src/runtime/update-checker.ts` - `packages/mosaic/__tests__/update-checker.test.ts` - any package metadata/version bumps needed - repo-source git wrappers under `packages/mosaic/framework/tools/git/` - Constraints: - - Jason approved breaking changes; legacy `@mosaic/cli` support is out of scope. + - Jason approved breaking changes; legacy `@mosaicstack/cli` support is out of scope. - Keep changes focused and mergeable. - Acceptance: - - updater only targets `@mosaic/mosaic` + - updater only targets `@mosaicstack/mosaic` - wrapper path works on Gitea in this environment without manual repo guessing - PR merges squash-only after green CI @@ -20,9 +20,9 @@ #### Update Checker Simplification (DONE) -- Removed `LEGACY_PKG`, `INSTALLED_PACKAGE_ORDER` constants — only `PKG = '@mosaic/mosaic'` remains -- `getInstalledVersion()` — removed loop over multiple packages, only checks `@mosaic/mosaic` -- `getLatestVersion()` — removed `installedPackage` parameter and candidate iteration; single query for `@mosaic/mosaic` +- Removed `LEGACY_PKG`, `INSTALLED_PACKAGE_ORDER` constants — only `PKG = '@mosaicstack/mosaic'` remains +- `getInstalledVersion()` — removed loop over multiple packages, only checks `@mosaicstack/mosaic` +- `getLatestVersion()` — removed `installedPackage` parameter and candidate iteration; single query for `@mosaicstack/mosaic` - `checkForUpdate()` — removed `currentPackage`-based cache key comparison; cache is now package-agnostic - `RegistryCache` — removed `currentPackage` and `targetPackage` fields - `formatUpdateNotice()` — removed `targetChanged` branch (package migration notice no longer relevant) @@ -30,9 +30,9 @@ #### Test Updates (DONE) -- Removed legacy `@mosaic/cli` fallback test +- Removed legacy `@mosaicstack/cli` fallback test - Removed cache cross-contamination test (was testing legacy→modern package transition) -- Added `does not query legacy @mosaic/cli package` test — asserts no `@mosaic/cli` npm commands are issued +- Added `does not query legacy @mosaicstack/cli package` test — asserts no `@mosaicstack/cli` npm commands are issued - Added `returns empty result when package is not installed` test - All 8 tests pass ✅ diff --git a/docs/scratchpads/41-plugin-host.md b/docs/scratchpads/41-plugin-host.md index fa0ed4a..ebbaf47 100644 --- a/docs/scratchpads/41-plugin-host.md +++ b/docs/scratchpads/41-plugin-host.md @@ -10,15 +10,15 @@ - 2026-03-13: session started in worktree; loading gateway/plugin package context. - 2026-03-13: implemented initial plugin module, service, interface, and AppModule wiring; pending verification. -- 2026-03-13: added `@mosaic/discord-plugin` as a gateway workspace dependency and regenerated `pnpm-lock.yaml`. +- 2026-03-13: added `@mosaicstack/discord-plugin` as a gateway workspace dependency and regenerated `pnpm-lock.yaml`. - 2026-03-13: built gateway dependency chain so workspace packages exported `dist/*` for clean TypeScript resolution in this fresh worktree. - 2026-03-13: verification complete. ## Verification -- `pnpm --filter @mosaic/gateway... build` ✅ -- `pnpm --filter @mosaic/gateway typecheck` ✅ -- `pnpm --filter @mosaic/gateway lint` ✅ +- `pnpm --filter @mosaicstack/gateway... build` ✅ +- `pnpm --filter @mosaicstack/gateway typecheck` ✅ +- `pnpm --filter @mosaicstack/gateway lint` ✅ - `pnpm format:check` ✅ - `pnpm typecheck` ✅ - `pnpm lint` ✅ diff --git a/docs/scratchpads/ci-docker-publish-20260330.md b/docs/scratchpads/ci-docker-publish-20260330.md index b8ee848..a8b7f23 100644 --- a/docs/scratchpads/ci-docker-publish-20260330.md +++ b/docs/scratchpads/ci-docker-publish-20260330.md @@ -21,7 +21,7 @@ - `pnpm typecheck` - `pnpm format:check` - `docker compose up -d` - - `pnpm --filter @mosaic/db db:push` + - `pnpm --filter @mosaicstack/db db:push` - `pnpm test` - `pnpm build` - Manual review of `.woodpecker/ci.yml` diff: publish steps are main-only, depend on `build`, and use secret-backed registry auth plus dual tags. diff --git a/docs/scratchpads/gateway-security-20260313.md b/docs/scratchpads/gateway-security-20260313.md index 543642c..759fd94 100644 --- a/docs/scratchpads/gateway-security-20260313.md +++ b/docs/scratchpads/gateway-security-20260313.md @@ -46,7 +46,7 @@ Complete the remaining gateway security hardening work: ## Verification Log -- `pnpm --filter @mosaic/gateway test -- src/chat/__tests__/chat-security.test.ts src/__tests__/resource-ownership.test.ts` +- `pnpm --filter @mosaicstack/gateway test -- src/chat/__tests__/chat-security.test.ts src/__tests__/resource-ownership.test.ts` - Red: failed on socket session reshaping and DTO role/length mismatches. - Green: passed with 3 test files and 20 tests passing. - `pnpm typecheck` diff --git a/docs/scratchpads/m3-001-provider-adapter.md b/docs/scratchpads/m3-001-provider-adapter.md index b81bdb3..fd5b143 100644 --- a/docs/scratchpads/m3-001-provider-adapter.md +++ b/docs/scratchpads/m3-001-provider-adapter.md @@ -6,7 +6,7 @@ Refactor ProviderService into an IProviderAdapter pattern without breaking exist ## Plan -1. Add `IProviderAdapter` interface and supporting types to `@mosaic/types` provider package +1. Add `IProviderAdapter` interface and supporting types to `@mosaicstack/types` provider package 2. Create `apps/gateway/src/agent/adapters/` directory with: - `provider-adapter.interface.ts` — IProviderAdapter + ProviderHealth + CompletionParams + CompletionEvent - `ollama.adapter.ts` — extract existing Ollama logic @@ -40,7 +40,7 @@ Refactor ProviderService into an IProviderAdapter pattern without breaking exist ## Progress -- [ ] Add types to @mosaic/types +- [ ] Add types to @mosaicstack/types - [ ] Create adapters/ directory - [ ] Create IProviderAdapter interface file - [ ] Create OllamaAdapter diff --git a/docs/scratchpads/mvp-20260312.md b/docs/scratchpads/mvp-20260312.md index 3387701..709898b 100644 --- a/docs/scratchpads/mvp-20260312.md +++ b/docs/scratchpads/mvp-20260312.md @@ -37,11 +37,11 @@ User confirmed: start the planning gate. ## Session Log -| Session | Date | Milestone | Tasks Done | Outcome | -| ------- | ---------- | -------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 1 | 2026-03-13 | Planning | Planning gate | Milestones created, 59 issues created, TASKS.md populated, manifest updated | -| 2 | 2026-03-13 | Vertical slice | P1-001, P1-007, P1-008, P2-001, P5-002, P6-005 | Communication spine built and merged (PR #61). Gateway + TUI + Discord. 3-agent gatekeeper review, 10/16 issues remediated, 4 deferred. | -| 3 | 2026-03-13 | Foundation | P0-002, P0-005, P0-006 | Foundation layer merged (PR #65). Docker Compose (PG+pgvector, Valkey, OTEL Collector, Jaeger), OTEL auto-instrumentation in gateway, @mosaic/types with DTOs + Socket.IO typed event maps. | +| Session | Date | Milestone | Tasks Done | Outcome | +| ------- | ---------- | -------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 1 | 2026-03-13 | Planning | Planning gate | Milestones created, 59 issues created, TASKS.md populated, manifest updated | +| 2 | 2026-03-13 | Vertical slice | P1-001, P1-007, P1-008, P2-001, P5-002, P6-005 | Communication spine built and merged (PR #61). Gateway + TUI + Discord. 3-agent gatekeeper review, 10/16 issues remediated, 4 deferred. | +| 3 | 2026-03-13 | Foundation | P0-002, P0-005, P0-006 | Foundation layer merged (PR #65). Docker Compose (PG+pgvector, Valkey, OTEL Collector, Jaeger), OTEL auto-instrumentation in gateway, @mosaicstack/types with DTOs + Socket.IO typed event maps. | ### Session 4 — Docker Compose fix @@ -94,9 +94,9 @@ User confirmed: start the planning gate. **Phase 6 details:** -- P6-002: @mosaic/prdy migrated from v0 (~400 LOC). PR #101. -- P6-003: @mosaic/quality-rails migrated from v0 (~500 LOC). PR #100. -- P6-004: @mosaic/mosaic wizard migrated from v0 (2272 LOC, 28 files). PR #103. +- P6-002: @mosaicstack/prdy migrated from v0 (~400 LOC). PR #101. +- P6-003: @mosaicstack/quality-rails migrated from v0 (~500 LOC). PR #100. +- P6-004: @mosaicstack/mosaic wizard migrated from v0 (2272 LOC, 28 files). PR #103. - P6-001: CLI subcommands wired — tui, prdy, quality-rails, wizard all working. PR #104. - BUG-1: PLUGIN_REGISTRY circular import fixed via plugin.tokens.ts. PR #102. - BUG-2: AuthStorage.create() → .inMemory() to prevent silent exit. PR #102. @@ -151,11 +151,11 @@ User confirmed: start the planning gate. | ---- | -------------------------------------------------------------------- | ------------------------ | | 1 | P0-001: Scaffold monorepo | Build system works | | 2 | P0-005: Docker Compose (PG + Valkey) | Infrastructure runs | -| 3 | P0-002: @mosaic/types (minimal — gateway, agent, chat types) | Shared contracts | +| 3 | P0-002: @mosaicstack/types (minimal — gateway, agent, chat types) | Shared contracts | | 4 | P1-001: Gateway scaffold (minimal NestJS + Fastify) | API surface boots | | 5 | P1-007: WebSocket server (chat streaming) | Real-time channel works | | 6 | P1-008: Basic agent dispatch (single provider) | LLM responds | -| 7 | P2-001: @mosaic/agent — Pi SDK integration (minimal) | Pi sessions work | +| 7 | P2-001: @mosaicstack/agent — Pi SDK integration (minimal) | Pi sessions work | | 8 | P6-005: Pi TUI integration (mosaic tui → gateway) | TUI ↔ Gateway proven | | 9 | P5-001: Plugin host (channel plugin interface) | Plugin arch works | | 10 | P5-002: Discord plugin (bot + channel) | Discord ↔ Gateway proven | @@ -175,9 +175,9 @@ User confirmed: start the planning gate. ### Session 10 (continued) — Phase 4 Memory & Intelligence -| Session | Date | Milestone | Tasks Done | Outcome | -| ------- | ---------- | --------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 10 | 2026-03-13 | Phase 4 | P4-001 through P4-007 | Full memory + log system: DB schema (preferences, insights w/ pgvector, agent_logs, skills, summarization_jobs), @mosaic/memory + @mosaic/log packages, embedding service, summarization pipeline w/ cron, memory tools in agent sessions, skill management CRUD. All gates green. | +| Session | Date | Milestone | Tasks Done | Outcome | +| ------- | ---------- | --------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 10 | 2026-03-13 | Phase 4 | P4-001 through P4-007 | Full memory + log system: DB schema (preferences, insights w/ pgvector, agent_logs, skills, summarization_jobs), @mosaicstack/memory + @mosaicstack/log packages, embedding service, summarization pipeline w/ cron, memory tools in agent sessions, skill management CRUD. All gates green. | ### Session 12 — Phase 7 planning + execution start diff --git a/docs/scratchpads/p5-003-telegram-plugin.md b/docs/scratchpads/p5-003-telegram-plugin.md index 4ab8600..22f0b0f 100644 --- a/docs/scratchpads/p5-003-telegram-plugin.md +++ b/docs/scratchpads/p5-003-telegram-plugin.md @@ -2,7 +2,7 @@ ## Objective -Implement `@mosaic/telegram-plugin` by matching the established Discord plugin pattern with Telegraf + socket.io-client, add package docs, and pass package typecheck/lint. +Implement `@mosaicstack/telegram-plugin` by matching the established Discord plugin pattern with Telegraf + socket.io-client, add package docs, and pass package typecheck/lint. ## Requirements Source @@ -34,13 +34,13 @@ manual structural parity with the Discord plugin. ## Progress Log - 2026-03-13: Loaded Mosaic/global/repo guidance, mission files, Discord reference implementation, and Telegram package scaffold. -- 2026-03-13: Added `telegraf` and `socket.io-client` to `@mosaic/telegram-plugin`. +- 2026-03-13: Added `telegraf` and `socket.io-client` to `@mosaicstack/telegram-plugin`. - 2026-03-13: Implemented Telegram message forwarding, gateway streaming accumulation, response chunking, and package README. ## Verification Evidence -- `pnpm --filter @mosaic/telegram-plugin typecheck` → pass -- `pnpm --filter @mosaic/telegram-plugin lint` → pass +- `pnpm --filter @mosaicstack/telegram-plugin typecheck` → pass +- `pnpm --filter @mosaicstack/telegram-plugin lint` → pass - `pnpm typecheck` → pass - `pnpm lint` → pass diff --git a/docs/scratchpads/p5-004-authentik-sso.md b/docs/scratchpads/p5-004-authentik-sso.md index 769e845..0678321 100644 --- a/docs/scratchpads/p5-004-authentik-sso.md +++ b/docs/scratchpads/p5-004-authentik-sso.md @@ -18,21 +18,21 @@ 4. Confirmed `packages/auth/src/index.ts` already exports `AuthConfig`; no change required there. - Verification: - 1. `pnpm --filter @mosaic/db build` - 2. `pnpm --filter @mosaic/auth typecheck` - 3. `pnpm --filter @mosaic/gateway typecheck` + 1. `pnpm --filter @mosaicstack/db build` + 2. `pnpm --filter @mosaicstack/auth typecheck` + 3. `pnpm --filter @mosaicstack/gateway typecheck` 4. `pnpm lint` 5. `pnpm format:check` - 6. `pnpm --filter @mosaic/auth test` - 7. `pnpm --filter @mosaic/gateway test` + 6. `pnpm --filter @mosaicstack/auth test` + 7. `pnpm --filter @mosaicstack/gateway test` - Results: - 1. `@mosaic/auth` typecheck passed after replacing the non-existent `enabled` field with conditional plugin registration. - 2. `@mosaic/gateway` typecheck passed. + 1. `@mosaicstack/auth` typecheck passed after replacing the non-existent `enabled` field with conditional plugin registration. + 2. `@mosaicstack/gateway` typecheck passed. 3. Repo lint passed. 4. Prettier check passed after formatting `apps/gateway/src/main.ts`. - 5. `@mosaic/auth` tests reported `No test files found, exiting with code 0`. - 6. `@mosaic/gateway` tests passed: `3` files, `20` tests. + 5. `@mosaicstack/auth` tests reported `No test files found, exiting with code 0`. + 6. `@mosaicstack/gateway` tests passed: `3` files, `20` tests. - Review: 1. Manual review of the diff found no blocker issues. diff --git a/docs/scratchpads/p8-001-sso-providers.md b/docs/scratchpads/p8-001-sso-providers.md index 92ed1b3..887276b 100644 --- a/docs/scratchpads/p8-001-sso-providers.md +++ b/docs/scratchpads/p8-001-sso-providers.md @@ -50,16 +50,16 @@ Add WorkOS and Keycloak as optional SSO providers to the BetterAuth configuratio ## Quality Gate Results -| Gate | Status | -| ------------------- | -------------------------------------------- | -| typecheck | ✅ 32/32 cached green | -| lint | ✅ 18/18 cached green | -| format:check | ✅ All matched files use Prettier code style | -| test (@mosaic/auth) | ✅ 8/8 tests passed | +| Gate | Status | +| ------------------------ | -------------------------------------------- | +| typecheck | ✅ 32/32 cached green | +| lint | ✅ 18/18 cached green | +| format:check | ✅ All matched files use Prettier code style | +| test (@mosaicstack/auth) | ✅ 8/8 tests passed | ## Verification Evidence - `pnpm typecheck` — FULL TURBO, 32 tasks successful - `pnpm lint` — FULL TURBO, 18 tasks successful - `pnpm format:check` — All matched files use Prettier code style! -- `pnpm --filter=@mosaic/auth test` — 8 tests passed, 0 failed +- `pnpm --filter=@mosaicstack/auth test` — 8 tests passed, 0 failed diff --git a/docs/scratchpads/p8-009-tui-slash-commands.md b/docs/scratchpads/p8-009-tui-slash-commands.md index 7e6cb93..b04d28e 100644 --- a/docs/scratchpads/p8-009-tui-slash-commands.md +++ b/docs/scratchpads/p8-009-tui-slash-commands.md @@ -12,7 +12,7 @@ ## Key Observations -- CommandDef in @mosaic/types does NOT have `category` field — will omit from LOCAL_COMMANDS +- CommandDef in @mosaicstack/types does NOT have `category` field — will omit from LOCAL_COMMANDS - CommandDef.args is `CommandArgDef[] | undefined`, not `{ usage: string }` — help.ts args rendering needs adjustment - Message role union currently: 'user' | 'assistant' | 'thinking' | 'tool' — adding 'system' - InputBar currently takes `onSubmit: (value: string) => void` — need to add slash command interception diff --git a/docs/scratchpads/task-mission-ownership-20260313.md b/docs/scratchpads/task-mission-ownership-20260313.md index 0374f71..3716a85 100644 --- a/docs/scratchpads/task-mission-ownership-20260313.md +++ b/docs/scratchpads/task-mission-ownership-20260313.md @@ -35,14 +35,14 @@ Close ownership gaps so task listing/creation and mission creation enforce proje ## Verification Log -- `pnpm --filter @mosaic/gateway test -- src/__tests__/resource-ownership.test.ts` +- `pnpm --filter @mosaicstack/gateway test -- src/__tests__/resource-ownership.test.ts` - Red: failed with 2 expected permission-path failures before controller changes. - Green: passed after wiring ownership checks and adding owned-task filtering coverage. -- `pnpm --filter @mosaic/gateway typecheck` +- `pnpm --filter @mosaicstack/gateway typecheck` - Pass on 2026-03-13 after fixing parameter ordering and mission project nullability. -- `pnpm --filter @mosaic/gateway lint` +- `pnpm --filter @mosaicstack/gateway lint` - Pass on 2026-03-13. -- `pnpm --filter @mosaic/gateway test` +- `pnpm --filter @mosaicstack/gateway test` - Pass on 2026-03-13 with 3 test files and 23 tests passing. - `pnpm format:check` - Pass on 2026-03-13. diff --git a/docs/scratchpads/update-checker-package-20260404.md b/docs/scratchpads/update-checker-package-20260404.md index 2543603..357a088 100644 --- a/docs/scratchpads/update-checker-package-20260404.md +++ b/docs/scratchpads/update-checker-package-20260404.md @@ -1,27 +1,27 @@ # Scratchpad — updater package target fix (#382) -- Objective: Fix `mosaic update` so modern installs query `@mosaic/mosaic` instead of stale `@mosaic/cli`. +- Objective: Fix `mosaic update` so modern installs query `@mosaicstack/mosaic` instead of stale `@mosaicstack/cli`. - Scope: updater logic, user-facing update/install hints, tests, package version bump(s). -- Constraints: preserve backward compatibility for older `@mosaic/cli` installs if practical. +- Constraints: preserve backward compatibility for older `@mosaicstack/cli` installs if practical. - Acceptance: - - fresh installs using `@mosaic/mosaic` report latest correctly + - fresh installs using `@mosaicstack/mosaic` report latest correctly - older installs do not regress unnecessarily - tests cover package lookup behavior - release version bumped for changed package(s) ## Decisions -- Prefer `@mosaic/mosaic` when both modern and legacy packages are installed globally. -- For legacy `@mosaic/cli` installs, query `@mosaic/cli` first, then fall back to `@mosaic/mosaic` if the legacy package is not published. +- Prefer `@mosaicstack/mosaic` when both modern and legacy packages are installed globally. +- For legacy `@mosaicstack/cli` installs, query `@mosaicstack/cli` first, then fall back to `@mosaicstack/mosaic` if the legacy package is not published. - Share install-target selection from `packages/mosaic` so both the consolidated CLI and the legacy `packages/cli` entrypoint print/install the same package target. - Extend the update cache to persist the resolved target package as well as the version so cached checks preserve the migration target. ## Validation - `pnpm install` -- `pnpm --filter @mosaic/mosaic test -- __tests__/update-checker.test.ts` +- `pnpm --filter @mosaicstack/mosaic test -- __tests__/update-checker.test.ts` - `pnpm exec eslint --no-warn-ignored packages/mosaic/src/runtime/update-checker.ts packages/mosaic/src/cli.ts packages/mosaic/src/index.ts packages/mosaic/__tests__/update-checker.test.ts packages/cli/src/cli.ts` -- `pnpm --filter @mosaic/mosaic lint` +- `pnpm --filter @mosaicstack/mosaic lint` - pre-push hooks: `typecheck`, `lint`, `format:check` ## Review @@ -30,5 +30,5 @@ ## Risks / Notes -- Direct `pnpm --filter @mosaic/mosaic typecheck` and `pnpm --filter @mosaic/cli ...` checks were not representative in this worktree because `packages/cli` is excluded from `pnpm-workspace.yaml` and the standalone package check lacked the built workspace dependency graph. +- Direct `pnpm --filter @mosaicstack/mosaic typecheck` and `pnpm --filter @mosaicstack/cli ...` checks were not representative in this worktree because `packages/cli` is excluded from `pnpm-workspace.yaml` and the standalone package check lacked the built workspace dependency graph. - The repo's pre-push hooks provided the authoritative validation path here and passed: root `typecheck`, `lint`, and `format:check`. diff --git a/docs/tasks/WP1-forge-package.md b/docs/tasks/WP1-forge-package.md index 8543fb8..a3b0bf0 100644 --- a/docs/tasks/WP1-forge-package.md +++ b/docs/tasks/WP1-forge-package.md @@ -15,7 +15,7 @@ Port the Forge progressive refinement pipeline from Python (~/src/mosaic-stack/f **Dependencies available:** -- `@mosaic/macp` (packages/macp) is built and provides: GateEntry, GateResult, Task types, credential resolution, gate running, event emission +- `@mosaicstack/macp` (packages/macp) is built and provides: GateEntry, GateResult, Task types, credential resolution, gate running, event emission ## Source Files (Python → TypeScript) @@ -193,14 +193,14 @@ packages/forge/ ```json { - "name": "@mosaic/forge", + "name": "@mosaicstack/forge", "version": "0.0.1", "type": "module", "exports": { ".": "./src/index.ts" }, "dependencies": { - "@mosaic/macp": "workspace:*" + "@mosaicstack/macp": "workspace:*" }, "devDependencies": { "vitest": "workspace:*", @@ -209,7 +209,7 @@ packages/forge/ } ``` -Only dependency: @mosaic/macp (for gate types, event emission). +Only dependency: @mosaicstack/macp (for gate types, event emission). ## Test Strategy (Board requirement) diff --git a/docs/tasks/WP2-macp-package.md b/docs/tasks/WP2-macp-package.md index 492856f..2aba000 100644 --- a/docs/tasks/WP2-macp-package.md +++ b/docs/tasks/WP2-macp-package.md @@ -101,7 +101,7 @@ packages/macp/ ```json { - "name": "@mosaic/macp", + "name": "@mosaicstack/macp", "version": "0.0.1", "type": "module", "exports": { @@ -146,5 +146,5 @@ Port ALL existing Python tests as TypeScript equivalents: After this package is built: -- `packages/coord` should import `@mosaic/macp` for event emission and gate types -- `plugins/macp` should import `@mosaic/macp` for credential resolution and protocol types +- `packages/coord` should import `@mosaicstack/macp` for event emission and gate types +- `plugins/macp` should import `@mosaicstack/macp` for credential resolution and protocol types diff --git a/packages/agent/package.json b/packages/agent/package.json index 25c2690..7d1157a 100644 --- a/packages/agent/package.json +++ b/packages/agent/package.json @@ -1,5 +1,5 @@ { - "name": "@mosaic/agent", + "name": "@mosaicstack/agent", "version": "0.0.2", "repository": { "type": "git", @@ -21,7 +21,7 @@ "test": "vitest run --passWithNoTests" }, "dependencies": { - "@mosaic/types": "workspace:*" + "@mosaicstack/types": "workspace:*" }, "devDependencies": { "typescript": "^5.8.0", diff --git a/packages/auth/package.json b/packages/auth/package.json index e9b8eed..d9edb31 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,5 +1,5 @@ { - "name": "@mosaic/auth", + "name": "@mosaicstack/auth", "version": "0.0.2", "repository": { "type": "git", @@ -28,7 +28,7 @@ "vitest": "^2.0.0" }, "dependencies": { - "@mosaic/db": "workspace:^", + "@mosaicstack/db": "workspace:^", "better-auth": "^1.5.5" }, "publishConfig": { diff --git a/packages/auth/src/auth.test.ts b/packages/auth/src/auth.test.ts index f752e91..4cc6dea 100644 --- a/packages/auth/src/auth.test.ts +++ b/packages/auth/src/auth.test.ts @@ -50,7 +50,7 @@ describe('buildOAuthProviders', () => { process.env['WORKOS_CLIENT_ID'] = 'client_test123'; expect(() => buildOAuthProviders()).toThrow( - '@mosaic/auth: WorkOS SSO requires WORKOS_ISSUER, WORKOS_CLIENT_ID, WORKOS_CLIENT_SECRET.', + '@mosaicstack/auth: WorkOS SSO requires WORKOS_ISSUER, WORKOS_CLIENT_ID, WORKOS_CLIENT_SECRET.', ); }); @@ -97,7 +97,7 @@ describe('buildOAuthProviders', () => { process.env['KEYCLOAK_CLIENT_SECRET'] = 'secret123'; expect(() => buildOAuthProviders()).toThrow( - '@mosaic/auth: Keycloak SSO requires KEYCLOAK_CLIENT_ID, KEYCLOAK_CLIENT_SECRET, KEYCLOAK_ISSUER.', + '@mosaicstack/auth: Keycloak SSO requires KEYCLOAK_CLIENT_ID, KEYCLOAK_CLIENT_SECRET, KEYCLOAK_ISSUER.', ); }); @@ -129,7 +129,7 @@ describe('buildOAuthProviders', () => { process.env['AUTHENTIK_CLIENT_ID'] = 'authentik-client'; expect(() => buildOAuthProviders()).toThrow( - '@mosaic/auth: Authentik SSO requires AUTHENTIK_ISSUER, AUTHENTIK_CLIENT_ID, AUTHENTIK_CLIENT_SECRET.', + '@mosaicstack/auth: Authentik SSO requires AUTHENTIK_ISSUER, AUTHENTIK_CLIENT_ID, AUTHENTIK_CLIENT_SECRET.', ); }); diff --git a/packages/auth/src/auth.ts b/packages/auth/src/auth.ts index 0c0c63d..f1b002f 100644 --- a/packages/auth/src/auth.ts +++ b/packages/auth/src/auth.ts @@ -2,7 +2,7 @@ import { betterAuth } from 'better-auth'; import { drizzleAdapter } from 'better-auth/adapters/drizzle'; import { admin } from 'better-auth/plugins'; import { genericOAuth, type GenericOAuthConfig } from 'better-auth/plugins/generic-oauth'; -import type { Db } from '@mosaic/db'; +import type { Db } from '@mosaicstack/db'; import { buildGenericOidcProviderConfigs } from './sso.js'; export interface AuthConfig { diff --git a/packages/auth/src/sso.ts b/packages/auth/src/sso.ts index 1da3649..fbf112d 100644 --- a/packages/auth/src/sso.ts +++ b/packages/auth/src/sso.ts @@ -66,7 +66,7 @@ function buildAuthentikConfig(env: EnvMap): GenericOidcProviderConfig | null { const presentCount = fields.filter(Boolean).length; if (presentCount > 0 && presentCount < fields.length) { throw new Error( - '@mosaic/auth: Authentik SSO requires AUTHENTIK_ISSUER, AUTHENTIK_CLIENT_ID, AUTHENTIK_CLIENT_SECRET.', + '@mosaicstack/auth: Authentik SSO requires AUTHENTIK_ISSUER, AUTHENTIK_CLIENT_ID, AUTHENTIK_CLIENT_SECRET.', ); } if (!issuer || !clientId || !clientSecret) { @@ -97,7 +97,7 @@ function buildWorkosConfig(env: EnvMap): GenericOidcProviderConfig | null { const presentCount = fields.filter(Boolean).length; if (presentCount > 0 && presentCount < fields.length) { throw new Error( - '@mosaic/auth: WorkOS SSO requires WORKOS_ISSUER, WORKOS_CLIENT_ID, WORKOS_CLIENT_SECRET.', + '@mosaicstack/auth: WorkOS SSO requires WORKOS_ISSUER, WORKOS_CLIENT_ID, WORKOS_CLIENT_SECRET.', ); } if (!issuer || !clientId || !clientSecret) { @@ -135,7 +135,7 @@ function buildKeycloakConfig(env: EnvMap): GenericOidcProviderConfig | null { const anySet = !!(issuer || clientId || clientSecret); if (anySet && (!issuer || !clientId || !clientSecret)) { throw new Error( - '@mosaic/auth: Keycloak SSO requires KEYCLOAK_CLIENT_ID, KEYCLOAK_CLIENT_SECRET, KEYCLOAK_ISSUER.', + '@mosaicstack/auth: Keycloak SSO requires KEYCLOAK_CLIENT_ID, KEYCLOAK_CLIENT_SECRET, KEYCLOAK_ISSUER.', ); } if (!issuer || !clientId || !clientSecret) { diff --git a/packages/brain/package.json b/packages/brain/package.json index 2e465a0..4018d8f 100644 --- a/packages/brain/package.json +++ b/packages/brain/package.json @@ -1,5 +1,5 @@ { - "name": "@mosaic/brain", + "name": "@mosaicstack/brain", "version": "0.0.2", "repository": { "type": "git", @@ -21,8 +21,8 @@ "test": "vitest run --passWithNoTests" }, "dependencies": { - "@mosaic/db": "workspace:^", - "@mosaic/types": "workspace:*" + "@mosaicstack/db": "workspace:^", + "@mosaicstack/types": "workspace:*" }, "devDependencies": { "typescript": "^5.8.0", diff --git a/packages/brain/src/agents.ts b/packages/brain/src/agents.ts index 852a32a..bea2c42 100644 --- a/packages/brain/src/agents.ts +++ b/packages/brain/src/agents.ts @@ -1,4 +1,4 @@ -import { eq, and, or, type Db, agents } from '@mosaic/db'; +import { eq, and, or, type Db, agents } from '@mosaicstack/db'; export type Agent = typeof agents.$inferSelect; export type NewAgent = typeof agents.$inferInsert; diff --git a/packages/brain/src/brain.ts b/packages/brain/src/brain.ts index 1b93882..787cd3c 100644 --- a/packages/brain/src/brain.ts +++ b/packages/brain/src/brain.ts @@ -1,4 +1,4 @@ -import type { Db } from '@mosaic/db'; +import type { Db } from '@mosaicstack/db'; import { createProjectsRepo, type ProjectsRepo } from './projects.js'; import { createMissionsRepo, type MissionsRepo } from './missions.js'; import { createMissionTasksRepo, type MissionTasksRepo } from './mission-tasks.js'; diff --git a/packages/brain/src/conversations.ts b/packages/brain/src/conversations.ts index 4508b96..ae3ed96 100644 --- a/packages/brain/src/conversations.ts +++ b/packages/brain/src/conversations.ts @@ -1,4 +1,4 @@ -import { eq, and, asc, desc, ilike, type Db, conversations, messages } from '@mosaic/db'; +import { eq, and, asc, desc, ilike, type Db, conversations, messages } from '@mosaicstack/db'; /** Maximum number of conversations returned per list query. */ const MAX_CONVERSATIONS = 200; diff --git a/packages/brain/src/mission-tasks.ts b/packages/brain/src/mission-tasks.ts index 1f0771a..acd4235 100644 --- a/packages/brain/src/mission-tasks.ts +++ b/packages/brain/src/mission-tasks.ts @@ -1,4 +1,4 @@ -import { eq, and, type Db, missionTasks } from '@mosaic/db'; +import { eq, and, type Db, missionTasks } from '@mosaicstack/db'; export type MissionTask = typeof missionTasks.$inferSelect; export type NewMissionTask = typeof missionTasks.$inferInsert; diff --git a/packages/brain/src/missions.ts b/packages/brain/src/missions.ts index bc211a7..1df6e13 100644 --- a/packages/brain/src/missions.ts +++ b/packages/brain/src/missions.ts @@ -1,4 +1,4 @@ -import { eq, and, type Db, missions } from '@mosaic/db'; +import { eq, and, type Db, missions } from '@mosaicstack/db'; export type Mission = typeof missions.$inferSelect; export type NewMission = typeof missions.$inferInsert; diff --git a/packages/brain/src/projects.ts b/packages/brain/src/projects.ts index 8a2418b..f4416ed 100644 --- a/packages/brain/src/projects.ts +++ b/packages/brain/src/projects.ts @@ -1,4 +1,4 @@ -import { eq, or, inArray, type Db, projects, teamMembers } from '@mosaic/db'; +import { eq, or, inArray, type Db, projects, teamMembers } from '@mosaicstack/db'; export type Project = typeof projects.$inferSelect; export type NewProject = typeof projects.$inferInsert; diff --git a/packages/brain/src/tasks.ts b/packages/brain/src/tasks.ts index 44ee2af..9029b25 100644 --- a/packages/brain/src/tasks.ts +++ b/packages/brain/src/tasks.ts @@ -1,4 +1,4 @@ -import { eq, type Db, tasks } from '@mosaic/db'; +import { eq, type Db, tasks } from '@mosaicstack/db'; export type Task = typeof tasks.$inferSelect; export type NewTask = typeof tasks.$inferInsert; diff --git a/packages/cli/package.json b/packages/cli/package.json index 9091746..73b5a0d 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,5 +1,5 @@ { - "name": "@mosaic/cli", + "name": "@mosaicstack/cli", "version": "0.0.17", "repository": { "type": "git", @@ -27,11 +27,11 @@ }, "dependencies": { "@clack/prompts": "^0.9.0", - "@mosaic/config": "workspace:^", - "@mosaic/mosaic": "workspace:^", - "@mosaic/prdy": "workspace:^", - "@mosaic/quality-rails": "workspace:^", - "@mosaic/types": "workspace:^", + "@mosaicstack/config": "workspace:^", + "@mosaicstack/mosaic": "workspace:^", + "@mosaicstack/prdy": "workspace:^", + "@mosaicstack/quality-rails": "workspace:^", + "@mosaicstack/types": "workspace:^", "commander": "^13.0.0", "ink": "^5.0.0", "ink-spinner": "^5.0.0", diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index 8630989..089fa33 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -2,7 +2,7 @@ import { createRequire } from 'module'; import { Command } from 'commander'; -import { registerQualityRails } from '@mosaic/quality-rails'; +import { registerQualityRails } from '@mosaicstack/quality-rails'; import { registerAgentCommand } from './commands/agent.js'; import { registerMissionCommand } from './commands/mission.js'; // prdy is registered via launch.ts @@ -14,7 +14,7 @@ const CLI_VERSION: string = (_require('../package.json') as { version: string }) // Fire-and-forget update check at startup (non-blocking, cached 1h) try { - const { backgroundUpdateCheck } = await import('@mosaic/mosaic'); + const { backgroundUpdateCheck } = await import('@mosaicstack/mosaic'); backgroundUpdateCheck(); } catch { // Silently ignore — update check is best-effort @@ -314,38 +314,36 @@ program .description('Check for and install Mosaic CLI updates') .option('--check', 'Check only, do not install') .action(async (opts: { check?: boolean }) => { - const { checkForUpdate, formatUpdateNotice, getInstallCommand } = - await import('@mosaic/mosaic'); + const { checkForAllUpdates, formatAllPackagesTable, getInstallAllCommand } = + await import('@mosaicstack/mosaic'); const { execSync } = await import('node:child_process'); console.log('Checking for updates…'); - const result = checkForUpdate({ skipCache: true }); + const results = checkForAllUpdates({ skipCache: true }); - if (!result.latest) { - console.error('Could not reach the Mosaic registry.'); - process.exit(1); - } + console.log(''); + console.log(formatAllPackagesTable(results)); - console.log(` Installed: ${result.current || '(none)'}`); - console.log(` Latest: ${result.latest}`); - - if (!result.updateAvailable) { - console.log('\n✔ Up to date.'); + const outdated = results.filter((r: { updateAvailable: boolean }) => r.updateAvailable); + if (outdated.length === 0) { + const anyInstalled = results.some((r: { current: string }) => r.current); + if (!anyInstalled) { + console.error('No @mosaicstack/* packages are installed.'); + process.exit(1); + } + console.log('\n✔ All packages up to date.'); return; } - const notice = formatUpdateNotice(result); - if (notice) console.log(notice); - if (opts.check) { process.exit(2); // Signal to callers that an update exists } - console.log('Installing update…'); + console.log(`\nInstalling ${outdated.length} update(s)…`); try { - // Relies on @mosaic:registry in ~/.npmrc — do NOT pass --registry - // globally or non-@mosaic deps will 404 against the Gitea registry. - execSync(getInstallCommand(result), { + // Relies on @mosaicstack:registry in ~/.npmrc + const cmd = getInstallAllCommand(outdated); + execSync(cmd, { stdio: 'inherit', timeout: 60_000, }); @@ -380,7 +378,7 @@ program createConfigService, WizardCancelledError, DEFAULT_MOSAIC_HOME, - } = await import('@mosaic/mosaic'); + } = await import('@mosaicstack/mosaic'); try { const mosaicHome = (opts['mosaicHome'] as string | undefined) ?? DEFAULT_MOSAIC_HOME; diff --git a/packages/cli/src/commands/gateway/daemon.ts b/packages/cli/src/commands/gateway/daemon.ts index d3bba52..fa6d32f 100644 --- a/packages/cli/src/commands/gateway/daemon.ts +++ b/packages/cli/src/commands/gateway/daemon.ts @@ -91,10 +91,10 @@ export function resolveGatewayEntry(): string { return meta.entryPoint; } - // Try to resolve from globally installed @mosaic/gateway + // Try to resolve from globally installed @mosaicstack/gateway try { const req = createRequire(import.meta.url); - const pkgPath = req.resolve('@mosaic/gateway/package.json'); + const pkgPath = req.resolve('@mosaicstack/gateway/package.json'); const mainEntry = join(resolve(pkgPath, '..'), 'dist', 'main.js'); if (existsSync(mainEntry)) return mainEntry; } catch { @@ -210,8 +210,8 @@ function sleep(ms: number): Promise { const GITEA_REGISTRY = 'https://git.mosaicstack.dev/api/packages/mosaic/npm/'; export function installGatewayPackage(): void { - console.log('Installing @mosaic/gateway from Gitea registry...'); - execSync(`npm install -g @mosaic/gateway@latest --@mosaic:registry=${GITEA_REGISTRY}`, { + console.log('Installing @mosaicstack/gateway from Gitea registry...'); + execSync(`npm install -g @mosaicstack/gateway@latest --@mosaic:registry=${GITEA_REGISTRY}`, { stdio: 'inherit', timeout: 120_000, }); @@ -219,7 +219,7 @@ export function installGatewayPackage(): void { export function uninstallGatewayPackage(): void { try { - execSync('npm uninstall -g @mosaic/gateway', { + execSync('npm uninstall -g @mosaicstack/gateway', { stdio: 'inherit', timeout: 60_000, }); @@ -230,15 +230,15 @@ export function uninstallGatewayPackage(): void { export function getInstalledGatewayVersion(): string | null { try { - const output = execSync('npm ls -g @mosaic/gateway --json --depth=0', { + const output = execSync('npm ls -g @mosaicstack/gateway --json --depth=0', { encoding: 'utf-8', timeout: 15_000, stdio: ['pipe', 'pipe', 'pipe'], }); const data = JSON.parse(output) as { - dependencies?: { '@mosaic/gateway'?: { version?: string } }; + dependencies?: { '@mosaicstack/gateway'?: { version?: string } }; }; - return data.dependencies?.['@mosaic/gateway']?.version ?? null; + return data.dependencies?.['@mosaicstack/gateway']?.version ?? null; } catch { return null; } diff --git a/packages/cli/src/commands/gateway/install.ts b/packages/cli/src/commands/gateway/install.ts index 17b2ca2..5c813a0 100644 --- a/packages/cli/src/commands/gateway/install.ts +++ b/packages/cli/src/commands/gateway/install.ts @@ -142,7 +142,7 @@ async function doInstall(rl: ReturnType, opts: InstallOp entryPoint = resolveGatewayEntry(); } catch { console.error('Error: Gateway package not found after install.'); - console.error('Check that @mosaic/gateway installed correctly.'); + console.error('Check that @mosaicstack/gateway installed correctly.'); return; } diff --git a/packages/cli/src/commands/launch.ts b/packages/cli/src/commands/launch.ts index 1c8a57c..0ea9dd4 100644 --- a/packages/cli/src/commands/launch.ts +++ b/packages/cli/src/commands/launch.ts @@ -494,13 +494,13 @@ function delegateToScript(scriptPath: string, args: string[], env?: Record { expect(notice).toContain('Update available'); }); - it('uses @mosaic/mosaic for installs', async () => { + it('uses @mosaicstack/mosaic for installs', async () => { execSyncMock.mockImplementation((command: string) => { if (command.includes('ls -g --depth=0 --json')) { return JSON.stringify({ dependencies: { - '@mosaic/mosaic': { version: '0.0.19' }, + '@mosaicstack/mosaic': { version: '0.0.19' }, }, }); } - if (command.includes('view @mosaic/mosaic version')) { + if (command.includes('view @mosaicstack/mosaic version')) { return '0.0.20'; } @@ -111,26 +111,26 @@ describe('formatUpdateNotice', () => { expect(result.current).toBe('0.0.19'); expect(result.latest).toBe('0.0.20'); - expect(result.currentPackage).toBe('@mosaic/mosaic'); - expect(result.targetPackage).toBe('@mosaic/mosaic'); - expect(notice).toContain('@mosaic/mosaic@latest'); + expect(result.currentPackage).toBe('@mosaicstack/mosaic'); + expect(result.targetPackage).toBe('@mosaicstack/mosaic'); + expect(notice).toContain('@mosaicstack/mosaic@latest'); }); - it('does not query legacy @mosaic/cli package', async () => { + it('does not query legacy @mosaicstack/cli package', async () => { execSyncMock.mockImplementation((command: string) => { - if (command.includes('view @mosaic/cli')) { - throw new Error('Should not query @mosaic/cli'); + if (command.includes('view @mosaicstack/cli')) { + throw new Error('Should not query @mosaicstack/cli'); } if (command.includes('ls -g --depth=0 --json')) { return JSON.stringify({ dependencies: { - '@mosaic/mosaic': { version: '0.0.19' }, + '@mosaicstack/mosaic': { version: '0.0.19' }, }, }); } - if (command.includes('view @mosaic/mosaic version')) { + if (command.includes('view @mosaicstack/mosaic version')) { return '0.0.20'; } @@ -140,11 +140,11 @@ describe('formatUpdateNotice', () => { const { checkForUpdate } = await importUpdateChecker(); const result = checkForUpdate({ skipCache: true }); - expect(result.targetPackage).toBe('@mosaic/mosaic'); + expect(result.targetPackage).toBe('@mosaicstack/mosaic'); expect(result.latest).toBe('0.0.20'); - // Verify no @mosaic/cli queries were made + // Verify no @mosaicstack/cli queries were made const calls = execSyncMock.mock.calls.map((c: any[]) => c[0] as string); - expect(calls.some((c) => c.includes('@mosaic/cli'))).toBe(false); + expect(calls.some((c) => c.includes('@mosaicstack/cli'))).toBe(false); }); it('returns empty result when package is not installed', async () => { @@ -153,7 +153,7 @@ describe('formatUpdateNotice', () => { return JSON.stringify({ dependencies: {} }); } - if (command.includes('view @mosaic/mosaic version')) { + if (command.includes('view @mosaicstack/mosaic version')) { return ''; } diff --git a/packages/mosaic/framework/defaults/README.md b/packages/mosaic/framework/defaults/README.md index 3ffeaa3..95584a2 100644 --- a/packages/mosaic/framework/defaults/README.md +++ b/packages/mosaic/framework/defaults/README.md @@ -31,7 +31,7 @@ The installer: - Downloads the framework from the monorepo archive - Installs it to `~/.config/mosaic/` -- Installs `@mosaic/cli` globally via npm (TUI, gateway client, wizard) +- Installs `@mosaicstack/cli` globally via npm (TUI, gateway client, wizard) - Adds `~/.config/mosaic/bin` to your PATH - Syncs runtime adapters and skills - Runs a health audit diff --git a/packages/mosaic/package.json b/packages/mosaic/package.json index d39cd54..df57f94 100644 --- a/packages/mosaic/package.json +++ b/packages/mosaic/package.json @@ -1,5 +1,5 @@ { - "name": "@mosaic/mosaic", + "name": "@mosaicstack/mosaic", "version": "0.0.19", "repository": { "type": "git", @@ -27,12 +27,12 @@ "test": "vitest run --passWithNoTests" }, "dependencies": { - "@mosaic/config": "workspace:*", - "@mosaic/forge": "workspace:*", - "@mosaic/macp": "workspace:*", - "@mosaic/prdy": "workspace:*", - "@mosaic/quality-rails": "workspace:*", - "@mosaic/types": "workspace:*", + "@mosaicstack/config": "workspace:*", + "@mosaicstack/forge": "workspace:*", + "@mosaicstack/macp": "workspace:*", + "@mosaicstack/prdy": "workspace:*", + "@mosaicstack/quality-rails": "workspace:*", + "@mosaicstack/types": "workspace:*", "@clack/prompts": "^0.9.1", "commander": "^13.0.0", "ink": "^5.0.0", diff --git a/packages/mosaic/src/cli.ts b/packages/mosaic/src/cli.ts index 17011f0..f18191c 100644 --- a/packages/mosaic/src/cli.ts +++ b/packages/mosaic/src/cli.ts @@ -2,7 +2,7 @@ import { createRequire } from 'module'; import { Command } from 'commander'; -import { registerQualityRails } from '@mosaic/quality-rails'; +import { registerQualityRails } from '@mosaicstack/quality-rails'; import { registerAgentCommand } from './commands/agent.js'; import { registerMissionCommand } from './commands/mission.js'; // prdy is registered via launch.ts @@ -10,9 +10,9 @@ import { registerLaunchCommands } from './commands/launch.js'; import { registerGatewayCommand } from './commands/gateway.js'; import { backgroundUpdateCheck, - checkForUpdate, - formatUpdateNotice, - getInstallCommand, + checkForAllUpdates, + formatAllPackagesTable, + getInstallAllCommand, } from './runtime/update-checker.js'; import { runWizard } from './wizard.js'; import { ClackPrompter } from './prompter/clack-prompter.js'; @@ -325,37 +325,35 @@ program .description('Check for and install Mosaic CLI updates') .option('--check', 'Check only, do not install') .action(async (opts: { check?: boolean }) => { - // checkForUpdate and formatUpdateNotice imported statically above + // checkForAllUpdates imported statically above const { execSync } = await import('node:child_process'); console.log('Checking for updates…'); - const result = checkForUpdate({ skipCache: true }); + const results = checkForAllUpdates({ skipCache: true }); - if (!result.latest) { - console.error('Could not reach the Mosaic registry.'); - process.exit(1); - } + console.log(''); + console.log(formatAllPackagesTable(results)); - console.log(` Installed: ${result.current || '(none)'}`); - console.log(` Latest: ${result.latest}`); - - if (!result.updateAvailable) { - console.log('\n✔ Up to date.'); + const outdated = results.filter((r: { updateAvailable: boolean }) => r.updateAvailable); + if (outdated.length === 0) { + const anyInstalled = results.some((r: { current: string }) => r.current); + if (!anyInstalled) { + console.error('No @mosaicstack/* packages are installed.'); + process.exit(1); + } + console.log('\n✔ All packages up to date.'); return; } - const notice = formatUpdateNotice(result); - if (notice) console.log(notice); - if (opts.check) { process.exit(2); // Signal to callers that an update exists } - console.log('Installing update…'); + console.log(`\nInstalling ${outdated.length} update(s)…`); try { - // Relies on @mosaic:registry in ~/.npmrc — do NOT pass --registry - // globally or non-@mosaic deps will 404 against the Gitea registry. - execSync(getInstallCommand(result), { + // Relies on @mosaicstack:registry in ~/.npmrc + const cmd = getInstallAllCommand(outdated); + execSync(cmd, { stdio: 'inherit', timeout: 60_000, }); diff --git a/packages/mosaic/src/commands/gateway/daemon.ts b/packages/mosaic/src/commands/gateway/daemon.ts index d3bba52..fa6d32f 100644 --- a/packages/mosaic/src/commands/gateway/daemon.ts +++ b/packages/mosaic/src/commands/gateway/daemon.ts @@ -91,10 +91,10 @@ export function resolveGatewayEntry(): string { return meta.entryPoint; } - // Try to resolve from globally installed @mosaic/gateway + // Try to resolve from globally installed @mosaicstack/gateway try { const req = createRequire(import.meta.url); - const pkgPath = req.resolve('@mosaic/gateway/package.json'); + const pkgPath = req.resolve('@mosaicstack/gateway/package.json'); const mainEntry = join(resolve(pkgPath, '..'), 'dist', 'main.js'); if (existsSync(mainEntry)) return mainEntry; } catch { @@ -210,8 +210,8 @@ function sleep(ms: number): Promise { const GITEA_REGISTRY = 'https://git.mosaicstack.dev/api/packages/mosaic/npm/'; export function installGatewayPackage(): void { - console.log('Installing @mosaic/gateway from Gitea registry...'); - execSync(`npm install -g @mosaic/gateway@latest --@mosaic:registry=${GITEA_REGISTRY}`, { + console.log('Installing @mosaicstack/gateway from Gitea registry...'); + execSync(`npm install -g @mosaicstack/gateway@latest --@mosaic:registry=${GITEA_REGISTRY}`, { stdio: 'inherit', timeout: 120_000, }); @@ -219,7 +219,7 @@ export function installGatewayPackage(): void { export function uninstallGatewayPackage(): void { try { - execSync('npm uninstall -g @mosaic/gateway', { + execSync('npm uninstall -g @mosaicstack/gateway', { stdio: 'inherit', timeout: 60_000, }); @@ -230,15 +230,15 @@ export function uninstallGatewayPackage(): void { export function getInstalledGatewayVersion(): string | null { try { - const output = execSync('npm ls -g @mosaic/gateway --json --depth=0', { + const output = execSync('npm ls -g @mosaicstack/gateway --json --depth=0', { encoding: 'utf-8', timeout: 15_000, stdio: ['pipe', 'pipe', 'pipe'], }); const data = JSON.parse(output) as { - dependencies?: { '@mosaic/gateway'?: { version?: string } }; + dependencies?: { '@mosaicstack/gateway'?: { version?: string } }; }; - return data.dependencies?.['@mosaic/gateway']?.version ?? null; + return data.dependencies?.['@mosaicstack/gateway']?.version ?? null; } catch { return null; } diff --git a/packages/mosaic/src/commands/gateway/install.ts b/packages/mosaic/src/commands/gateway/install.ts index 17b2ca2..5c813a0 100644 --- a/packages/mosaic/src/commands/gateway/install.ts +++ b/packages/mosaic/src/commands/gateway/install.ts @@ -142,7 +142,7 @@ async function doInstall(rl: ReturnType, opts: InstallOp entryPoint = resolveGatewayEntry(); } catch { console.error('Error: Gateway package not found after install.'); - console.error('Check that @mosaic/gateway installed correctly.'); + console.error('Check that @mosaicstack/gateway installed correctly.'); return; } diff --git a/packages/mosaic/src/commands/launch.ts b/packages/mosaic/src/commands/launch.ts index 1c8a57c..0ea9dd4 100644 --- a/packages/mosaic/src/commands/launch.ts +++ b/packages/mosaic/src/commands/launch.ts @@ -494,13 +494,13 @@ function delegateToScript(scriptPath: string, args: string[], env?: Record; checkedAt: string; registry: string; } -function readCache(): RegistryCache | null { +function readAllCache(): AllPackagesCache | null { try { if (!existsSync(CACHE_FILE)) return null; - const raw = JSON.parse(readFileSync(CACHE_FILE, 'utf-8')) as RegistryCache; + const raw = JSON.parse(readFileSync(CACHE_FILE, 'utf-8')) as AllPackagesCache; const age = Date.now() - new Date(raw.checkedAt).getTime(); if (age > CACHE_TTL_MS) return null; return raw; @@ -146,7 +168,7 @@ function readCache(): RegistryCache | null { } } -function writeCache(entry: RegistryCache): void { +function writeAllCache(entry: AllPackagesCache): void { try { mkdirSync(CACHE_DIR, { recursive: true }); writeFileSync(CACHE_FILE, JSON.stringify(entry, null, 2) + '\n', 'utf-8'); @@ -155,10 +177,28 @@ function writeCache(entry: RegistryCache): void { } } +// Legacy single-package cache (backward compat) +type RegistryCache = { latest: string; checkedAt: string; registry: string }; + +function readCache(): RegistryCache | null { + const c = readAllCache(); + if (!c) return null; + const mosaicLatest = c.packages[PKG]?.latest; + if (!mosaicLatest) return null; + return { latest: mosaicLatest, checkedAt: c.checkedAt, registry: c.registry }; +} + +function writeCache(entry: RegistryCache): void { + const existing = readAllCache(); + const packages = { ...(existing?.packages ?? {}) }; + packages[PKG] = { latest: entry.latest }; + writeAllCache({ packages, checkedAt: entry.checkedAt, registry: entry.registry }); +} + // ─── Public API ───────────────────────────────────────────────────────────── /** - * Get the currently installed @mosaic/mosaic version. + * Get the currently installed @mosaicstack/mosaic version. */ export function getInstalledVersion(): { name: string; version: string } { try { @@ -179,7 +219,7 @@ export function getInstalledVersion(): { name: string; version: string } { } /** - * Fetch the latest published @mosaic/mosaic version from the Gitea npm registry. + * Fetch the latest published @mosaicstack/mosaic version from the Gitea npm registry. * Returns empty string on failure. */ export function getLatestVersion(): { name: string; version: string } { @@ -199,6 +239,9 @@ export function getInstallCommand(result: Pick { + const result: Record = {}; + try { + const raw = npmExec('ls -g --depth=0 --json 2>/dev/null', 3000); + if (raw) { + const data = JSON.parse(raw) as { + dependencies?: Record; + }; + for (const [name, info] of Object.entries(data?.dependencies ?? {})) { + if (name.startsWith('@mosaicstack/') && info.version) { + result[name] = info.version; + } + } + } + } catch { + // fall through + } + return result; +} + +/** + * Fetch the latest published version of a single package from the registry. + */ +function getLatestVersionFor(pkgName: string): string { + return npmExec(`view ${pkgName} version --registry=${REGISTRY}`); +} + +/** + * Check all known @mosaicstack/* packages for updates. + * Returns an array of per-package results, sorted by package name. + * Never throws. + */ +export function checkForAllUpdates(options?: { skipCache?: boolean }): PackageUpdateResult[] { + const installed = getInstalledVersions(); + const checkedAt = new Date().toISOString(); + + // Resolve latest versions (from cache or network) + let latestVersions: Record; + + if (!options?.skipCache) { + const cached = readAllCache(); + if (cached) { + latestVersions = {}; + for (const pkg of KNOWN_PACKAGES) { + const cachedLatest = cached.packages[pkg]?.latest; + if (cachedLatest) { + latestVersions[pkg] = cachedLatest; + } + } + } else { + latestVersions = {}; + for (const pkg of KNOWN_PACKAGES) { + const v = getLatestVersionFor(pkg); + if (v) latestVersions[pkg] = v; + } + writeAllCache({ + packages: Object.fromEntries( + Object.entries(latestVersions).map(([k, v]) => [k, { latest: v }]), + ), + checkedAt, + registry: REGISTRY, + }); + } + } else { + latestVersions = {}; + for (const pkg of KNOWN_PACKAGES) { + const v = getLatestVersionFor(pkg); + if (v) latestVersions[pkg] = v; + } + writeAllCache({ + packages: Object.fromEntries( + Object.entries(latestVersions).map(([k, v]) => [k, { latest: v }]), + ), + checkedAt, + registry: REGISTRY, + }); + } + + const results: PackageUpdateResult[] = []; + for (const pkg of KNOWN_PACKAGES) { + const current = installed[pkg] ?? ''; + const latest = latestVersions[pkg] ?? ''; + results.push({ + package: pkg, + current, + latest, + updateAvailable: !!(current && latest && semverLt(current, latest)), + }); + } + + return results.sort((a, b) => a.package.localeCompare(b.package)); +} + +/** + * Get the install command for all outdated packages. + */ +export function getInstallAllCommand(outdated: PackageUpdateResult[]): string { + const pkgs = outdated.filter((r) => r.updateAvailable).map((r) => `${r.package}@latest`); + if (pkgs.length === 0) return ''; + return `npm i -g ${pkgs.join(' ')}`; +} + +/** + * Format a table showing all packages with their current/latest versions. + */ +export function formatAllPackagesTable(results: PackageUpdateResult[]): string { + if (results.length === 0) return 'No @mosaicstack/* packages found.'; + + const hasUpdate = results.some((r) => r.updateAvailable); + const nameWidth = Math.max(...results.map((r) => r.package.length), 10); + const verWidth = 10; + + const header = + ' ' + + 'Package'.padEnd(nameWidth + 2) + + 'Current'.padEnd(verWidth + 2) + + 'Latest'.padEnd(verWidth + 2) + + 'Status'; + const sep = ' ' + '-'.repeat(header.length - 2); + + const rows = results.map((r) => { + const status = !r.current + ? 'not installed' + : r.updateAvailable + ? '⬆ update available' + : '✔ up to date'; + return ( + ' ' + + r.package.padEnd(nameWidth + 2) + + (r.current || '-').padEnd(verWidth + 2) + + (r.latest || '-').padEnd(verWidth + 2) + + status + ); + }); + + return [header, sep, ...rows].join('\n'); +} diff --git a/packages/mosaic/src/tui/app.tsx b/packages/mosaic/src/tui/app.tsx index 4538cfa..ff9d64a 100644 --- a/packages/mosaic/src/tui/app.tsx +++ b/packages/mosaic/src/tui/app.tsx @@ -1,6 +1,6 @@ import React, { useState, useCallback, useEffect, useMemo, useRef } from 'react'; import { Box, useApp, useInput } from 'ink'; -import type { ParsedCommand } from '@mosaic/types'; +import type { ParsedCommand } from '@mosaicstack/types'; import { TopBar } from './components/top-bar.js'; import { BottomBar } from './components/bottom-bar.js'; import { MessageList } from './components/message-list.js'; diff --git a/packages/mosaic/src/tui/commands/commands.integration.spec.ts b/packages/mosaic/src/tui/commands/commands.integration.spec.ts index 89871a3..fa28d07 100644 --- a/packages/mosaic/src/tui/commands/commands.integration.spec.ts +++ b/packages/mosaic/src/tui/commands/commands.integration.spec.ts @@ -11,7 +11,7 @@ import { describe, it, expect, beforeEach } from 'vitest'; import { parseSlashCommand } from './parse.js'; import { CommandRegistry } from './registry.js'; -import type { CommandDef } from '@mosaic/types'; +import type { CommandDef } from '@mosaicstack/types'; // ─── Parse + Registry Round-trip ───────────────────────────────────────────── diff --git a/packages/mosaic/src/tui/commands/local/help.ts b/packages/mosaic/src/tui/commands/local/help.ts index da3d850..fc22941 100644 --- a/packages/mosaic/src/tui/commands/local/help.ts +++ b/packages/mosaic/src/tui/commands/local/help.ts @@ -1,4 +1,4 @@ -import type { ParsedCommand } from '@mosaic/types'; +import type { ParsedCommand } from '@mosaicstack/types'; import { commandRegistry } from '../registry.js'; export function executeHelp(_parsed: ParsedCommand): string { diff --git a/packages/mosaic/src/tui/commands/local/status.ts b/packages/mosaic/src/tui/commands/local/status.ts index e136a51..27f0c88 100644 --- a/packages/mosaic/src/tui/commands/local/status.ts +++ b/packages/mosaic/src/tui/commands/local/status.ts @@ -1,4 +1,4 @@ -import type { ParsedCommand } from '@mosaic/types'; +import type { ParsedCommand } from '@mosaicstack/types'; export interface StatusContext { connected: boolean; diff --git a/packages/mosaic/src/tui/commands/parse.ts b/packages/mosaic/src/tui/commands/parse.ts index 17f2eaa..37bc376 100644 --- a/packages/mosaic/src/tui/commands/parse.ts +++ b/packages/mosaic/src/tui/commands/parse.ts @@ -1,4 +1,4 @@ -import type { ParsedCommand } from '@mosaic/types'; +import type { ParsedCommand } from '@mosaicstack/types'; export function parseSlashCommand(input: string): ParsedCommand | null { const match = input.match(/^\/([a-z][a-z0-9:_-]*)\s*(.*)?$/i); diff --git a/packages/mosaic/src/tui/commands/registry.ts b/packages/mosaic/src/tui/commands/registry.ts index d3c38fa..f66e7dc 100644 --- a/packages/mosaic/src/tui/commands/registry.ts +++ b/packages/mosaic/src/tui/commands/registry.ts @@ -1,4 +1,4 @@ -import type { CommandDef, CommandManifest } from '@mosaic/types'; +import type { CommandDef, CommandManifest } from '@mosaicstack/types'; // Local-only commands (work even when gateway is disconnected) const LOCAL_COMMANDS: CommandDef[] = [ diff --git a/packages/mosaic/src/tui/components/bottom-bar.tsx b/packages/mosaic/src/tui/components/bottom-bar.tsx index f875501..c5166a5 100644 --- a/packages/mosaic/src/tui/components/bottom-bar.tsx +++ b/packages/mosaic/src/tui/components/bottom-bar.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { Box, Text } from 'ink'; -import type { RoutingDecisionInfo } from '@mosaic/types'; +import type { RoutingDecisionInfo } from '@mosaicstack/types'; import type { TokenUsage } from '../hooks/use-socket.js'; import type { GitInfo } from '../hooks/use-git-info.js'; diff --git a/packages/mosaic/src/tui/components/command-autocomplete.tsx b/packages/mosaic/src/tui/components/command-autocomplete.tsx index 6fdcf65..9b697a0 100644 --- a/packages/mosaic/src/tui/components/command-autocomplete.tsx +++ b/packages/mosaic/src/tui/components/command-autocomplete.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { Box, Text } from 'ink'; -import type { CommandDef, CommandArgDef } from '@mosaic/types'; +import type { CommandDef, CommandArgDef } from '@mosaicstack/types'; interface CommandAutocompleteProps { commands: CommandDef[]; diff --git a/packages/mosaic/src/tui/components/input-bar.tsx b/packages/mosaic/src/tui/components/input-bar.tsx index 457a400..38b9b8a 100644 --- a/packages/mosaic/src/tui/components/input-bar.tsx +++ b/packages/mosaic/src/tui/components/input-bar.tsx @@ -1,7 +1,7 @@ import React, { useCallback } from 'react'; import { Box, Text, useInput } from 'ink'; import TextInput from 'ink-text-input'; -import type { ParsedCommand, CommandDef } from '@mosaic/types'; +import type { ParsedCommand, CommandDef } from '@mosaicstack/types'; import { parseSlashCommand, commandRegistry } from '../commands/index.js'; import { CommandAutocomplete } from './command-autocomplete.js'; import { useInputHistory } from '../hooks/use-input-history.js'; diff --git a/packages/mosaic/src/tui/hooks/use-socket.ts b/packages/mosaic/src/tui/hooks/use-socket.ts index 0635e01..f51c669 100644 --- a/packages/mosaic/src/tui/hooks/use-socket.ts +++ b/packages/mosaic/src/tui/hooks/use-socket.ts @@ -15,7 +15,7 @@ import type { SlashCommandResultPayload, SystemReloadPayload, RoutingDecisionInfo, -} from '@mosaic/types'; +} from '@mosaicstack/types'; import { commandRegistry } from '../commands/index.js'; export interface ToolCall { diff --git a/packages/prdy/package.json b/packages/prdy/package.json index 9fb0eef..984a62f 100644 --- a/packages/prdy/package.json +++ b/packages/prdy/package.json @@ -1,5 +1,5 @@ { - "name": "@mosaic/prdy", + "name": "@mosaicstack/prdy", "version": "0.0.2", "repository": { "type": "git", diff --git a/packages/quality-rails/package.json b/packages/quality-rails/package.json index c01f3f3..d88800d 100644 --- a/packages/quality-rails/package.json +++ b/packages/quality-rails/package.json @@ -1,5 +1,5 @@ { - "name": "@mosaic/quality-rails", + "name": "@mosaicstack/quality-rails", "version": "0.0.3", "repository": { "type": "git", diff --git a/packages/queue/package.json b/packages/queue/package.json index 6bd1c24..bacf30a 100644 --- a/packages/queue/package.json +++ b/packages/queue/package.json @@ -1,5 +1,5 @@ { - "name": "@mosaic/queue", + "name": "@mosaicstack/queue", "version": "0.0.3", "repository": { "type": "git", @@ -21,7 +21,7 @@ "test": "vitest run --passWithNoTests" }, "dependencies": { - "@mosaic/types": "workspace:*", + "@mosaicstack/types": "workspace:*", "ioredis": "^5.10.0" }, "devDependencies": { diff --git a/packages/storage/package.json b/packages/storage/package.json index 5451fd1..c9beb5e 100644 --- a/packages/storage/package.json +++ b/packages/storage/package.json @@ -1,5 +1,5 @@ { - "name": "@mosaic/storage", + "name": "@mosaicstack/storage", "version": "0.0.3", "repository": { "type": "git", @@ -22,8 +22,8 @@ }, "dependencies": { "@electric-sql/pglite": "^0.2.17", - "@mosaic/db": "workspace:^", - "@mosaic/types": "workspace:*" + "@mosaicstack/db": "workspace:^", + "@mosaicstack/types": "workspace:*" }, "devDependencies": { "typescript": "^5.8.0", diff --git a/packages/storage/src/adapters/postgres.ts b/packages/storage/src/adapters/postgres.ts index f6c69a5..6fb74d8 100644 --- a/packages/storage/src/adapters/postgres.ts +++ b/packages/storage/src/adapters/postgres.ts @@ -8,8 +8,8 @@ import { sql, type Db, type DbHandle, -} from '@mosaic/db'; -import * as schema from '@mosaic/db'; +} from '@mosaicstack/db'; +import * as schema from '@mosaicstack/db'; import type { StorageAdapter, StorageConfig } from '../types.js'; /* eslint-disable @typescript-eslint/no-explicit-any */ diff --git a/packages/types/package.json b/packages/types/package.json index 3e8008c..c78aabb 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,5 +1,5 @@ { - "name": "@mosaic/types", + "name": "@mosaicstack/types", "version": "0.0.2", "repository": { "type": "git", diff --git a/plugins/discord/package.json b/plugins/discord/package.json index e5b5511..dcd5eca 100644 --- a/plugins/discord/package.json +++ b/plugins/discord/package.json @@ -1,5 +1,5 @@ { - "name": "@mosaic/discord-plugin", + "name": "@mosaicstack/discord-plugin", "version": "0.0.2", "repository": { "type": "git", diff --git a/plugins/macp/README.md b/plugins/macp/README.md index 0911eb7..f1d7fe5 100644 --- a/plugins/macp/README.md +++ b/plugins/macp/README.md @@ -55,7 +55,7 @@ Add the plugin entry to your OpenClaw config: ## Verification ```bash -pnpm --filter @mosaic/oc-macp-plugin typecheck || npx tsc --noEmit -p plugins/macp/tsconfig.json +pnpm --filter @mosaicstack/oc-macp-plugin typecheck || npx tsc --noEmit -p plugins/macp/tsconfig.json pnpm prettier --write "plugins/macp/**/*.{ts,json,md}" pnpm format:check ``` diff --git a/plugins/macp/package.json b/plugins/macp/package.json index 7bd6dc6..1775a4a 100644 --- a/plugins/macp/package.json +++ b/plugins/macp/package.json @@ -1,5 +1,5 @@ { - "name": "@mosaic/oc-macp-plugin", + "name": "@mosaicstack/oc-macp-plugin", "version": "0.0.2", "repository": { "type": "git", diff --git a/plugins/mosaic-framework/package.json b/plugins/mosaic-framework/package.json index 1173b3c..c5b2d58 100644 --- a/plugins/mosaic-framework/package.json +++ b/plugins/mosaic-framework/package.json @@ -1,5 +1,5 @@ { - "name": "@mosaic/oc-framework-plugin", + "name": "@mosaicstack/oc-framework-plugin", "version": "0.0.2", "repository": { "type": "git", diff --git a/plugins/telegram/README.md b/plugins/telegram/README.md index 2f44258..596a914 100644 --- a/plugins/telegram/README.md +++ b/plugins/telegram/README.md @@ -1,6 +1,6 @@ -# @mosaic/telegram-plugin +# @mosaicstack/telegram-plugin -`@mosaic/telegram-plugin` connects a Telegram bot to the Mosaic gateway chat namespace so Telegram chats can participate in the same conversation flow as the web, TUI, and Discord channels. +`@mosaicstack/telegram-plugin` connects a Telegram bot to the Mosaic gateway chat namespace so Telegram chats can participate in the same conversation flow as the web, TUI, and Discord channels. ## Required Environment Variables diff --git a/plugins/telegram/package.json b/plugins/telegram/package.json index 8b5bfbd..6800d18 100644 --- a/plugins/telegram/package.json +++ b/plugins/telegram/package.json @@ -1,5 +1,5 @@ { - "name": "@mosaic/telegram-plugin", + "name": "@mosaicstack/telegram-plugin", "version": "0.0.2", "repository": { "type": "git", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5925de7..df1291d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -56,40 +56,40 @@ importers: '@modelcontextprotocol/sdk': specifier: ^1.27.1 version: 1.27.1(zod@4.3.6) - '@mosaic/auth': + '@mosaicstack/auth': specifier: workspace:^ version: link:../../packages/auth - '@mosaic/brain': + '@mosaicstack/brain': specifier: workspace:^ version: link:../../packages/brain - '@mosaic/config': + '@mosaicstack/config': specifier: workspace:^ version: link:../../packages/config - '@mosaic/coord': + '@mosaicstack/coord': specifier: workspace:^ version: link:../../packages/coord - '@mosaic/db': + '@mosaicstack/db': specifier: workspace:^ version: link:../../packages/db - '@mosaic/discord-plugin': + '@mosaicstack/discord-plugin': specifier: workspace:^ version: link:../../plugins/discord - '@mosaic/log': + '@mosaicstack/log': specifier: workspace:^ version: link:../../packages/log - '@mosaic/memory': + '@mosaicstack/memory': specifier: workspace:^ version: link:../../packages/memory - '@mosaic/queue': + '@mosaicstack/queue': specifier: workspace:^ version: link:../../packages/queue - '@mosaic/storage': + '@mosaicstack/storage': specifier: workspace:^ version: link:../../packages/storage - '@mosaic/telegram-plugin': + '@mosaicstack/telegram-plugin': specifier: workspace:^ version: link:../../plugins/telegram - '@mosaic/types': + '@mosaicstack/types': specifier: workspace:^ version: link:../../packages/types '@nestjs/common': @@ -195,7 +195,7 @@ importers: apps/web: dependencies: - '@mosaic/design-tokens': + '@mosaicstack/design-tokens': specifier: workspace:^ version: link:../../packages/design-tokens better-auth: @@ -253,7 +253,7 @@ importers: packages/agent: dependencies: - '@mosaic/types': + '@mosaicstack/types': specifier: workspace:* version: link:../types devDependencies: @@ -266,7 +266,7 @@ importers: packages/auth: dependencies: - '@mosaic/db': + '@mosaicstack/db': specifier: workspace:^ version: link:../db better-auth: @@ -288,10 +288,10 @@ importers: packages/brain: dependencies: - '@mosaic/db': + '@mosaicstack/db': specifier: workspace:^ version: link:../db - '@mosaic/types': + '@mosaicstack/types': specifier: workspace:* version: link:../types devDependencies: @@ -304,13 +304,13 @@ importers: packages/config: dependencies: - '@mosaic/memory': + '@mosaicstack/memory': specifier: workspace:^ version: link:../memory - '@mosaic/queue': + '@mosaicstack/queue': specifier: workspace:^ version: link:../queue - '@mosaic/storage': + '@mosaicstack/storage': specifier: workspace:^ version: link:../storage devDependencies: @@ -326,7 +326,7 @@ importers: packages/coord: dependencies: - '@mosaic/types': + '@mosaicstack/types': specifier: workspace:* version: link:../types devDependencies: @@ -379,7 +379,7 @@ importers: packages/forge: dependencies: - '@mosaic/macp': + '@mosaicstack/macp': specifier: workspace:* version: link:../macp devDependencies: @@ -398,7 +398,7 @@ importers: packages/log: dependencies: - '@mosaic/db': + '@mosaicstack/db': specifier: workspace:* version: link:../db drizzle-orm: @@ -429,13 +429,13 @@ importers: packages/memory: dependencies: - '@mosaic/db': + '@mosaicstack/db': specifier: workspace:* version: link:../db - '@mosaic/storage': + '@mosaicstack/storage': specifier: workspace:* version: link:../storage - '@mosaic/types': + '@mosaicstack/types': specifier: workspace:* version: link:../types drizzle-orm: @@ -454,22 +454,22 @@ importers: '@clack/prompts': specifier: ^0.9.1 version: 0.9.1 - '@mosaic/config': + '@mosaicstack/config': specifier: workspace:* version: link:../config - '@mosaic/forge': + '@mosaicstack/forge': specifier: workspace:* version: link:../forge - '@mosaic/macp': + '@mosaicstack/macp': specifier: workspace:* version: link:../macp - '@mosaic/prdy': + '@mosaicstack/prdy': specifier: workspace:* version: link:../prdy - '@mosaic/quality-rails': + '@mosaicstack/quality-rails': specifier: workspace:* version: link:../quality-rails - '@mosaic/types': + '@mosaicstack/types': specifier: workspace:* version: link:../types commander: @@ -562,7 +562,7 @@ importers: packages/queue: dependencies: - '@mosaic/types': + '@mosaicstack/types': specifier: workspace:* version: link:../types ioredis: @@ -581,10 +581,10 @@ importers: '@electric-sql/pglite': specifier: ^0.2.17 version: 0.2.17 - '@mosaic/db': + '@mosaicstack/db': specifier: workspace:^ version: link:../db - '@mosaic/types': + '@mosaicstack/types': specifier: workspace:* version: link:../types devDependencies: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 9a5ca83..18b7f89 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -2,7 +2,7 @@ packages: - 'apps/*' - 'packages/*' - 'plugins/*' - - '!packages/cli' # merged into @mosaic/mosaic + - '!packages/cli' # merged into @mosaicstack/mosaic ignoredBuiltDependencies: - '@nestjs/core' diff --git a/scratchpads/cli-tui-tools-enhancement.md b/scratchpads/cli-tui-tools-enhancement.md index 733475e..9e17bd6 100644 --- a/scratchpads/cli-tui-tools-enhancement.md +++ b/scratchpads/cli-tui-tools-enhancement.md @@ -44,7 +44,7 @@ Add 5 capability areas to the Mosaic CLI/TUI + gateway agent: ### 5. Implement /stop -- Add `abort` event to ClientToServerEvents in @mosaic/types +- Add `abort` event to ClientToServerEvents in @mosaicstack/types - TUI sends abort event on /stop command - Gateway chat handler aborts the Pi session prompt - Update use-socket to support abort diff --git a/scripts/publish-npmjs.sh b/scripts/publish-npmjs.sh index 1d839b6..fe66da4 100755 --- a/scripts/publish-npmjs.sh +++ b/scripts/publish-npmjs.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash -# Publish @mosaic/* packages to npmjs.org as @mosaicstack/* +# Publish @mosaicstack/* packages to npmjs.org as @mosaicstack/* # # This script patches each package.json to: -# 1. Rename @mosaic/X → @mosaicstack/X +# 1. Rename @mosaicstack/X → @mosaicstack/X # 2. Replace workspace:^ deps with resolved versions using @mosaicstack/* names # 3. Run npm publish # 4. Restore original package.json @@ -41,7 +41,7 @@ done echo "Found ${#PACKAGE_DIRS[@]} publishable packages" -# Build a version map: @mosaic/X → version +# Build a version map: @mosaicstack/X → version declare -A VERSION_MAP for dir in "${PACKAGE_DIRS[@]}"; do name=$(jq -r '.name' "$dir/package.json") @@ -91,8 +91,8 @@ publish_package() { local dep_version dep_version=$(echo "$patched" | jq -r ".$dep_field[\"$dep\"]") - # Only transform @mosaic/* workspace deps - if [[ "$dep" == @mosaic/* ]] && [[ "$dep_version" == workspace:* ]]; then + # Only transform @mosaicstack/* workspace deps + if [[ "$dep" == @mosaicstack/* ]] && [[ "$dep_version" == workspace:* ]]; then local new_dep="${dep/@mosaic\//@mosaicstack/}" local resolved="${VERSION_MAP[$dep]:-}" diff --git a/skills/mosaic-board/SKILL.md b/skills/mosaic-board/SKILL.md index 8749b16..ad6eda4 100644 --- a/skills/mosaic-board/SKILL.md +++ b/skills/mosaic-board/SKILL.md @@ -122,7 +122,7 @@ Format the output as a readable Board Decision document: This skill works **standalone** — you don't need the full Mosaic Stack or Forge pipeline. Just invoke `/skill:mosaic-board` with any brief or proposal. -When used within the **Forge pipeline** (`@mosaic/forge`), the board stage is automated with parallel persona tasks and mechanical synthesis via `board-tasks.ts`. +When used within the **Forge pipeline** (`@mosaicstack/forge`), the board stage is automated with parallel persona tasks and mechanical synthesis via `board-tasks.ts`. --- diff --git a/skills/mosaic-forge/SKILL.md b/skills/mosaic-forge/SKILL.md index 83323f6..5143c81 100644 --- a/skills/mosaic-forge/SKILL.md +++ b/skills/mosaic-forge/SKILL.md @@ -129,7 +129,7 @@ After each stage, verify before advancing: ## Full Pipeline Mode (Mosaic Stack) -When the full `@mosaic/forge` package is available, Forge uses MACP task execution: +When the full `@mosaicstack/forge` package is available, Forge uses MACP task execution: ```bash # Run from CLI diff --git a/tools/install.sh b/tools/install.sh index 14f11f6..75f3788 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -3,7 +3,7 @@ # # Installs both components: # 1. Mosaic framework → ~/.config/mosaic/ (bash launcher, guides, runtime configs, tools) -# 2. @mosaic/mosaic (npm) → ~/.npm-global/ (CLI, TUI, gateway client, wizard) +# 2. @mosaicstack/mosaic (npm) → ~/.npm-global/ (CLI, TUI, gateway client, wizard) # # Remote install (recommended): # bash <(curl -fsSL https://git.mosaicstack.dev/mosaic/mosaic-stack/raw/branch/main/tools/install.sh) @@ -20,7 +20,7 @@ # Environment: # MOSAIC_HOME — framework install dir (default: ~/.config/mosaic) # MOSAIC_REGISTRY — npm registry URL (default: Gitea instance) -# MOSAIC_SCOPE — npm scope (default: @mosaic) +# MOSAIC_SCOPE — npm scope (default: @mosaicstack) # MOSAIC_PREFIX — npm global prefix (default: ~/.npm-global) # MOSAIC_NO_COLOR — disable colour (set to 1) # MOSAIC_REF — git ref for framework (default: main) @@ -51,7 +51,7 @@ done # ─── constants ──────────────────────────────────────────────────────────────── MOSAIC_HOME="${MOSAIC_HOME:-$HOME/.config/mosaic}" REGISTRY="${MOSAIC_REGISTRY:-https://git.mosaicstack.dev/api/packages/mosaic/npm/}" -SCOPE="${MOSAIC_SCOPE:-@mosaic}" +SCOPE="${MOSAIC_SCOPE:-@mosaicstack}" PREFIX="${MOSAIC_PREFIX:-$HOME/.npm-global}" CLI_PKG="${SCOPE}/mosaic" REPO_BASE="https://git.mosaicstack.dev/mosaic/mosaic-stack" @@ -208,11 +208,11 @@ if [[ "$FLAG_FRAMEWORK" == "true" ]]; then fi # ═══════════════════════════════════════════════════════════════════════════════ -# PART 2: @mosaic/mosaic (npm — TUI, gateway client, wizard, CLI) +# PART 2: @mosaicstack/mosaic (npm — TUI, gateway client, wizard, CLI) # ═══════════════════════════════════════════════════════════════════════════════ if [[ "$FLAG_CLI" == "true" ]]; then - step "@mosaic/cli (npm package)" + step "@mosaicstack/cli (npm package)" # Ensure prefix dir if [[ ! -d "$PREFIX" ]]; then