@fractary/codex 0.11.2 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -33,7 +33,7 @@ declare function getExtension(uri: string): string;
33
33
  declare function getFilename(uri: string): string;
34
34
  declare function getDirectory(uri: string): string;
35
35
 
36
- type StorageProviderType = 'local' | 'github' | 'http' | 's3' | 's3-archive' | 'r2' | 'gcs' | 'drive' | 'file-plugin';
36
+ type StorageProviderType$1 = 'local' | 'github' | 'http' | 's3' | 's3-archive' | 'r2' | 'gcs' | 'drive' | 'file-plugin';
37
37
  interface FetchResult {
38
38
  content: Buffer;
39
39
  contentType: string;
@@ -51,13 +51,13 @@ interface FetchOptions {
51
51
  }
52
52
  interface StorageProvider {
53
53
  readonly name: string;
54
- readonly type: StorageProviderType;
54
+ readonly type: StorageProviderType$1;
55
55
  fetch(reference: ResolvedReference, options?: FetchOptions): Promise<FetchResult>;
56
56
  exists(reference: ResolvedReference, options?: FetchOptions): Promise<boolean>;
57
57
  canHandle(reference: ResolvedReference): boolean;
58
58
  }
59
- interface StorageProviderConfig {
60
- type: StorageProviderType;
59
+ interface StorageProviderConfig$1 {
60
+ type: StorageProviderType$1;
61
61
  options?: Record<string, unknown>;
62
62
  timeout?: number;
63
63
  maxRetries?: number;
@@ -74,7 +74,7 @@ interface ResolvedReference extends ParsedReference {
74
74
  cachePath: string;
75
75
  isCurrentProject: boolean;
76
76
  localPath?: string;
77
- sourceType?: StorageProviderType;
77
+ sourceType?: StorageProviderType$1;
78
78
  filePluginSource?: string;
79
79
  }
80
80
  interface ResolveOptions {
@@ -203,7 +203,7 @@ declare const CustomTypeSchema: z.ZodObject<{
203
203
  exclude: string[];
204
204
  } | undefined;
205
205
  }>;
206
- type CustomTypeConfig = z.infer<typeof CustomTypeSchema>;
206
+ type CustomTypeConfig$1 = z.infer<typeof CustomTypeSchema>;
207
207
  declare const TypesConfigSchema: z.ZodObject<{
208
208
  custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
209
209
  description: z.ZodOptional<z.ZodString>;
@@ -277,7 +277,7 @@ declare const TypesConfigSchema: z.ZodObject<{
277
277
  } | undefined;
278
278
  }> | undefined;
279
279
  }>;
280
- type TypesConfig = z.infer<typeof TypesConfigSchema>;
280
+ type TypesConfig$1 = z.infer<typeof TypesConfigSchema>;
281
281
  interface ValidationResult {
282
282
  valid: boolean;
283
283
  errors: Array<{
@@ -288,7 +288,7 @@ interface ValidationResult {
288
288
  }
289
289
  declare function parseTtl(value: string | number): number;
290
290
  declare function validateCustomTypes(config: unknown): ValidationResult;
291
- declare function loadCustomTypes(config: TypesConfig): Map<string, ArtifactType>;
291
+ declare function loadCustomTypes(config: TypesConfig$1): Map<string, ArtifactType>;
292
292
  declare function mergeTypes(builtIn: Record<string, ArtifactType>, custom: Map<string, ArtifactType>): Map<string, ArtifactType>;
293
293
  declare function extendType(baseName: string, overrides: Partial<Omit<ArtifactType, 'name'>>): Partial<ArtifactType>;
294
294
 
@@ -1347,7 +1347,7 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1347
1347
  }> | undefined;
1348
1348
  } | undefined;
1349
1349
  }>;
1350
- type UnifiedConfig = z.infer<typeof UnifiedConfigSchema>;
1350
+ type UnifiedConfig$1 = z.infer<typeof UnifiedConfigSchema>;
1351
1351
 
1352
1352
  interface ParseMetadataOptions {
1353
1353
  strict?: boolean;
@@ -1489,7 +1489,7 @@ declare class HttpStorage implements StorageProvider {
1489
1489
  declare function createHttpStorage(options?: HttpStorageOptions): HttpStorage;
1490
1490
 
1491
1491
  interface FilePluginStorageOptions {
1492
- config: UnifiedConfig;
1492
+ config: UnifiedConfig$1;
1493
1493
  enableS3Fallback?: boolean;
1494
1494
  baseDir?: string;
1495
1495
  }
@@ -1535,7 +1535,7 @@ interface StorageManagerConfig {
1535
1535
  http?: HttpStorageOptions;
1536
1536
  s3Archive?: S3ArchiveStorageOptions;
1537
1537
  filePlugin?: FilePluginStorageOptions;
1538
- priority?: StorageProviderType[];
1538
+ priority?: StorageProviderType$1[];
1539
1539
  enableCaching?: boolean;
1540
1540
  codexConfig?: CodexConfig;
1541
1541
  }
@@ -1547,16 +1547,16 @@ declare class StorageManager {
1547
1547
  private resolveToken;
1548
1548
  private resolveFetchOptions;
1549
1549
  registerProvider(provider: StorageProvider): void;
1550
- removeProvider(type: StorageProviderType): boolean;
1551
- getProvider(type: StorageProviderType): StorageProvider | undefined;
1550
+ removeProvider(type: StorageProviderType$1): boolean;
1551
+ getProvider(type: StorageProviderType$1): StorageProvider | undefined;
1552
1552
  getProviders(): StorageProvider[];
1553
1553
  findProvider(reference: ResolvedReference): StorageProvider | null;
1554
1554
  fetch(reference: ResolvedReference, options?: FetchOptions): Promise<FetchResult>;
1555
1555
  exists(reference: ResolvedReference, options?: FetchOptions): Promise<boolean>;
1556
- fetchWith(type: StorageProviderType, reference: ResolvedReference, options?: FetchOptions): Promise<FetchResult>;
1556
+ fetchWith(type: StorageProviderType$1, reference: ResolvedReference, options?: FetchOptions): Promise<FetchResult>;
1557
1557
  fetchMany(references: ResolvedReference[], options?: FetchOptions): Promise<Map<string, FetchResult | Error>>;
1558
1558
  getStatus(): Array<{
1559
- type: StorageProviderType;
1559
+ type: StorageProviderType$1;
1560
1560
  name: string;
1561
1561
  priority: number;
1562
1562
  }>;
@@ -1752,45 +1752,45 @@ interface SyncOptions {
1752
1752
  hash?: string;
1753
1753
  }>;
1754
1754
  }
1755
- interface SyncRule {
1755
+ interface SyncRule$1 {
1756
1756
  pattern: string;
1757
1757
  include: boolean;
1758
1758
  priority?: number;
1759
1759
  direction?: SyncDirection;
1760
1760
  }
1761
- interface DirectionalSyncConfig {
1761
+ interface DirectionalSyncConfig$1 {
1762
1762
  include: string[];
1763
1763
  exclude?: string[];
1764
1764
  }
1765
1765
  interface RoutingConfig {
1766
1766
  use_frontmatter?: boolean;
1767
1767
  }
1768
- interface SyncConfig {
1768
+ interface SyncConfig$1 {
1769
1769
  defaultDirection: SyncDirection;
1770
- rules: SyncRule[];
1770
+ rules: SyncRule$1[];
1771
1771
  defaultExcludes: string[];
1772
1772
  deleteOrphans: boolean;
1773
1773
  conflictStrategy: 'newest' | 'local' | 'remote' | 'manual';
1774
- from_codex?: DirectionalSyncConfig;
1775
- to_codex?: DirectionalSyncConfig;
1774
+ from_codex?: DirectionalSyncConfig$1;
1775
+ to_codex?: DirectionalSyncConfig$1;
1776
1776
  routing?: RoutingConfig;
1777
1777
  default_from_codex?: string[];
1778
1778
  default_to_codex?: string[];
1779
1779
  exclude?: string[];
1780
1780
  }
1781
- declare const DEFAULT_SYNC_CONFIG: SyncConfig;
1781
+ declare const DEFAULT_SYNC_CONFIG: SyncConfig$1;
1782
1782
 
1783
1783
  interface EvaluationResult {
1784
1784
  path: string;
1785
1785
  shouldSync: boolean;
1786
- matchedRule?: SyncRule;
1786
+ matchedRule?: SyncRule$1;
1787
1787
  reason: string;
1788
1788
  }
1789
- declare function evaluatePath(path: string, rules: SyncRule[], direction: SyncDirection, defaultExcludes?: string[]): EvaluationResult;
1790
- declare function evaluatePaths(paths: string[], rules: SyncRule[], direction: SyncDirection, defaultExcludes?: string[]): Map<string, EvaluationResult>;
1791
- declare function filterSyncablePaths(paths: string[], rules: SyncRule[], direction: SyncDirection, defaultExcludes?: string[]): string[];
1792
- declare function createRulesFromPatterns(include?: string[], exclude?: string[]): SyncRule[];
1793
- declare function mergeRules(...ruleSets: SyncRule[][]): SyncRule[];
1789
+ declare function evaluatePath(path: string, rules: SyncRule$1[], direction: SyncDirection, defaultExcludes?: string[]): EvaluationResult;
1790
+ declare function evaluatePaths(paths: string[], rules: SyncRule$1[], direction: SyncDirection, defaultExcludes?: string[]): Map<string, EvaluationResult>;
1791
+ declare function filterSyncablePaths(paths: string[], rules: SyncRule$1[], direction: SyncDirection, defaultExcludes?: string[]): string[];
1792
+ declare function createRulesFromPatterns(include?: string[], exclude?: string[]): SyncRule$1[];
1793
+ declare function mergeRules(...ruleSets: SyncRule$1[][]): SyncRule$1[];
1794
1794
  interface EvaluationSummary {
1795
1795
  total: number;
1796
1796
  included: number;
@@ -1798,7 +1798,7 @@ interface EvaluationSummary {
1798
1798
  byReason: Record<string, number>;
1799
1799
  }
1800
1800
  declare function summarizeEvaluations(results: Map<string, EvaluationResult>): EvaluationSummary;
1801
- declare function validateRules$1(rules: SyncRule[]): string[];
1801
+ declare function validateRules$1(rules: SyncRule$1[]): string[];
1802
1802
 
1803
1803
  interface FileInfo {
1804
1804
  path: string;
@@ -1806,7 +1806,7 @@ interface FileInfo {
1806
1806
  mtime: number;
1807
1807
  hash?: string;
1808
1808
  }
1809
- declare function createSyncPlan(sourceFiles: FileInfo[], targetFiles: FileInfo[], options: SyncOptions, config: SyncConfig): SyncPlan;
1809
+ declare function createSyncPlan(sourceFiles: FileInfo[], targetFiles: FileInfo[], options: SyncOptions, config: SyncConfig$1): SyncPlan;
1810
1810
  declare function estimateSyncTime(plan: SyncPlan, bytesPerSecond?: number): number;
1811
1811
  declare function createEmptySyncPlan(direction?: SyncDirection): SyncPlan;
1812
1812
  declare function filterPlanOperations(plan: SyncPlan, operations: Array<'create' | 'update' | 'delete'>): SyncPlan;
@@ -1847,7 +1847,7 @@ interface RoutingScanResult {
1847
1847
 
1848
1848
  interface SyncManagerConfig {
1849
1849
  localStorage: LocalStorage;
1850
- config?: Partial<SyncConfig>;
1850
+ config?: Partial<SyncConfig$1>;
1851
1851
  manifestPath?: string;
1852
1852
  }
1853
1853
  declare class SyncManager {
@@ -1865,7 +1865,9 @@ declare class SyncManager {
1865
1865
  getOrCreateManifest(org: string, project: string): Promise<SyncManifest>;
1866
1866
  listLocalFiles(directory: string): Promise<FileInfo[]>;
1867
1867
  createPlan(_org: string, _project: string, sourceDir: string, targetFiles: FileInfo[], options?: SyncOptions): Promise<SyncPlan>;
1868
- createRoutingAwarePlan(org: string, project: string, codexDir: string, options?: SyncOptions): Promise<SyncPlan & {
1868
+ createRoutingAwarePlan(org: string, project: string, codexDir: string, options?: SyncOptions & {
1869
+ codexRepo?: string;
1870
+ }): Promise<SyncPlan & {
1869
1871
  routingScan?: RoutingScanResult;
1870
1872
  }>;
1871
1873
  executePlan(plan: SyncPlan, options?: SyncOptions): Promise<SyncResult>;
@@ -1874,19 +1876,19 @@ declare class SyncManager {
1874
1876
  isFileSynced(path: string): Promise<boolean>;
1875
1877
  getLastSyncTime(): Promise<number | null>;
1876
1878
  clearManifest(): Promise<void>;
1877
- getConfig(): SyncConfig;
1878
- updateConfig(updates: Partial<SyncConfig>): void;
1879
+ getConfig(): SyncConfig$1;
1880
+ updateConfig(updates: Partial<SyncConfig$1>): void;
1879
1881
  }
1880
1882
  declare function createSyncManager(config: SyncManagerConfig): SyncManager;
1881
1883
 
1882
- type PermissionLevel = 'none' | 'read' | 'write' | 'admin';
1884
+ type PermissionLevel$1 = 'none' | 'read' | 'write' | 'admin';
1883
1885
  type PermissionScope = 'global' | 'org' | 'project' | 'path';
1884
1886
  type PermissionAction = 'fetch' | 'cache' | 'sync' | 'invalidate' | 'manage';
1885
- interface PermissionRule {
1887
+ interface PermissionRule$1 {
1886
1888
  id?: string;
1887
1889
  pattern: string;
1888
1890
  actions: PermissionAction[];
1889
- level: PermissionLevel;
1891
+ level: PermissionLevel$1;
1890
1892
  scope: PermissionScope;
1891
1893
  org?: string;
1892
1894
  project?: string;
@@ -1903,46 +1905,46 @@ interface PermissionContext {
1903
1905
  }
1904
1906
  interface PermissionResult {
1905
1907
  allowed: boolean;
1906
- level: PermissionLevel;
1907
- matchedRule?: PermissionRule;
1908
+ level: PermissionLevel$1;
1909
+ matchedRule?: PermissionRule$1;
1908
1910
  reason: string;
1909
1911
  }
1910
1912
  interface PermissionConfig {
1911
- defaultLevel: PermissionLevel;
1913
+ defaultLevel: PermissionLevel$1;
1912
1914
  defaultAllow: boolean;
1913
- rules: PermissionRule[];
1915
+ rules: PermissionRule$1[];
1914
1916
  enforced: boolean;
1915
1917
  }
1916
1918
  declare const DEFAULT_PERMISSION_CONFIG: PermissionConfig;
1917
- declare const PERMISSION_LEVEL_ORDER: PermissionLevel[];
1918
- declare function levelGrants(granted: PermissionLevel, required: PermissionLevel): boolean;
1919
- declare function maxLevel(a: PermissionLevel, b: PermissionLevel): PermissionLevel;
1920
- declare function minLevel(a: PermissionLevel, b: PermissionLevel): PermissionLevel;
1919
+ declare const PERMISSION_LEVEL_ORDER: PermissionLevel$1[];
1920
+ declare function levelGrants(granted: PermissionLevel$1, required: PermissionLevel$1): boolean;
1921
+ declare function maxLevel(a: PermissionLevel$1, b: PermissionLevel$1): PermissionLevel$1;
1922
+ declare function minLevel(a: PermissionLevel$1, b: PermissionLevel$1): PermissionLevel$1;
1921
1923
 
1922
- declare function ruleMatchesContext(rule: PermissionRule, context: PermissionContext): boolean;
1923
- declare function ruleMatchesPath(rule: PermissionRule, path: string): boolean;
1924
- declare function ruleMatchesAction(rule: PermissionRule, action: PermissionAction): boolean;
1924
+ declare function ruleMatchesContext(rule: PermissionRule$1, context: PermissionContext): boolean;
1925
+ declare function ruleMatchesPath(rule: PermissionRule$1, path: string): boolean;
1926
+ declare function ruleMatchesAction(rule: PermissionRule$1, action: PermissionAction): boolean;
1925
1927
  declare function evaluatePermission(path: string, action: PermissionAction, context: PermissionContext, config: PermissionConfig): PermissionResult;
1926
1928
  declare function isAllowed(path: string, action: PermissionAction, context: PermissionContext, config: PermissionConfig): boolean;
1927
- declare function hasPermission(path: string, action: PermissionAction, requiredLevel: PermissionLevel, context: PermissionContext, config: PermissionConfig): boolean;
1929
+ declare function hasPermission(path: string, action: PermissionAction, requiredLevel: PermissionLevel$1, context: PermissionContext, config: PermissionConfig): boolean;
1928
1930
  declare function evaluatePermissions(paths: string[], action: PermissionAction, context: PermissionContext, config: PermissionConfig): Map<string, PermissionResult>;
1929
- declare function filterByPermission(paths: string[], action: PermissionAction, context: PermissionContext, config: PermissionConfig, requiredLevel?: PermissionLevel): string[];
1930
- declare function validateRules(rules: PermissionRule[]): string[];
1931
+ declare function filterByPermission(paths: string[], action: PermissionAction, context: PermissionContext, config: PermissionConfig, requiredLevel?: PermissionLevel$1): string[];
1932
+ declare function validateRules(rules: PermissionRule$1[]): string[];
1931
1933
  declare function createRule(options: {
1932
1934
  pattern: string;
1933
1935
  actions: PermissionAction[];
1934
- level: PermissionLevel;
1935
- scope?: PermissionRule['scope'];
1936
+ level: PermissionLevel$1;
1937
+ scope?: PermissionRule$1['scope'];
1936
1938
  org?: string;
1937
1939
  project?: string;
1938
1940
  priority?: number;
1939
1941
  description?: string;
1940
- }): PermissionRule;
1942
+ }): PermissionRule$1;
1941
1943
  declare const CommonRules: {
1942
- allowDocs: () => PermissionRule;
1943
- denyPrivate: () => PermissionRule;
1944
- readOnlySpecs: () => PermissionRule;
1945
- adminManage: () => PermissionRule;
1944
+ allowDocs: () => PermissionRule$1;
1945
+ denyPrivate: () => PermissionRule$1;
1946
+ readOnlySpecs: () => PermissionRule$1;
1947
+ adminManage: () => PermissionRule$1;
1946
1948
  };
1947
1949
 
1948
1950
  interface PermissionManagerConfig {
@@ -1954,14 +1956,14 @@ declare class PermissionManager {
1954
1956
  private defaultContext;
1955
1957
  constructor(options?: PermissionManagerConfig);
1956
1958
  isAllowed(path: string, action: PermissionAction, context?: PermissionContext): boolean;
1957
- hasPermission(path: string, action: PermissionAction, requiredLevel: PermissionLevel, context?: PermissionContext): boolean;
1959
+ hasPermission(path: string, action: PermissionAction, requiredLevel: PermissionLevel$1, context?: PermissionContext): boolean;
1958
1960
  evaluate(path: string, action: PermissionAction, context?: PermissionContext): PermissionResult;
1959
- filterAllowed(paths: string[], action: PermissionAction, context?: PermissionContext, requiredLevel?: PermissionLevel): string[];
1960
- addRule(rule: PermissionRule): void;
1961
+ filterAllowed(paths: string[], action: PermissionAction, context?: PermissionContext, requiredLevel?: PermissionLevel$1): string[];
1962
+ addRule(rule: PermissionRule$1): void;
1961
1963
  removeRule(id: string): boolean;
1962
- getRules(): PermissionRule[];
1964
+ getRules(): PermissionRule$1[];
1963
1965
  clearRules(): void;
1964
- setRules(rules: PermissionRule[]): void;
1966
+ setRules(rules: PermissionRule$1[]): void;
1965
1967
  getConfig(): PermissionConfig;
1966
1968
  updateConfig(updates: Partial<Omit<PermissionConfig, 'rules'>>): void;
1967
1969
  setDefaultContext(context: PermissionContext): void;
@@ -1969,7 +1971,7 @@ declare class PermissionManager {
1969
1971
  enable(): void;
1970
1972
  disable(): void;
1971
1973
  isEnforced(): boolean;
1972
- assertPermission(path: string, action: PermissionAction, requiredLevel?: PermissionLevel, context?: PermissionContext): void;
1974
+ assertPermission(path: string, action: PermissionAction, requiredLevel?: PermissionLevel$1, context?: PermissionContext): void;
1973
1975
  }
1974
1976
  declare class PermissionDeniedError extends Error {
1975
1977
  readonly path: string;
@@ -2092,4 +2094,147 @@ declare function hasLegacyReferences(text: string): boolean;
2092
2094
  declare function migrateFileReferences(content: string, options?: ConversionOptions): ReferenceConversionResult;
2093
2095
  declare function generateReferenceMigrationSummary(results: ReferenceConversionResult[]): string;
2094
2096
 
2095
- export { type ArtifactType, type AutoSyncPattern, AutoSyncPatternSchema, BUILT_IN_TYPES, CODEX_URI_PREFIX, type CacheEntry, type CacheEntryMetadata, type CacheEntryStatus, type CacheLookupResult, CacheManager, type CacheManagerConfig, CachePersistence, type CachePersistenceOptions, type CacheStats, type CodexConfig, CodexConfigSchema, CodexError, CommonRules, ConfigurationError, type ConversionOptions, type ConvertedReference, type CustomSyncDestination, type CustomTypeConfig, CustomTypeSchema, DEFAULT_CACHE_DIR, DEFAULT_FETCH_OPTIONS, DEFAULT_MIGRATION_OPTIONS, DEFAULT_PERMISSION_CONFIG, DEFAULT_SYNC_CONFIG, DEFAULT_TYPE, type EvaluationResult, type EvaluationSummary, type FetchOptions, type FetchResult, type FileInfo, FilePluginFileNotFoundError, type FilePluginFileNotFoundErrorOptions, FilePluginStorage, type FilePluginStorageOptions, type FileSyncStatus, GitHubStorage, type GitHubStorageOptions, HttpStorage, type HttpStorageOptions, LEGACY_PATTERNS, LEGACY_REF_PREFIX, type LegacyAutoSyncPattern, type LegacyCodexConfig, type LoadConfigOptions, LocalStorage, type LocalStorageOptions, type Metadata, MetadataSchema, type MigrationChange, type MigrationOptions, type MigrationResult, type ModernCodexConfig, type ModernSyncPattern, PERMISSION_LEVEL_ORDER, type ParseMetadataOptions, type ParseOptions, type ParseResult, type ParsedReference, type PermissionAction, type PermissionConfig, type PermissionContext, PermissionDeniedError, type PermissionLevel, PermissionManager, type PermissionManagerConfig, type PermissionResult, type PermissionRule, type PermissionScope, type PlanStats, type ReferenceConversionResult, type ResolveOptions, type ResolveOrgOptions, type ResolvedReference, type SerializedCacheEntry, type ShouldSyncOptions, StorageManager, type StorageManagerConfig, type StorageProvider, type StorageProviderConfig, type StorageProviderType, type SyncConfig, type SyncDirection, SyncManager, type SyncManagerConfig, type SyncManifest, type SyncManifestEntry, type SyncOperation, type SyncOptions, type SyncPlan, type SyncResult, type SyncRule, type SyncRules, SyncRulesSchema, TTL, TypeRegistry, type TypeRegistryOptions, type TypesConfig, TypesConfigSchema, ValidationError, type VersionDetectionResult, buildUri, calculateCachePath, calculateContentHash, convertLegacyReference, convertLegacyReferences, convertToUri, createCacheEntry, createCacheManager, createCachePersistence, createDefaultRegistry, createEmptyModernConfig, createEmptySyncPlan, createGitHubStorage, createHttpStorage, createLocalStorage, createPermissionManager, createRule, createRulesFromPatterns, createStorageManager, createSyncManager, createSyncPlan, deserializeCacheEntry, detectContentType, detectCurrentProject, detectVersion, estimateSyncTime, evaluatePath, evaluatePaths, evaluatePatterns, evaluatePermission, evaluatePermissions, extendType, extractOrgFromRepoName, extractRawFrontmatter, filterByPatterns, filterByPermission, filterPlanOperations, filterSyncablePaths, findLegacyReferences, formatPlanSummary, generateMigrationReport, generateReferenceMigrationSummary, getBuiltInType, getBuiltInTypeNames, getCacheEntryAge, getCacheEntryStatus, getCurrentContext, getCustomSyncDestinations, getDefaultCacheManager, getDefaultConfig, getDefaultDirectories, getDefaultPermissionManager, getDefaultRules, getDefaultStorageManager, getDirectory, getExtension, getFilename, getMigrationRequirements, getPlanStats, getRelativeCachePath, getRemainingTtl, getTargetRepos, hasContentChanged, hasFrontmatter, hasLegacyReferences, hasPermission as hasPermissionLevel, isBuiltInType, isCacheEntryFresh, isCacheEntryValid, isCurrentProjectUri, isLegacyConfig, isLegacyReference, isModernConfig, isAllowed as isPermissionAllowed, isValidUri, levelGrants, loadConfig, loadCustomTypes, matchAnyPattern, matchPattern, maxLevel, mergeFetchOptions, mergeRules, mergeTypes, migrateConfig, migrateFileReferences, minLevel, needsMigration, parseCustomDestination, parseMetadata, parseReference, parseTtl, resolveOrganization, resolveReference, resolveReferences, ruleMatchesAction, ruleMatchesContext, ruleMatchesPath, sanitizePath, serializeCacheEntry, setDefaultCacheManager, setDefaultPermissionManager, setDefaultStorageManager, shouldSyncToRepo, summarizeEvaluations, touchCacheEntry, validateCustomTypes, validateMetadata, validateMigratedConfig, validateOrg, validatePath, validateRules as validatePermissionRules, validateProject, validateRules$1 as validateRules, validateUri };
2097
+ interface ExpandEnvOptions {
2098
+ env?: Record<string, string | undefined>;
2099
+ warnOnMissing?: boolean;
2100
+ onMissing?: (varName: string) => void;
2101
+ }
2102
+ declare function expandEnvVars(value: string, options?: ExpandEnvOptions): string;
2103
+ declare function expandEnvVarsInConfig<T>(config: T, options?: ExpandEnvOptions): T;
2104
+ declare function hasEnvVars(value: string): boolean;
2105
+ declare function extractEnvVarNames(value: string): string[];
2106
+
2107
+ type StorageProviderType = 'local' | 'github' | 'http' | 's3';
2108
+ interface LocalStorageConfig {
2109
+ type: 'local';
2110
+ basePath: string;
2111
+ followSymlinks?: boolean;
2112
+ priority?: number;
2113
+ }
2114
+ interface GitHubStorageConfig {
2115
+ type: 'github';
2116
+ token?: string;
2117
+ apiBaseUrl?: string;
2118
+ rawBaseUrl?: string;
2119
+ branch?: string;
2120
+ priority?: number;
2121
+ }
2122
+ interface HttpStorageConfig {
2123
+ type: 'http';
2124
+ baseUrl: string;
2125
+ headers?: Record<string, string>;
2126
+ timeout?: number;
2127
+ priority?: number;
2128
+ }
2129
+ interface S3StorageConfig {
2130
+ type: 's3';
2131
+ bucket: string;
2132
+ region?: string;
2133
+ accessKeyId?: string;
2134
+ secretAccessKey?: string;
2135
+ priority?: number;
2136
+ }
2137
+ type StorageProviderConfig = LocalStorageConfig | GitHubStorageConfig | HttpStorageConfig | S3StorageConfig;
2138
+ interface CacheConfig {
2139
+ directory?: string;
2140
+ cacheDir?: string;
2141
+ defaultTtl?: number;
2142
+ maxSize?: number;
2143
+ maxMemoryEntries?: number;
2144
+ maxMemorySize?: number;
2145
+ enablePersistence?: boolean;
2146
+ }
2147
+ interface CustomTypeConfig {
2148
+ description?: string;
2149
+ patterns?: string[];
2150
+ defaultTtl?: number;
2151
+ archiveAfterDays?: number | null;
2152
+ archiveStorage?: 'local' | 'cloud' | 'drive' | null;
2153
+ }
2154
+ interface TypesConfig {
2155
+ custom?: Record<string, CustomTypeConfig>;
2156
+ }
2157
+ type PermissionLevel = 'none' | 'read' | 'write' | 'admin';
2158
+ interface PermissionRule {
2159
+ pattern: string;
2160
+ permission: PermissionLevel;
2161
+ users?: string[];
2162
+ }
2163
+ interface PermissionsConfig {
2164
+ default?: PermissionLevel;
2165
+ rules?: PermissionRule[];
2166
+ }
2167
+ interface DirectionalSyncConfig {
2168
+ include: string[];
2169
+ exclude?: string[];
2170
+ }
2171
+ interface SyncRule {
2172
+ pattern: string;
2173
+ direction?: 'to-codex' | 'from-codex' | 'bidirectional';
2174
+ }
2175
+ interface SyncConfig {
2176
+ bidirectional?: boolean;
2177
+ conflictResolution?: 'prompt' | 'local' | 'remote' | 'newest' | 'skip';
2178
+ exclude?: string[];
2179
+ rules?: SyncRule[];
2180
+ to_codex?: DirectionalSyncConfig;
2181
+ from_codex?: DirectionalSyncConfig;
2182
+ default_to_codex?: string[];
2183
+ default_from_codex?: string[];
2184
+ environments?: Record<string, string>;
2185
+ }
2186
+ interface McpConfig {
2187
+ enabled?: boolean;
2188
+ port?: number;
2189
+ }
2190
+ interface ProjectArchiveConfig {
2191
+ bucket?: string;
2192
+ prefix?: string;
2193
+ storageClass?: string;
2194
+ }
2195
+ interface ArchiveConfig {
2196
+ projects?: Record<string, ProjectArchiveConfig>;
2197
+ }
2198
+ interface FileConfig {
2199
+ sources?: Array<{
2200
+ name: string;
2201
+ path: string;
2202
+ type?: string;
2203
+ }>;
2204
+ }
2205
+ interface CodexYamlConfig {
2206
+ organization: string;
2207
+ project?: string;
2208
+ codex_repo?: string;
2209
+ cacheDir?: string;
2210
+ cache?: CacheConfig;
2211
+ storage?: StorageProviderConfig[];
2212
+ types?: TypesConfig;
2213
+ permissions?: PermissionsConfig;
2214
+ sync?: SyncConfig;
2215
+ mcp?: McpConfig;
2216
+ archive?: ArchiveConfig;
2217
+ }
2218
+ interface UnifiedConfig {
2219
+ codex?: CodexYamlConfig;
2220
+ file?: FileConfig;
2221
+ [key: string]: unknown;
2222
+ }
2223
+ interface ReadConfigOptions {
2224
+ expandEnv?: boolean;
2225
+ env?: Record<string, string | undefined>;
2226
+ warnOnMissingEnv?: boolean;
2227
+ }
2228
+ declare function readCodexConfig(configPath: string, options?: ReadConfigOptions): Promise<CodexYamlConfig>;
2229
+ declare function readUnifiedConfig(configPath: string, options?: ReadConfigOptions): Promise<UnifiedConfig>;
2230
+ declare function isUnifiedConfig(config: unknown): config is UnifiedConfig;
2231
+
2232
+ declare function parseDuration(duration: string | number): number;
2233
+ declare function parseSize(size: string | number): number;
2234
+ declare function formatBytes(bytes: number): string;
2235
+ declare function formatDuration(ms: number): string;
2236
+ declare function formatSeconds(seconds: number): string;
2237
+ declare function isValidDuration(value: string): boolean;
2238
+ declare function isValidSize(value: string): boolean;
2239
+
2240
+ export { type ArchiveConfig, type ArtifactType, type AutoSyncPattern, AutoSyncPatternSchema, BUILT_IN_TYPES, CODEX_URI_PREFIX, type CacheEntry, type CacheEntryMetadata, type CacheEntryStatus, type CacheLookupResult, CacheManager, type CacheManagerConfig, CachePersistence, type CachePersistenceOptions, type CacheStats, type CodexConfig, CodexConfigSchema, CodexError, type CodexYamlConfig, CommonRules, ConfigurationError, type ConversionOptions, type ConvertedReference, type CustomSyncDestination, type CustomTypeConfig$1 as CustomTypeConfig, CustomTypeSchema, DEFAULT_CACHE_DIR, DEFAULT_FETCH_OPTIONS, DEFAULT_MIGRATION_OPTIONS, DEFAULT_PERMISSION_CONFIG, DEFAULT_SYNC_CONFIG, DEFAULT_TYPE, type DirectionalSyncConfig, type EvaluationResult, type EvaluationSummary, type ExpandEnvOptions, type FetchOptions, type FetchResult, type FileConfig, type FileInfo, FilePluginFileNotFoundError, type FilePluginFileNotFoundErrorOptions, FilePluginStorage, type FilePluginStorageOptions, type FileSyncStatus, GitHubStorage, type GitHubStorageOptions, HttpStorage, type HttpStorageOptions, LEGACY_PATTERNS, LEGACY_REF_PREFIX, type LegacyAutoSyncPattern, type LegacyCodexConfig, type LoadConfigOptions, LocalStorage, type LocalStorageOptions, type Metadata, MetadataSchema, type MigrationChange, type MigrationOptions, type MigrationResult, type ModernCodexConfig, type ModernSyncPattern, PERMISSION_LEVEL_ORDER, type ParseMetadataOptions, type ParseOptions, type ParseResult, type ParsedReference, type PermissionAction, type PermissionConfig, type PermissionContext, PermissionDeniedError, type PermissionLevel$1 as PermissionLevel, PermissionManager, type PermissionManagerConfig, type PermissionResult, type PermissionRule$1 as PermissionRule, type PermissionScope, type PlanStats, type ReadConfigOptions, type ReferenceConversionResult, type ResolveOptions, type ResolveOrgOptions, type ResolvedReference, type SerializedCacheEntry, type ShouldSyncOptions, StorageManager, type StorageManagerConfig, type StorageProvider, type StorageProviderConfig$1 as StorageProviderConfig, type StorageProviderType$1 as StorageProviderType, type SyncConfig$1 as SyncConfig, type SyncDirection, SyncManager, type SyncManagerConfig, type SyncManifest, type SyncManifestEntry, type SyncOperation, type SyncOptions, type SyncPlan, type SyncResult, type SyncRule$1 as SyncRule, type SyncRules, SyncRulesSchema, TTL, TypeRegistry, type TypeRegistryOptions, type TypesConfig$1 as TypesConfig, TypesConfigSchema, type UnifiedConfig, ValidationError, type VersionDetectionResult, type CacheConfig as YamlCacheConfig, type CustomTypeConfig as YamlCustomTypeConfig, type GitHubStorageConfig as YamlGitHubStorageConfig, type HttpStorageConfig as YamlHttpStorageConfig, type LocalStorageConfig as YamlLocalStorageConfig, type McpConfig as YamlMcpConfig, type PermissionLevel as YamlPermissionLevel, type PermissionRule as YamlPermissionRule, type PermissionsConfig as YamlPermissionsConfig, type S3StorageConfig as YamlS3StorageConfig, type StorageProviderConfig as YamlStorageProviderConfig, type StorageProviderType as YamlStorageProviderType, type SyncConfig as YamlSyncConfig, type SyncRule as YamlSyncRule, type TypesConfig as YamlTypesConfig, buildUri, calculateCachePath, calculateContentHash, convertLegacyReference, convertLegacyReferences, convertToUri, createCacheEntry, createCacheManager, createCachePersistence, createDefaultRegistry, createEmptyModernConfig, createEmptySyncPlan, createGitHubStorage, createHttpStorage, createLocalStorage, createPermissionManager, createRule, createRulesFromPatterns, createStorageManager, createSyncManager, createSyncPlan, deserializeCacheEntry, detectContentType, detectCurrentProject, detectVersion, estimateSyncTime, evaluatePath, evaluatePaths, evaluatePatterns, evaluatePermission, evaluatePermissions, expandEnvVars, expandEnvVarsInConfig, extendType, extractEnvVarNames, extractOrgFromRepoName, extractRawFrontmatter, filterByPatterns, filterByPermission, filterPlanOperations, filterSyncablePaths, findLegacyReferences, formatBytes, formatDuration, formatPlanSummary, formatSeconds, generateMigrationReport, generateReferenceMigrationSummary, getBuiltInType, getBuiltInTypeNames, getCacheEntryAge, getCacheEntryStatus, getCurrentContext, getCustomSyncDestinations, getDefaultCacheManager, getDefaultConfig, getDefaultDirectories, getDefaultPermissionManager, getDefaultRules, getDefaultStorageManager, getDirectory, getExtension, getFilename, getMigrationRequirements, getPlanStats, getRelativeCachePath, getRemainingTtl, getTargetRepos, hasContentChanged, hasEnvVars, hasFrontmatter, hasLegacyReferences, hasPermission as hasPermissionLevel, isBuiltInType, isCacheEntryFresh, isCacheEntryValid, isCurrentProjectUri, isLegacyConfig, isLegacyReference, isModernConfig, isAllowed as isPermissionAllowed, isUnifiedConfig, isValidDuration, isValidSize, isValidUri, levelGrants, loadConfig, loadCustomTypes, matchAnyPattern, matchPattern, maxLevel, mergeFetchOptions, mergeRules, mergeTypes, migrateConfig, migrateFileReferences, minLevel, needsMigration, parseCustomDestination, parseDuration, parseMetadata, parseReference, parseSize, parseTtl, readCodexConfig, readUnifiedConfig, resolveOrganization, resolveReference, resolveReferences, ruleMatchesAction, ruleMatchesContext, ruleMatchesPath, sanitizePath, serializeCacheEntry, setDefaultCacheManager, setDefaultPermissionManager, setDefaultStorageManager, shouldSyncToRepo, summarizeEvaluations, touchCacheEntry, validateCustomTypes, validateMetadata, validateMigratedConfig, validateOrg, validatePath, validateRules as validatePermissionRules, validateProject, validateRules$1 as validateRules, validateUri };