@fractary/codex 0.7.1 → 0.9.0

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,16 +33,56 @@ 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';
37
+ interface FetchResult {
38
+ content: Buffer;
39
+ contentType: string;
40
+ size: number;
41
+ source: string;
42
+ metadata?: Record<string, unknown>;
43
+ }
44
+ interface FetchOptions {
45
+ timeout?: number;
46
+ maxRetries?: number;
47
+ token?: string;
48
+ branch?: string;
49
+ followRedirects?: boolean;
50
+ maxSize?: number;
51
+ }
52
+ interface StorageProvider {
53
+ readonly name: string;
54
+ readonly type: StorageProviderType;
55
+ fetch(reference: ResolvedReference, options?: FetchOptions): Promise<FetchResult>;
56
+ exists(reference: ResolvedReference, options?: FetchOptions): Promise<boolean>;
57
+ canHandle(reference: ResolvedReference): boolean;
58
+ }
59
+ interface StorageProviderConfig {
60
+ type: StorageProviderType;
61
+ options?: Record<string, unknown>;
62
+ timeout?: number;
63
+ maxRetries?: number;
64
+ auth?: {
65
+ tokenEnv?: string;
66
+ token?: string;
67
+ };
68
+ }
69
+ declare const DEFAULT_FETCH_OPTIONS: Required<FetchOptions>;
70
+ declare function mergeFetchOptions(options?: FetchOptions): Required<FetchOptions>;
71
+ declare function detectContentType(path: string): string;
72
+
36
73
  interface ResolvedReference extends ParsedReference {
37
74
  cachePath: string;
38
75
  isCurrentProject: boolean;
39
76
  localPath?: string;
77
+ sourceType?: StorageProviderType;
78
+ filePluginSource?: string;
40
79
  }
41
80
  interface ResolveOptions {
42
81
  cacheDir?: string;
43
82
  currentOrg?: string;
44
83
  currentProject?: string;
45
84
  cwd?: string;
85
+ config?: any;
46
86
  }
47
87
  declare const DEFAULT_CACHE_DIR = ".fractary/codex/cache";
48
88
  declare function detectCurrentProject(cwd?: string): {
@@ -143,7 +183,7 @@ declare const CustomTypeSchema: z.ZodObject<{
143
183
  description?: string | undefined;
144
184
  defaultTtl?: number | undefined;
145
185
  archiveAfterDays?: number | null | undefined;
146
- archiveStorage?: "local" | "cloud" | "drive" | null | undefined;
186
+ archiveStorage?: "local" | "drive" | "cloud" | null | undefined;
147
187
  syncPatterns?: string[] | undefined;
148
188
  excludePatterns?: string[] | undefined;
149
189
  permissions?: {
@@ -155,7 +195,7 @@ declare const CustomTypeSchema: z.ZodObject<{
155
195
  description?: string | undefined;
156
196
  defaultTtl?: number | undefined;
157
197
  archiveAfterDays?: number | null | undefined;
158
- archiveStorage?: "local" | "cloud" | "drive" | null | undefined;
198
+ archiveStorage?: "local" | "drive" | "cloud" | null | undefined;
159
199
  syncPatterns?: string[] | undefined;
160
200
  excludePatterns?: string[] | undefined;
161
201
  permissions?: {
@@ -188,7 +228,7 @@ declare const TypesConfigSchema: z.ZodObject<{
188
228
  description?: string | undefined;
189
229
  defaultTtl?: number | undefined;
190
230
  archiveAfterDays?: number | null | undefined;
191
- archiveStorage?: "local" | "cloud" | "drive" | null | undefined;
231
+ archiveStorage?: "local" | "drive" | "cloud" | null | undefined;
192
232
  syncPatterns?: string[] | undefined;
193
233
  excludePatterns?: string[] | undefined;
194
234
  permissions?: {
@@ -200,7 +240,7 @@ declare const TypesConfigSchema: z.ZodObject<{
200
240
  description?: string | undefined;
201
241
  defaultTtl?: number | undefined;
202
242
  archiveAfterDays?: number | null | undefined;
203
- archiveStorage?: "local" | "cloud" | "drive" | null | undefined;
243
+ archiveStorage?: "local" | "drive" | "cloud" | null | undefined;
204
244
  syncPatterns?: string[] | undefined;
205
245
  excludePatterns?: string[] | undefined;
206
246
  permissions?: {
@@ -214,7 +254,7 @@ declare const TypesConfigSchema: z.ZodObject<{
214
254
  description?: string | undefined;
215
255
  defaultTtl?: number | undefined;
216
256
  archiveAfterDays?: number | null | undefined;
217
- archiveStorage?: "local" | "cloud" | "drive" | null | undefined;
257
+ archiveStorage?: "local" | "drive" | "cloud" | null | undefined;
218
258
  syncPatterns?: string[] | undefined;
219
259
  excludePatterns?: string[] | undefined;
220
260
  permissions?: {
@@ -228,7 +268,7 @@ declare const TypesConfigSchema: z.ZodObject<{
228
268
  description?: string | undefined;
229
269
  defaultTtl?: number | undefined;
230
270
  archiveAfterDays?: number | null | undefined;
231
- archiveStorage?: "local" | "cloud" | "drive" | null | undefined;
271
+ archiveStorage?: "local" | "drive" | "cloud" | null | undefined;
232
272
  syncPatterns?: string[] | undefined;
233
273
  excludePatterns?: string[] | undefined;
234
274
  permissions?: {
@@ -358,12 +398,12 @@ declare const CodexConfigSchema: z.ZodObject<{
358
398
  target: z.ZodOptional<z.ZodString>;
359
399
  systems: z.ZodOptional<z.ZodString>;
360
400
  }, "strip", z.ZodTypeAny, {
361
- systems?: string | undefined;
362
401
  source?: string | undefined;
402
+ systems?: string | undefined;
363
403
  target?: string | undefined;
364
404
  }, {
365
- systems?: string | undefined;
366
405
  source?: string | undefined;
406
+ systems?: string | undefined;
367
407
  target?: string | undefined;
368
408
  }>>;
369
409
  rules: z.ZodOptional<z.ZodObject<{
@@ -424,11 +464,48 @@ declare const CodexConfigSchema: z.ZodObject<{
424
464
  default_to_codex?: string[] | undefined;
425
465
  default_from_codex?: string[] | undefined;
426
466
  }>>;
467
+ archive: z.ZodOptional<z.ZodObject<{
468
+ projects: z.ZodRecord<z.ZodString, z.ZodObject<{
469
+ enabled: z.ZodBoolean;
470
+ handler: z.ZodEnum<["s3", "r2", "gcs", "local"]>;
471
+ bucket: z.ZodOptional<z.ZodString>;
472
+ prefix: z.ZodOptional<z.ZodString>;
473
+ patterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
474
+ }, "strip", z.ZodTypeAny, {
475
+ enabled: boolean;
476
+ handler: "local" | "s3" | "r2" | "gcs";
477
+ patterns?: string[] | undefined;
478
+ bucket?: string | undefined;
479
+ prefix?: string | undefined;
480
+ }, {
481
+ enabled: boolean;
482
+ handler: "local" | "s3" | "r2" | "gcs";
483
+ patterns?: string[] | undefined;
484
+ bucket?: string | undefined;
485
+ prefix?: string | undefined;
486
+ }>>;
487
+ }, "strip", z.ZodTypeAny, {
488
+ projects: Record<string, {
489
+ enabled: boolean;
490
+ handler: "local" | "s3" | "r2" | "gcs";
491
+ patterns?: string[] | undefined;
492
+ bucket?: string | undefined;
493
+ prefix?: string | undefined;
494
+ }>;
495
+ }, {
496
+ projects: Record<string, {
497
+ enabled: boolean;
498
+ handler: "local" | "s3" | "r2" | "gcs";
499
+ patterns?: string[] | undefined;
500
+ bucket?: string | undefined;
501
+ prefix?: string | undefined;
502
+ }>;
503
+ }>>;
427
504
  }, "strict", z.ZodTypeAny, {
428
505
  organizationSlug: string;
429
506
  directories?: {
430
- systems?: string | undefined;
431
507
  source?: string | undefined;
508
+ systems?: string | undefined;
432
509
  target?: string | undefined;
433
510
  } | undefined;
434
511
  rules?: {
@@ -449,11 +526,20 @@ declare const CodexConfigSchema: z.ZodObject<{
449
526
  default_to_codex?: string[] | undefined;
450
527
  default_from_codex?: string[] | undefined;
451
528
  } | undefined;
529
+ archive?: {
530
+ projects: Record<string, {
531
+ enabled: boolean;
532
+ handler: "local" | "s3" | "r2" | "gcs";
533
+ patterns?: string[] | undefined;
534
+ bucket?: string | undefined;
535
+ prefix?: string | undefined;
536
+ }>;
537
+ } | undefined;
452
538
  }, {
453
539
  organizationSlug: string;
454
540
  directories?: {
455
- systems?: string | undefined;
456
541
  source?: string | undefined;
542
+ systems?: string | undefined;
457
543
  target?: string | undefined;
458
544
  } | undefined;
459
545
  rules?: {
@@ -474,8 +560,438 @@ declare const CodexConfigSchema: z.ZodObject<{
474
560
  default_to_codex?: string[] | undefined;
475
561
  default_from_codex?: string[] | undefined;
476
562
  } | undefined;
563
+ archive?: {
564
+ projects: Record<string, {
565
+ enabled: boolean;
566
+ handler: "local" | "s3" | "r2" | "gcs";
567
+ patterns?: string[] | undefined;
568
+ bucket?: string | undefined;
569
+ prefix?: string | undefined;
570
+ }>;
571
+ } | undefined;
477
572
  }>;
478
573
  type CodexConfig = z.infer<typeof CodexConfigSchema>;
574
+ declare const UnifiedConfigSchema: z.ZodObject<{
575
+ file: z.ZodOptional<z.ZodObject<{
576
+ schema_version: z.ZodString;
577
+ sources: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
578
+ type: z.ZodEnum<["s3", "r2", "gcs", "local"]>;
579
+ bucket: z.ZodOptional<z.ZodString>;
580
+ prefix: z.ZodOptional<z.ZodString>;
581
+ region: z.ZodOptional<z.ZodString>;
582
+ local: z.ZodObject<{
583
+ base_path: z.ZodString;
584
+ }, "strip", z.ZodTypeAny, {
585
+ base_path: string;
586
+ }, {
587
+ base_path: string;
588
+ }>;
589
+ push: z.ZodOptional<z.ZodObject<{
590
+ compress: z.ZodOptional<z.ZodBoolean>;
591
+ keep_local: z.ZodOptional<z.ZodBoolean>;
592
+ }, "strip", z.ZodTypeAny, {
593
+ compress?: boolean | undefined;
594
+ keep_local?: boolean | undefined;
595
+ }, {
596
+ compress?: boolean | undefined;
597
+ keep_local?: boolean | undefined;
598
+ }>>;
599
+ auth: z.ZodOptional<z.ZodObject<{
600
+ profile: z.ZodOptional<z.ZodString>;
601
+ }, "strip", z.ZodTypeAny, {
602
+ profile?: string | undefined;
603
+ }, {
604
+ profile?: string | undefined;
605
+ }>>;
606
+ }, "strip", z.ZodTypeAny, {
607
+ local: {
608
+ base_path: string;
609
+ };
610
+ type: "local" | "s3" | "r2" | "gcs";
611
+ push?: {
612
+ compress?: boolean | undefined;
613
+ keep_local?: boolean | undefined;
614
+ } | undefined;
615
+ bucket?: string | undefined;
616
+ prefix?: string | undefined;
617
+ region?: string | undefined;
618
+ auth?: {
619
+ profile?: string | undefined;
620
+ } | undefined;
621
+ }, {
622
+ local: {
623
+ base_path: string;
624
+ };
625
+ type: "local" | "s3" | "r2" | "gcs";
626
+ push?: {
627
+ compress?: boolean | undefined;
628
+ keep_local?: boolean | undefined;
629
+ } | undefined;
630
+ bucket?: string | undefined;
631
+ prefix?: string | undefined;
632
+ region?: string | undefined;
633
+ auth?: {
634
+ profile?: string | undefined;
635
+ } | undefined;
636
+ }>, {
637
+ local: {
638
+ base_path: string;
639
+ };
640
+ type: "local" | "s3" | "r2" | "gcs";
641
+ push?: {
642
+ compress?: boolean | undefined;
643
+ keep_local?: boolean | undefined;
644
+ } | undefined;
645
+ bucket?: string | undefined;
646
+ prefix?: string | undefined;
647
+ region?: string | undefined;
648
+ auth?: {
649
+ profile?: string | undefined;
650
+ } | undefined;
651
+ }, {
652
+ local: {
653
+ base_path: string;
654
+ };
655
+ type: "local" | "s3" | "r2" | "gcs";
656
+ push?: {
657
+ compress?: boolean | undefined;
658
+ keep_local?: boolean | undefined;
659
+ } | undefined;
660
+ bucket?: string | undefined;
661
+ prefix?: string | undefined;
662
+ region?: string | undefined;
663
+ auth?: {
664
+ profile?: string | undefined;
665
+ } | undefined;
666
+ }>>;
667
+ }, "strip", z.ZodTypeAny, {
668
+ schema_version: string;
669
+ sources: Record<string, {
670
+ local: {
671
+ base_path: string;
672
+ };
673
+ type: "local" | "s3" | "r2" | "gcs";
674
+ push?: {
675
+ compress?: boolean | undefined;
676
+ keep_local?: boolean | undefined;
677
+ } | undefined;
678
+ bucket?: string | undefined;
679
+ prefix?: string | undefined;
680
+ region?: string | undefined;
681
+ auth?: {
682
+ profile?: string | undefined;
683
+ } | undefined;
684
+ }>;
685
+ }, {
686
+ schema_version: string;
687
+ sources: Record<string, {
688
+ local: {
689
+ base_path: string;
690
+ };
691
+ type: "local" | "s3" | "r2" | "gcs";
692
+ push?: {
693
+ compress?: boolean | undefined;
694
+ keep_local?: boolean | undefined;
695
+ } | undefined;
696
+ bucket?: string | undefined;
697
+ prefix?: string | undefined;
698
+ region?: string | undefined;
699
+ auth?: {
700
+ profile?: string | undefined;
701
+ } | undefined;
702
+ }>;
703
+ }>>;
704
+ codex: z.ZodOptional<z.ZodObject<{
705
+ organizationSlug: z.ZodString;
706
+ directories: z.ZodOptional<z.ZodObject<{
707
+ source: z.ZodOptional<z.ZodString>;
708
+ target: z.ZodOptional<z.ZodString>;
709
+ systems: z.ZodOptional<z.ZodString>;
710
+ }, "strip", z.ZodTypeAny, {
711
+ source?: string | undefined;
712
+ systems?: string | undefined;
713
+ target?: string | undefined;
714
+ }, {
715
+ source?: string | undefined;
716
+ systems?: string | undefined;
717
+ target?: string | undefined;
718
+ }>>;
719
+ rules: z.ZodOptional<z.ZodObject<{
720
+ autoSyncPatterns: z.ZodOptional<z.ZodArray<z.ZodObject<{
721
+ pattern: z.ZodString;
722
+ include: z.ZodArray<z.ZodString, "many">;
723
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
724
+ }, "strip", z.ZodTypeAny, {
725
+ include: string[];
726
+ pattern: string;
727
+ exclude?: string[] | undefined;
728
+ }, {
729
+ include: string[];
730
+ pattern: string;
731
+ exclude?: string[] | undefined;
732
+ }>, "many">>;
733
+ preventSelfSync: z.ZodOptional<z.ZodBoolean>;
734
+ preventCodexSync: z.ZodOptional<z.ZodBoolean>;
735
+ allowProjectOverrides: z.ZodOptional<z.ZodBoolean>;
736
+ defaultInclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
737
+ defaultExclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
738
+ }, "strip", z.ZodTypeAny, {
739
+ autoSyncPatterns?: {
740
+ include: string[];
741
+ pattern: string;
742
+ exclude?: string[] | undefined;
743
+ }[] | undefined;
744
+ preventSelfSync?: boolean | undefined;
745
+ preventCodexSync?: boolean | undefined;
746
+ allowProjectOverrides?: boolean | undefined;
747
+ defaultInclude?: string[] | undefined;
748
+ defaultExclude?: string[] | undefined;
749
+ }, {
750
+ autoSyncPatterns?: {
751
+ include: string[];
752
+ pattern: string;
753
+ exclude?: string[] | undefined;
754
+ }[] | undefined;
755
+ preventSelfSync?: boolean | undefined;
756
+ preventCodexSync?: boolean | undefined;
757
+ allowProjectOverrides?: boolean | undefined;
758
+ defaultInclude?: string[] | undefined;
759
+ defaultExclude?: string[] | undefined;
760
+ }>>;
761
+ sync: z.ZodOptional<z.ZodObject<{
762
+ to_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
763
+ from_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
764
+ default_to_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
765
+ default_from_codex: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
766
+ }, "strip", z.ZodTypeAny, {
767
+ to_codex?: string[] | undefined;
768
+ from_codex?: string[] | undefined;
769
+ default_to_codex?: string[] | undefined;
770
+ default_from_codex?: string[] | undefined;
771
+ }, {
772
+ to_codex?: string[] | undefined;
773
+ from_codex?: string[] | undefined;
774
+ default_to_codex?: string[] | undefined;
775
+ default_from_codex?: string[] | undefined;
776
+ }>>;
777
+ archive: z.ZodOptional<z.ZodObject<{
778
+ projects: z.ZodRecord<z.ZodString, z.ZodObject<{
779
+ enabled: z.ZodBoolean;
780
+ handler: z.ZodEnum<["s3", "r2", "gcs", "local"]>;
781
+ bucket: z.ZodOptional<z.ZodString>;
782
+ prefix: z.ZodOptional<z.ZodString>;
783
+ patterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
784
+ }, "strip", z.ZodTypeAny, {
785
+ enabled: boolean;
786
+ handler: "local" | "s3" | "r2" | "gcs";
787
+ patterns?: string[] | undefined;
788
+ bucket?: string | undefined;
789
+ prefix?: string | undefined;
790
+ }, {
791
+ enabled: boolean;
792
+ handler: "local" | "s3" | "r2" | "gcs";
793
+ patterns?: string[] | undefined;
794
+ bucket?: string | undefined;
795
+ prefix?: string | undefined;
796
+ }>>;
797
+ }, "strip", z.ZodTypeAny, {
798
+ projects: Record<string, {
799
+ enabled: boolean;
800
+ handler: "local" | "s3" | "r2" | "gcs";
801
+ patterns?: string[] | undefined;
802
+ bucket?: string | undefined;
803
+ prefix?: string | undefined;
804
+ }>;
805
+ }, {
806
+ projects: Record<string, {
807
+ enabled: boolean;
808
+ handler: "local" | "s3" | "r2" | "gcs";
809
+ patterns?: string[] | undefined;
810
+ bucket?: string | undefined;
811
+ prefix?: string | undefined;
812
+ }>;
813
+ }>>;
814
+ }, "strict", z.ZodTypeAny, {
815
+ organizationSlug: string;
816
+ directories?: {
817
+ source?: string | undefined;
818
+ systems?: string | undefined;
819
+ target?: string | undefined;
820
+ } | undefined;
821
+ rules?: {
822
+ autoSyncPatterns?: {
823
+ include: string[];
824
+ pattern: string;
825
+ exclude?: string[] | undefined;
826
+ }[] | undefined;
827
+ preventSelfSync?: boolean | undefined;
828
+ preventCodexSync?: boolean | undefined;
829
+ allowProjectOverrides?: boolean | undefined;
830
+ defaultInclude?: string[] | undefined;
831
+ defaultExclude?: string[] | undefined;
832
+ } | undefined;
833
+ sync?: {
834
+ to_codex?: string[] | undefined;
835
+ from_codex?: string[] | undefined;
836
+ default_to_codex?: string[] | undefined;
837
+ default_from_codex?: string[] | undefined;
838
+ } | undefined;
839
+ archive?: {
840
+ projects: Record<string, {
841
+ enabled: boolean;
842
+ handler: "local" | "s3" | "r2" | "gcs";
843
+ patterns?: string[] | undefined;
844
+ bucket?: string | undefined;
845
+ prefix?: string | undefined;
846
+ }>;
847
+ } | undefined;
848
+ }, {
849
+ organizationSlug: string;
850
+ directories?: {
851
+ source?: string | undefined;
852
+ systems?: string | undefined;
853
+ target?: string | undefined;
854
+ } | undefined;
855
+ rules?: {
856
+ autoSyncPatterns?: {
857
+ include: string[];
858
+ pattern: string;
859
+ exclude?: string[] | undefined;
860
+ }[] | undefined;
861
+ preventSelfSync?: boolean | undefined;
862
+ preventCodexSync?: boolean | undefined;
863
+ allowProjectOverrides?: boolean | undefined;
864
+ defaultInclude?: string[] | undefined;
865
+ defaultExclude?: string[] | undefined;
866
+ } | undefined;
867
+ sync?: {
868
+ to_codex?: string[] | undefined;
869
+ from_codex?: string[] | undefined;
870
+ default_to_codex?: string[] | undefined;
871
+ default_from_codex?: string[] | undefined;
872
+ } | undefined;
873
+ archive?: {
874
+ projects: Record<string, {
875
+ enabled: boolean;
876
+ handler: "local" | "s3" | "r2" | "gcs";
877
+ patterns?: string[] | undefined;
878
+ bucket?: string | undefined;
879
+ prefix?: string | undefined;
880
+ }>;
881
+ } | undefined;
882
+ }>>;
883
+ }, "strip", z.ZodTypeAny, {
884
+ file?: {
885
+ schema_version: string;
886
+ sources: Record<string, {
887
+ local: {
888
+ base_path: string;
889
+ };
890
+ type: "local" | "s3" | "r2" | "gcs";
891
+ push?: {
892
+ compress?: boolean | undefined;
893
+ keep_local?: boolean | undefined;
894
+ } | undefined;
895
+ bucket?: string | undefined;
896
+ prefix?: string | undefined;
897
+ region?: string | undefined;
898
+ auth?: {
899
+ profile?: string | undefined;
900
+ } | undefined;
901
+ }>;
902
+ } | undefined;
903
+ codex?: {
904
+ organizationSlug: string;
905
+ directories?: {
906
+ source?: string | undefined;
907
+ systems?: string | undefined;
908
+ target?: string | undefined;
909
+ } | undefined;
910
+ rules?: {
911
+ autoSyncPatterns?: {
912
+ include: string[];
913
+ pattern: string;
914
+ exclude?: string[] | undefined;
915
+ }[] | undefined;
916
+ preventSelfSync?: boolean | undefined;
917
+ preventCodexSync?: boolean | undefined;
918
+ allowProjectOverrides?: boolean | undefined;
919
+ defaultInclude?: string[] | undefined;
920
+ defaultExclude?: string[] | undefined;
921
+ } | undefined;
922
+ sync?: {
923
+ to_codex?: string[] | undefined;
924
+ from_codex?: string[] | undefined;
925
+ default_to_codex?: string[] | undefined;
926
+ default_from_codex?: string[] | undefined;
927
+ } | undefined;
928
+ archive?: {
929
+ projects: Record<string, {
930
+ enabled: boolean;
931
+ handler: "local" | "s3" | "r2" | "gcs";
932
+ patterns?: string[] | undefined;
933
+ bucket?: string | undefined;
934
+ prefix?: string | undefined;
935
+ }>;
936
+ } | undefined;
937
+ } | undefined;
938
+ }, {
939
+ file?: {
940
+ schema_version: string;
941
+ sources: Record<string, {
942
+ local: {
943
+ base_path: string;
944
+ };
945
+ type: "local" | "s3" | "r2" | "gcs";
946
+ push?: {
947
+ compress?: boolean | undefined;
948
+ keep_local?: boolean | undefined;
949
+ } | undefined;
950
+ bucket?: string | undefined;
951
+ prefix?: string | undefined;
952
+ region?: string | undefined;
953
+ auth?: {
954
+ profile?: string | undefined;
955
+ } | undefined;
956
+ }>;
957
+ } | undefined;
958
+ codex?: {
959
+ organizationSlug: string;
960
+ directories?: {
961
+ source?: string | undefined;
962
+ systems?: string | undefined;
963
+ target?: string | undefined;
964
+ } | undefined;
965
+ rules?: {
966
+ autoSyncPatterns?: {
967
+ include: string[];
968
+ pattern: string;
969
+ exclude?: string[] | undefined;
970
+ }[] | undefined;
971
+ preventSelfSync?: boolean | undefined;
972
+ preventCodexSync?: boolean | undefined;
973
+ allowProjectOverrides?: boolean | undefined;
974
+ defaultInclude?: string[] | undefined;
975
+ defaultExclude?: string[] | undefined;
976
+ } | undefined;
977
+ sync?: {
978
+ to_codex?: string[] | undefined;
979
+ from_codex?: string[] | undefined;
980
+ default_to_codex?: string[] | undefined;
981
+ default_from_codex?: string[] | undefined;
982
+ } | undefined;
983
+ archive?: {
984
+ projects: Record<string, {
985
+ enabled: boolean;
986
+ handler: "local" | "s3" | "r2" | "gcs";
987
+ patterns?: string[] | undefined;
988
+ bucket?: string | undefined;
989
+ prefix?: string | undefined;
990
+ }>;
991
+ } | undefined;
992
+ } | undefined;
993
+ }>;
994
+ type UnifiedConfig = z.infer<typeof UnifiedConfigSchema>;
479
995
 
480
996
  interface ParseMetadataOptions {
481
997
  strict?: boolean;
@@ -549,43 +1065,6 @@ interface CustomSyncDestination {
549
1065
  declare function parseCustomDestination(value: string): CustomSyncDestination;
550
1066
  declare function getCustomSyncDestinations(metadata: Metadata): CustomSyncDestination[];
551
1067
 
552
- type StorageProviderType = 'local' | 'github' | 'http' | 's3' | 'r2' | 'gcs' | 'drive';
553
- interface FetchResult {
554
- content: Buffer;
555
- contentType: string;
556
- size: number;
557
- source: string;
558
- metadata?: Record<string, unknown>;
559
- }
560
- interface FetchOptions {
561
- timeout?: number;
562
- maxRetries?: number;
563
- token?: string;
564
- branch?: string;
565
- followRedirects?: boolean;
566
- maxSize?: number;
567
- }
568
- interface StorageProvider {
569
- readonly name: string;
570
- readonly type: StorageProviderType;
571
- fetch(reference: ResolvedReference, options?: FetchOptions): Promise<FetchResult>;
572
- exists(reference: ResolvedReference, options?: FetchOptions): Promise<boolean>;
573
- canHandle(reference: ResolvedReference): boolean;
574
- }
575
- interface StorageProviderConfig {
576
- type: StorageProviderType;
577
- options?: Record<string, unknown>;
578
- timeout?: number;
579
- maxRetries?: number;
580
- auth?: {
581
- tokenEnv?: string;
582
- token?: string;
583
- };
584
- }
585
- declare const DEFAULT_FETCH_OPTIONS: Required<FetchOptions>;
586
- declare function mergeFetchOptions(options?: FetchOptions): Required<FetchOptions>;
587
- declare function detectContentType(path: string): string;
588
-
589
1068
  interface LocalStorageOptions {
590
1069
  baseDir?: string;
591
1070
  }
@@ -653,10 +1132,53 @@ declare class HttpStorage implements StorageProvider {
653
1132
  }
654
1133
  declare function createHttpStorage(options?: HttpStorageOptions): HttpStorage;
655
1134
 
1135
+ interface FilePluginStorageOptions {
1136
+ config: UnifiedConfig;
1137
+ enableS3Fallback?: boolean;
1138
+ baseDir?: string;
1139
+ }
1140
+ declare class FilePluginStorage implements StorageProvider {
1141
+ private options;
1142
+ readonly name = "file-plugin";
1143
+ readonly type: "local";
1144
+ private sourceResolver;
1145
+ private baseDir;
1146
+ constructor(options: FilePluginStorageOptions);
1147
+ canHandle(reference: ResolvedReference): boolean;
1148
+ fetch(reference: ResolvedReference, _options?: FetchOptions): Promise<FetchResult>;
1149
+ exists(reference: ResolvedReference, _options?: FetchOptions): Promise<boolean>;
1150
+ private detectContentType;
1151
+ private createFileNotFoundError;
1152
+ }
1153
+
1154
+ interface FilePluginFileNotFoundErrorOptions {
1155
+ includeCloudSuggestions?: boolean;
1156
+ storageType?: string;
1157
+ }
1158
+ declare class FilePluginFileNotFoundError extends Error {
1159
+ readonly filePath: string;
1160
+ readonly sourceName: string;
1161
+ constructor(filePath: string, sourceName: string, options?: FilePluginFileNotFoundErrorOptions);
1162
+ }
1163
+
1164
+ interface ArchiveProjectConfig {
1165
+ enabled: boolean;
1166
+ handler: 's3' | 'r2' | 'gcs' | 'local';
1167
+ bucket?: string;
1168
+ prefix?: string;
1169
+ patterns?: string[];
1170
+ }
1171
+ interface S3ArchiveStorageOptions {
1172
+ projects?: Record<string, ArchiveProjectConfig>;
1173
+ fractaryCli?: string;
1174
+ }
1175
+
656
1176
  interface StorageManagerConfig {
657
1177
  local?: LocalStorageOptions;
658
1178
  github?: GitHubStorageOptions;
659
1179
  http?: HttpStorageOptions;
1180
+ s3Archive?: S3ArchiveStorageOptions;
1181
+ filePlugin?: FilePluginStorageOptions;
660
1182
  priority?: StorageProviderType[];
661
1183
  enableCaching?: boolean;
662
1184
  }
@@ -1202,4 +1724,4 @@ declare function hasLegacyReferences(text: string): boolean;
1202
1724
  declare function migrateFileReferences(content: string, options?: ConversionOptions): ReferenceConversionResult;
1203
1725
  declare function generateReferenceMigrationSummary(results: ReferenceConversionResult[]): string;
1204
1726
 
1205
- 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, 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 };
1727
+ 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 };