@fractary/codex 0.12.0 → 0.12.4

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.cts 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
 
@@ -460,7 +460,7 @@ declare const CodexConfigSchema: z.ZodObject<{
460
460
  include: string[];
461
461
  exclude?: string[] | undefined;
462
462
  }>>;
463
- from_codex: z.ZodOptional<z.ZodObject<{
463
+ from_codex: z.ZodOptional<z.ZodEffects<z.ZodObject<{
464
464
  include: z.ZodArray<z.ZodString, "many">;
465
465
  exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
466
466
  }, "strip", z.ZodTypeAny, {
@@ -469,6 +469,12 @@ declare const CodexConfigSchema: z.ZodObject<{
469
469
  }, {
470
470
  include: string[];
471
471
  exclude?: string[] | undefined;
472
+ }>, {
473
+ include: string[];
474
+ exclude?: string[] | undefined;
475
+ }, {
476
+ include: string[];
477
+ exclude?: string[] | undefined;
472
478
  }>>;
473
479
  exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
474
480
  default_to_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -923,7 +929,7 @@ declare const UnifiedConfigSchema: z.ZodObject<{
923
929
  include: string[];
924
930
  exclude?: string[] | undefined;
925
931
  }>>;
926
- from_codex: z.ZodOptional<z.ZodObject<{
932
+ from_codex: z.ZodOptional<z.ZodEffects<z.ZodObject<{
927
933
  include: z.ZodArray<z.ZodString, "many">;
928
934
  exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
929
935
  }, "strip", z.ZodTypeAny, {
@@ -932,6 +938,12 @@ declare const UnifiedConfigSchema: z.ZodObject<{
932
938
  }, {
933
939
  include: string[];
934
940
  exclude?: string[] | undefined;
941
+ }>, {
942
+ include: string[];
943
+ exclude?: string[] | undefined;
944
+ }, {
945
+ include: string[];
946
+ exclude?: string[] | undefined;
935
947
  }>>;
936
948
  exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
937
949
  default_to_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -1347,7 +1359,7 @@ declare const UnifiedConfigSchema: z.ZodObject<{
1347
1359
  }> | undefined;
1348
1360
  } | undefined;
1349
1361
  }>;
1350
- type UnifiedConfig = z.infer<typeof UnifiedConfigSchema>;
1362
+ type UnifiedConfig$1 = z.infer<typeof UnifiedConfigSchema>;
1351
1363
 
1352
1364
  interface ParseMetadataOptions {
1353
1365
  strict?: boolean;
@@ -1489,7 +1501,7 @@ declare class HttpStorage implements StorageProvider {
1489
1501
  declare function createHttpStorage(options?: HttpStorageOptions): HttpStorage;
1490
1502
 
1491
1503
  interface FilePluginStorageOptions {
1492
- config: UnifiedConfig;
1504
+ config: UnifiedConfig$1;
1493
1505
  enableS3Fallback?: boolean;
1494
1506
  baseDir?: string;
1495
1507
  }
@@ -1535,7 +1547,7 @@ interface StorageManagerConfig {
1535
1547
  http?: HttpStorageOptions;
1536
1548
  s3Archive?: S3ArchiveStorageOptions;
1537
1549
  filePlugin?: FilePluginStorageOptions;
1538
- priority?: StorageProviderType[];
1550
+ priority?: StorageProviderType$1[];
1539
1551
  enableCaching?: boolean;
1540
1552
  codexConfig?: CodexConfig;
1541
1553
  }
@@ -1547,16 +1559,16 @@ declare class StorageManager {
1547
1559
  private resolveToken;
1548
1560
  private resolveFetchOptions;
1549
1561
  registerProvider(provider: StorageProvider): void;
1550
- removeProvider(type: StorageProviderType): boolean;
1551
- getProvider(type: StorageProviderType): StorageProvider | undefined;
1562
+ removeProvider(type: StorageProviderType$1): boolean;
1563
+ getProvider(type: StorageProviderType$1): StorageProvider | undefined;
1552
1564
  getProviders(): StorageProvider[];
1553
1565
  findProvider(reference: ResolvedReference): StorageProvider | null;
1554
1566
  fetch(reference: ResolvedReference, options?: FetchOptions): Promise<FetchResult>;
1555
1567
  exists(reference: ResolvedReference, options?: FetchOptions): Promise<boolean>;
1556
- fetchWith(type: StorageProviderType, reference: ResolvedReference, options?: FetchOptions): Promise<FetchResult>;
1568
+ fetchWith(type: StorageProviderType$1, reference: ResolvedReference, options?: FetchOptions): Promise<FetchResult>;
1557
1569
  fetchMany(references: ResolvedReference[], options?: FetchOptions): Promise<Map<string, FetchResult | Error>>;
1558
1570
  getStatus(): Array<{
1559
- type: StorageProviderType;
1571
+ type: StorageProviderType$1;
1560
1572
  name: string;
1561
1573
  priority: number;
1562
1574
  }>;
@@ -1752,45 +1764,45 @@ interface SyncOptions {
1752
1764
  hash?: string;
1753
1765
  }>;
1754
1766
  }
1755
- interface SyncRule {
1767
+ interface SyncRule$1 {
1756
1768
  pattern: string;
1757
1769
  include: boolean;
1758
1770
  priority?: number;
1759
1771
  direction?: SyncDirection;
1760
1772
  }
1761
- interface DirectionalSyncConfig {
1773
+ interface DirectionalSyncConfig$1 {
1762
1774
  include: string[];
1763
1775
  exclude?: string[];
1764
1776
  }
1765
1777
  interface RoutingConfig {
1766
1778
  use_frontmatter?: boolean;
1767
1779
  }
1768
- interface SyncConfig {
1780
+ interface SyncConfig$1 {
1769
1781
  defaultDirection: SyncDirection;
1770
- rules: SyncRule[];
1782
+ rules: SyncRule$1[];
1771
1783
  defaultExcludes: string[];
1772
1784
  deleteOrphans: boolean;
1773
1785
  conflictStrategy: 'newest' | 'local' | 'remote' | 'manual';
1774
- from_codex?: DirectionalSyncConfig;
1775
- to_codex?: DirectionalSyncConfig;
1786
+ from_codex?: DirectionalSyncConfig$1;
1787
+ to_codex?: DirectionalSyncConfig$1;
1776
1788
  routing?: RoutingConfig;
1777
1789
  default_from_codex?: string[];
1778
1790
  default_to_codex?: string[];
1779
1791
  exclude?: string[];
1780
1792
  }
1781
- declare const DEFAULT_SYNC_CONFIG: SyncConfig;
1793
+ declare const DEFAULT_SYNC_CONFIG: SyncConfig$1;
1782
1794
 
1783
1795
  interface EvaluationResult {
1784
1796
  path: string;
1785
1797
  shouldSync: boolean;
1786
- matchedRule?: SyncRule;
1798
+ matchedRule?: SyncRule$1;
1787
1799
  reason: string;
1788
1800
  }
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[];
1801
+ declare function evaluatePath(path: string, rules: SyncRule$1[], direction: SyncDirection, defaultExcludes?: string[]): EvaluationResult;
1802
+ declare function evaluatePaths(paths: string[], rules: SyncRule$1[], direction: SyncDirection, defaultExcludes?: string[]): Map<string, EvaluationResult>;
1803
+ declare function filterSyncablePaths(paths: string[], rules: SyncRule$1[], direction: SyncDirection, defaultExcludes?: string[]): string[];
1804
+ declare function createRulesFromPatterns(include?: string[], exclude?: string[]): SyncRule$1[];
1805
+ declare function mergeRules(...ruleSets: SyncRule$1[][]): SyncRule$1[];
1794
1806
  interface EvaluationSummary {
1795
1807
  total: number;
1796
1808
  included: number;
@@ -1798,7 +1810,7 @@ interface EvaluationSummary {
1798
1810
  byReason: Record<string, number>;
1799
1811
  }
1800
1812
  declare function summarizeEvaluations(results: Map<string, EvaluationResult>): EvaluationSummary;
1801
- declare function validateRules$1(rules: SyncRule[]): string[];
1813
+ declare function validateRules$1(rules: SyncRule$1[]): string[];
1802
1814
 
1803
1815
  interface FileInfo {
1804
1816
  path: string;
@@ -1806,7 +1818,7 @@ interface FileInfo {
1806
1818
  mtime: number;
1807
1819
  hash?: string;
1808
1820
  }
1809
- declare function createSyncPlan(sourceFiles: FileInfo[], targetFiles: FileInfo[], options: SyncOptions, config: SyncConfig): SyncPlan;
1821
+ declare function createSyncPlan(sourceFiles: FileInfo[], targetFiles: FileInfo[], options: SyncOptions, config: SyncConfig$1): SyncPlan;
1810
1822
  declare function estimateSyncTime(plan: SyncPlan, bytesPerSecond?: number): number;
1811
1823
  declare function createEmptySyncPlan(direction?: SyncDirection): SyncPlan;
1812
1824
  declare function filterPlanOperations(plan: SyncPlan, operations: Array<'create' | 'update' | 'delete'>): SyncPlan;
@@ -1847,7 +1859,7 @@ interface RoutingScanResult {
1847
1859
 
1848
1860
  interface SyncManagerConfig {
1849
1861
  localStorage: LocalStorage;
1850
- config?: Partial<SyncConfig>;
1862
+ config?: Partial<SyncConfig$1>;
1851
1863
  manifestPath?: string;
1852
1864
  }
1853
1865
  declare class SyncManager {
@@ -1876,19 +1888,19 @@ declare class SyncManager {
1876
1888
  isFileSynced(path: string): Promise<boolean>;
1877
1889
  getLastSyncTime(): Promise<number | null>;
1878
1890
  clearManifest(): Promise<void>;
1879
- getConfig(): SyncConfig;
1880
- updateConfig(updates: Partial<SyncConfig>): void;
1891
+ getConfig(): SyncConfig$1;
1892
+ updateConfig(updates: Partial<SyncConfig$1>): void;
1881
1893
  }
1882
1894
  declare function createSyncManager(config: SyncManagerConfig): SyncManager;
1883
1895
 
1884
- type PermissionLevel = 'none' | 'read' | 'write' | 'admin';
1896
+ type PermissionLevel$1 = 'none' | 'read' | 'write' | 'admin';
1885
1897
  type PermissionScope = 'global' | 'org' | 'project' | 'path';
1886
1898
  type PermissionAction = 'fetch' | 'cache' | 'sync' | 'invalidate' | 'manage';
1887
- interface PermissionRule {
1899
+ interface PermissionRule$1 {
1888
1900
  id?: string;
1889
1901
  pattern: string;
1890
1902
  actions: PermissionAction[];
1891
- level: PermissionLevel;
1903
+ level: PermissionLevel$1;
1892
1904
  scope: PermissionScope;
1893
1905
  org?: string;
1894
1906
  project?: string;
@@ -1905,46 +1917,46 @@ interface PermissionContext {
1905
1917
  }
1906
1918
  interface PermissionResult {
1907
1919
  allowed: boolean;
1908
- level: PermissionLevel;
1909
- matchedRule?: PermissionRule;
1920
+ level: PermissionLevel$1;
1921
+ matchedRule?: PermissionRule$1;
1910
1922
  reason: string;
1911
1923
  }
1912
1924
  interface PermissionConfig {
1913
- defaultLevel: PermissionLevel;
1925
+ defaultLevel: PermissionLevel$1;
1914
1926
  defaultAllow: boolean;
1915
- rules: PermissionRule[];
1927
+ rules: PermissionRule$1[];
1916
1928
  enforced: boolean;
1917
1929
  }
1918
1930
  declare const DEFAULT_PERMISSION_CONFIG: PermissionConfig;
1919
- declare const PERMISSION_LEVEL_ORDER: PermissionLevel[];
1920
- declare function levelGrants(granted: PermissionLevel, required: PermissionLevel): boolean;
1921
- declare function maxLevel(a: PermissionLevel, b: PermissionLevel): PermissionLevel;
1922
- declare function minLevel(a: PermissionLevel, b: PermissionLevel): PermissionLevel;
1931
+ declare const PERMISSION_LEVEL_ORDER: PermissionLevel$1[];
1932
+ declare function levelGrants(granted: PermissionLevel$1, required: PermissionLevel$1): boolean;
1933
+ declare function maxLevel(a: PermissionLevel$1, b: PermissionLevel$1): PermissionLevel$1;
1934
+ declare function minLevel(a: PermissionLevel$1, b: PermissionLevel$1): PermissionLevel$1;
1923
1935
 
1924
- declare function ruleMatchesContext(rule: PermissionRule, context: PermissionContext): boolean;
1925
- declare function ruleMatchesPath(rule: PermissionRule, path: string): boolean;
1926
- declare function ruleMatchesAction(rule: PermissionRule, action: PermissionAction): boolean;
1936
+ declare function ruleMatchesContext(rule: PermissionRule$1, context: PermissionContext): boolean;
1937
+ declare function ruleMatchesPath(rule: PermissionRule$1, path: string): boolean;
1938
+ declare function ruleMatchesAction(rule: PermissionRule$1, action: PermissionAction): boolean;
1927
1939
  declare function evaluatePermission(path: string, action: PermissionAction, context: PermissionContext, config: PermissionConfig): PermissionResult;
1928
1940
  declare function isAllowed(path: string, action: PermissionAction, context: PermissionContext, config: PermissionConfig): boolean;
1929
- declare function hasPermission(path: string, action: PermissionAction, requiredLevel: PermissionLevel, context: PermissionContext, config: PermissionConfig): boolean;
1941
+ declare function hasPermission(path: string, action: PermissionAction, requiredLevel: PermissionLevel$1, context: PermissionContext, config: PermissionConfig): boolean;
1930
1942
  declare function evaluatePermissions(paths: string[], action: PermissionAction, context: PermissionContext, config: PermissionConfig): Map<string, PermissionResult>;
1931
- declare function filterByPermission(paths: string[], action: PermissionAction, context: PermissionContext, config: PermissionConfig, requiredLevel?: PermissionLevel): string[];
1932
- declare function validateRules(rules: PermissionRule[]): string[];
1943
+ declare function filterByPermission(paths: string[], action: PermissionAction, context: PermissionContext, config: PermissionConfig, requiredLevel?: PermissionLevel$1): string[];
1944
+ declare function validateRules(rules: PermissionRule$1[]): string[];
1933
1945
  declare function createRule(options: {
1934
1946
  pattern: string;
1935
1947
  actions: PermissionAction[];
1936
- level: PermissionLevel;
1937
- scope?: PermissionRule['scope'];
1948
+ level: PermissionLevel$1;
1949
+ scope?: PermissionRule$1['scope'];
1938
1950
  org?: string;
1939
1951
  project?: string;
1940
1952
  priority?: number;
1941
1953
  description?: string;
1942
- }): PermissionRule;
1954
+ }): PermissionRule$1;
1943
1955
  declare const CommonRules: {
1944
- allowDocs: () => PermissionRule;
1945
- denyPrivate: () => PermissionRule;
1946
- readOnlySpecs: () => PermissionRule;
1947
- adminManage: () => PermissionRule;
1956
+ allowDocs: () => PermissionRule$1;
1957
+ denyPrivate: () => PermissionRule$1;
1958
+ readOnlySpecs: () => PermissionRule$1;
1959
+ adminManage: () => PermissionRule$1;
1948
1960
  };
1949
1961
 
1950
1962
  interface PermissionManagerConfig {
@@ -1956,14 +1968,14 @@ declare class PermissionManager {
1956
1968
  private defaultContext;
1957
1969
  constructor(options?: PermissionManagerConfig);
1958
1970
  isAllowed(path: string, action: PermissionAction, context?: PermissionContext): boolean;
1959
- hasPermission(path: string, action: PermissionAction, requiredLevel: PermissionLevel, context?: PermissionContext): boolean;
1971
+ hasPermission(path: string, action: PermissionAction, requiredLevel: PermissionLevel$1, context?: PermissionContext): boolean;
1960
1972
  evaluate(path: string, action: PermissionAction, context?: PermissionContext): PermissionResult;
1961
- filterAllowed(paths: string[], action: PermissionAction, context?: PermissionContext, requiredLevel?: PermissionLevel): string[];
1962
- addRule(rule: PermissionRule): void;
1973
+ filterAllowed(paths: string[], action: PermissionAction, context?: PermissionContext, requiredLevel?: PermissionLevel$1): string[];
1974
+ addRule(rule: PermissionRule$1): void;
1963
1975
  removeRule(id: string): boolean;
1964
- getRules(): PermissionRule[];
1976
+ getRules(): PermissionRule$1[];
1965
1977
  clearRules(): void;
1966
- setRules(rules: PermissionRule[]): void;
1978
+ setRules(rules: PermissionRule$1[]): void;
1967
1979
  getConfig(): PermissionConfig;
1968
1980
  updateConfig(updates: Partial<Omit<PermissionConfig, 'rules'>>): void;
1969
1981
  setDefaultContext(context: PermissionContext): void;
@@ -1971,7 +1983,7 @@ declare class PermissionManager {
1971
1983
  enable(): void;
1972
1984
  disable(): void;
1973
1985
  isEnforced(): boolean;
1974
- assertPermission(path: string, action: PermissionAction, requiredLevel?: PermissionLevel, context?: PermissionContext): void;
1986
+ assertPermission(path: string, action: PermissionAction, requiredLevel?: PermissionLevel$1, context?: PermissionContext): void;
1975
1987
  }
1976
1988
  declare class PermissionDeniedError extends Error {
1977
1989
  readonly path: string;
@@ -2094,4 +2106,147 @@ declare function hasLegacyReferences(text: string): boolean;
2094
2106
  declare function migrateFileReferences(content: string, options?: ConversionOptions): ReferenceConversionResult;
2095
2107
  declare function generateReferenceMigrationSummary(results: ReferenceConversionResult[]): string;
2096
2108
 
2097
- 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 };
2109
+ interface ExpandEnvOptions {
2110
+ env?: Record<string, string | undefined>;
2111
+ warnOnMissing?: boolean;
2112
+ onMissing?: (varName: string) => void;
2113
+ }
2114
+ declare function expandEnvVars(value: string, options?: ExpandEnvOptions): string;
2115
+ declare function expandEnvVarsInConfig<T>(config: T, options?: ExpandEnvOptions): T;
2116
+ declare function hasEnvVars(value: string): boolean;
2117
+ declare function extractEnvVarNames(value: string): string[];
2118
+
2119
+ type StorageProviderType = 'local' | 'github' | 'http' | 's3';
2120
+ interface LocalStorageConfig {
2121
+ type: 'local';
2122
+ basePath: string;
2123
+ followSymlinks?: boolean;
2124
+ priority?: number;
2125
+ }
2126
+ interface GitHubStorageConfig {
2127
+ type: 'github';
2128
+ token?: string;
2129
+ apiBaseUrl?: string;
2130
+ rawBaseUrl?: string;
2131
+ branch?: string;
2132
+ priority?: number;
2133
+ }
2134
+ interface HttpStorageConfig {
2135
+ type: 'http';
2136
+ baseUrl: string;
2137
+ headers?: Record<string, string>;
2138
+ timeout?: number;
2139
+ priority?: number;
2140
+ }
2141
+ interface S3StorageConfig {
2142
+ type: 's3';
2143
+ bucket: string;
2144
+ region?: string;
2145
+ accessKeyId?: string;
2146
+ secretAccessKey?: string;
2147
+ priority?: number;
2148
+ }
2149
+ type StorageProviderConfig = LocalStorageConfig | GitHubStorageConfig | HttpStorageConfig | S3StorageConfig;
2150
+ interface CacheConfig {
2151
+ directory?: string;
2152
+ cacheDir?: string;
2153
+ defaultTtl?: number;
2154
+ maxSize?: number;
2155
+ maxMemoryEntries?: number;
2156
+ maxMemorySize?: number;
2157
+ enablePersistence?: boolean;
2158
+ }
2159
+ interface CustomTypeConfig {
2160
+ description?: string;
2161
+ patterns?: string[];
2162
+ defaultTtl?: number;
2163
+ archiveAfterDays?: number | null;
2164
+ archiveStorage?: 'local' | 'cloud' | 'drive' | null;
2165
+ }
2166
+ interface TypesConfig {
2167
+ custom?: Record<string, CustomTypeConfig>;
2168
+ }
2169
+ type PermissionLevel = 'none' | 'read' | 'write' | 'admin';
2170
+ interface PermissionRule {
2171
+ pattern: string;
2172
+ permission: PermissionLevel;
2173
+ users?: string[];
2174
+ }
2175
+ interface PermissionsConfig {
2176
+ default?: PermissionLevel;
2177
+ rules?: PermissionRule[];
2178
+ }
2179
+ interface DirectionalSyncConfig {
2180
+ include: string[];
2181
+ exclude?: string[];
2182
+ }
2183
+ interface SyncRule {
2184
+ pattern: string;
2185
+ direction?: 'to-codex' | 'from-codex' | 'bidirectional';
2186
+ }
2187
+ interface SyncConfig {
2188
+ bidirectional?: boolean;
2189
+ conflictResolution?: 'prompt' | 'local' | 'remote' | 'newest' | 'skip';
2190
+ exclude?: string[];
2191
+ rules?: SyncRule[];
2192
+ to_codex?: DirectionalSyncConfig;
2193
+ from_codex?: DirectionalSyncConfig;
2194
+ default_to_codex?: string[];
2195
+ default_from_codex?: string[];
2196
+ environments?: Record<string, string>;
2197
+ }
2198
+ interface McpConfig {
2199
+ enabled?: boolean;
2200
+ port?: number;
2201
+ }
2202
+ interface ProjectArchiveConfig {
2203
+ bucket?: string;
2204
+ prefix?: string;
2205
+ storageClass?: string;
2206
+ }
2207
+ interface ArchiveConfig {
2208
+ projects?: Record<string, ProjectArchiveConfig>;
2209
+ }
2210
+ interface FileConfig {
2211
+ sources?: Array<{
2212
+ name: string;
2213
+ path: string;
2214
+ type?: string;
2215
+ }>;
2216
+ }
2217
+ interface CodexYamlConfig {
2218
+ organization: string;
2219
+ project?: string;
2220
+ codex_repo?: string;
2221
+ cacheDir?: string;
2222
+ cache?: CacheConfig;
2223
+ storage?: StorageProviderConfig[];
2224
+ types?: TypesConfig;
2225
+ permissions?: PermissionsConfig;
2226
+ sync?: SyncConfig;
2227
+ mcp?: McpConfig;
2228
+ archive?: ArchiveConfig;
2229
+ }
2230
+ interface UnifiedConfig {
2231
+ codex?: CodexYamlConfig;
2232
+ file?: FileConfig;
2233
+ [key: string]: unknown;
2234
+ }
2235
+ interface ReadConfigOptions {
2236
+ expandEnv?: boolean;
2237
+ env?: Record<string, string | undefined>;
2238
+ warnOnMissingEnv?: boolean;
2239
+ }
2240
+ declare function readCodexConfig(configPath: string, options?: ReadConfigOptions): Promise<CodexYamlConfig>;
2241
+ declare function readUnifiedConfig(configPath: string, options?: ReadConfigOptions): Promise<UnifiedConfig>;
2242
+ declare function isUnifiedConfig(config: unknown): config is UnifiedConfig;
2243
+
2244
+ declare function parseDuration(duration: string | number): number;
2245
+ declare function parseSize(size: string | number): number;
2246
+ declare function formatBytes(bytes: number): string;
2247
+ declare function formatDuration(ms: number): string;
2248
+ declare function formatSeconds(seconds: number): string;
2249
+ declare function isValidDuration(value: string): boolean;
2250
+ declare function isValidSize(value: string): boolean;
2251
+
2252
+ 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 };