import type { ApiClient } from './api-client'; import type { RepoSyncResult } from './repo-sync'; import type { AgentChatMode, AgentServerConfig, ProjectConfigResponse } from './types'; export interface ConfigSyncState { currentConfigHash: string | undefined; projectConfig: ProjectConfigResponse | undefined; serverConfig: AgentServerConfig | null; availableChatModes: AgentChatMode[]; activeChatMode: AgentChatMode | undefined; activeChatModeExplicit: boolean; mcpConfigPath: string | undefined; dockerCustomizationHash: string | undefined; /** * 共有ファイルの配置に失敗したもの。ハートビートで api へ報告し、画面に警告として出す。 * 成功のみになったら消す(復旧後も古い警告が残り続けないように)。 */ sharedFileMountErrors?: { destPath: string; error: string; }[]; } export interface ConfigSyncDeps { client: ApiClient; prefix: string; projectDir: string | undefined; apiUrl: string; token: string; projectCode: string; localAgentChatMode: AgentChatMode | undefined; browserLocalPort?: number; /** * Called when Docker customization changes (Docker mode only). * * `commandId`, when the config sync was itself triggered by a `config_sync` * (or `setup`) command, is the id of that triggering command. Threaded * through to `ProjectAgent.performDockerRebuild()` so it can pass it to * `shutdown()` as `excludeCommandId` — the same self-reference reason as * `performReboot`/`performUpdate`: `performDockerRebuild()` is invoked * fire-and-forget from *inside* the triggering command's own still-executing * handler (see `processCommand` in agent-transport.ts, which only removes * the commandId from `inFlightCommands` in a `finally` block that runs after * the handler — including `submitResult()` — returns), so without excluding * it, `shutdown()`'s drain would needlessly wait on the triggering command's * own in-flight entry until `submitResult()` finishes. */ onDockerRebuild?: (commandId?: string) => void; } /** * Perform config sync from server and update state. * Returns true if config was updated. * * @param commandId See `ConfigSyncDeps.onDockerRebuild`'s doc comment — passed * through to it (via `applyProjectConfig`) when this sync was triggered by a * `config_sync`/`setup` command. `undefined` for background syncs (initial * startup retry loop, debounced `config-update` notifications). */ export declare function performConfigSync(deps: ConfigSyncDeps, state: ConfigSyncState, commandId?: string): Promise; /** * Perform full setup: config sync + repository sync + documentation check. */ export declare function performSetup(deps: ConfigSyncDeps, state: ConfigSyncState, commandId?: string): Promise; /** Options for applyProjectConfig */ export interface ApplyProjectConfigOptions { /** * `true` のとき、`config` はディスクキャッシュから復元したもので、 * 秘匿情報 (envVars 等) が抜けている可能性がある。 * 直前まで適用していた envVars を保持してネットワーク断時の劣化を防ぐ。 */ fromCache?: boolean; /** See `ConfigSyncDeps.onDockerRebuild`'s doc comment. */ commandId?: string; } /** * Apply project config to state (update serverConfig, write AWS/MCP config files). */ export declare function applyProjectConfig(deps: ConfigSyncDeps, state: ConfigSyncState, config: ProjectConfigResponse, options?: ApplyProjectConfigOptions): Promise; export interface SyncRepositoryOptions { repositoryCode: string; branch?: string; } /** * 特定リポジトリをコードとブランチ指定で同期する。 */ export declare function performSyncRepository(deps: ConfigSyncDeps, state: ConfigSyncState, options: SyncRepositoryOptions): Promise; /** * Schedule a debounced config sync. * Returns the new timer handle (caller should store it and clear on stop). */ export declare function scheduleConfigSync(deps: ConfigSyncDeps, state: ConfigSyncState, existingTimer: ReturnType | null): ReturnType; /** * Refresh available chat modes and server config. */ export declare function refreshChatMode(deps: ConfigSyncDeps, state: ConfigSyncState, verbose: boolean): Promise; /** * MCP server script path resolution. * * When running with ts-node/tsx, __dirname points to src/ where server.js does not exist. * In that case, fall back to dist/mcp/server.js. */ export declare function resolveMcpServerPath(): string; //# sourceMappingURL=agent-config-sync.d.ts.map