/** * Instance Store & Environment Store * * Manages: * - Instance naming → .data/{ns}/{photon}/context.json * - Environment vars → .data/{ns}/{photon}/env.json * - Instance state paths → .data/{ns}/{photon}/state/{instance}/state.json * * Instance naming is a runtime concept. Every @stateful photon automatically * supports named instances — the runtime manages them. Clients (CLI, Beam, * Claude Desktop) specify which instance to use via the _use MCP tool. */ import type { ConstructorParam } from '@portel/photon-core'; /** * Resolve the namespace for a photon file relative to its PHOTON_DIR/baseDir. * * {baseDir}/foo.photon.ts -> '' * {baseDir}/alice/foo.photon.ts -> 'alice' * {baseDir}/org/team/foo.photon.ts -> 'org/team' */ export declare function resolvePhotonNamespace(baseDir: string, absolutePath: string): string; export declare class InstanceStore { private baseDir; constructor(baseDir?: string); private _path; /** * Get current instance name for a photon. Returns "" for default. */ getCurrentInstance(photonName: string, namespace?: string): string; /** * Set current instance name for a photon. Pass "" for default. * Always writes to new .data/ path. */ setCurrentInstance(photonName: string, instance: string, namespace?: string): void; /** * List all instances by scanning state directories. * Checks .data/ path first, then legacy paths. */ listInstances(photonName: string, photonFilePath?: string, namespace?: string): string[]; /** * List instances sorted by modification time (most recent first). */ listInstancesByMtime(photonName: string, namespace?: string): { instances: string[]; autoInstance: string; metadata: Record; }; } export declare class CLISessionStore { private sessionDir; constructor(); /** * Get a stable session key for the current terminal. */ private static _getSessionKey; private _path; getCurrentInstance(photonName: string): string; setCurrentInstance(photonName: string, instance: string): void; } export declare class EnvStore { private baseDir; constructor(baseDir?: string); private _path; read(photonName: string, namespace?: string): Record; /** * Write env vars. Always writes to new .data/ path. */ write(photonName: string, values: Record, namespace?: string): void; /** * Get the value of a specific env param. */ resolve(photonName: string, paramName: string, envVarName: string, namespace?: string): string | undefined; /** * Get masked values for display. */ getMasked(photonName: string, namespace?: string): Record; } /** * Get the state file path for a photon instance. * New: .data/{ns}/{photon}/state/{instance}/state.json * Falls back to legacy paths if new path doesn't exist yet. */ export declare function getInstanceStatePath(photonName: string, instance: string, baseDir?: string, photonFilePath?: string, namespace?: string): string; /** * Get the event log path for a photon instance. * New: .data/{ns}/{photon}/state/{instance}/state.log */ export declare function getInstanceLogPath(photonName: string, instance: string, baseDir?: string, photonFilePath?: string, namespace?: string): string; export declare function getEnvParams(params: ConstructorParam[]): ConstructorParam[]; //# sourceMappingURL=context-store.d.ts.map