Skip to content

Add unified agent sync providers for credentials and preferences#42

Merged
gricha merged 2 commits intomainfrom
unified-agent-sync-providers
Jan 8, 2026
Merged

Add unified agent sync providers for credentials and preferences#42
gricha merged 2 commits intomainfrom
unified-agent-sync-providers

Conversation

@gricha
Copy link
Copy Markdown
Owner

@gricha gricha commented Jan 8, 2026

Summary

  • Introduces a unified AgentSyncProvider interface for syncing agent credentials and preferences to workspaces
  • Creates a central registry at src/agents/ that combines sync and session providers for each coding agent
  • Replaces hardcoded sync methods in WorkspaceManager with the new abstraction
  • Adds comprehensive unit tests with mock FileCopier for testability without Docker

Architecture

src/agents/
├── types.ts              # Core interfaces (AgentSyncProvider, SyncFile, etc.)
├── index.ts              # Central registry + syncAllAgents orchestrator
├── sync/
│   ├── types.ts          # FileCopier interface
│   ├── copier.ts         # Docker + mock implementations
│   ├── claude-code.ts    # Claude Code sync provider
│   ├── opencode.ts       # OpenCode sync provider
│   └── codex.ts          # Codex sync provider
└── __tests__/            # Unit tests (40 tests, no Docker required)

What Each Agent Now Syncs

Agent Credentials Preferences
Claude Code ~/.claude/.credentials.json settings.json, CLAUDE.md, ~/.claude/agents/ (skills), MCP servers from ~/.claude.json
OpenCode Generated opencode.json with zen_token MCP config from host's opencode.json
Codex ~/.codex/auth.json ~/.codex/config.toml

Key Design Decisions

  1. Testability first: FileCopier interface allows unit testing without Docker
  2. One-time sync: Credentials/preferences sync on workspace create/start (not continuous)
  3. Central registry: src/agents/index.ts is the single entry point for all agent capabilities
  4. Option C architecture: Keeps existing session providers in place, adds sync providers alongside

Changes

  • New: src/agents/ - Agent sync providers and central registry
  • New: test/integration/agent-sync.test.ts - Integration test
  • Modified: src/workspace/manager.ts - Replaced 3 methods with syncAllAgents() call
  • Modified: src/agent/file-watcher.ts - Uses getCredentialFilePaths() from agents module
  • Modified: test/helpers/agent.ts - Fixed agents config passthrough

Testing

  • 40 new unit tests for providers and orchestrator
  • 4 new integration tests for agent sync
  • All 189 existing tests pass

Comment thread src/agents/sync/copier.ts Outdated
Comment on lines +55 to +59
await docker.execInContainer(containerName, ['chmod', '-R', '644', dir.dest], {
user: 'workspace',
});
await docker.execInContainer(containerName, ['chmod', '755', dir.dest], {
user: 'workspace',

This comment was marked as outdated.

@gricha gricha force-pushed the unified-agent-sync-providers branch from 2441f66 to 1f6513a Compare January 8, 2026 03:42
@gricha gricha force-pushed the unified-agent-sync-providers branch from 1f6513a to b120282 Compare January 8, 2026 04:47
@gricha gricha merged commit 1969206 into main Jan 8, 2026
6 checks passed
@gricha gricha deleted the unified-agent-sync-providers branch January 8, 2026 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant