@stll/folio-agents 0.6.1 → 0.7.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/operation-schema.d.ts +573 -3
- package/dist/operation-schema.js +142 -3
- package/dist/parse.js +68 -3
- package/dist/tools.js +39 -12
- package/dist/types.d.ts +3 -3
- package/package.json +1 -1
|
@@ -45,7 +45,7 @@ declare const FOLIO_TEXT_RANGE_JSON_SCHEMA: {
|
|
|
45
45
|
};
|
|
46
46
|
/**
|
|
47
47
|
* JSON Schema (draft-07 compatible) for ONE document operation: the full
|
|
48
|
-
*
|
|
48
|
+
* thirteen-variant union accepted by `parseFolioDocumentOperationBatch` in
|
|
49
49
|
* `@stll/folio-core`, one `oneOf` variant per entry in
|
|
50
50
|
* `FOLIO_DOCUMENT_OPERATION_TYPES`. Intended for LLM tool definitions and
|
|
51
51
|
* other consumers that need the contract's wire shape without re-declaring
|
|
@@ -287,7 +287,7 @@ declare const FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA: {
|
|
|
287
287
|
readonly additionalProperties: false;
|
|
288
288
|
}, {
|
|
289
289
|
readonly type: "object";
|
|
290
|
-
readonly description:
|
|
290
|
+
readonly description: "Apply inline formatting to the text covered by a range handle in direct or tracked mode.";
|
|
291
291
|
readonly properties: {
|
|
292
292
|
readonly type: {
|
|
293
293
|
readonly type: "string";
|
|
@@ -767,6 +767,291 @@ declare const FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA: {
|
|
|
767
767
|
};
|
|
768
768
|
readonly required: readonly ["id", "type", "blockId", "parties"];
|
|
769
769
|
readonly additionalProperties: false;
|
|
770
|
+
}, {
|
|
771
|
+
readonly type: "object";
|
|
772
|
+
readonly description: "Insert a row next to the row containing the anchor block.";
|
|
773
|
+
readonly properties: {
|
|
774
|
+
readonly type: {
|
|
775
|
+
readonly type: "string";
|
|
776
|
+
readonly enum: readonly ["insertTableRow"];
|
|
777
|
+
};
|
|
778
|
+
readonly blockId: {
|
|
779
|
+
readonly type: "string";
|
|
780
|
+
readonly description: "Id of the target block, from a prior document read.";
|
|
781
|
+
};
|
|
782
|
+
readonly position: {
|
|
783
|
+
readonly type: "string";
|
|
784
|
+
readonly enum: readonly ["after", "before"];
|
|
785
|
+
readonly description: "Insert after the anchor row (default) or before it. Defaults to \"after\".";
|
|
786
|
+
};
|
|
787
|
+
readonly cellTexts: {
|
|
788
|
+
readonly type: "array";
|
|
789
|
+
readonly description: "Initial text for physical cells in source order; omitted cells stay empty.";
|
|
790
|
+
readonly items: {
|
|
791
|
+
readonly type: "string";
|
|
792
|
+
};
|
|
793
|
+
};
|
|
794
|
+
readonly id: {
|
|
795
|
+
readonly type: "string";
|
|
796
|
+
readonly description: string;
|
|
797
|
+
};
|
|
798
|
+
readonly severity: {
|
|
799
|
+
readonly type: "string";
|
|
800
|
+
readonly enum: readonly ["low", "medium", "high"];
|
|
801
|
+
readonly description: "Optional review severity for structured-review workflows.";
|
|
802
|
+
};
|
|
803
|
+
readonly area: {
|
|
804
|
+
readonly type: "string";
|
|
805
|
+
readonly description: "Optional review area label (e.g. \"Penalty\") for structured-review workflows.";
|
|
806
|
+
};
|
|
807
|
+
readonly precondition: {
|
|
808
|
+
readonly type: "object";
|
|
809
|
+
readonly description: string;
|
|
810
|
+
readonly properties: {
|
|
811
|
+
readonly blockTextHash: {
|
|
812
|
+
readonly type: "string";
|
|
813
|
+
readonly pattern: "^h[0-9a-z]+$";
|
|
814
|
+
readonly description: "Normalized hash of the target block's text.";
|
|
815
|
+
};
|
|
816
|
+
};
|
|
817
|
+
readonly required: readonly ["blockTextHash"];
|
|
818
|
+
readonly additionalProperties: false;
|
|
819
|
+
};
|
|
820
|
+
};
|
|
821
|
+
readonly required: readonly ["id", "type", "blockId"];
|
|
822
|
+
readonly additionalProperties: false;
|
|
823
|
+
}, {
|
|
824
|
+
readonly type: "object";
|
|
825
|
+
readonly description: "Delete the row containing the anchor block.";
|
|
826
|
+
readonly properties: {
|
|
827
|
+
readonly type: {
|
|
828
|
+
readonly type: "string";
|
|
829
|
+
readonly enum: readonly ["deleteTableRow"];
|
|
830
|
+
};
|
|
831
|
+
readonly blockId: {
|
|
832
|
+
readonly type: "string";
|
|
833
|
+
readonly description: "Id of the target block, from a prior document read.";
|
|
834
|
+
};
|
|
835
|
+
readonly id: {
|
|
836
|
+
readonly type: "string";
|
|
837
|
+
readonly description: string;
|
|
838
|
+
};
|
|
839
|
+
readonly severity: {
|
|
840
|
+
readonly type: "string";
|
|
841
|
+
readonly enum: readonly ["low", "medium", "high"];
|
|
842
|
+
readonly description: "Optional review severity for structured-review workflows.";
|
|
843
|
+
};
|
|
844
|
+
readonly area: {
|
|
845
|
+
readonly type: "string";
|
|
846
|
+
readonly description: "Optional review area label (e.g. \"Penalty\") for structured-review workflows.";
|
|
847
|
+
};
|
|
848
|
+
readonly precondition: {
|
|
849
|
+
readonly type: "object";
|
|
850
|
+
readonly description: string;
|
|
851
|
+
readonly properties: {
|
|
852
|
+
readonly blockTextHash: {
|
|
853
|
+
readonly type: "string";
|
|
854
|
+
readonly pattern: "^h[0-9a-z]+$";
|
|
855
|
+
readonly description: "Normalized hash of the target block's text.";
|
|
856
|
+
};
|
|
857
|
+
};
|
|
858
|
+
readonly required: readonly ["blockTextHash"];
|
|
859
|
+
readonly additionalProperties: false;
|
|
860
|
+
};
|
|
861
|
+
};
|
|
862
|
+
readonly required: readonly ["id", "type", "blockId"];
|
|
863
|
+
readonly additionalProperties: false;
|
|
864
|
+
}, {
|
|
865
|
+
readonly type: "object";
|
|
866
|
+
readonly description: "Insert a column next to the column containing the anchor block.";
|
|
867
|
+
readonly properties: {
|
|
868
|
+
readonly type: {
|
|
869
|
+
readonly type: "string";
|
|
870
|
+
readonly enum: readonly ["insertTableColumn"];
|
|
871
|
+
};
|
|
872
|
+
readonly blockId: {
|
|
873
|
+
readonly type: "string";
|
|
874
|
+
readonly description: "Id of the target block, from a prior document read.";
|
|
875
|
+
};
|
|
876
|
+
readonly position: {
|
|
877
|
+
readonly type: "string";
|
|
878
|
+
readonly enum: readonly ["after", "before"];
|
|
879
|
+
readonly description: "Insert after the anchor column (default) or before it. Defaults to \"after\".";
|
|
880
|
+
};
|
|
881
|
+
readonly cellTexts: {
|
|
882
|
+
readonly type: "array";
|
|
883
|
+
readonly description: "Initial text for newly created physical cells in row order.";
|
|
884
|
+
readonly items: {
|
|
885
|
+
readonly type: "string";
|
|
886
|
+
};
|
|
887
|
+
};
|
|
888
|
+
readonly id: {
|
|
889
|
+
readonly type: "string";
|
|
890
|
+
readonly description: string;
|
|
891
|
+
};
|
|
892
|
+
readonly severity: {
|
|
893
|
+
readonly type: "string";
|
|
894
|
+
readonly enum: readonly ["low", "medium", "high"];
|
|
895
|
+
readonly description: "Optional review severity for structured-review workflows.";
|
|
896
|
+
};
|
|
897
|
+
readonly area: {
|
|
898
|
+
readonly type: "string";
|
|
899
|
+
readonly description: "Optional review area label (e.g. \"Penalty\") for structured-review workflows.";
|
|
900
|
+
};
|
|
901
|
+
readonly precondition: {
|
|
902
|
+
readonly type: "object";
|
|
903
|
+
readonly description: string;
|
|
904
|
+
readonly properties: {
|
|
905
|
+
readonly blockTextHash: {
|
|
906
|
+
readonly type: "string";
|
|
907
|
+
readonly pattern: "^h[0-9a-z]+$";
|
|
908
|
+
readonly description: "Normalized hash of the target block's text.";
|
|
909
|
+
};
|
|
910
|
+
};
|
|
911
|
+
readonly required: readonly ["blockTextHash"];
|
|
912
|
+
readonly additionalProperties: false;
|
|
913
|
+
};
|
|
914
|
+
};
|
|
915
|
+
readonly required: readonly ["id", "type", "blockId"];
|
|
916
|
+
readonly additionalProperties: false;
|
|
917
|
+
}, {
|
|
918
|
+
readonly type: "object";
|
|
919
|
+
readonly description: "Delete the column containing the anchor block.";
|
|
920
|
+
readonly properties: {
|
|
921
|
+
readonly type: {
|
|
922
|
+
readonly type: "string";
|
|
923
|
+
readonly enum: readonly ["deleteTableColumn"];
|
|
924
|
+
};
|
|
925
|
+
readonly blockId: {
|
|
926
|
+
readonly type: "string";
|
|
927
|
+
readonly description: "Id of the target block, from a prior document read.";
|
|
928
|
+
};
|
|
929
|
+
readonly id: {
|
|
930
|
+
readonly type: "string";
|
|
931
|
+
readonly description: string;
|
|
932
|
+
};
|
|
933
|
+
readonly severity: {
|
|
934
|
+
readonly type: "string";
|
|
935
|
+
readonly enum: readonly ["low", "medium", "high"];
|
|
936
|
+
readonly description: "Optional review severity for structured-review workflows.";
|
|
937
|
+
};
|
|
938
|
+
readonly area: {
|
|
939
|
+
readonly type: "string";
|
|
940
|
+
readonly description: "Optional review area label (e.g. \"Penalty\") for structured-review workflows.";
|
|
941
|
+
};
|
|
942
|
+
readonly precondition: {
|
|
943
|
+
readonly type: "object";
|
|
944
|
+
readonly description: string;
|
|
945
|
+
readonly properties: {
|
|
946
|
+
readonly blockTextHash: {
|
|
947
|
+
readonly type: "string";
|
|
948
|
+
readonly pattern: "^h[0-9a-z]+$";
|
|
949
|
+
readonly description: "Normalized hash of the target block's text.";
|
|
950
|
+
};
|
|
951
|
+
};
|
|
952
|
+
readonly required: readonly ["blockTextHash"];
|
|
953
|
+
readonly additionalProperties: false;
|
|
954
|
+
};
|
|
955
|
+
};
|
|
956
|
+
readonly required: readonly ["id", "type", "blockId"];
|
|
957
|
+
readonly additionalProperties: false;
|
|
958
|
+
}, {
|
|
959
|
+
readonly type: "object";
|
|
960
|
+
readonly description: "Merge a region targeted by an opposite-cell anchor or a downward row count. Tracked mode supports vertical-only regions with empty continuation cells.";
|
|
961
|
+
readonly properties: {
|
|
962
|
+
readonly type: {
|
|
963
|
+
readonly type: "string";
|
|
964
|
+
readonly enum: readonly ["mergeTableCells"];
|
|
965
|
+
};
|
|
966
|
+
readonly blockId: {
|
|
967
|
+
readonly type: "string";
|
|
968
|
+
readonly description: "Id of the target block, from a prior document read.";
|
|
969
|
+
};
|
|
970
|
+
readonly endBlockId: {
|
|
971
|
+
readonly type: "string";
|
|
972
|
+
readonly minLength: 1;
|
|
973
|
+
readonly description: "Stable paragraph anchor inside the opposite corner cell.";
|
|
974
|
+
};
|
|
975
|
+
readonly rowCount: {
|
|
976
|
+
readonly type: "integer";
|
|
977
|
+
readonly minimum: 2;
|
|
978
|
+
readonly description: "Number of grid rows to merge downward from the anchored cell.";
|
|
979
|
+
};
|
|
980
|
+
readonly id: {
|
|
981
|
+
readonly type: "string";
|
|
982
|
+
readonly description: string;
|
|
983
|
+
};
|
|
984
|
+
readonly severity: {
|
|
985
|
+
readonly type: "string";
|
|
986
|
+
readonly enum: readonly ["low", "medium", "high"];
|
|
987
|
+
readonly description: "Optional review severity for structured-review workflows.";
|
|
988
|
+
};
|
|
989
|
+
readonly area: {
|
|
990
|
+
readonly type: "string";
|
|
991
|
+
readonly description: "Optional review area label (e.g. \"Penalty\") for structured-review workflows.";
|
|
992
|
+
};
|
|
993
|
+
readonly precondition: {
|
|
994
|
+
readonly type: "object";
|
|
995
|
+
readonly description: string;
|
|
996
|
+
readonly properties: {
|
|
997
|
+
readonly blockTextHash: {
|
|
998
|
+
readonly type: "string";
|
|
999
|
+
readonly pattern: "^h[0-9a-z]+$";
|
|
1000
|
+
readonly description: "Normalized hash of the target block's text.";
|
|
1001
|
+
};
|
|
1002
|
+
};
|
|
1003
|
+
readonly required: readonly ["blockTextHash"];
|
|
1004
|
+
readonly additionalProperties: false;
|
|
1005
|
+
};
|
|
1006
|
+
};
|
|
1007
|
+
readonly required: readonly ["id", "type", "blockId"];
|
|
1008
|
+
readonly oneOf: readonly [{
|
|
1009
|
+
readonly required: readonly ["endBlockId"];
|
|
1010
|
+
}, {
|
|
1011
|
+
readonly required: readonly ["rowCount"];
|
|
1012
|
+
}];
|
|
1013
|
+
readonly additionalProperties: false;
|
|
1014
|
+
}, {
|
|
1015
|
+
readonly type: "object";
|
|
1016
|
+
readonly description: "Split one spanned table cell into individual cells. Tracked mode supports vertical-only spans.";
|
|
1017
|
+
readonly properties: {
|
|
1018
|
+
readonly type: {
|
|
1019
|
+
readonly type: "string";
|
|
1020
|
+
readonly enum: readonly ["splitTableCell"];
|
|
1021
|
+
};
|
|
1022
|
+
readonly blockId: {
|
|
1023
|
+
readonly type: "string";
|
|
1024
|
+
readonly description: "Id of the target block, from a prior document read.";
|
|
1025
|
+
};
|
|
1026
|
+
readonly id: {
|
|
1027
|
+
readonly type: "string";
|
|
1028
|
+
readonly description: string;
|
|
1029
|
+
};
|
|
1030
|
+
readonly severity: {
|
|
1031
|
+
readonly type: "string";
|
|
1032
|
+
readonly enum: readonly ["low", "medium", "high"];
|
|
1033
|
+
readonly description: "Optional review severity for structured-review workflows.";
|
|
1034
|
+
};
|
|
1035
|
+
readonly area: {
|
|
1036
|
+
readonly type: "string";
|
|
1037
|
+
readonly description: "Optional review area label (e.g. \"Penalty\") for structured-review workflows.";
|
|
1038
|
+
};
|
|
1039
|
+
readonly precondition: {
|
|
1040
|
+
readonly type: "object";
|
|
1041
|
+
readonly description: string;
|
|
1042
|
+
readonly properties: {
|
|
1043
|
+
readonly blockTextHash: {
|
|
1044
|
+
readonly type: "string";
|
|
1045
|
+
readonly pattern: "^h[0-9a-z]+$";
|
|
1046
|
+
readonly description: "Normalized hash of the target block's text.";
|
|
1047
|
+
};
|
|
1048
|
+
};
|
|
1049
|
+
readonly required: readonly ["blockTextHash"];
|
|
1050
|
+
readonly additionalProperties: false;
|
|
1051
|
+
};
|
|
1052
|
+
};
|
|
1053
|
+
readonly required: readonly ["id", "type", "blockId"];
|
|
1054
|
+
readonly additionalProperties: false;
|
|
770
1055
|
}];
|
|
771
1056
|
};
|
|
772
1057
|
/**
|
|
@@ -1024,7 +1309,7 @@ declare const FOLIO_DOCUMENT_OPERATION_BATCH_JSON_SCHEMA: {
|
|
|
1024
1309
|
readonly additionalProperties: false;
|
|
1025
1310
|
}, {
|
|
1026
1311
|
readonly type: "object";
|
|
1027
|
-
readonly description:
|
|
1312
|
+
readonly description: "Apply inline formatting to the text covered by a range handle in direct or tracked mode.";
|
|
1028
1313
|
readonly properties: {
|
|
1029
1314
|
readonly type: {
|
|
1030
1315
|
readonly type: "string";
|
|
@@ -1504,6 +1789,291 @@ declare const FOLIO_DOCUMENT_OPERATION_BATCH_JSON_SCHEMA: {
|
|
|
1504
1789
|
};
|
|
1505
1790
|
readonly required: readonly ["id", "type", "blockId", "parties"];
|
|
1506
1791
|
readonly additionalProperties: false;
|
|
1792
|
+
}, {
|
|
1793
|
+
readonly type: "object";
|
|
1794
|
+
readonly description: "Insert a row next to the row containing the anchor block.";
|
|
1795
|
+
readonly properties: {
|
|
1796
|
+
readonly type: {
|
|
1797
|
+
readonly type: "string";
|
|
1798
|
+
readonly enum: readonly ["insertTableRow"];
|
|
1799
|
+
};
|
|
1800
|
+
readonly blockId: {
|
|
1801
|
+
readonly type: "string";
|
|
1802
|
+
readonly description: "Id of the target block, from a prior document read.";
|
|
1803
|
+
};
|
|
1804
|
+
readonly position: {
|
|
1805
|
+
readonly type: "string";
|
|
1806
|
+
readonly enum: readonly ["after", "before"];
|
|
1807
|
+
readonly description: "Insert after the anchor row (default) or before it. Defaults to \"after\".";
|
|
1808
|
+
};
|
|
1809
|
+
readonly cellTexts: {
|
|
1810
|
+
readonly type: "array";
|
|
1811
|
+
readonly description: "Initial text for physical cells in source order; omitted cells stay empty.";
|
|
1812
|
+
readonly items: {
|
|
1813
|
+
readonly type: "string";
|
|
1814
|
+
};
|
|
1815
|
+
};
|
|
1816
|
+
readonly id: {
|
|
1817
|
+
readonly type: "string";
|
|
1818
|
+
readonly description: string;
|
|
1819
|
+
};
|
|
1820
|
+
readonly severity: {
|
|
1821
|
+
readonly type: "string";
|
|
1822
|
+
readonly enum: readonly ["low", "medium", "high"];
|
|
1823
|
+
readonly description: "Optional review severity for structured-review workflows.";
|
|
1824
|
+
};
|
|
1825
|
+
readonly area: {
|
|
1826
|
+
readonly type: "string";
|
|
1827
|
+
readonly description: "Optional review area label (e.g. \"Penalty\") for structured-review workflows.";
|
|
1828
|
+
};
|
|
1829
|
+
readonly precondition: {
|
|
1830
|
+
readonly type: "object";
|
|
1831
|
+
readonly description: string;
|
|
1832
|
+
readonly properties: {
|
|
1833
|
+
readonly blockTextHash: {
|
|
1834
|
+
readonly type: "string";
|
|
1835
|
+
readonly pattern: "^h[0-9a-z]+$";
|
|
1836
|
+
readonly description: "Normalized hash of the target block's text.";
|
|
1837
|
+
};
|
|
1838
|
+
};
|
|
1839
|
+
readonly required: readonly ["blockTextHash"];
|
|
1840
|
+
readonly additionalProperties: false;
|
|
1841
|
+
};
|
|
1842
|
+
};
|
|
1843
|
+
readonly required: readonly ["id", "type", "blockId"];
|
|
1844
|
+
readonly additionalProperties: false;
|
|
1845
|
+
}, {
|
|
1846
|
+
readonly type: "object";
|
|
1847
|
+
readonly description: "Delete the row containing the anchor block.";
|
|
1848
|
+
readonly properties: {
|
|
1849
|
+
readonly type: {
|
|
1850
|
+
readonly type: "string";
|
|
1851
|
+
readonly enum: readonly ["deleteTableRow"];
|
|
1852
|
+
};
|
|
1853
|
+
readonly blockId: {
|
|
1854
|
+
readonly type: "string";
|
|
1855
|
+
readonly description: "Id of the target block, from a prior document read.";
|
|
1856
|
+
};
|
|
1857
|
+
readonly id: {
|
|
1858
|
+
readonly type: "string";
|
|
1859
|
+
readonly description: string;
|
|
1860
|
+
};
|
|
1861
|
+
readonly severity: {
|
|
1862
|
+
readonly type: "string";
|
|
1863
|
+
readonly enum: readonly ["low", "medium", "high"];
|
|
1864
|
+
readonly description: "Optional review severity for structured-review workflows.";
|
|
1865
|
+
};
|
|
1866
|
+
readonly area: {
|
|
1867
|
+
readonly type: "string";
|
|
1868
|
+
readonly description: "Optional review area label (e.g. \"Penalty\") for structured-review workflows.";
|
|
1869
|
+
};
|
|
1870
|
+
readonly precondition: {
|
|
1871
|
+
readonly type: "object";
|
|
1872
|
+
readonly description: string;
|
|
1873
|
+
readonly properties: {
|
|
1874
|
+
readonly blockTextHash: {
|
|
1875
|
+
readonly type: "string";
|
|
1876
|
+
readonly pattern: "^h[0-9a-z]+$";
|
|
1877
|
+
readonly description: "Normalized hash of the target block's text.";
|
|
1878
|
+
};
|
|
1879
|
+
};
|
|
1880
|
+
readonly required: readonly ["blockTextHash"];
|
|
1881
|
+
readonly additionalProperties: false;
|
|
1882
|
+
};
|
|
1883
|
+
};
|
|
1884
|
+
readonly required: readonly ["id", "type", "blockId"];
|
|
1885
|
+
readonly additionalProperties: false;
|
|
1886
|
+
}, {
|
|
1887
|
+
readonly type: "object";
|
|
1888
|
+
readonly description: "Insert a column next to the column containing the anchor block.";
|
|
1889
|
+
readonly properties: {
|
|
1890
|
+
readonly type: {
|
|
1891
|
+
readonly type: "string";
|
|
1892
|
+
readonly enum: readonly ["insertTableColumn"];
|
|
1893
|
+
};
|
|
1894
|
+
readonly blockId: {
|
|
1895
|
+
readonly type: "string";
|
|
1896
|
+
readonly description: "Id of the target block, from a prior document read.";
|
|
1897
|
+
};
|
|
1898
|
+
readonly position: {
|
|
1899
|
+
readonly type: "string";
|
|
1900
|
+
readonly enum: readonly ["after", "before"];
|
|
1901
|
+
readonly description: "Insert after the anchor column (default) or before it. Defaults to \"after\".";
|
|
1902
|
+
};
|
|
1903
|
+
readonly cellTexts: {
|
|
1904
|
+
readonly type: "array";
|
|
1905
|
+
readonly description: "Initial text for newly created physical cells in row order.";
|
|
1906
|
+
readonly items: {
|
|
1907
|
+
readonly type: "string";
|
|
1908
|
+
};
|
|
1909
|
+
};
|
|
1910
|
+
readonly id: {
|
|
1911
|
+
readonly type: "string";
|
|
1912
|
+
readonly description: string;
|
|
1913
|
+
};
|
|
1914
|
+
readonly severity: {
|
|
1915
|
+
readonly type: "string";
|
|
1916
|
+
readonly enum: readonly ["low", "medium", "high"];
|
|
1917
|
+
readonly description: "Optional review severity for structured-review workflows.";
|
|
1918
|
+
};
|
|
1919
|
+
readonly area: {
|
|
1920
|
+
readonly type: "string";
|
|
1921
|
+
readonly description: "Optional review area label (e.g. \"Penalty\") for structured-review workflows.";
|
|
1922
|
+
};
|
|
1923
|
+
readonly precondition: {
|
|
1924
|
+
readonly type: "object";
|
|
1925
|
+
readonly description: string;
|
|
1926
|
+
readonly properties: {
|
|
1927
|
+
readonly blockTextHash: {
|
|
1928
|
+
readonly type: "string";
|
|
1929
|
+
readonly pattern: "^h[0-9a-z]+$";
|
|
1930
|
+
readonly description: "Normalized hash of the target block's text.";
|
|
1931
|
+
};
|
|
1932
|
+
};
|
|
1933
|
+
readonly required: readonly ["blockTextHash"];
|
|
1934
|
+
readonly additionalProperties: false;
|
|
1935
|
+
};
|
|
1936
|
+
};
|
|
1937
|
+
readonly required: readonly ["id", "type", "blockId"];
|
|
1938
|
+
readonly additionalProperties: false;
|
|
1939
|
+
}, {
|
|
1940
|
+
readonly type: "object";
|
|
1941
|
+
readonly description: "Delete the column containing the anchor block.";
|
|
1942
|
+
readonly properties: {
|
|
1943
|
+
readonly type: {
|
|
1944
|
+
readonly type: "string";
|
|
1945
|
+
readonly enum: readonly ["deleteTableColumn"];
|
|
1946
|
+
};
|
|
1947
|
+
readonly blockId: {
|
|
1948
|
+
readonly type: "string";
|
|
1949
|
+
readonly description: "Id of the target block, from a prior document read.";
|
|
1950
|
+
};
|
|
1951
|
+
readonly id: {
|
|
1952
|
+
readonly type: "string";
|
|
1953
|
+
readonly description: string;
|
|
1954
|
+
};
|
|
1955
|
+
readonly severity: {
|
|
1956
|
+
readonly type: "string";
|
|
1957
|
+
readonly enum: readonly ["low", "medium", "high"];
|
|
1958
|
+
readonly description: "Optional review severity for structured-review workflows.";
|
|
1959
|
+
};
|
|
1960
|
+
readonly area: {
|
|
1961
|
+
readonly type: "string";
|
|
1962
|
+
readonly description: "Optional review area label (e.g. \"Penalty\") for structured-review workflows.";
|
|
1963
|
+
};
|
|
1964
|
+
readonly precondition: {
|
|
1965
|
+
readonly type: "object";
|
|
1966
|
+
readonly description: string;
|
|
1967
|
+
readonly properties: {
|
|
1968
|
+
readonly blockTextHash: {
|
|
1969
|
+
readonly type: "string";
|
|
1970
|
+
readonly pattern: "^h[0-9a-z]+$";
|
|
1971
|
+
readonly description: "Normalized hash of the target block's text.";
|
|
1972
|
+
};
|
|
1973
|
+
};
|
|
1974
|
+
readonly required: readonly ["blockTextHash"];
|
|
1975
|
+
readonly additionalProperties: false;
|
|
1976
|
+
};
|
|
1977
|
+
};
|
|
1978
|
+
readonly required: readonly ["id", "type", "blockId"];
|
|
1979
|
+
readonly additionalProperties: false;
|
|
1980
|
+
}, {
|
|
1981
|
+
readonly type: "object";
|
|
1982
|
+
readonly description: "Merge a region targeted by an opposite-cell anchor or a downward row count. Tracked mode supports vertical-only regions with empty continuation cells.";
|
|
1983
|
+
readonly properties: {
|
|
1984
|
+
readonly type: {
|
|
1985
|
+
readonly type: "string";
|
|
1986
|
+
readonly enum: readonly ["mergeTableCells"];
|
|
1987
|
+
};
|
|
1988
|
+
readonly blockId: {
|
|
1989
|
+
readonly type: "string";
|
|
1990
|
+
readonly description: "Id of the target block, from a prior document read.";
|
|
1991
|
+
};
|
|
1992
|
+
readonly endBlockId: {
|
|
1993
|
+
readonly type: "string";
|
|
1994
|
+
readonly minLength: 1;
|
|
1995
|
+
readonly description: "Stable paragraph anchor inside the opposite corner cell.";
|
|
1996
|
+
};
|
|
1997
|
+
readonly rowCount: {
|
|
1998
|
+
readonly type: "integer";
|
|
1999
|
+
readonly minimum: 2;
|
|
2000
|
+
readonly description: "Number of grid rows to merge downward from the anchored cell.";
|
|
2001
|
+
};
|
|
2002
|
+
readonly id: {
|
|
2003
|
+
readonly type: "string";
|
|
2004
|
+
readonly description: string;
|
|
2005
|
+
};
|
|
2006
|
+
readonly severity: {
|
|
2007
|
+
readonly type: "string";
|
|
2008
|
+
readonly enum: readonly ["low", "medium", "high"];
|
|
2009
|
+
readonly description: "Optional review severity for structured-review workflows.";
|
|
2010
|
+
};
|
|
2011
|
+
readonly area: {
|
|
2012
|
+
readonly type: "string";
|
|
2013
|
+
readonly description: "Optional review area label (e.g. \"Penalty\") for structured-review workflows.";
|
|
2014
|
+
};
|
|
2015
|
+
readonly precondition: {
|
|
2016
|
+
readonly type: "object";
|
|
2017
|
+
readonly description: string;
|
|
2018
|
+
readonly properties: {
|
|
2019
|
+
readonly blockTextHash: {
|
|
2020
|
+
readonly type: "string";
|
|
2021
|
+
readonly pattern: "^h[0-9a-z]+$";
|
|
2022
|
+
readonly description: "Normalized hash of the target block's text.";
|
|
2023
|
+
};
|
|
2024
|
+
};
|
|
2025
|
+
readonly required: readonly ["blockTextHash"];
|
|
2026
|
+
readonly additionalProperties: false;
|
|
2027
|
+
};
|
|
2028
|
+
};
|
|
2029
|
+
readonly required: readonly ["id", "type", "blockId"];
|
|
2030
|
+
readonly oneOf: readonly [{
|
|
2031
|
+
readonly required: readonly ["endBlockId"];
|
|
2032
|
+
}, {
|
|
2033
|
+
readonly required: readonly ["rowCount"];
|
|
2034
|
+
}];
|
|
2035
|
+
readonly additionalProperties: false;
|
|
2036
|
+
}, {
|
|
2037
|
+
readonly type: "object";
|
|
2038
|
+
readonly description: "Split one spanned table cell into individual cells. Tracked mode supports vertical-only spans.";
|
|
2039
|
+
readonly properties: {
|
|
2040
|
+
readonly type: {
|
|
2041
|
+
readonly type: "string";
|
|
2042
|
+
readonly enum: readonly ["splitTableCell"];
|
|
2043
|
+
};
|
|
2044
|
+
readonly blockId: {
|
|
2045
|
+
readonly type: "string";
|
|
2046
|
+
readonly description: "Id of the target block, from a prior document read.";
|
|
2047
|
+
};
|
|
2048
|
+
readonly id: {
|
|
2049
|
+
readonly type: "string";
|
|
2050
|
+
readonly description: string;
|
|
2051
|
+
};
|
|
2052
|
+
readonly severity: {
|
|
2053
|
+
readonly type: "string";
|
|
2054
|
+
readonly enum: readonly ["low", "medium", "high"];
|
|
2055
|
+
readonly description: "Optional review severity for structured-review workflows.";
|
|
2056
|
+
};
|
|
2057
|
+
readonly area: {
|
|
2058
|
+
readonly type: "string";
|
|
2059
|
+
readonly description: "Optional review area label (e.g. \"Penalty\") for structured-review workflows.";
|
|
2060
|
+
};
|
|
2061
|
+
readonly precondition: {
|
|
2062
|
+
readonly type: "object";
|
|
2063
|
+
readonly description: string;
|
|
2064
|
+
readonly properties: {
|
|
2065
|
+
readonly blockTextHash: {
|
|
2066
|
+
readonly type: "string";
|
|
2067
|
+
readonly pattern: "^h[0-9a-z]+$";
|
|
2068
|
+
readonly description: "Normalized hash of the target block's text.";
|
|
2069
|
+
};
|
|
2070
|
+
};
|
|
2071
|
+
readonly required: readonly ["blockTextHash"];
|
|
2072
|
+
readonly additionalProperties: false;
|
|
2073
|
+
};
|
|
2074
|
+
};
|
|
2075
|
+
readonly required: readonly ["id", "type", "blockId"];
|
|
2076
|
+
readonly additionalProperties: false;
|
|
1507
2077
|
}];
|
|
1508
2078
|
};
|
|
1509
2079
|
};
|
package/dist/operation-schema.js
CHANGED
|
@@ -120,7 +120,7 @@ const blockIdProperty = {
|
|
|
120
120
|
};
|
|
121
121
|
/**
|
|
122
122
|
* JSON Schema (draft-07 compatible) for ONE document operation: the full
|
|
123
|
-
*
|
|
123
|
+
* thirteen-variant union accepted by `parseFolioDocumentOperationBatch` in
|
|
124
124
|
* `@stll/folio-core`, one `oneOf` variant per entry in
|
|
125
125
|
* `FOLIO_DOCUMENT_OPERATION_TYPES`. Intended for LLM tool definitions and
|
|
126
126
|
* other consumers that need the contract's wire shape without re-declaring
|
|
@@ -205,7 +205,7 @@ const FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA = {
|
|
|
205
205
|
},
|
|
206
206
|
{
|
|
207
207
|
type: "object",
|
|
208
|
-
description: "Apply inline formatting to the text covered by a range handle
|
|
208
|
+
description: "Apply inline formatting to the text covered by a range handle in direct or tracked mode.",
|
|
209
209
|
properties: {
|
|
210
210
|
...operationMetaProperties,
|
|
211
211
|
type: {
|
|
@@ -427,6 +427,145 @@ const FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA = {
|
|
|
427
427
|
"parties"
|
|
428
428
|
],
|
|
429
429
|
additionalProperties: false
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
type: "object",
|
|
433
|
+
description: "Insert a row next to the row containing the anchor block.",
|
|
434
|
+
properties: {
|
|
435
|
+
...operationMetaProperties,
|
|
436
|
+
type: {
|
|
437
|
+
type: "string",
|
|
438
|
+
enum: ["insertTableRow"]
|
|
439
|
+
},
|
|
440
|
+
blockId: blockIdProperty,
|
|
441
|
+
position: {
|
|
442
|
+
type: "string",
|
|
443
|
+
enum: ["after", "before"],
|
|
444
|
+
description: "Insert after the anchor row (default) or before it. Defaults to \"after\"."
|
|
445
|
+
},
|
|
446
|
+
cellTexts: {
|
|
447
|
+
type: "array",
|
|
448
|
+
description: "Initial text for physical cells in source order; omitted cells stay empty.",
|
|
449
|
+
items: { type: "string" }
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
required: [
|
|
453
|
+
"id",
|
|
454
|
+
"type",
|
|
455
|
+
"blockId"
|
|
456
|
+
],
|
|
457
|
+
additionalProperties: false
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
type: "object",
|
|
461
|
+
description: "Delete the row containing the anchor block.",
|
|
462
|
+
properties: {
|
|
463
|
+
...operationMetaProperties,
|
|
464
|
+
type: {
|
|
465
|
+
type: "string",
|
|
466
|
+
enum: ["deleteTableRow"]
|
|
467
|
+
},
|
|
468
|
+
blockId: blockIdProperty
|
|
469
|
+
},
|
|
470
|
+
required: [
|
|
471
|
+
"id",
|
|
472
|
+
"type",
|
|
473
|
+
"blockId"
|
|
474
|
+
],
|
|
475
|
+
additionalProperties: false
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
type: "object",
|
|
479
|
+
description: "Insert a column next to the column containing the anchor block.",
|
|
480
|
+
properties: {
|
|
481
|
+
...operationMetaProperties,
|
|
482
|
+
type: {
|
|
483
|
+
type: "string",
|
|
484
|
+
enum: ["insertTableColumn"]
|
|
485
|
+
},
|
|
486
|
+
blockId: blockIdProperty,
|
|
487
|
+
position: {
|
|
488
|
+
type: "string",
|
|
489
|
+
enum: ["after", "before"],
|
|
490
|
+
description: "Insert after the anchor column (default) or before it. Defaults to \"after\"."
|
|
491
|
+
},
|
|
492
|
+
cellTexts: {
|
|
493
|
+
type: "array",
|
|
494
|
+
description: "Initial text for newly created physical cells in row order.",
|
|
495
|
+
items: { type: "string" }
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
required: [
|
|
499
|
+
"id",
|
|
500
|
+
"type",
|
|
501
|
+
"blockId"
|
|
502
|
+
],
|
|
503
|
+
additionalProperties: false
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
type: "object",
|
|
507
|
+
description: "Delete the column containing the anchor block.",
|
|
508
|
+
properties: {
|
|
509
|
+
...operationMetaProperties,
|
|
510
|
+
type: {
|
|
511
|
+
type: "string",
|
|
512
|
+
enum: ["deleteTableColumn"]
|
|
513
|
+
},
|
|
514
|
+
blockId: blockIdProperty
|
|
515
|
+
},
|
|
516
|
+
required: [
|
|
517
|
+
"id",
|
|
518
|
+
"type",
|
|
519
|
+
"blockId"
|
|
520
|
+
],
|
|
521
|
+
additionalProperties: false
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
type: "object",
|
|
525
|
+
description: "Merge a region targeted by an opposite-cell anchor or a downward row count. Tracked mode supports vertical-only regions with empty continuation cells.",
|
|
526
|
+
properties: {
|
|
527
|
+
...operationMetaProperties,
|
|
528
|
+
type: {
|
|
529
|
+
type: "string",
|
|
530
|
+
enum: ["mergeTableCells"]
|
|
531
|
+
},
|
|
532
|
+
blockId: blockIdProperty,
|
|
533
|
+
endBlockId: {
|
|
534
|
+
type: "string",
|
|
535
|
+
minLength: 1,
|
|
536
|
+
description: "Stable paragraph anchor inside the opposite corner cell."
|
|
537
|
+
},
|
|
538
|
+
rowCount: {
|
|
539
|
+
type: "integer",
|
|
540
|
+
minimum: 2,
|
|
541
|
+
description: "Number of grid rows to merge downward from the anchored cell."
|
|
542
|
+
}
|
|
543
|
+
},
|
|
544
|
+
required: [
|
|
545
|
+
"id",
|
|
546
|
+
"type",
|
|
547
|
+
"blockId"
|
|
548
|
+
],
|
|
549
|
+
oneOf: [{ required: ["endBlockId"] }, { required: ["rowCount"] }],
|
|
550
|
+
additionalProperties: false
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
type: "object",
|
|
554
|
+
description: "Split one spanned table cell into individual cells. Tracked mode supports vertical-only spans.",
|
|
555
|
+
properties: {
|
|
556
|
+
...operationMetaProperties,
|
|
557
|
+
type: {
|
|
558
|
+
type: "string",
|
|
559
|
+
enum: ["splitTableCell"]
|
|
560
|
+
},
|
|
561
|
+
blockId: blockIdProperty
|
|
562
|
+
},
|
|
563
|
+
required: [
|
|
564
|
+
"id",
|
|
565
|
+
"type",
|
|
566
|
+
"blockId"
|
|
567
|
+
],
|
|
568
|
+
additionalProperties: false
|
|
430
569
|
}
|
|
431
570
|
]
|
|
432
571
|
};
|
|
@@ -455,7 +594,7 @@ const FOLIO_DOCUMENT_OPERATION_BATCH_JSON_SCHEMA = {
|
|
|
455
594
|
mode: {
|
|
456
595
|
type: "string",
|
|
457
596
|
enum: FOLIO_DOCUMENT_OPERATION_MODES,
|
|
458
|
-
description: "How edits land: \"tracked-changes\" (default) proposes revisions for human review, \"direct\" applies immediately. `
|
|
597
|
+
description: "How edits land: \"tracked-changes\" (default) proposes revisions for human review, \"direct\" applies immediately. `insertSignatureTable` supports \"direct\" only. Tracked cell merge and split operations support unambiguous vertical-only topology."
|
|
459
598
|
},
|
|
460
599
|
atomic: {
|
|
461
600
|
type: "boolean",
|
package/dist/parse.js
CHANGED
|
@@ -11,6 +11,7 @@ const isNonEmptyString = (value) => typeof value === "string" && value.length >
|
|
|
11
11
|
*/
|
|
12
12
|
const MAX_OPERATIONS_PER_CALL = 50;
|
|
13
13
|
const MAX_OPERATION_TEXT_LENGTH = 1e5;
|
|
14
|
+
const MAX_TABLE_INSERTION_CELL_TEXTS = 256;
|
|
14
15
|
/** Plain-language error for a string argument over {@link MAX_OPERATION_TEXT_LENGTH}. */
|
|
15
16
|
const explainTextTooLong = (label, length) => `${label} is ${length.toLocaleString()} characters, over the ${MAX_OPERATION_TEXT_LENGTH.toLocaleString()}-character limit; shorten it or split it into multiple operations.`;
|
|
16
17
|
/**
|
|
@@ -57,8 +58,8 @@ const parseAddCommentInput = (args) => {
|
|
|
57
58
|
}
|
|
58
59
|
};
|
|
59
60
|
};
|
|
60
|
-
const OPERATION_TYPES = "replaceInBlock, replaceRange, commentOnRange, insertAfterBlock, insertBeforeBlock, replaceBlock, deleteBlock";
|
|
61
|
-
const isOperationType = (value) => value === "replaceInBlock" || value === "replaceRange" || value === "commentOnRange" || value === "insertAfterBlock" || value === "insertBeforeBlock" || value === "replaceBlock" || value === "deleteBlock";
|
|
61
|
+
const OPERATION_TYPES = "replaceInBlock, replaceRange, commentOnRange, formatRange, insertAfterBlock, insertBeforeBlock, replaceBlock, deleteBlock, insertTableRow, deleteTableRow, insertTableColumn, deleteTableColumn, mergeTableCells, splitTableCell";
|
|
62
|
+
const isOperationType = (value) => value === "replaceInBlock" || value === "replaceRange" || value === "commentOnRange" || value === "formatRange" || value === "insertAfterBlock" || value === "insertBeforeBlock" || value === "replaceBlock" || value === "deleteBlock" || value === "insertTableRow" || value === "deleteTableRow" || value === "insertTableColumn" || value === "deleteTableColumn" || value === "mergeTableCells" || value === "splitTableCell";
|
|
62
63
|
const readTextRange = (value, index) => {
|
|
63
64
|
const path = `operations[${index}].range`;
|
|
64
65
|
if (!isPlainObject(value)) return `${path} must be an object copied from find_text.`;
|
|
@@ -95,7 +96,7 @@ const buildSuggestedOperation = (raw, index) => {
|
|
|
95
96
|
if (typeof comment === "string" && comment.length > 1e5) return explainTextTooLong(`operations[${index}].comment`, comment.length);
|
|
96
97
|
const opId = isNonEmptyString(id) ? id : `op-${index + 1}`;
|
|
97
98
|
const commentField = typeof comment === "string" ? { comment: { text: comment } } : {};
|
|
98
|
-
if (type === "replaceRange" || type === "commentOnRange") {
|
|
99
|
+
if (type === "replaceRange" || type === "commentOnRange" || type === "formatRange") {
|
|
99
100
|
const range = readTextRange(raw["range"], index);
|
|
100
101
|
if (typeof range === "string") return range;
|
|
101
102
|
if (type === "commentOnRange") {
|
|
@@ -107,6 +108,28 @@ const buildSuggestedOperation = (raw, index) => {
|
|
|
107
108
|
comment: { text: comment }
|
|
108
109
|
};
|
|
109
110
|
}
|
|
111
|
+
if (type === "formatRange") {
|
|
112
|
+
const rawFormatting = raw["formatting"];
|
|
113
|
+
if (!isPlainObject(rawFormatting)) return `operations[${index}] (formatRange) requires a \`formatting\` object.`;
|
|
114
|
+
const formatting = {};
|
|
115
|
+
for (const key of [
|
|
116
|
+
"bold",
|
|
117
|
+
"italic",
|
|
118
|
+
"underline"
|
|
119
|
+
]) {
|
|
120
|
+
const value = rawFormatting[key];
|
|
121
|
+
if (value === void 0) continue;
|
|
122
|
+
if (typeof value !== "boolean") return `operations[${index}].formatting.${key} must be a boolean when provided.`;
|
|
123
|
+
formatting[key] = value;
|
|
124
|
+
}
|
|
125
|
+
if (Object.keys(formatting).length === 0) return `operations[${index}] (formatRange) requires at least one formatting property.`;
|
|
126
|
+
return {
|
|
127
|
+
id: opId,
|
|
128
|
+
type,
|
|
129
|
+
range,
|
|
130
|
+
formatting
|
|
131
|
+
};
|
|
132
|
+
}
|
|
110
133
|
const replace = raw["replace"];
|
|
111
134
|
if (typeof replace !== "string") return `operations[${index}] (replaceRange) requires a string \`replace\`.`;
|
|
112
135
|
if (replace.length > 1e5) return explainTextTooLong(`operations[${index}] (replaceRange) \`replace\``, replace.length);
|
|
@@ -119,6 +142,48 @@ const buildSuggestedOperation = (raw, index) => {
|
|
|
119
142
|
};
|
|
120
143
|
}
|
|
121
144
|
if (!isNonEmptyString(blockId)) return `operations[${index}].blockId must be a non-empty string.`;
|
|
145
|
+
if (type === "insertTableRow" || type === "insertTableColumn") {
|
|
146
|
+
const position = raw["position"];
|
|
147
|
+
if (position !== void 0 && position !== "after" && position !== "before") return `operations[${index}] (${type}) \`position\` must be "after" or "before" when provided.`;
|
|
148
|
+
const rawCellTexts = raw["cellTexts"];
|
|
149
|
+
if (rawCellTexts !== void 0 && !Array.isArray(rawCellTexts)) return `operations[${index}] (${type}) \`cellTexts\` must be an array of strings when provided.`;
|
|
150
|
+
if (rawCellTexts !== void 0 && rawCellTexts.length > MAX_TABLE_INSERTION_CELL_TEXTS) return `operations[${index}] (${type}) \`cellTexts\` has ${rawCellTexts.length.toLocaleString()} entries, over the ${MAX_TABLE_INSERTION_CELL_TEXTS.toLocaleString()}-cell limit.`;
|
|
151
|
+
const cellTexts = [];
|
|
152
|
+
for (const [cellIndex, cellText] of (rawCellTexts ?? []).entries()) {
|
|
153
|
+
if (typeof cellText !== "string") return `operations[${index}] (${type}) \`cellTexts[${cellIndex}]\` must be a string.`;
|
|
154
|
+
if (cellText.length > 1e5) return explainTextTooLong(`operations[${index}] (${type}) \`cellTexts[${cellIndex}]\``, cellText.length);
|
|
155
|
+
cellTexts.push(cellText);
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
id: opId,
|
|
159
|
+
type,
|
|
160
|
+
blockId,
|
|
161
|
+
...position !== void 0 && { position },
|
|
162
|
+
...rawCellTexts !== void 0 && { cellTexts }
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
if (type === "deleteTableRow" || type === "deleteTableColumn" || type === "splitTableCell") return {
|
|
166
|
+
id: opId,
|
|
167
|
+
type,
|
|
168
|
+
blockId
|
|
169
|
+
};
|
|
170
|
+
if (type === "mergeTableCells") {
|
|
171
|
+
const endBlockId = raw["endBlockId"];
|
|
172
|
+
const rowCount = raw["rowCount"];
|
|
173
|
+
if (isNonEmptyString(endBlockId) && rowCount === void 0) return {
|
|
174
|
+
id: opId,
|
|
175
|
+
type,
|
|
176
|
+
blockId,
|
|
177
|
+
endBlockId
|
|
178
|
+
};
|
|
179
|
+
if (endBlockId === void 0 && typeof rowCount === "number" && Number.isInteger(rowCount) && rowCount >= 2) return {
|
|
180
|
+
id: opId,
|
|
181
|
+
type,
|
|
182
|
+
blockId,
|
|
183
|
+
rowCount
|
|
184
|
+
};
|
|
185
|
+
return `operations[${index}] (mergeTableCells) requires exactly one non-empty \`endBlockId\` or integer \`rowCount\` of at least 2.`;
|
|
186
|
+
}
|
|
122
187
|
if (type === "replaceInBlock") {
|
|
123
188
|
const find = raw["find"];
|
|
124
189
|
const replace = raw["replace"];
|
package/dist/tools.js
CHANGED
|
@@ -83,23 +83,18 @@ const scopedHandleSchema = {
|
|
|
83
83
|
/**
|
|
84
84
|
* `suggest_changes` deliberately narrows the full document-operation contract
|
|
85
85
|
* (see `FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA` in `operation-schema.ts`):
|
|
86
|
-
* - excluded types: `
|
|
87
|
-
*
|
|
88
|
-
* `commentOnBlock` (covered by the dedicated `add_comment` tool);
|
|
86
|
+
* - excluded types: `insertSignatureTable` (direct-only) and `commentOnBlock`
|
|
87
|
+
* (covered by the dedicated `add_comment` tool);
|
|
89
88
|
* - `id` is optional here (auto-generated `op-1`, `op-2`, … by `parse.ts`)
|
|
90
89
|
* where the contract requires it;
|
|
91
90
|
* - `comment` is a plain string here; `parse.ts` wraps it into the contract's
|
|
92
91
|
* `{ text }` object;
|
|
93
92
|
* - the review metadata (`severity`, `area`), `precondition` guard, and the
|
|
94
93
|
* insert/replace formatting knobs (`inheritFormatting`, `pageBreakBefore`,
|
|
95
|
-
* `preserveFormatting`, `styleId`, `
|
|
96
|
-
* `formatting`) are not exposed to the model.
|
|
94
|
+
* `preserveFormatting`, `styleId`, `parties`, `quote`,
|
|
95
|
+
* except `formatting`) are not exposed to the model.
|
|
97
96
|
*/
|
|
98
|
-
const SUGGEST_CHANGES_EXCLUDED_OPERATION_TYPES = /* @__PURE__ */ new Set([
|
|
99
|
-
"formatRange",
|
|
100
|
-
"commentOnBlock",
|
|
101
|
-
"insertSignatureTable"
|
|
102
|
-
]);
|
|
97
|
+
const SUGGEST_CHANGES_EXCLUDED_OPERATION_TYPES = /* @__PURE__ */ new Set(["commentOnBlock", "insertSignatureTable"]);
|
|
103
98
|
/**
|
|
104
99
|
* The contract operation types `suggest_changes` exposes to the model,
|
|
105
100
|
* derived from the shared contract constant minus the exclusions above.
|
|
@@ -124,9 +119,19 @@ const suggestChangesOperationSchema = {
|
|
|
124
119
|
type: "string",
|
|
125
120
|
description: "The block to edit, from `read_document` or `find_text`."
|
|
126
121
|
},
|
|
122
|
+
endBlockId: {
|
|
123
|
+
type: "string",
|
|
124
|
+
minLength: 1,
|
|
125
|
+
description: "For cell merging, a block in the opposite corner cell."
|
|
126
|
+
},
|
|
127
|
+
rowCount: {
|
|
128
|
+
type: "integer",
|
|
129
|
+
minimum: 2,
|
|
130
|
+
description: "For vertical cell merging, the number of grid rows to merge downward."
|
|
131
|
+
},
|
|
127
132
|
range: {
|
|
128
133
|
...FOLIO_TEXT_RANGE_JSON_SCHEMA,
|
|
129
|
-
description: "Required for `replaceRange` and `
|
|
134
|
+
description: "Required for `replaceRange`, `commentOnRange`, and `formatRange`: copy the range object returned by `find_text`."
|
|
130
135
|
},
|
|
131
136
|
find: {
|
|
132
137
|
type: "string",
|
|
@@ -140,6 +145,28 @@ const suggestChangesOperationSchema = {
|
|
|
140
145
|
type: "string",
|
|
141
146
|
description: "Required for `insertAfterBlock` / `insertBeforeBlock` / `replaceBlock`: the text to insert or replace the block with, up to 100,000 characters."
|
|
142
147
|
},
|
|
148
|
+
position: {
|
|
149
|
+
type: "string",
|
|
150
|
+
enum: ["after", "before"],
|
|
151
|
+
description: "For row or column insertion, place the new structure after the anchor or before it."
|
|
152
|
+
},
|
|
153
|
+
cellTexts: {
|
|
154
|
+
type: "array",
|
|
155
|
+
description: "For row or column insertion, initial text for new physical cells in source order, up to 100,000 characters per cell.",
|
|
156
|
+
maxItems: 256,
|
|
157
|
+
items: { type: "string" }
|
|
158
|
+
},
|
|
159
|
+
formatting: {
|
|
160
|
+
type: "object",
|
|
161
|
+
description: "Required for `formatRange`: set one or more inline properties to enable or disable.",
|
|
162
|
+
properties: {
|
|
163
|
+
bold: { type: "boolean" },
|
|
164
|
+
italic: { type: "boolean" },
|
|
165
|
+
underline: { type: "boolean" }
|
|
166
|
+
},
|
|
167
|
+
minProperties: 1,
|
|
168
|
+
additionalProperties: false
|
|
169
|
+
},
|
|
143
170
|
comment: {
|
|
144
171
|
type: "string",
|
|
145
172
|
description: "Optional comment explaining this edit, attached to the affected text, up to 100,000 characters."
|
|
@@ -289,7 +316,7 @@ const FOLIO_AGENT_TOOLS = [
|
|
|
289
316
|
},
|
|
290
317
|
{
|
|
291
318
|
name: FOLIO_AGENT_TOOL_NAMES.readChanges,
|
|
292
|
-
description: "Read pending tracked changes
|
|
319
|
+
description: "Read pending tracked changes awaiting human review. Use this to see the effect of edits already suggested via `suggest_changes` before proposing more.",
|
|
293
320
|
inputSchema: {
|
|
294
321
|
type: "object",
|
|
295
322
|
properties: {},
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FolioAITextRangeHandle, FolioDocumentOperationIssue, FolioDocumentOperationReceipt, FolioDocumentOutlineEntry, FolioDocumentSectionHandle, FolioDocumentStoryHandle } from "@stll/folio-core/server";
|
|
1
|
+
import { FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FolioAITextRangeHandle, FolioDocumentOperationIssue, FolioDocumentOperationReceipt, FolioDocumentOutlineEntry, FolioDocumentSectionHandle, FolioDocumentStoryHandle, FolioReviewChange } from "@stll/folio-core/server";
|
|
2
2
|
|
|
3
3
|
//#region src/types.d.ts
|
|
4
4
|
/**
|
|
@@ -136,10 +136,10 @@ type FolioAgentComment = {
|
|
|
136
136
|
quote: string;
|
|
137
137
|
replies: FolioAgentCommentReply[];
|
|
138
138
|
};
|
|
139
|
-
/** A pending tracked change
|
|
139
|
+
/** A pending tracked change, shaped to match {@link FolioDocxReviewer.getChanges}. */
|
|
140
140
|
type FolioAgentChange = {
|
|
141
141
|
id: string;
|
|
142
|
-
type: "
|
|
142
|
+
type: FolioReviewChange["type"];
|
|
143
143
|
author: string;
|
|
144
144
|
text: string;
|
|
145
145
|
blockId: string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/folio-agents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Framework-neutral LLM tool layer over folio's ai-edits engine: function-calling tools so an agent can read and mutate .docx documents through @stll/folio-core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|