fix: add prompts/templates to backup + STDIO attach for docker-image servers

Two bugs fixed:

1. Backup completeness: JSON backup API now includes prompts and
   templates. Previously these were silently dropped during
   backup/restore, causing data loss on migration.

2. STDIO proxy for docker-image servers: servers with dockerImage
   but no packageName/command (like docmost) now use k8s Attach
   to connect to the container's PID 1 stdin/stdout instead of
   exec. This fixes "has no packageName or command" errors.

Changes:
- backup-service.ts: add BackupPrompt/BackupTemplate types, export them
- restore-service.ts: restore prompts (with project FK) and templates
- mcp-proxy-service.ts: sendViaPersistentAttach for docker-image STDIO
- orchestrator.ts: add attachInteractive to McpOrchestrator interface
- kubernetes-orchestrator.ts: implement attachInteractive via k8s Attach
- k8s-client-official.ts: expose Attach client

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Michal
2026-04-09 23:21:34 +01:00
parent d293df738a
commit 1bd5087052
11 changed files with 1327 additions and 6 deletions

View File

@@ -67,6 +67,10 @@ vi.mock('@kubernetes/client-node', () => {
exec = vi.fn();
}
class MockAttach {
attach = vi.fn();
}
class MockLog {
log = vi.fn();
}
@@ -75,6 +79,7 @@ vi.mock('@kubernetes/client-node', () => {
KubeConfig: MockKubeConfig,
CoreV1Api: class {},
Exec: MockExec,
Attach: MockAttach,
Log: MockLog,
// Export test helpers
__testHelpers: { setHandler, getHandler, clearHandlers, mockCore },