/** * daemon/pai-projects.ts — PAI named session integration. * * Shells out to the `pai` CLI to list and launch named Claude project sessions. * Results are cached for 30 seconds to avoid hammering the CLI on every request. * * Usage: * const projects = await listPaiProjects(); * const project = await findPaiProject("whazaa"); * const { pid, sessionId } = await launchPaiProject("whazaa"); */ export interface PaiProject { name: string; names: string[]; slug: string; displayName: string; rootPath: string; sessionCount: number; lastActive: string; sessionConfig?: { permission?: string; flags?: string; env?: Record; autoStart?: boolean; }; } /** Invalidate the project list cache (e.g. after launching a project). */ export declare function invalidatePaiProjectCache(): void; /** * Return all named PAI projects. * Results are cached for 30 seconds. */ export declare function listPaiProjects(all?: boolean): Promise; /** * Find a project by any of its names or aliases, among CURATED projects only. * * Deliberately narrower than findPaiProject(). The `--all` set is ~118 entries * with empty `names` and genuine ambiguity — three separate registry rows share * the display name "Glidr" at different paths — so resolving a task against it * silently dispatches work to the wrong directory. Bus participation therefore * stays opt-in: a project joins by being given an alias * (`pai project name `), and anything without one is * reported as unlaunchable rather than guessed at. * * Matching is case-insensitive. */ export declare function findCuratedPaiProject(name: string): Promise; /** * Find a project by any of its names or aliases. * Matching is case-insensitive. */ export declare function findPaiProject(name: string): Promise; /** * Get the effective (merged) config for a PAI project. * * Calls `pai project config --json` which returns project config, * global defaults, and the merged effective config. We use `effective` * because it respects the resolution order: project overrides globals. */ export declare function getEffectiveConfig(name: string): Promise<{ permission?: string; flags?: string; env?: Record; autoStart?: boolean; } | undefined>; /** * Launch Claude in the named project's directory as a visual iTerm2 tab. * * Uses `pai project config --json` to get the effective (merged) * config, then builds a shell command that: * 1. cd's to the project directory * 2. Exports any env vars from the config * 3. Runs `claude` with the configured flags * * Opens a new iTerm2 tab via AppleScript and types the command into it. * Returns the iTerm2 session ID for registration with HybridSessionManager. */ export declare function launchPaiProject(name: string): Promise<{ itermSessionId: string; sessionId: string; }>; /** * A launch that cannot succeed no matter how often it is retried. * * Carries `permanent` so the caller — and PAI's task poller across the IPC * boundary — can tell "this will never work" from "this did not work yet" and * park the task instead of re-dispatching it every fifteen minutes forever. */ export declare class ProjectRootMissingError extends Error { readonly projectName: string; readonly rootPath: string; readonly code = "project_root_missing"; readonly permanent = true; constructor(projectName: string, rootPath: string); } export declare function launchResolvedPaiProject(project: PaiProject, opts?: { /** * What the session should do instead of resuming. * * Queued as the second initial-prompt line, so it runs immediately after * `/Name` and before anything else can reach the session. MUST be a single * line: Claude Code splits the initial-prompt argument on newlines and * treats each as a separate queued prompt, so an embedded newline silently * fragments the instruction into several. */ initialPrompt?: string; }): Promise<{ itermSessionId: string; sessionId: string; }>; //# sourceMappingURL=pai-projects.d.ts.map