🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

dimcode-darwin-arm64

Package Overview
Dependencies
Maintainers
3
Versions
188
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dimcode-darwin-arm64 - npm Package Compare versions

Comparing version
0.2.39
to
0.3.0-beta.0
+202
bin/runtime/light-ocr/darwin/arm64/engine/LICENSE
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{
"files": [
{
"bytes": 11358,
"path": "LICENSE",
"sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30"
},
{
"bytes": 258,
"path": "NOTICE",
"sha256": "24cb7b29285527efc05b8b85c3086fa589e06078dc3ad0075fb51546aa85f547"
},
{
"bytes": 321,
"path": "README.md",
"sha256": "56f5c2fc3c0e018a22bff801a721f04632ad84b044a4f87514ae3bfc79f77e51"
},
{
"bytes": 2020,
"path": "license-inventory.json",
"sha256": "d36c7420b5582d08d71f47ce87608dcbc0ea7dca75a0fb5ad591574a36df6025"
},
{
"bytes": 1110,
"path": "licenses/clipper-BSL-1.0.txt",
"sha256": "32ee7398e3123736fd14e9f08287edc2d97ace102ab54d8dc4edc8d31c651fa8"
},
{
"bytes": 1076,
"path": "licenses/nlohmann-json-MIT.txt",
"sha256": "86b998c792894ccb911a1cb7994f7a9652894e7a094c0b5e45be2f553f45cf14"
},
{
"bytes": 1094,
"path": "licenses/onnxruntime-MIT.txt",
"sha256": "c250d6278f0b47a6439fb7592b08b58a55eb9f535aa49a1db63211c3f982b674"
},
{
"bytes": 333022,
"path": "licenses/onnxruntime-ThirdPartyNotices.txt",
"sha256": "e00f828e0a33de591a355ae6606d2625f5758da7d2c844db7821c9dd3e3647b6"
},
{
"bytes": 11358,
"path": "licenses/opencv-Apache-2.0.txt",
"sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30"
},
{
"bytes": 733,
"path": "licenses/opencv-COPYRIGHT.txt",
"sha256": "bba849c98da85a2b27b86113284a90812c959b1c1fc4ed67de9355475d1e6831"
},
{
"bytes": 2010,
"path": "licenses/opencv-carotene-BSD-3-Clause.txt",
"sha256": "fb86be28d90bfef2fffcb86469f7c19962b7a367da9676a521cc1fc33f2996fc"
},
{
"bytes": 1002,
"path": "licenses/opencv-zlib.txt",
"sha256": "845efc77857d485d91fb3e0b884aaa929368c717ae8186b66fe1ed2495753243"
},
{
"bytes": 1064,
"path": "licenses/pdfium-native-MIT.txt",
"sha256": "e0d1cbc5ab7f2a71622dc703e52642ef7c7e81b4b4caa9e382da4a1a2eb45c62"
},
{
"bytes": 2879,
"path": "licenses/pdfium-native-THIRD-PARTY-NOTICES.md",
"sha256": "01c3f30c69061d39f0f0a4c575b75f48ec33c77e27d9f4c0f4d05ffe4db9cb99"
},
{
"bytes": 2510,
"path": "licenses/stb-MIT-or-Unlicense.txt",
"sha256": "bebfe904b14301657e4e5d655c811d51fd31b97c455b9cc2d8600d6bac6cff63"
},
{
"bytes": 33514304,
"path": "native/libonnxruntime.1.22.0.dylib",
"sha256": "6c2f8af5def6e533f17383a4f07dc4eabbd4807d242a478b69f62fcfbe3c1dd3"
},
{
"bytes": 6120304,
"path": "native/light_ocr_node.node",
"sha256": "27a0130c3063eb0421c36bef62e219f9cfbfa5fd94fd1735ab5c997beee4732c"
},
{
"bytes": 1468,
"path": "native/runtime-descriptor.json",
"sha256": "61187535f0f0da1a74e6c9c4e35d68c541adc90f0153b6c3241aca650b82e58f"
},
{
"bytes": 919,
"path": "package.json",
"sha256": "5379275035ddbfbdfddaf266e7abe7d75799a90655b61581732746bf0e182e73"
},
{
"bytes": 382,
"path": "pdfium/index.cjs",
"sha256": "d6d6ea1c607b0c56600ad33853d4910b7ed45934b4f6a8e1c40b4d4d735d8340"
},
{
"bytes": 7732848,
"path": "pdfium/libpdfium.dylib",
"sha256": "68e82322c55f745ef1d2ef2a93c0ba4ba2c6491d9cc16c65c2be587ec7a17622"
},
{
"bytes": 263720,
"path": "pdfium/pdfium.node",
"sha256": "ed36d230cda28b25dd443c3fe1b0083cbfca86b9d6c78de0e42ce0d78d9eb55c"
},
{
"bytes": 6005,
"path": "sbom.spdx.json",
"sha256": "002ceb7ae046d2a7d0737d78e900f24edc9554ff7d1aa102e1f1f08b272ea0a7"
}
],
"package": "@arcships/light-ocr-darwin-arm64",
"schemaVersion": "1.0",
"version": "0.5.5"
}
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{
"files": [
{
"component": "opencv",
"file": "licenses/opencv-Apache-2.0.txt",
"sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30"
},
{
"component": "opencv",
"file": "licenses/opencv-COPYRIGHT.txt",
"sha256": "bba849c98da85a2b27b86113284a90812c959b1c1fc4ed67de9355475d1e6831"
},
{
"component": "zlib",
"file": "licenses/opencv-zlib.txt",
"sha256": "845efc77857d485d91fb3e0b884aaa929368c717ae8186b66fe1ed2495753243"
},
{
"component": "clipper",
"file": "licenses/clipper-BSL-1.0.txt",
"sha256": "32ee7398e3123736fd14e9f08287edc2d97ace102ab54d8dc4edc8d31c651fa8"
},
{
"component": "nlohmann-json",
"file": "licenses/nlohmann-json-MIT.txt",
"sha256": "86b998c792894ccb911a1cb7994f7a9652894e7a094c0b5e45be2f553f45cf14"
},
{
"component": "onnxruntime",
"file": "licenses/onnxruntime-MIT.txt",
"sha256": "c250d6278f0b47a6439fb7592b08b58a55eb9f535aa49a1db63211c3f982b674"
},
{
"component": "onnxruntime",
"file": "licenses/onnxruntime-ThirdPartyNotices.txt",
"sha256": "e00f828e0a33de591a355ae6606d2625f5758da7d2c844db7821c9dd3e3647b6"
},
{
"component": "stb",
"file": "licenses/stb-MIT-or-Unlicense.txt",
"sha256": "bebfe904b14301657e4e5d655c811d51fd31b97c455b9cc2d8600d6bac6cff63"
},
{
"component": "carotene",
"file": "licenses/opencv-carotene-BSD-3-Clause.txt",
"sha256": "fb86be28d90bfef2fffcb86469f7c19962b7a367da9676a521cc1fc33f2996fc"
},
{
"component": "pdfium-native-0.6.1",
"file": "licenses/pdfium-native-MIT.txt",
"sha256": "e0d1cbc5ab7f2a71622dc703e52642ef7c7e81b4b4caa9e382da4a1a2eb45c62"
},
{
"component": "pdfium-native-0.6.1",
"file": "licenses/pdfium-native-THIRD-PARTY-NOTICES.md",
"sha256": "01c3f30c69061d39f0f0a4c575b75f48ec33c77e27d9f4c0f4d05ffe4db9cb99"
}
],
"schemaVersion": "1.0"
}
The MIT License (MIT)
Copyright (c) 2015 Gregor Ratajc, Lukas Treyer, Maxime Chalton
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) 2013-2022 Niels Lohmann
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Sorry, the diff of this file is too big to display

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
/*
* By downloading, copying, installing or using the software you agree to this license.
* If you do not agree to this license, do not download, install,
* copy or use the software.
*
*
* License Agreement
* For Open Source Computer Vision Library
* (3-clause BSD License)
*
* Copyright (C) 2014-2015, NVIDIA Corporation, all rights reserved.
* Third party copyrights are property of their respective owners.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the names of the copyright holders nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* This software is provided by the copyright holders and contributors "as is" and
* any express or implied warranties, including, but not limited to, the implied
* warranties of merchantability and fitness for a particular purpose are disclaimed.
* In no event shall copyright holders or contributors be liable for any direct,
* indirect, incidental, special, exemplary, or consequential damages
* (including, but not limited to, procurement of substitute goods or services;
* loss of use, data, or profits; or business interruption) however caused
* and on any theory of liability, whether in contract, strict liability,
* or tort (including negligence or otherwise) arising in any way out of
* the use of this software, even if advised of the possibility of such damage.
*/
Copyright (C) 2000-2022, Intel Corporation, all rights reserved.
Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
Copyright (C) 2009-2016, NVIDIA Corporation, all rights reserved.
Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
Copyright (C) 2015-2023, OpenCV Foundation, all rights reserved.
Copyright (C) 2008-2016, Itseez Inc., all rights reserved.
Copyright (C) 2019-2023, Xperience AI, all rights reserved.
Copyright (C) 2019-2022, Shenzhen Institute of Artificial Intelligence and Robotics for Society, all rights reserved.
Copyright (C) 2022-2023, Southern University of Science And Technology, all rights reserved.
Third party copyrights are property of their respective owners.
Copyright notice:
(C) 1995-2022 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
MIT License
Copyright (c) 2026 xonaman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# Third-Party Notices
`pdfium-native` is distributed under the [MIT License](./LICENSE). It bundles
and/or links against the third-party native components listed below. Each
component remains under its own license; the relevant license texts are shipped
inside the prebuilt PDFium distribution under `deps/pdfium/licenses/`.
## Bundled native libraries
| Component | Version | License |
| -------------------------------------------------- | --------------- | --------------------------------------- |
| [PDFium](https://pdfium.googlesource.com/pdfium/) | `chromium/7749` | BSD-3-Clause |
| [stb_image_write](https://github.com/nothings/stb) | `v1.16` | Public Domain (Unlicense) or MIT (dual) |
- **PDFium** — the PDF rendering and parsing engine, consumed as a prebuilt
shared library from
[bblanchon/pdfium-binaries](https://github.com/bblanchon/pdfium-binaries).
Copyright The PDFium Authors. Licensed under BSD-3-Clause.
- **stb_image_write** — single-header PNG/JPEG encoder vendored in
`src/stb_image_write.{h,cc}`, used to encode rendered bitmaps. By Sean Barrett
(and based on Jon Olick's public-domain JPEG writer). Dual-licensed: you may
use it under the MIT License or as public domain (Unlicense).
## Components statically linked into the prebuilt PDFium library
The prebuilt PDFium shared library statically incorporates the third-party
components below. Their versions track the upstream PDFium `chromium/7749`
build; full license texts are provided in `deps/pdfium/licenses/`.
| Component | License |
| ------------------------- | ----------------------------------------- |
| Abseil | Apache-2.0 |
| Anti-Grain Geometry (2.3) | Anti-Grain Geometry License (permissive) |
| fast_float | MIT (also Apache-2.0 / BSL-1.0) |
| FreeType | FreeType License (FTL) or GPLv2 |
| ICU | Unicode License v3 |
| Little CMS (lcms2) | MIT |
| libjpeg-turbo | BSD-3-Clause and IJG License |
| OpenJPEG | BSD-2-Clause |
| libpng | libpng License (PNG Reference Library v2) |
| libtiff | libtiff License (MIT/BSD-style) |
| LLVM libc | Apache-2.0 with LLVM Exceptions |
| simdutf | MIT (also Apache-2.0) |
| zlib (1.3.1) | zlib License |
If you redistribute `pdfium-native` (or its prebuilt binaries), you must retain
the above notices and the corresponding license texts.
This software is available under 2 licenses -- choose whichever you prefer.
------------------------------------------------------------------------------
ALTERNATIVE A - MIT License
Copyright (c) 2017 Sean Barrett
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
------------------------------------------------------------------------------
ALTERNATIVE B - Public Domain (www.unlicense.org)
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
software, either in source code form or as a compiled binary, for any purpose,
commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this
software dedicate any and all copyright interest in the software to the public
domain. We make this dedication for the benefit of the public at large and to
the detriment of our heirs and successors. We intend this dedication to be an
overt act of relinquishment in perpetuity of all present and future rights to
this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

{
"addon": {
"bytes": 6120304,
"path": "native/light_ocr_node.node",
"sha256": "27a0130c3063eb0421c36bef62e219f9cfbfa5fd94fd1735ab5c997beee4732c"
},
"autoPolicy": {
"id": "macos-arm64-v1",
"providers": [
"apple",
"cpu"
],
"version": 1
},
"platform": {
"architecture": "arm64",
"id": "macos-arm64",
"os": "darwin"
},
"providers": {
"apple": {
"artifacts": [
{
"bytes": 6120304,
"path": "native/light_ocr_node.node",
"sha256": "27a0130c3063eb0421c36bef62e219f9cfbfa5fd94fd1735ab5c997beee4732c"
}
],
"qualificationId": "apple-open-macos-v1",
"runtimeProvider": "CoreML"
},
"cpu": {
"artifacts": [
{
"bytes": 33514304,
"path": "native/libonnxruntime.1.22.0.dylib",
"sha256": "6c2f8af5def6e533f17383a4f07dc4eabbd4807d242a478b69f62fcfbe3c1dd3"
}
],
"qualificationId": "cpu-baseline-v1",
"runtimeProvider": "CPUExecutionProvider"
}
},
"qualificationOnly": false,
"released": true,
"runtime": {
"abi": "onnxruntime-c-api-22",
"artifacts": [
{
"bytes": 33514304,
"path": "native/libonnxruntime.1.22.0.dylib",
"sha256": "6c2f8af5def6e533f17383a4f07dc4eabbd4807d242a478b69f62fcfbe3c1dd3"
}
],
"flavor": "cpu",
"kind": "onnxruntime-cpu",
"version": "1.22.0"
},
"schemaVersion": "2.0"
}
light-ocr
Copyright 2026 light-ocr contributors
This product includes software developed by the light-ocr contributors.
Third-party licenses and notices for packaged dependencies and model
artifacts are distributed with their respective release artifacts.
{
"bugs": {
"url": "https://github.com/arcships/light-ocr/issues"
},
"cpu": [
"arm64"
],
"description": "Native macos-arm64 runtime for @arcships/light-ocr",
"engines": {
"node": "^22.0.0 || ^24.0.0"
},
"exports": {
".": "./native/light_ocr_node.node",
"./pdfium": "./pdfium/index.cjs"
},
"files": [
"native/",
"pdfium/",
"licenses/",
"license-inventory.json",
"sbom.spdx.json",
"artifact-hashes.json",
"README.md",
"LICENSE",
"NOTICE"
],
"homepage": "https://github.com/arcships/light-ocr#readme",
"license": "Apache-2.0",
"main": "./native/light_ocr_node.node",
"name": "@arcships/light-ocr-darwin-arm64",
"os": [
"darwin"
],
"publishConfig": {
"access": "public",
"provenance": true
},
"repository": {
"type": "git",
"url": "git+https://github.com/arcships/light-ocr.git"
},
"version": "0.5.5"
}
# @arcships/light-ocr-darwin-arm64
The prebuilt macos-arm64 native runtime for `@arcships/light-ocr`.
This is an internal distribution package for `@arcships/light-ocr`. Install
the facade package instead of depending on this package directly.
Documentation: https://github.com/arcships/light-ocr
License: Apache-2.0
{
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2026-07-27T05:14:38Z",
"creators": [
"Tool: light-ocr-generate-release-metadata/1.0"
]
},
"dataLicense": "CC0-1.0",
"documentDescribes": [
"SPDXRef-Package-light-ocr-core"
],
"documentNamespace": "https://light-ocr.invalid/spdx/5f6a36e0414a4c6cb500ecb757041cf7a51c09e0737b67096201e061d1571b2b",
"name": "light-ocr-core-macos-arm64",
"packages": [
{
"SPDXID": "SPDXRef-Package-light-ocr-core",
"copyrightText": "Copyright 2026 light-ocr contributors",
"downloadLocation": "NOASSERTION",
"filesAnalyzed": false,
"licenseConcluded": "Apache-2.0",
"licenseDeclared": "Apache-2.0",
"name": "light-ocr-core",
"versionInfo": "0.1.0"
},
{
"SPDXID": "SPDXRef-Package-onnxruntime",
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "d571e63a2329baacb713f441e65ad75284de354db6e1ac435fe4bebbb417986a"
}
],
"copyrightText": "NOASSERTION",
"downloadLocation": "https://api.nuget.org/v3-flatcontainer/microsoft.ml.onnxruntime/1.22.0/microsoft.ml.onnxruntime.1.22.0.nupkg",
"filesAnalyzed": false,
"licenseConcluded": "MIT",
"licenseDeclared": "MIT",
"name": "onnxruntime",
"versionInfo": "1.22.0"
},
{
"SPDXID": "SPDXRef-Package-opencv",
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "b2171af5be6b26f7a06b1229948bbb2bdaa74fcf5cd097e0af6378fce50a6eb9"
}
],
"copyrightText": "NOASSERTION",
"downloadLocation": "https://codeload.github.com/opencv/opencv/tar.gz/refs/tags/4.10.0",
"filesAnalyzed": false,
"licenseConcluded": "Apache-2.0",
"licenseDeclared": "Apache-2.0",
"name": "opencv",
"versionInfo": "4.10.0"
},
{
"SPDXID": "SPDXRef-Package-opencv-zlib",
"copyrightText": "NOASSERTION",
"downloadLocation": "https://codeload.github.com/opencv/opencv/tar.gz/refs/tags/4.10.0",
"filesAnalyzed": false,
"licenseConcluded": "Zlib",
"licenseDeclared": "Zlib",
"name": "zlib",
"versionInfo": "1.3.1"
},
{
"SPDXID": "SPDXRef-Package-opencv-carotene",
"copyrightText": "NOASSERTION",
"downloadLocation": "https://codeload.github.com/opencv/opencv/tar.gz/refs/tags/4.10.0",
"filesAnalyzed": false,
"licenseConcluded": "BSD-3-Clause",
"licenseDeclared": "BSD-3-Clause",
"name": "carotene",
"versionInfo": "0.0.1"
},
{
"SPDXID": "SPDXRef-Package-clipper",
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "2be14496a1609fa8602d9d3672c83ee95d5ef44a08b765a60e65b93a68882ff6"
}
],
"copyrightText": "NOASSERTION",
"downloadLocation": "https://codeload.github.com/fonttools/pyclipper/tar.gz/refs/tags/1.3.0.post6",
"filesAnalyzed": false,
"licenseConcluded": "BSL-1.0",
"licenseDeclared": "BSL-1.0",
"name": "clipper",
"versionInfo": "6.4.2-pyclipper-1.3.0.post6"
},
{
"SPDXID": "SPDXRef-Package-stb",
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "e4e3bba9c572a4a4148373a914d88ea0f0d11de8cc2c66739926e7eca0223319"
}
],
"copyrightText": "NOASSERTION",
"downloadLocation": "https://codeload.github.com/nothings/stb/tar.gz/31c1ad37456438565541f4919958214b6e762fb4",
"filesAnalyzed": false,
"licenseConcluded": "MIT OR Unlicense",
"licenseDeclared": "MIT OR Unlicense",
"name": "stb",
"versionInfo": "31c1ad37456438565541f4919958214b6e762fb4"
},
{
"SPDXID": "SPDXRef-Package-nlohmann-json",
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406"
}
],
"copyrightText": "NOASSERTION",
"downloadLocation": "https://codeload.github.com/nlohmann/json/tar.gz/refs/tags/v3.11.3",
"filesAnalyzed": false,
"licenseConcluded": "MIT",
"licenseDeclared": "MIT",
"name": "nlohmann-json",
"versionInfo": "3.11.3"
},
{
"SPDXID": "SPDXRef-Package-pdfium-native",
"copyrightText": "Copyright (c) 2026 xonaman",
"downloadLocation": "https://github.com/xonaman/nodejs-pdfium-native/releases/tag/v0.6.1",
"filesAnalyzed": false,
"licenseConcluded": "MIT",
"licenseDeclared": "MIT",
"name": "pdfium-native",
"versionInfo": "0.6.1"
}
],
"relationships": [
{
"relatedSpdxElement": "SPDXRef-Package-onnxruntime",
"relationshipType": "DEPENDS_ON",
"spdxElementId": "SPDXRef-Package-light-ocr-core"
},
{
"relatedSpdxElement": "SPDXRef-Package-opencv",
"relationshipType": "DEPENDS_ON",
"spdxElementId": "SPDXRef-Package-light-ocr-core"
},
{
"relatedSpdxElement": "SPDXRef-Package-opencv-zlib",
"relationshipType": "CONTAINS",
"spdxElementId": "SPDXRef-Package-opencv"
},
{
"relatedSpdxElement": "SPDXRef-Package-opencv-carotene",
"relationshipType": "CONTAINS",
"spdxElementId": "SPDXRef-Package-opencv"
},
{
"relatedSpdxElement": "SPDXRef-Package-clipper",
"relationshipType": "DEPENDS_ON",
"spdxElementId": "SPDXRef-Package-light-ocr-core"
},
{
"relatedSpdxElement": "SPDXRef-Package-stb",
"relationshipType": "DEPENDS_ON",
"spdxElementId": "SPDXRef-Package-light-ocr-core"
},
{
"relatedSpdxElement": "SPDXRef-Package-nlohmann-json",
"relationshipType": "DEPENDS_ON",
"spdxElementId": "SPDXRef-Package-light-ocr-core"
},
{
"relatedSpdxElement": "SPDXRef-Package-pdfium-native",
"relationshipType": "DEPENDS_ON",
"spdxElementId": "SPDXRef-Package-light-ocr-core"
}
],
"spdxVersion": "SPDX-2.3"
}
light-ocr
Copyright 2026 light-ocr contributors
This product includes software developed by the light-ocr contributors.
Third-party licenses and notices for packaged dependencies and model
artifacts are distributed with their respective release artifacts.
{
"bugs": {
"url": "https://github.com/arcships/light-ocr/issues"
},
"description": "Model-free Node.js runtime for light-ocr",
"engines": {
"node": "^22.0.0 || ^24.0.0"
},
"exports": {
".": {
"import": "./src/index.mjs",
"require": "./src/index.cjs",
"types": "./src/index.d.ts"
},
"./cli": "./src/cli.cjs",
"./facade": "./src/facade.cjs",
"./metadata": "./src/metadata.cjs"
},
"files": [
"src/",
"README.md",
"LICENSE",
"NOTICE"
],
"homepage": "https://github.com/arcships/light-ocr#readme",
"license": "Apache-2.0",
"main": "./src/index.cjs",
"module": "./src/index.mjs",
"name": "@arcships/light-ocr-runtime",
"optionalDependencies": {
"@arcships/light-ocr-darwin-arm64": "0.5.5",
"@arcships/light-ocr-darwin-x64": "0.5.5",
"@arcships/light-ocr-linux-arm64-gnu": "0.5.5",
"@arcships/light-ocr-linux-x64-gnu": "0.5.5",
"@arcships/light-ocr-win32-arm64": "0.5.5",
"@arcships/light-ocr-win32-x64": "0.5.5"
},
"publishConfig": {
"access": "public",
"provenance": true
},
"repository": {
"type": "git",
"url": "git+https://github.com/arcships/light-ocr.git"
},
"type": "commonjs",
"types": "./src/index.d.ts",
"version": "0.1.5"
}
# @arcships/light-ocr-runtime
Model-free Node.js runtime for `light-ocr`. It owns native loading, engine lifecycle, encoded-image support, scheduling, errors, and shared OCR types.
The N2 release assembler publishes this package as the shared runtime. Direct callers must provide a local model bundle:
```js
const { createEngine } = require('@arcships/light-ocr-runtime');
const engine = await createEngine({ bundlePath: '/absolute/model/bundle' });
```
Use `@arcships/light-ocr` for stable Small, `@arcships/light-ocr-tiny` for the size-first preview, or `@arcships/light-ocr-medium` for the quality-first preview. The runtime never downloads a model.
#!/usr/bin/env node
'use strict';
// Shared CLI implementation for the tier facades (cli-design.md §3, D106/D107).
//
// Subcommand structure (cli-design.md §2.1):
// light-ocr recognize <path|--stdin> [flags] # default OCR
// light-ocr detect <path|--stdin> [flags] # detect only (N1 step 5)
// light-ocr info --model-info | --version # diagnostics, no image
// light-ocr image.png ... # implicit recognize
//
// stdout = machine results only; stderr = logs/warnings/usage (cli-design.md §5).
// Exit codes are a stable surface (cli-design.md §10, D106).
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
const { parseExifOrientation } = require('./exif.cjs');
const SUBCOMMANDS = new Set(['recognize', 'detect', 'info', 'doctor']);
const EXIT = {
success: 0,
usage: 64,
invalid_argument: 65,
invalid_image: 66,
unsupported_capability: 67,
model: 68,
resource_limit_exceeded: 69,
env_package: 70,
inference_failed: 71,
internal_error: 72,
};
const OCR_ERROR_EXIT = {
invalid_argument: EXIT.invalid_argument,
invalid_image: EXIT.invalid_argument,
unsupported_pixel_format: EXIT.invalid_image,
unsupported_capability: EXIT.unsupported_capability,
invalid_model_bundle: EXIT.model,
unsupported_model: EXIT.model,
model_integrity_failed: EXIT.model,
runtime_initialization_failed: EXIT.env_package,
invalid_engine: EXIT.env_package,
resource_limit_exceeded: EXIT.resource_limit_exceeded,
inference_failed: EXIT.inference_failed,
postprocess_failed: EXIT.inference_failed,
internal_error: EXIT.internal_error,
bundle_io_failed: EXIT.env_package,
queue_full: EXIT.internal_error,
environment_closing: EXIT.internal_error,
unsupported_platform: EXIT.env_package,
package_load_failed: EXIT.env_package,
};
const ALLOWED_PROVIDERS = new Set(['auto', 'cpu', 'apple', 'webgpu']);
const ALLOWED_FORMATS = new Set(['json', 'jsonl', 'text']);
function die(stderr, commandName, message) {
stderr.write(`${commandName}: ${message}\n`);
}
function useColor(stderr) {
if (process.env.NO_COLOR) return false;
return stderr.isTTY === true;
}
// --- argv parser (D-N1-2: hand-written, zero-dependency) ---
// Parses `--flag value`, `--flag=value`, `--bool`, and positional args.
// Returns { subcommand, positionals, flags } or throws { code, message }.
function parseArgs(argv) {
const positionals = [];
const flags = {};
let i = 0;
while (i < argv.length) {
const arg = argv[i];
if (arg === '--') {
positionals.push(...argv.slice(i + 1));
break;
}
if (arg.startsWith('--')) {
const eq = arg.indexOf('=');
if (eq > 2) {
flags[arg.slice(2, eq)] = arg.slice(eq + 1);
i += 1;
continue;
}
const name = arg.slice(2);
const knownBooleans = new Set([
'stdin', 'no-exif', 'no-color', 'quiet', 'help',
'model-info', 'version', 'crop', 'json',
]);
if (knownBooleans.has(name)) {
flags[name] = true;
i += 1;
continue;
}
// value flag: consume next arg
if (i + 1 >= argv.length) {
throw { code: EXIT.usage, message: `--${name} requires a value` };
}
flags[name] = argv[i + 1];
i += 2;
continue;
}
positionals.push(arg);
i += 1;
}
return { positionals, flags };
}
function resolveSubcommand(positionals) {
if (positionals.length > 0 && SUBCOMMANDS.has(positionals[0])) {
return { subcommand: positionals[0], rest: positionals.slice(1) };
}
// implicit recognize
return { subcommand: 'recognize', rest: positionals };
}
// --- input resolution ---
function readImageInput(rest, flags, stderr) {
const useStdin = flags.stdin === true;
if (useStdin) {
if (rest.length > 0) {
throw { code: EXIT.usage, message: 'cannot pass both a file path and --stdin' };
}
const type = flags.type;
if (!type) {
throw { code: EXIT.usage, message: '--stdin requires --type image/png or --type image/jpeg' };
}
if (type !== 'image/png' && type !== 'image/jpeg') {
throw { code: EXIT.invalid_argument, message: `unsupported --type ${type}; use image/png or image/jpeg` };
}
// read all of stdin synchronously (CLI is short-lived)
return readStdinSync();
}
if (rest.length === 0) {
throw { code: EXIT.usage, message: 'expected a file path or --stdin' };
}
if (rest.length > 1) {
throw { code: EXIT.usage, message: `unexpected extra argument: ${rest[1]}` };
}
const file = rest[0];
try {
return fs.readFileSync(file);
} catch (cause) {
throw {
code: EXIT.usage,
message: cause.code === 'ENOENT'
? `file not found: ${file}`
: `cannot read file: ${file} (${cause.message})`,
};
}
}
function readStdinSync() {
// Node's stdin is async by default; use a blocking read via fs.readFileSync(0).
// fd 0 is stdin. This throws EBADF on some platforms if stdin is a pipe with
// no data, but for CLI usage (piped image bytes) it works.
try {
return fs.readFileSync(0);
} catch (cause) {
throw { code: EXIT.usage, message: `cannot read stdin: ${cause.message}` };
}
}
// --- format options ---
function resolveFormat(flags, subcommand) {
// detect does not expose --format (cli-design.md §3.1 detect)
if (subcommand === 'detect') {
if (flags.format !== undefined) {
throw { code: EXIT.invalid_argument, message: 'detect does not accept --format; output is always JSON' };
}
return 'json';
}
const format = flags.format === undefined ? 'json' : flags.format;
if (!ALLOWED_FORMATS.has(format)) {
throw { code: EXIT.invalid_argument, message: `unsupported --format ${format}; use json, jsonl, or text` };
}
return format;
}
function resolveProvider(flags) {
if (flags.provider === undefined) return undefined;
const provider = flags.provider;
if (!ALLOWED_PROVIDERS.has(provider)) {
throw { code: EXIT.invalid_argument, message: `unsupported --provider ${provider}; use auto, cpu, apple, or webgpu` };
}
return provider;
}
function parseRegion(flags) {
if (flags.region === undefined) return undefined;
const parts = String(flags.region).split(',');
if (parts.length !== 4) {
throw { code: EXIT.invalid_argument, message: `--region expects x,y,w,h (got ${flags.region})` };
}
const values = parts.map((p) => {
const n = Number.parseInt(p, 10);
if (!Number.isInteger(n) || n < 0 || String(n) !== p.trim()) {
throw { code: EXIT.invalid_argument, message: `--region values must be non-negative integers (got ${p})` };
}
return n;
});
const [x, y, width, height] = values;
if (width === 0 || height === 0) {
throw { code: EXIT.invalid_argument, message: '--region width and height must be positive' };
}
return { x, y, width, height };
}
// --- subcommand handlers ---
async function runInfo(rest, flags, stdout, stderr, config) {
if (rest.length > 0) {
throw { code: EXIT.invalid_argument, message: `info does not accept a file path: ${rest[0]}` };
}
const hasModelInfo = flags['model-info'] === true;
const hasVersion = flags.version === true;
if (!hasModelInfo && !hasVersion) {
throw { code: EXIT.usage, message: 'info requires --model-info or --version' };
}
if (hasModelInfo && hasVersion) {
throw { code: EXIT.invalid_argument, message: '--model-info and --version are mutually exclusive' };
}
// info must not accept image/ocr flags
for (const blocked of ['stdin', 'type', 'format', 'region', 'no-exif', 'provider', 'crop']) {
if (flags[blocked] !== undefined) {
throw { code: EXIT.invalid_argument, message: `info does not accept --${blocked}` };
}
}
if (hasVersion) {
stdout.write(JSON.stringify({
npm: config.packageVersion,
core: config.coreVersion,
model: config.modelProfile.bundleId,
tier: config.modelProfile.tier,
maturity: config.modelProfile.maturity,
}) + '\n');
return;
}
// --model-info
const engine = await config.createEngine();
try {
stdout.write(JSON.stringify({
...engine.info,
modelProfile: config.modelProfile,
}, null, 2) + '\n');
} finally {
await engine.close();
}
}
// --- DocumentResult envelope (cli-design.md §9, D106) ---
const SUPPORTED_SCHEMA_VERSION = 1;
function buildEnvelope(result, sourceInfo) {
const lines = result.lines.map((line, index) => ({
id: `L${index}`,
text: line.text,
confidence: line.confidence,
box: line.box,
}));
const page = {
index: 0,
width: result.imageWidth,
height: result.imageHeight,
coordinateSpace: 'pageSpace',
structure: 'ocr-order',
lines,
modelBundleId: result.modelBundleId,
timingUs: result.timingUs,
};
if (result.diagnostics) page.diagnostics = result.diagnostics;
return {
schemaVersion: SUPPORTED_SCHEMA_VERSION,
source: {
kind: 'image',
mediaType: sourceInfo.mediaType || null,
identity: sourceInfo.identity || {},
appliedTransforms: sourceInfo.appliedTransforms || { exifApplied: false },
},
pages: [page],
};
}
function buildPageRecord(envelope) {
// JSONL: one page record per line (cli-design.md §9.3)
const page = envelope.pages[0];
return {
schemaVersion: envelope.schemaVersion,
source: envelope.source.identity,
pageIndex: page.index,
status: 'ok',
page,
};
}
function resolveSchemaVersion(flags) {
if (flags['schema-version'] === undefined) return SUPPORTED_SCHEMA_VERSION;
const requested = flags['schema-version'];
// accept integer or string-integer
const version = Number.isInteger(Number(requested)) ? Number(requested) : NaN;
if (!Number.isInteger(version) || version !== SUPPORTED_SCHEMA_VERSION) {
throw {
code: EXIT.invalid_argument,
message: `unsupported --schema-version ${requested}; only version ${SUPPORTED_SCHEMA_VERSION} is supported`,
};
}
return version;
}
function inferMediaType(filePath, stdinType) {
if (stdinType) return stdinType;
if (!filePath) return null;
const ext = path.extname(filePath).toLowerCase();
if (ext === '.png') return 'image/png';
if (ext === '.jpg' || ext === '.jpeg') return 'image/jpeg';
return null;
}
async function runRecognize(rest, flags, stdout, stderr, config) {
// Validate all flags before reading input so parameter errors surface
// before filesystem/network errors (D106: stable failure ordering).
const format = resolveFormat(flags, 'recognize');
const provider = resolveProvider(flags);
resolveSchemaVersion(flags);
const region = parseRegion(flags);
const data = readImageInput(rest, flags, stderr);
const sourceInfo = {
mediaType: flags.stdin ? flags.type : inferMediaType(rest[0]),
identity: flags.stdin ? { stdin: true } : { path: rest[0] },
};
const engineOptions = {};
if (provider) engineOptions.execution = { provider };
const engine = await config.createEngine(engineOptions);
try {
const recognizeOptions = {};
if (flags['no-exif'] === true) recognizeOptions.applyExif = false;
if (region) recognizeOptions.region = region;
const result = await engine.recognizeEncoded(data, recognizeOptions);
// EXIF orientation: C++ decode path applies the pixel transform when
// applyExif is true (default). Parse the tag in JS for appliedTransforms
// reporting; the actual pixel rotation happens in C++.
const noExif = flags['no-exif'] === true;
const orientation = noExif ? 1 : parseExifOrientation(data);
const exifApplied = !noExif && orientation !== 1;
const sourceInfo = {
mediaType: flags.stdin ? flags.type : inferMediaType(rest[0]),
identity: flags.stdin ? { stdin: true } : { path: rest[0] },
};
const envelope = buildEnvelope(result, {
mediaType: sourceInfo.mediaType,
identity: sourceInfo.identity,
appliedTransforms: {
exifOrientation: orientation,
exifApplied,
sourceWidth: exifApplied ? result.imageHeight : result.imageWidth,
sourceHeight: exifApplied ? result.imageWidth : result.imageHeight,
pageWidth: result.imageWidth,
pageHeight: result.imageHeight,
region: region || undefined,
},
});
writeResult(envelope, format, stdout, 'recognize');
} finally {
await engine.close();
}
}
function buildDetectEnvelope(detectionResult, sourceInfo) {
// detectionResult comes through as OcrResult format: each line has empty
// text and detection score as confidence. Convert to detections[].
const detections = detectionResult.lines.map((line, index) => ({
id: `D${index}`,
score: line.confidence,
box: line.box,
}));
const page = {
index: 0,
width: detectionResult.imageWidth,
height: detectionResult.imageHeight,
coordinateSpace: 'pageSpace',
structure: 'detect',
detections,
modelBundleId: detectionResult.modelBundleId,
timingUs: detectionResult.timingUs,
};
return {
schemaVersion: SUPPORTED_SCHEMA_VERSION,
source: {
kind: 'image',
mediaType: sourceInfo.mediaType || null,
identity: sourceInfo.identity || {},
appliedTransforms: sourceInfo.appliedTransforms || { exifApplied: false },
},
pages: [page],
};
}
async function runDetect(rest, flags, stdout, stderr, config) {
// Validate all flags before reading input (same ordering as recognize).
const provider = resolveProvider(flags);
resolveSchemaVersion(flags);
const region = parseRegion(flags);
const data = readImageInput(rest, flags, stderr);
const sourceInfo = {
mediaType: flags.stdin ? flags.type : inferMediaType(rest[0]),
identity: flags.stdin ? { stdin: true } : { path: rest[0] },
};
const engineOptions = {};
if (provider) engineOptions.execution = { provider };
const engine = await config.createEngine(engineOptions);
try {
const detectOptions = {};
if (flags['no-exif'] === true) detectOptions.applyExif = false;
if (region) detectOptions.region = region;
const result = await engine.detect(data, detectOptions);
// EXIF reporting (same as recognize)
const noExif = flags['no-exif'] === true;
const orientation = noExif ? 1 : parseExifOrientation(data);
const exifApplied = !noExif && orientation !== 1;
const envelope = buildDetectEnvelope(result, {
mediaType: sourceInfo.mediaType,
identity: sourceInfo.identity,
appliedTransforms: {
exifOrientation: orientation,
exifApplied,
sourceWidth: exifApplied ? result.imageHeight : result.imageWidth,
sourceHeight: exifApplied ? result.imageWidth : result.imageHeight,
pageWidth: result.imageWidth,
pageHeight: result.imageHeight,
region: region || undefined,
},
});
// detect output is always JSON (no --format flag)
stdout.write(JSON.stringify(envelope, null, 2) + '\n');
} finally {
await engine.close();
}
}
function writeResult(envelope, format, stdout, subcommand) {
if (format === 'text') {
// text: just the recognized text lines, one per line (cli-design.md §5)
for (const line of envelope.pages[0].lines) {
stdout.write(line.text + '\n');
}
return;
}
if (format === 'jsonl') {
// single image = one page record (cli-design.md §9.3)
stdout.write(JSON.stringify(buildPageRecord(envelope)) + '\n');
return;
}
// json — full DocumentResult envelope
stdout.write(JSON.stringify(envelope, null, 2) + '\n');
}
// --- doctor subcommand (system diagnostics, no user content) ---
function safeRequireResolve(spec) {
try { return require.resolve(spec); } catch { return undefined; }
}
async function loadGpuInfo(config) {
try {
const engine = await config.createEngine();
try {
return { ...engine.info };
} finally {
await engine.close();
}
} catch {
return undefined;
}
}
async function runDoctor(rest, flags, stdout, stderr, config) {
if (rest.length > 0) {
throw { code: EXIT.invalid_argument, message: `doctor does not accept arguments: ${rest[0]}` };
}
for (const blocked of ['stdin', 'type', 'format', 'region', 'no-exif', 'provider', 'crop',
'model-info', 'version']) {
if (flags[blocked] !== undefined) {
throw { code: EXIT.invalid_argument, message: `doctor does not accept --${blocked}` };
}
}
const info = {
schemaVersion: 1,
tool: {
command: config.commandName,
version: config.packageVersion,
coreVersion: config.coreVersion,
},
model: { ...config.modelProfile },
system: {
node: process.version,
platform: process.platform,
arch: process.arch,
release: os.release(),
cpuModel: os.cpus()[0]?.model || 'unknown',
cpuCores: os.cpus().length,
totalMemoryGB: +(os.totalmem() / (1024 ** 3)).toFixed(1),
},
native: { status: 'unavailable' },
modules: {
runtime: safeRequireResolve('@arcships/light-ocr-runtime') !== undefined,
model: safeRequireResolve(config.modelProfile.model ? `@arcships/light-ocr-model-${config.modelProfile.model}` : '@arcships/light-ocr-model-ppocrv6-small') !== undefined,
},
};
// Native runtime details
if (typeof config.loadNative === 'function') {
try {
const native = config.loadNative();
info.native = {
status: 'ok',
availableProviders: native.runtimePolicy.availableProviders,
runtimeFlavor: native.runtimePolicy.runtimeFlavor,
runtimeVersion: native.runtimePolicy.runtimeVersion,
platformId: native.runtimePolicy.platformId,
qualificationOnly: native.runtimePolicy.qualificationOnly,
released: native.runtimePolicy.released,
descriptorPath: native.descriptorPath,
};
} catch (error) {
info.native = { status: 'error', message: error.message || String(error) };
}
}
// GPU/engine info (requires engine creation — slow, only when available)
if (flags.gpu !== true) {
// skip GPU probe unless explicitly requested
} else {
const gpuInfo = await loadGpuInfo(config);
if (gpuInfo) info.gpu = gpuInfo;
}
stdout.write(JSON.stringify(info, null, 2) + '\n');
}
// --- help ---
function printHelp(stdout, verbose, config) {
const command = config.commandName;
stdout.write(`${command} ${config.packageVersion} — local OCR (${config.modelProfile.tier})\n\n`);
stdout.write('Usage:\n');
stdout.write(` ${command} recognize <path|--stdin> [flags] Recognize text in an image (default)\n`);
stdout.write(` ${command} detect <path|--stdin> [flags] Detect text regions only\n`);
stdout.write(` ${command} info --model-info | --version Show engine/version info\n`);
stdout.write(` ${command} doctor [--json] System diagnostics\n`);
stdout.write(` ${command} <image> [flags] Implicit recognize\n\n`);
stdout.write(`Run \`${command} <subcommand> --help\` for flags of that subcommand.\n`);
}
function printSubcommandHelp(stdout, subcommand, config) {
const command = config.commandName;
if (subcommand === 'recognize') {
stdout.write(`${command} recognize — recognize text in an image\n\n`);
stdout.write(`Usage:\n ${command} recognize <path> [flags]\n ${command} recognize --stdin --type <mime> [flags]\n\n`);
stdout.write('Flags:\n');
stdout.write(' --format json|jsonl|text Output format (default: json)\n');
stdout.write(' --region x,y,w,h Restrict recognition to a pageSpace rectangle\n');
stdout.write(' --provider auto|cpu|apple|webgpu Execution provider (default: auto)\n');
stdout.write(' --no-exif Disable EXIF orientation correction\n');
stdout.write(' --schema-version 1 Request exact output schema\n');
stdout.write(' --quiet Suppress non-error stderr\n');
stdout.write(' --score-threshold <n> Recognition score threshold (advanced)\n');
stdout.write(' --no-color Disable stderr color (advanced)\n');
return;
}
if (subcommand === 'detect') {
stdout.write(`${command} detect — detect text regions, no recognition\n\n`);
stdout.write(`Usage:\n ${command} detect <path> [flags]\n ${command} detect --stdin --type <mime> [flags]\n\n`);
stdout.write('Flags:\n');
stdout.write(' --region x,y,w,h Restrict detection to a pageSpace rectangle\n');
stdout.write(' --crop Reserved; currently fails as unsupported\n');
stdout.write(' --provider auto|cpu|apple|webgpu Execution provider (default: auto)\n');
stdout.write(' --no-exif Disable EXIF orientation correction\n');
stdout.write(' --schema-version 1 Request exact output schema\n');
stdout.write(' --quiet Suppress non-error stderr\n');
return;
}
if (subcommand === 'info') {
stdout.write(`${command} info — show engine or version info without reading an image\n\n`);
stdout.write(`Usage:\n ${command} info --model-info\n ${command} info --version\n\n`);
stdout.write('Flags (mutually exclusive):\n');
stdout.write(' --model-info Print EngineInfo JSON\n');
stdout.write(' --version Print npm/core/model version triple\n');
return;
}
if (subcommand === 'doctor') {
stdout.write(`${command} doctor — system diagnostics for troubleshooting\n\n`);
stdout.write(`Usage:\n ${command} doctor [--json]\n\n`);
stdout.write('Collects hardware and runtime information (no user content).\n');
stdout.write('Output is always JSON. Use --json for explicit intent.\n\n');
stdout.write('Flags:\n');
stdout.write(' --json Explicit JSON output flag (default behavior)\n');
return;
}
printHelp(stdout, false, config);
}
// --- main ---
async function main(argv, config) {
const stdout = process.stdout;
const stderr = process.stderr;
let parsed;
try {
parsed = parseArgs(argv);
} catch (e) {
die(stderr, config.commandName, e.message);
return e.code;
}
if (parsed.flags.help) {
if (parsed.positionals.length > 0 && SUBCOMMANDS.has(parsed.positionals[0])) {
printSubcommandHelp(stdout, parsed.positionals[0], config);
} else {
printHelp(stdout, false, config);
}
return EXIT.success;
}
const { subcommand, rest } = resolveSubcommand(parsed.positionals);
try {
if (subcommand === 'info') {
await runInfo(rest, parsed.flags, stdout, stderr, config);
} else if (subcommand === 'doctor') {
await runDoctor(rest, parsed.flags, stdout, stderr, config);
} else if (subcommand === 'recognize') {
await runRecognize(rest, parsed.flags, stdout, stderr, config);
} else if (subcommand === 'detect') {
// Validate detect flag contract: detect does not expose --format
resolveFormat(parsed.flags, 'detect');
if (parsed.flags.crop !== undefined && parsed.flags.crop !== true) {
throw { code: EXIT.invalid_argument, message: '--crop is a boolean flag' };
}
if (parsed.flags.crop === true) {
throw {
code: EXIT.unsupported_capability,
message: '--crop is not available in this release; use detection boxes with --region',
};
}
await runDetect(rest, parsed.flags, stdout, stderr, config);
} else {
die(stderr, config.commandName, `unknown subcommand: ${subcommand}`);
return EXIT.usage;
}
return EXIT.success;
} catch (e) {
if (e instanceof config.OcrError) {
const code = OCR_ERROR_EXIT[e.code] ?? EXIT.internal_error;
die(stderr, config.commandName, `${e.message}${e.detail ? ` (${e.detail})` : ''}`);
return code;
}
if (e && typeof e.code === 'number') {
die(stderr, config.commandName, e.message);
return e.code;
}
die(stderr, config.commandName, e?.message || String(e));
return EXIT.internal_error;
}
}
function createCli(config) {
if (!config || typeof config !== 'object') throw new TypeError('CLI config must be an object');
for (const key of ['createEngine', 'OcrError', 'commandName', 'packageVersion', 'coreVersion', 'modelProfile']) {
if (!config[key]) throw new TypeError(`CLI config requires ${key}`);
}
const frozenConfig = Object.freeze({ ...config });
return Object.freeze({
main: (argv) => main(argv, frozenConfig),
parseArgs,
EXIT,
OCR_ERROR_EXIT,
buildEnvelope,
buildDetectEnvelope,
buildPageRecord,
resolveSchemaVersion,
inferMediaType,
parseRegion,
runDoctor: (rest, flags, stdout, stderr) => runDoctor(rest, flags, stdout, stderr, frozenConfig),
});
}
module.exports = { createCli };
'use strict';
// Minimal JPEG EXIF orientation parser (D106, D-N1-5).
// Reads the orientation tag from the JPEG APP1 segment and applies the
// corresponding pixel transform. Zero-dependency, stb-style.
//
// Only orientation (tag 0x0112) is read. Other EXIF fields are skipped.
// PNG eXIf is not handled here; PNG has no EXIF orientation in v1.
//
// References:
// - JEITA CP-3451C (Exif 2.3) section 4.6.4 (APP1 structure)
// - TIFF tag 0x0112 Orientation
// Parse the EXIF orientation value from a JPEG buffer.
// Returns 1..8 if found, or 1 (normal) if not present / not a JPEG.
function parseExifOrientation(buffer) {
if (!buffer || buffer.length < 4) return 1;
// JPEG must start with SOI marker 0xFFD8
if (buffer[0] !== 0xff || buffer[1] !== 0xd8) return 1;
let offset = 2;
while (offset + 1 < buffer.length) {
// Each marker: 0xFF then marker code
if (buffer[offset] !== 0xff) return 1;
const marker = buffer[offset + 1];
offset += 2;
// SOI (D8), EOI (D9), RSTn (D0-D7), TEM (01): no payload
if (marker === 0xd8 || marker === 0xd9) return 1;
if (marker >= 0xd0 && marker <= 0xd7) continue;
if (marker === 0x01) continue;
// SOS (DA): start of scan — EXIF would be before this
if (marker === 0xda) return 1;
// All other markers have a 2-byte length (including the length bytes)
if (offset + 1 >= buffer.length) return 1;
const length = (buffer[offset] << 8) | buffer[offset + 1];
if (length < 2 || offset + length > buffer.length) return 1;
// APP1 marker is 0xFFE1
if (marker === 0xe1) {
const orientation = tryParseApp1(buffer, offset, length);
if (orientation) return orientation;
}
offset += length;
}
return 1;
}
// Try to parse APP1 as EXIF. Returns orientation 1..8 or 0 if not EXIF.
function tryParseApp1(buffer, dataOffset, segmentLength) {
// APP1 data starts after the 2-byte length field
// EXIF header: "Exif\0\0" (6 bytes)
const exifHeader = dataOffset + 2;
if (exifHeader + 6 > dataOffset + segmentLength) return 0;
if (buffer[exifHeader] !== 0x45 || buffer[exifHeader + 1] !== 0x78 ||
buffer[exifHeader + 2] !== 0x69 || buffer[exifHeader + 3] !== 0x66 ||
buffer[exifHeader + 4] !== 0x00 || buffer[exifHeader + 5] !== 0x00) {
return 0; // not EXIF (could be XMP)
}
// TIFF header starts here
const tiffStart = exifHeader + 6;
if (tiffStart + 8 > dataOffset + segmentLength) return 0;
// Byte order: II (little-endian) or MM (big-endian)
const littleEndian = buffer[tiffStart] === 0x49 && buffer[tiffStart + 1] === 0x49;
const bigEndian = buffer[tiffStart] === 0x4d && buffer[tiffStart + 1] === 0x4d;
if (!littleEndian && !bigEndian) return 0;
const le = littleEndian;
// Magic number 42 (0x002A)
const magic = readU16(buffer, tiffStart + 2, le);
if (magic !== 0x002a) return 0;
// Offset to IFD0 from TIFF start
const ifdOffset = tiffStart + readU32(buffer, tiffStart + 4, le);
if (ifdOffset + 2 > dataOffset + segmentLength) return 0;
const entryCount = readU16(buffer, ifdOffset, le);
for (let i = 0; i < entryCount; i++) {
const entryOffset = ifdOffset + 2 + i * 12;
if (entryOffset + 12 > dataOffset + segmentLength) break;
const tag = readU16(buffer, entryOffset, le);
if (tag === 0x0112) { // Orientation
const type = readU16(buffer, entryOffset + 2, le);
const count = readU32(buffer, entryOffset + 4, le);
if (type === 3 && count === 1) { // SHORT
const value = readU16(buffer, entryOffset + 8, le);
if (value >= 1 && value <= 8) return value;
}
return 0;
}
}
return 0;
}
function readU16(buffer, offset, littleEndian) {
if (littleEndian) return buffer[offset] | (buffer[offset + 1] << 8);
return (buffer[offset] << 8) | buffer[offset + 1];
}
function readU32(buffer, offset, littleEndian) {
if (littleEndian) {
return (buffer[offset]) |
(buffer[offset + 1] << 8) |
(buffer[offset + 2] << 16) |
(buffer[offset + 3] << 24);
}
return (buffer[offset] << 24) |
(buffer[offset + 1] << 16) |
(buffer[offset + 2] << 8) |
(buffer[offset + 3]);
}
// Apply EXIF orientation to RGB pixel data.
// input: { data: Uint8Array (RGB), width, height }
// orientation: 1..8
// Returns { data, width, height } in pageSpace (orientation-corrected).
function applyOrientation(pixels, orientation) {
if (orientation === 1) return pixels; // normal, no transform
const { data, width: w, height: h } = pixels;
const channels = 3;
switch (orientation) {
case 2: // flip horizontal
return flipHorizontal(data, w, h, channels);
case 3: // rotate 180
return rotate180(data, w, h, channels);
case 4: // flip vertical
return flipVertical(data, w, h, channels);
case 5: // transpose (flip horizontal + rotate 270 CW)
return transpose(data, w, h, channels);
case 6: // rotate 90 CW
return rotate90CW(data, w, h, channels);
case 7: // transverse (flip horizontal + rotate 90 CW)
return transverse(data, w, h, channels);
case 8: // rotate 90 CCW (= 270 CW)
return rotate90CCW(data, w, h, channels);
default:
return pixels;
}
}
function alloc(w, h, channels) {
return { data: new Uint8Array(w * h * channels), width: w, height: h };
}
function flipHorizontal(data, w, h, c) {
const out = alloc(w, h, c);
for (let y = 0; y < h; y++) {
for (let x = 0; x < w; x++) {
const src = (y * w + x) * c;
const dst = (y * w + (w - 1 - x)) * c;
for (let i = 0; i < c; i++) out.data[dst + i] = data[src + i];
}
}
return out;
}
function flipVertical(data, w, h, c) {
const out = alloc(w, h, c);
for (let y = 0; y < h; y++) {
for (let x = 0; x < w; x++) {
const src = (y * w + x) * c;
const dst = ((h - 1 - y) * w + x) * c;
for (let i = 0; i < c; i++) out.data[dst + i] = data[src + i];
}
}
return out;
}
function rotate180(data, w, h, c) {
const out = alloc(w, h, c);
for (let y = 0; y < h; y++) {
for (let x = 0; x < w; x++) {
const src = (y * w + x) * c;
const dst = ((h - 1 - y) * w + (w - 1 - x)) * c;
for (let i = 0; i < c; i++) out.data[dst + i] = data[src + i];
}
}
return out;
}
function rotate90CW(data, w, h, c) {
// new dimensions: h x w
const out = alloc(h, w, c);
for (let y = 0; y < h; y++) {
for (let x = 0; x < w; x++) {
const src = (y * w + x) * c;
// (x, y) -> (h-1-y, x) in the new w'=h, h'=w grid
const dst = (x * h + (h - 1 - y)) * c;
for (let i = 0; i < c; i++) out.data[dst + i] = data[src + i];
}
}
return out;
}
function rotate90CCW(data, w, h, c) {
const out = alloc(h, w, c);
for (let y = 0; y < h; y++) {
for (let x = 0; x < w; x++) {
const src = (y * w + x) * c;
// (x, y) -> (y, w-1-x)
const dst = ((w - 1 - x) * h + y) * c;
for (let i = 0; i < c; i++) out.data[dst + i] = data[src + i];
}
}
return out;
}
function transpose(data, w, h, c) {
// transpose: (x,y) -> (y,x)
const out = alloc(h, w, c);
for (let y = 0; y < h; y++) {
for (let x = 0; x < w; x++) {
const src = (y * w + x) * c;
const dst = (x * h + y) * c;
for (let i = 0; i < c; i++) out.data[dst + i] = data[src + i];
}
}
return out;
}
function transverse(data, w, h, c) {
// transverse: (x,y) -> (h-1-y, w-1-x)
const out = alloc(h, w, c);
for (let y = 0; y < h; y++) {
for (let x = 0; x < w; x++) {
const src = (y * w + x) * c;
const dst = ((h - 1 - y) * h + (w - 1 - x)) * c;
for (let i = 0; i < c; i++) out.data[dst + i] = data[src + i];
}
}
return out;
}
module.exports = { parseExifOrientation, applyOrientation };
'use strict';
const fs = require('node:fs');
const path = require('node:path');
const runtime = require('./index.cjs');
function createModelFacade(config) {
if (!config || typeof config !== 'object') {
throw new TypeError('model facade config must be an object');
}
const {
model,
modelPackage,
compatibleBundleIds,
appleBundleIds = compatibleBundleIds,
developmentBundlePath,
profile,
} = config;
if (typeof model !== 'string' || model === '') {
throw new TypeError('model facade config requires model');
}
if (typeof modelPackage !== 'string' || modelPackage === '') {
throw new TypeError('model facade config requires modelPackage');
}
if (!Array.isArray(compatibleBundleIds) || compatibleBundleIds.length === 0) {
throw new TypeError('model facade config requires compatibleBundleIds');
}
if (!profile || typeof profile !== 'object' || profile.model !== model) {
throw new TypeError('model facade config requires a matching profile');
}
function resolveBuiltInBundle(selectedModel, requireApple) {
if (selectedModel !== model) {
throw new runtime.OcrError(
'invalid_argument',
`model must be ${JSON.stringify(model)}`,
);
}
let manifestPath;
if (developmentBundlePath) {
const candidate = path.resolve(developmentBundlePath, 'manifest.json');
if (fs.existsSync(candidate)) manifestPath = candidate;
}
if (!manifestPath) {
try {
manifestPath = require.resolve(`${modelPackage}/bundle/manifest.json`);
} catch (cause) {
throw new runtime.OcrError(
'package_load_failed',
`Unable to locate the built-in ${model} model`,
`Reinstall ${modelPackage}; ${cause instanceof Error ? cause.message : String(cause)}`,
);
}
}
let manifest;
try {
manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
} catch (cause) {
throw new runtime.OcrError(
'package_load_failed',
'Unable to read the built-in model manifest',
cause instanceof Error ? cause.message : String(cause),
);
}
const accepted = requireApple ? appleBundleIds : compatibleBundleIds;
if (!accepted.includes(manifest.bundleId)) {
throw new runtime.OcrError(
'package_load_failed',
`The installed model package is incompatible with the ${model} facade`,
`expected ${accepted.join(' or ')}, received ${String(manifest.bundleId)}`,
);
}
return path.dirname(manifestPath);
}
function resolveCreateOptions(options) {
if (options === undefined) options = {};
if (options === null || typeof options !== 'object' || Array.isArray(options)) {
throw new runtime.OcrError('invalid_argument', 'createEngine options must be an object');
}
const hasModel = Object.prototype.hasOwnProperty.call(options, 'model');
const hasBundlePath = Object.prototype.hasOwnProperty.call(options, 'bundlePath');
if (hasModel && hasBundlePath) {
throw new runtime.OcrError(
'invalid_argument',
'model and bundlePath cannot be used together',
);
}
if (hasBundlePath) return options;
const selectedModel = hasModel ? options.model : model;
const requireApple = options.execution?.provider === 'apple';
const resolved = {
...options,
bundlePath: resolveBuiltInBundle(selectedModel, requireApple),
};
delete resolved.model;
return resolved;
}
async function createEngine(options) {
return runtime.createEngine(resolveCreateOptions(options));
}
const modelProfile = Object.freeze({
...profile,
excludedLanguages: Object.freeze([...(profile?.excludedLanguages || [])]),
});
return Object.freeze({
createEngine,
OcrError: runtime.OcrError,
modelProfile,
});
}
module.exports = { createModelFacade };
'use strict';
const { loadNative } = require('./load-native.cjs');
class OcrError extends Error {
constructor(code, message, detail) {
super(message);
this.name = 'OcrError';
this.code = code;
if (detail !== undefined && detail !== '') this.detail = detail;
}
}
function normalizeNativeError(error) {
if (error && error.name === 'OcrError') {
Object.setPrototypeOf(error, OcrError.prototype);
}
return error;
}
function deepFreeze(value) {
if (!value || typeof value !== 'object' || Object.isFrozen(value)) return value;
for (const child of Object.values(value)) deepFreeze(child);
return Object.freeze(value);
}
function validateSignal(signal) {
if (
signal === null ||
typeof signal !== 'object' ||
typeof signal.aborted !== 'boolean' ||
typeof signal.addEventListener !== 'function' ||
typeof signal.removeEventListener !== 'function'
) {
throw new OcrError('invalid_argument', 'signal must be an AbortSignal');
}
}
function abortReason(signal) {
return signal.reason === undefined
? new DOMException('The operation was aborted', 'AbortError')
: signal.reason;
}
function resolveCreateOptions(options) {
if (options === undefined) options = {};
if (options === null || typeof options !== 'object' || Array.isArray(options)) {
throw new OcrError('invalid_argument', 'createEngine options must be an object');
}
const hasModel = Object.prototype.hasOwnProperty.call(options, 'model');
const hasBundlePath = Object.prototype.hasOwnProperty.call(options, 'bundlePath');
if (hasModel) {
throw new OcrError(
'invalid_argument',
'@arcships/light-ocr-runtime is model-free; pass bundlePath or use a model facade',
);
}
if (!hasBundlePath || typeof options.bundlePath !== 'string' || options.bundlePath === '') {
throw new OcrError(
'invalid_argument',
'@arcships/light-ocr-runtime requires a non-empty bundlePath',
);
}
return options;
}
class OcrEngineImpl {
#native;
#closePromise;
constructor(nativeEngine) {
this.#native = nativeEngine;
this.info = deepFreeze(nativeEngine.info);
Object.defineProperty(this, 'info', { writable: false, configurable: false });
}
recognize(image, options = {}) {
return this.#recognize('recognize', image, options);
}
recognizeEncoded(data, options = {}) {
return this.#recognize('recognizeEncoded', data, options);
}
detect(data, options = {}) {
return this.#recognize('detect', data, options);
}
#recognize(nativeMethod, image, options) {
let signal;
let nativeOptions;
try {
if (options === null || typeof options !== 'object' || Array.isArray(options)) {
throw new OcrError('invalid_argument', 'recognize options must be an object');
}
signal = options.signal;
if (signal !== undefined) {
validateSignal(signal);
if (signal.aborted) return Promise.reject(abortReason(signal));
}
nativeOptions = { ...options };
delete nativeOptions.signal;
} catch (error) {
return Promise.reject(normalizeNativeError(error));
}
let operation;
try {
operation = this.#native[nativeMethod](image, nativeOptions);
} catch (error) {
return Promise.reject(normalizeNativeError(error));
}
return new Promise((resolve, reject) => {
let settled = false;
const cleanup = () => {
if (signal !== undefined) signal.removeEventListener('abort', onAbort);
};
const settle = (callback, value) => {
if (settled) return;
settled = true;
cleanup();
callback(value);
};
const onAbort = () => {
if (settled) return;
try {
this.#native.cancel(operation.requestId);
} catch {
// Public cancellation still wins. Native teardown owns any remaining work.
}
settle(reject, abortReason(signal));
};
operation.promise.then(
(value) => settle(resolve, value),
(error) => settle(reject, normalizeNativeError(error)),
);
if (signal !== undefined) {
signal.addEventListener('abort', onAbort, { once: true });
if (signal.aborted) onAbort();
}
});
}
close() {
if (this.#closePromise === undefined) {
try {
this.#closePromise = Promise.resolve(this.#native.close()).catch((error) => {
throw normalizeNativeError(error);
});
} catch (error) {
this.#closePromise = Promise.reject(normalizeNativeError(error));
}
}
return this.#closePromise;
}
}
let nativeRuntime;
async function createEngine(options) {
try {
const resolvedOptions = resolveCreateOptions(options);
if (!nativeRuntime) nativeRuntime = loadNative();
const nativeEngine = await nativeRuntime.binding.createEngine(
resolvedOptions,
nativeRuntime.runtimePolicy,
);
return new OcrEngineImpl(nativeEngine);
} catch (error) {
throw normalizeNativeError(error);
}
}
module.exports = { createEngine, OcrError, loadNative };
/// <reference types="node" />
export type PixelFormat = 'gray8' | 'rgb8' | 'bgr8' | 'rgba8';
export type DetectionStrategy = 'bounded' | 'tiled' | 'upstreamExact';
export type ExecutionProvider = 'auto' | 'cpu' | 'apple' | 'webgpu';
export type SessionFallback = 'error' | 'cpu';
export type CpuPartition = 'allow' | 'forbid';
export type PerformanceHint = 'latency' | 'throughput';
/** WebGPU accepts auto/fp32; fp16 is reserved for the Apple provider. */
export type Precision = 'auto' | 'fp32' | 'fp16';
export interface ModelProfile {
readonly tier: 'tiny' | 'small' | 'medium';
readonly model: string;
readonly bundleId: string;
readonly languages: number;
readonly excludedLanguages: readonly string[];
readonly dictionaryEntries: number;
readonly maturity: 'preview' | 'stable';
}
export interface DetectionOptions {
readonly strategy?: DetectionStrategy;
readonly maxSide?: number;
}
export interface ExecutionOptions {
/** Only providers shipped and qualified by this release appear in this union. */
readonly provider?: ExecutionProvider;
readonly sessionFallback?: SessionFallback;
readonly cpuPartition?: CpuPartition;
readonly deviceId?: number;
readonly performanceHint?: PerformanceHint;
readonly precision?: Precision;
}
export interface RawImage {
readonly data: Uint8Array;
readonly width: number;
readonly height: number;
readonly stride: number;
readonly pixelFormat: PixelFormat;
}
export interface ResourceLimits {
readonly maxWidth: number;
readonly maxHeight: number;
readonly maxPixels: number;
readonly maxDetectionSide: number;
readonly maxDetectionCandidates: number;
readonly maxDetectionTiles: number;
readonly maxRecognitionBatchSize: number;
readonly maxRecognitionWidth: number;
readonly maxTemporaryBytes: number;
}
export interface CreateEngineOptions {
readonly bundlePath: string;
readonly intraOpThreads?: number;
readonly interOpThreads?: number;
readonly recognitionScoreThreshold?: number;
readonly recognitionBatchSize?: number;
readonly reducedLimits?: Omit<ResourceLimits, 'maxDetectionTiles'> & {
/** Omission preserves the 0.1 reducedLimits source shape. */
readonly maxDetectionTiles?: number;
};
readonly queueCapacity?: number;
readonly maxPendingInputBytes?: number;
readonly detection?: DetectionOptions;
readonly execution?: ExecutionOptions;
}
export interface RecognizeOptions {
readonly recognitionScoreThreshold?: number;
readonly recognitionBatchSize?: number;
readonly includeDiagnostics?: boolean;
readonly signal?: AbortSignal;
readonly useTextlineOrientation?: boolean;
readonly detectionMaxSide?: number;
readonly applyExif?: boolean;
readonly region?: Rect;
}
export interface Point { readonly x: number; readonly y: number }
export interface Rect {
readonly x: number;
readonly y: number;
readonly width: number;
readonly height: number;
}
export interface OcrLine {
readonly text: string;
readonly confidence: number;
readonly box: readonly [Point, Point, Point, Point];
}
export type RejectionReason = 'below_score_threshold' | 'empty_decode';
export interface RejectedLine { readonly line: OcrLine; readonly reason: RejectionReason }
export interface DiagnosticWarning { readonly code: string; readonly message: string }
export interface RecognitionBatchShape {
readonly batchSize: number;
readonly height: number;
readonly width: number;
readonly computeUnit: 'cpu' | 'ane' | 'gpu';
readonly modelId: string;
readonly shapeBucket: string;
}
export interface DetectionPassShape {
readonly tileOrdinal: number;
readonly x: number;
readonly y: number;
readonly width: number;
readonly height: number;
readonly tensorWidth: number;
readonly tensorHeight: number;
readonly contourCandidates: number;
readonly rawCandidates: number;
}
export interface Diagnostics {
readonly rejectedLines: readonly RejectedLine[];
readonly warnings: readonly DiagnosticWarning[];
readonly detectedCandidates: number;
readonly acceptedBoxes: number;
readonly detectionInputWidth: number;
readonly detectionInputHeight: number;
readonly rawDetectionBoxes: number;
readonly suppressedDuplicateBoxes: number;
readonly maxLiveDetectionPassBuffers: number;
readonly detectionPasses: readonly DetectionPassShape[];
readonly recognitionBatchShapes: readonly RecognitionBatchShape[];
}
export interface TimingUs {
readonly total: number;
readonly decode: number;
readonly inputValidation: number;
readonly detectionPreprocess: number;
readonly detectionInference: number;
readonly detectionPostprocess: number;
readonly detectionMerge: number;
readonly cropAndSort: number;
readonly recognitionPreprocess: number;
readonly recognitionInference: number;
readonly recognitionPostprocess: number;
}
export interface OcrResult {
readonly lines: readonly OcrLine[];
readonly imageWidth: number;
readonly imageHeight: number;
readonly modelBundleId: string;
readonly timingUs: TimingUs;
readonly diagnostics?: Diagnostics;
}
export interface TiledDetectionInfo {
readonly contractVersion: 'tiled-v1';
readonly tileSide: 1280;
readonly minimumOverlap: 128;
readonly artificialBoundaryMargin: 32;
readonly mergeIouThreshold: 0.5;
readonly mergeIosThreshold: 0.8;
}
export interface ProviderCapabilityInfo {
readonly provider: string;
readonly packageIncluded: boolean;
readonly deviceAvailable: boolean;
/** True only when this exact hardware family has reviewed qualification evidence. */
readonly deviceValidated: boolean;
}
export interface SessionExecutionInfo {
readonly requestedProvider: string;
readonly actualProviderChain: readonly string[];
readonly device: string;
readonly deviceFamily: string;
readonly operatingSystem: string;
readonly precision: string;
readonly shapePolicy: string;
readonly modelId: string;
readonly modelSha256: string;
readonly runtime: string;
readonly runtimeVersion: string;
readonly providerVersion: string;
readonly modelCacheStatus: string;
readonly qualificationId: string;
/** False means the open macOS compatibility path is experimental on this device. */
readonly deviceValidated: boolean;
readonly sessionFallback: boolean;
readonly fallbackReason?: string;
}
export type CreationReason =
| 'adapter_unavailable' | 'model_compute_unsupported'
| 'device_memory_insufficient' | 'driver_version_unsupported'
| 'package_corrupt' | 'artifact_hash_mismatch' | 'provider_abi_mismatch'
| 'internal_assertion_failed' | 'unrecoverable_load_failed';
export type CreationAttemptStatus = 'selected' | 'skipped' | 'fatal';
export interface CreationAttempt {
readonly provider: string;
readonly status: CreationAttemptStatus;
readonly creationReason?: CreationReason;
readonly errorCode?: CoreErrorCode;
}
export interface CreationTrace {
readonly requestedProvider: string;
readonly policyId?: string;
readonly policyVersion?: number;
readonly orderedCandidates: readonly string[];
readonly attempts: readonly CreationAttempt[];
readonly selectedProvider?: string;
}
export interface ExecutionInfo {
readonly requestedProvider: ExecutionProvider;
readonly sessionFallback: SessionFallback;
readonly cpuPartition: CpuPartition;
readonly deviceId?: number;
readonly performanceHint: PerformanceHint;
readonly requestedPrecision: Precision;
readonly providerCapabilities: readonly ProviderCapabilityInfo[];
readonly selectionTrace: CreationTrace;
readonly sessions: {
readonly detection: SessionExecutionInfo;
readonly recognition: SessionExecutionInfo;
};
}
export interface EngineInfo {
readonly coreVersion: string;
readonly modelBundleId: string;
readonly modelBundleSchemaVersion: string;
readonly normalizedConfigSchemaVersion: string;
readonly backend: string;
/** @deprecated Use execution.sessions for stage-specific provider details. */
readonly executionProvider: string;
readonly execution: ExecutionInfo;
readonly capabilities: {
readonly detection: boolean;
readonly recognition: boolean;
readonly textlineOrientation: boolean;
readonly tiledDetection: boolean;
};
readonly concurrencyMode: 'serialized_reject_when_busy';
readonly limits: ResourceLimits & { readonly maxConcurrentCalls: 1 };
readonly intraOpThreads: number;
readonly interOpThreads: number;
readonly detectionStrategy: DetectionStrategy;
readonly detectionMaxSide: number;
readonly tiledDetection?: TiledDetectionInfo;
readonly defaultRecognitionScoreThreshold: number;
readonly defaultRecognitionBatchSize: number;
readonly adapter: {
readonly scheduler: 'dedicated_fifo';
readonly queueCapacity: number;
readonly maxPendingInputBytes: number;
};
}
export type CoreErrorCode =
| 'invalid_argument' | 'invalid_image' | 'unsupported_pixel_format'
| 'unsupported_capability' | 'invalid_model_bundle' | 'unsupported_model'
| 'model_integrity_failed' | 'runtime_initialization_failed' | 'inference_failed'
| 'postprocess_failed' | 'resource_limit_exceeded' | 'invalid_engine'
| 'internal_error';
export type AdapterErrorCode =
| 'bundle_io_failed' | 'queue_full' | 'environment_closing'
| 'unsupported_platform' | 'package_load_failed';
export type OcrErrorCode = CoreErrorCode | AdapterErrorCode;
export class OcrError extends Error {
constructor(code: OcrErrorCode, message: string, detail?: string);
readonly name: 'OcrError';
readonly code: OcrErrorCode;
readonly detail?: string;
readonly creationTrace?: CreationTrace;
}
export interface OcrEngine {
readonly info: EngineInfo;
recognize(image: RawImage, options?: RecognizeOptions): Promise<OcrResult>;
recognizeEncoded(data: Uint8Array, options?: RecognizeOptions): Promise<OcrResult>;
detect(data: Uint8Array, options?: RecognizeOptions): Promise<DetectionResult>;
close(): Promise<void>;
}
export interface DetectionBox {
readonly score: number;
readonly box: readonly [Point, Point, Point, Point];
}
export interface DetectionResult {
readonly boxes: readonly DetectionBox[];
readonly imageWidth: number;
readonly imageHeight: number;
readonly modelBundleId: string;
readonly timingUs: TimingUs;
}
export function createEngine(options: CreateEngineOptions): Promise<OcrEngine>;
import cjs from './index.cjs';
export const createEngine = cjs.createEngine;
export const OcrError = cjs.OcrError;
'use strict';
const crypto = require('node:crypto');
const fs = require('node:fs');
const path = require('node:path');
function adapterError(code, message, detail, cause) {
const error = new Error(message, cause === undefined ? undefined : { cause });
error.name = 'OcrError';
error.code = code;
if (detail) error.detail = detail;
return error;
}
function platformIdentity() {
const key = `${process.platform}-${process.arch}`;
const identities = {
'darwin-arm64': { id: 'macos-arm64', os: 'darwin', architecture: 'arm64' },
'darwin-x64': { id: 'macos-x64', os: 'darwin', architecture: 'x86_64' },
'win32-arm64': { id: 'windows-arm64', os: 'win32', architecture: 'arm64' },
'win32-x64': { id: 'windows-x64', os: 'win32', architecture: 'x86_64' },
};
if (key === 'linux-x64') {
const report = process.report?.getReport?.();
if (report?.header?.glibcVersionRuntime) {
return { id: 'linux-x64', os: 'linux', architecture: 'x86_64', libc: 'glibc' };
}
throw adapterError(
'unsupported_platform',
'light-ocr currently supports Linux x64 with glibc only',
key,
);
}
if (key === 'linux-arm64') {
const report = process.report?.getReport?.();
if (report?.header?.glibcVersionRuntime) {
return { id: 'linux-arm64', os: 'linux', architecture: 'arm64', libc: 'glibc' };
}
throw adapterError(
'unsupported_platform',
'light-ocr currently supports Linux arm64 with glibc only',
key,
);
}
const identity = identities[key];
if (!identity) {
throw adapterError('unsupported_platform', `light-ocr does not support ${key}`, key);
}
return identity;
}
function platformPackage() {
const packages = {
'macos-arm64': '@arcships/light-ocr-darwin-arm64',
'macos-x64': '@arcships/light-ocr-darwin-x64',
'windows-arm64': '@arcships/light-ocr-win32-arm64',
'windows-x64': '@arcships/light-ocr-win32-x64',
'linux-x64': '@arcships/light-ocr-linux-x64-gnu',
'linux-arm64': '@arcships/light-ocr-linux-arm64-gnu',
};
return packages[platformIdentity().id];
}
function exactKeys(value, expected, field) {
if (!value || typeof value !== 'object' || Array.isArray(value)) {
throw adapterError('package_load_failed', `${field} must be an object`);
}
const actual = Object.keys(value).sort();
const wanted = [...expected].sort();
if (actual.length !== wanted.length || actual.some((key, index) => key !== wanted[index])) {
throw adapterError('package_load_failed', `${field} fields are invalid`);
}
}
function safeArtifactPath(root, value, field) {
if (typeof value !== 'string' || value === '' || value.includes('\0')) {
throw adapterError('package_load_failed', `${field} must be a package-relative path`);
}
const normalized = value.replaceAll('\\', '/');
if (
path.posix.isAbsolute(normalized) ||
/^[A-Za-z]:/.test(normalized) ||
normalized.split('/').some((part) => part === '..' || part === '' || part === '.')
) {
throw adapterError('package_load_failed', `${field} escapes the native package`, value);
}
const resolved = path.resolve(root, ...normalized.split('/'));
const relative = path.relative(path.resolve(root), resolved);
if (relative.startsWith('..') || path.isAbsolute(relative)) {
throw adapterError('package_load_failed', `${field} escapes the native package`, value);
}
return resolved;
}
function sha256(filename) {
return crypto.createHash('sha256').update(fs.readFileSync(filename)).digest('hex');
}
function verifyArtifact(root, artifact, field) {
exactKeys(artifact, ['path', 'bytes', 'sha256'], field);
const filename = safeArtifactPath(root, artifact.path, `${field}.path`);
let stats;
try {
stats = fs.lstatSync(filename);
} catch (cause) {
throw adapterError('package_load_failed', 'Descriptor artifact is missing', artifact.path, cause);
}
if (!stats.isFile() || stats.isSymbolicLink()) {
throw adapterError('package_load_failed', 'Descriptor artifact is not a regular file', artifact.path);
}
if (!Number.isSafeInteger(artifact.bytes) || artifact.bytes < 1 || stats.size !== artifact.bytes) {
throw adapterError('package_load_failed', 'Descriptor artifact byte count mismatch', artifact.path);
}
if (!/^[a-f0-9]{64}$/.test(artifact.sha256 || '') || sha256(filename) !== artifact.sha256) {
throw adapterError('package_load_failed', 'Descriptor artifact hash mismatch', artifact.path);
}
return filename;
}
function sameArtifact(left, right) {
return left?.path === right?.path && left?.bytes === right?.bytes &&
left?.sha256 === right?.sha256;
}
function validateRuntimeDescriptor(descriptorPath) {
const absoluteDescriptor = path.resolve(descriptorPath);
const nativeDirectory = path.dirname(absoluteDescriptor);
if (
path.basename(absoluteDescriptor) !== 'runtime-descriptor.json' ||
path.basename(nativeDirectory) !== 'native'
) {
throw adapterError(
'package_load_failed',
'Native runtime descriptor must use the package native/runtime-descriptor.json path',
absoluteDescriptor,
);
}
let descriptor;
try {
const nativeStats = fs.lstatSync(nativeDirectory);
if (!nativeStats.isDirectory() || nativeStats.isSymbolicLink()) {
throw new Error('native payload root is not a regular directory');
}
const stats = fs.lstatSync(absoluteDescriptor);
if (!stats.isFile() || stats.isSymbolicLink()) throw new Error('not a regular file');
descriptor = JSON.parse(fs.readFileSync(absoluteDescriptor, 'utf8'));
} catch (cause) {
throw adapterError(
'package_load_failed',
'Unable to read the native runtime descriptor',
absoluteDescriptor,
cause,
);
}
exactKeys(
descriptor,
['schemaVersion', 'platform', 'runtime', 'qualificationOnly', 'released',
'autoPolicy', 'providers', 'addon'],
'runtime descriptor',
);
if (descriptor.schemaVersion !== '2.0') {
throw adapterError('package_load_failed', 'Unsupported native runtime descriptor schema');
}
const root = path.dirname(path.dirname(absoluteDescriptor));
const expected = platformIdentity();
const expectedPlatformKeys = expected.libc
? ['id', 'os', 'architecture', 'libc']
: ['id', 'os', 'architecture'];
exactKeys(descriptor.platform, expectedPlatformKeys, 'platform');
const actual = descriptor.platform;
if (
actual.id !== expected.id ||
actual.os !== expected.os ||
actual.architecture !== expected.architecture ||
(expected.libc && actual.libc !== expected.libc)
) {
throw adapterError('package_load_failed', 'Native runtime descriptor platform mismatch');
}
if (
typeof descriptor.released !== 'boolean' ||
typeof descriptor.qualificationOnly !== 'boolean' ||
descriptor.qualificationOnly === descriptor.released
) {
throw adapterError('package_load_failed', 'Native runtime descriptor release flags are invalid');
}
exactKeys(descriptor.autoPolicy, ['id', 'version', 'providers'], 'autoPolicy');
const policy = descriptor.autoPolicy;
if (
typeof policy.id !== 'string' || policy.id === '' ||
!Number.isSafeInteger(policy.version) || policy.version < 1 || policy.version > 0xffffffff ||
!Array.isArray(policy.providers) || policy.providers.length === 0 ||
policy.providers.length > 3 || policy.providers.at(-1) !== 'cpu' ||
new Set(policy.providers).size !== policy.providers.length
) {
throw adapterError('package_load_failed', 'Native runtime descriptor Auto policy is invalid');
}
exactKeys(descriptor.runtime, ['flavor', 'kind', 'version', 'abi', 'artifacts'], 'runtime');
const runtime = descriptor.runtime;
const expectedRuntimes = {
cpu: { kind: 'onnxruntime-cpu', version: '1.22.0', abi: 'onnxruntime-c-api-22' },
webgpu: {
kind: 'onnxruntime-plugin-webgpu',
version: '1.24.4',
abi: 'onnxruntime-c-api-24-plugin-ep-0.1',
},
};
const expectedRuntime = expectedRuntimes[runtime.flavor];
if (
!expectedRuntime || runtime.kind !== expectedRuntime.kind ||
runtime.version !== expectedRuntime.version || runtime.abi !== expectedRuntime.abi ||
!Array.isArray(runtime.artifacts) || runtime.artifacts.length === 0
) {
throw adapterError('package_load_failed', 'Native runtime descriptor ABI identity is invalid');
}
if (runtime.flavor === 'webgpu' && !['linux', 'win32'].includes(actual.os)) {
throw adapterError('package_load_failed', 'WebGPU runtime is not supported on this platform');
}
if (runtime.flavor !== 'webgpu' && descriptor.qualificationOnly) {
throw adapterError('package_load_failed', 'CPU runtime cannot be qualification-only');
}
const addon = verifyArtifact(root, descriptor.addon, 'addon');
const runtimePaths = new Set();
const verifiedRuntime = new Map();
runtime.artifacts.forEach((artifact, index) => {
const filename = verifyArtifact(root, artifact, `runtime.artifacts[${index}]`);
if (runtimePaths.has(artifact.path)) {
throw adapterError('package_load_failed', 'Runtime artifact inventory contains a duplicate path');
}
runtimePaths.add(artifact.path);
verifiedRuntime.set(artifact.path, filename);
});
exactKeys(descriptor.providers, Object.keys(descriptor.providers), 'providers');
const availableProviders = Object.keys(descriptor.providers);
if (
availableProviders.length === 0 ||
new Set(availableProviders).size !== availableProviders.length ||
availableProviders.some((provider) => !['cpu', 'apple', 'webgpu'].includes(provider)) ||
!descriptor.providers.cpu
) {
throw adapterError('package_load_failed', 'Native runtime descriptor provider policy is invalid');
}
let webgpuLibrary = '';
let webgpuProviderBytes = 0;
let webgpuProviderSha256 = '';
for (const [providerId, provider] of Object.entries(descriptor.providers)) {
const expectedKeys = providerId === 'webgpu'
? ['runtimeProvider', 'providerVersion', 'qualificationId', 'providerLibrary', 'artifacts']
: ['runtimeProvider', 'qualificationId', 'artifacts'];
exactKeys(provider, expectedKeys, `providers.${providerId}`);
if (
typeof provider.qualificationId !== 'string' || provider.qualificationId === '' ||
!Array.isArray(provider.artifacts) || provider.artifacts.length === 0
) {
throw adapterError('package_load_failed', `Provider ${providerId} identity is invalid`);
}
const expectedProviderName = {
cpu: 'CPUExecutionProvider',
apple: 'CoreML',
webgpu: 'WebGpuExecutionProvider',
}[providerId];
if (provider.runtimeProvider !== expectedProviderName) {
throw adapterError('package_load_failed', `Provider ${providerId} runtime identity is invalid`);
}
const providerPaths = new Set();
provider.artifacts.forEach((artifact, index) => {
verifyArtifact(root, artifact, `providers.${providerId}.artifacts[${index}]`);
if (providerPaths.has(artifact.path)) {
throw adapterError('package_load_failed', `Provider ${providerId} has duplicate artifacts`);
}
providerPaths.add(artifact.path);
if (providerId !== 'apple' && !runtimePaths.has(artifact.path)) {
throw adapterError('package_load_failed', `Provider ${providerId} artifact is outside runtime inventory`);
}
if (providerId === 'apple' && artifact.path !== descriptor.addon.path) {
throw adapterError('package_load_failed', 'Apple provider artifact must be the native addon');
}
});
if (providerId === 'webgpu') {
if (provider.providerVersion !== '0.1.0') {
throw adapterError('package_load_failed', 'WebGPU provider version is invalid');
}
webgpuLibrary = verifyArtifact(root, provider.providerLibrary, 'providers.webgpu.providerLibrary');
const declared = provider.artifacts.find(
(artifact) => artifact.path === provider.providerLibrary.path,
);
const expectedBasename = actual.os === 'win32'
? 'onnxruntime_providers_webgpu.dll'
: 'libonnxruntime_providers_webgpu.so';
if (
!declared || !sameArtifact(declared, provider.providerLibrary) ||
path.basename(webgpuLibrary) !== expectedBasename
) {
throw adapterError('package_load_failed', 'WebGPU provider library contract is invalid');
}
webgpuProviderBytes = provider.providerLibrary.bytes;
webgpuProviderSha256 = provider.providerLibrary.sha256;
}
}
const coreName = actual.os === 'win32'
? 'onnxruntime.dll'
: actual.os === 'darwin'
? 'libonnxruntime.1.22.0.dylib'
: 'libonnxruntime.so.1';
const runtimeNames = [...verifiedRuntime.values()].map((filename) => path.basename(filename)).sort();
const expectedRuntimeNames = runtime.flavor === 'webgpu'
? actual.os === 'win32'
? ['dxcompiler.dll', 'dxil.dll', 'onnxruntime.dll', 'onnxruntime_providers_webgpu.dll']
: ['libonnxruntime.so.1', 'libonnxruntime_providers_webgpu.so']
: [coreName];
if (
runtimeNames.length !== expectedRuntimeNames.length ||
runtimeNames.some((name, index) => name !== expectedRuntimeNames[index])
) {
throw adapterError('package_load_failed', 'Native runtime artifact set is incomplete');
}
const cpuArtifacts = descriptor.providers.cpu.artifacts;
if (
cpuArtifacts.length !== 1 ||
path.basename(safeArtifactPath(root, cpuArtifacts[0].path, 'CPU artifact path')) !== coreName
) {
throw adapterError('package_load_failed', 'CPU provider does not reference the core runtime');
}
const actualPayload = new Set();
const inventory = (directory, relativeDirectory) => {
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
const relative = `${relativeDirectory}/${entry.name}`;
const filename = path.join(directory, entry.name);
if (entry.isSymbolicLink()) {
throw adapterError('package_load_failed', 'Native runtime payload contains a symlink', relative);
}
if (entry.isDirectory()) {
inventory(filename, relative);
} else if (entry.isFile() && relative !== 'native/runtime-descriptor.json') {
actualPayload.add(relative);
} else if (!entry.isFile()) {
throw adapterError('package_load_failed', 'Native runtime payload is not a regular file', relative);
}
}
};
inventory(nativeDirectory, 'native');
const referenced = new Set([descriptor.addon.path, ...runtimePaths]);
if (
actualPayload.size !== referenced.size ||
[...actualPayload].some((filename) => !referenced.has(filename))
) {
throw adapterError('package_load_failed', 'Native runtime descriptor payload inventory mismatch');
}
const expectedPolicy = runtime.flavor === 'webgpu'
? ['webgpu', 'cpu']
: actual.id === 'macos-arm64'
? ['apple', 'cpu']
: ['cpu'];
const expectedAvailable = runtime.flavor === 'webgpu'
? ['cpu', 'webgpu']
: actual.id === 'macos-arm64'
? ['apple', 'cpu']
: ['cpu'];
const sortedAvailable = [...availableProviders].sort();
if (
policy.providers.length !== expectedPolicy.length ||
policy.providers.some((provider, index) => provider !== expectedPolicy[index]) ||
sortedAvailable.length !== expectedAvailable.length ||
sortedAvailable.some((provider, index) => provider !== expectedAvailable[index]) ||
policy.providers.some((provider) => !availableProviders.includes(provider))
) {
throw adapterError(
'package_load_failed',
'Native runtime descriptor providers disagree with platform capabilities',
);
}
const providerQualificationIds = sortedAvailable.map(
(providerId) => descriptor.providers[providerId].qualificationId,
);
const runtimePolicy = Object.freeze({
id: policy.id,
version: policy.version,
platformId: actual.id,
runtimeFlavor: runtime.flavor,
runtimeVersion: runtime.version,
runtimeAbi: runtime.abi,
qualificationOnly: descriptor.qualificationOnly,
released: descriptor.released,
orderedCandidates: Object.freeze([...policy.providers]),
availableProviders: Object.freeze(sortedAvailable),
providerQualificationIds: Object.freeze(providerQualificationIds),
webgpuProviderLibrary: webgpuLibrary,
webgpuProviderBytes,
webgpuProviderSha256,
});
return {
addon,
descriptor: Object.freeze(descriptor),
descriptorPath: absoluteDescriptor,
runtimePolicy,
};
}
function resolveDevelopmentInput() {
if (!process.env.LIGHT_OCR_NODE_BINARY) return undefined;
const binary = path.resolve(process.env.LIGHT_OCR_NODE_BINARY);
const descriptor = process.env.LIGHT_OCR_RUNTIME_DESCRIPTOR
? path.resolve(process.env.LIGHT_OCR_RUNTIME_DESCRIPTOR)
: path.join(path.dirname(binary), 'runtime-descriptor.json');
return { binary, descriptor };
}
function validateNativeContract(binding, runtimePolicy) {
const contract = binding?.runtimeContract;
const fields = [
'policyId',
'policyVersion',
'platformId',
'runtimeFlavor',
'runtimeVersion',
'runtimeAbi',
'qualificationOnly',
'released',
];
const policyFields = {
policyId: runtimePolicy.id,
policyVersion: runtimePolicy.version,
platformId: runtimePolicy.platformId,
runtimeFlavor: runtimePolicy.runtimeFlavor,
runtimeVersion: runtimePolicy.runtimeVersion,
runtimeAbi: runtimePolicy.runtimeAbi,
qualificationOnly: runtimePolicy.qualificationOnly,
released: runtimePolicy.released,
};
if (
!contract ||
typeof contract !== 'object' ||
fields.some((field) => contract[field] !== policyFields[field]) ||
!Array.isArray(contract.orderedCandidates) ||
!Array.isArray(contract.availableProviders) ||
!Array.isArray(contract.providerQualificationIds) ||
contract.orderedCandidates.length !== runtimePolicy.orderedCandidates.length ||
contract.orderedCandidates.some(
(provider, index) => provider !== runtimePolicy.orderedCandidates[index],
) ||
contract.availableProviders.length !== runtimePolicy.availableProviders.length ||
contract.availableProviders.some(
(provider, index) => provider !== runtimePolicy.availableProviders[index],
) ||
contract.providerQualificationIds.length !== runtimePolicy.providerQualificationIds.length ||
contract.providerQualificationIds.some(
(qualificationId, index) => qualificationId !== runtimePolicy.providerQualificationIds[index],
)
) {
throw adapterError(
'package_load_failed',
'Runtime descriptor is incompatible with the native addon ABI or capabilities',
);
}
}
function loadNative() {
const development = resolveDevelopmentInput();
let input;
if (development) {
input = development;
} else {
const packageName = platformPackage();
try {
const binary = require.resolve(packageName);
input = { binary, descriptor: path.join(path.dirname(binary), 'runtime-descriptor.json') };
} catch (cause) {
throw adapterError(
'package_load_failed',
`Unable to locate ${packageName}`,
'Reinstall @arcships/light-ocr without --omit=optional and verify that the current platform is supported.',
cause,
);
}
}
if (!fs.existsSync(input.binary)) {
throw adapterError('package_load_failed', 'Native addon is missing', input.binary);
}
const verified = validateRuntimeDescriptor(input.descriptor);
if (path.resolve(input.binary) !== path.resolve(verified.addon)) {
throw adapterError('package_load_failed', 'Runtime descriptor addon path mismatch', input.binary);
}
try {
const binding = require(verified.addon);
validateNativeContract(binding, verified.runtimePolicy);
return Object.freeze({ binding, runtimePolicy: verified.runtimePolicy });
} catch (cause) {
throw adapterError('package_load_failed', 'Unable to load the verified native addon', '', cause);
}
}
module.exports = { loadNative, validateRuntimeDescriptor };
'use strict';
module.exports = Object.freeze({ coreVersion: '0.5.5' });
MIT License
Copyright (c) 2026 xonaman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# Third-Party Notices
`pdfium-native` is distributed under the [MIT License](./LICENSE). It bundles
and/or links against the third-party native components listed below. Each
component remains under its own license; the relevant license texts are shipped
inside the prebuilt PDFium distribution under `deps/pdfium/licenses/`.
## Bundled native libraries
| Component | Version | License |
| -------------------------------------------------- | --------------- | --------------------------------------- |
| [PDFium](https://pdfium.googlesource.com/pdfium/) | `chromium/7749` | BSD-3-Clause |
| [stb_image_write](https://github.com/nothings/stb) | `v1.16` | Public Domain (Unlicense) or MIT (dual) |
- **PDFium** — the PDF rendering and parsing engine, consumed as a prebuilt
shared library from
[bblanchon/pdfium-binaries](https://github.com/bblanchon/pdfium-binaries).
Copyright The PDFium Authors. Licensed under BSD-3-Clause.
- **stb_image_write** — single-header PNG/JPEG encoder vendored in
`src/stb_image_write.{h,cc}`, used to encode rendered bitmaps. By Sean Barrett
(and based on Jon Olick's public-domain JPEG writer). Dual-licensed: you may
use it under the MIT License or as public domain (Unlicense).
## Components statically linked into the prebuilt PDFium library
The prebuilt PDFium shared library statically incorporates the third-party
components below. Their versions track the upstream PDFium `chromium/7749`
build; full license texts are provided in `deps/pdfium/licenses/`.
| Component | License |
| ------------------------- | ----------------------------------------- |
| Abseil | Apache-2.0 |
| Anti-Grain Geometry (2.3) | Anti-Grain Geometry License (permissive) |
| fast_float | MIT (also Apache-2.0 / BSL-1.0) |
| FreeType | FreeType License (FTL) or GPLv2 |
| ICU | Unicode License v3 |
| Little CMS (lcms2) | MIT |
| libjpeg-turbo | BSD-3-Clause and IJG License |
| OpenJPEG | BSD-2-Clause |
| libpng | libpng License (PNG Reference Library v2) |
| libtiff | libtiff License (MIT/BSD-style) |
| LLVM libc | Apache-2.0 with LLVM Exceptions |
| simdutf | MIT (also Apache-2.0) |
| zlib (1.3.1) | zlib License |
If you redistribute `pdfium-native` (or its prebuilt binaries), you must retain
the above notices and the corresponding license texts.
+102
-82

@@ -8,30 +8,10 @@ {

"arch": "arm64",
"lightOcrVersion": "0.3.0",
"lightOcrVersion": "0.5.5",
"bundleId": "ppocrv6-small-native-20260719.1",
"facade": "facade/js/index.cjs",
"engine": "engine/src/index.cjs",
"modelBundle": "model/bundle",
"nativeAddon": "facade/node_modules/@arcships/light-ocr-darwin-arm64/native/light_ocr_node.node",
"nativeAddon": "engine/node_modules/@arcships/light-ocr-darwin-arm64/native/light_ocr_node.node",
"inventory": [
{
"path": "facade/js/index.cjs",
"size": 6775,
"sha256": "b853a72b910c352239e012063cb4cbaef19981484ede3f1fa74fd9b188448dcb"
},
{
"path": "facade/js/index.d.ts",
"size": 9525,
"sha256": "a2aae806b892f0ab57f8406704100d2a43d035a6b792cdfc7b04d9ebd32090e2"
},
{
"path": "facade/js/index.mjs",
"size": 116,
"sha256": "43f119a9043dddd3a32f1d1de3dbb85eba39a78b05903c5838067ff0cbb6f62a"
},
{
"path": "facade/js/load-native.cjs",
"size": 19462,
"sha256": "9b688e69a544a0413a98f68fb7e40537ad0bab957e3f0ef54f03d41b6af58fa6"
},
{
"path": "facade/LICENSE",
"path": "engine/LICENSE",
"size": 11358,

@@ -41,8 +21,8 @@ "sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30"

{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/artifact-hashes.json",
"size": 3334,
"sha256": "dfd772104faf9e84ba5afaa2310a3ddeed9571c1f3f0bca38f38bc4377663c75"
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/artifact-hashes.json",
"size": 3809,
"sha256": "25bc7f02999ec0f8ab4a2eba310ad83a6c2c768850495e379558228a3fe39f56"
},
{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/LICENSE",
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/LICENSE",
"size": 11358,

@@ -52,8 +32,8 @@ "sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30"

{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/license-inventory.json",
"size": 1616,
"sha256": "45cb774e5492e547f17914007b77747d3c9c834851b57eac02ebe1e378673d06"
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/license-inventory.json",
"size": 2020,
"sha256": "d36c7420b5582d08d71f47ce87608dcbc0ea7dca75a0fb5ad591574a36df6025"
},
{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/licenses/clipper-BSL-1.0.txt",
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/licenses/clipper-BSL-1.0.txt",
"size": 1110,

@@ -63,3 +43,3 @@ "sha256": "32ee7398e3123736fd14e9f08287edc2d97ace102ab54d8dc4edc8d31c651fa8"

{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/licenses/nlohmann-json-MIT.txt",
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/licenses/nlohmann-json-MIT.txt",
"size": 1076,

@@ -69,3 +49,3 @@ "sha256": "86b998c792894ccb911a1cb7994f7a9652894e7a094c0b5e45be2f553f45cf14"

{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/licenses/onnxruntime-MIT.txt",
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/licenses/onnxruntime-MIT.txt",
"size": 1094,

@@ -75,3 +55,3 @@ "sha256": "c250d6278f0b47a6439fb7592b08b58a55eb9f535aa49a1db63211c3f982b674"

{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/licenses/onnxruntime-ThirdPartyNotices.txt",
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/licenses/onnxruntime-ThirdPartyNotices.txt",
"size": 333022,

@@ -81,3 +61,3 @@ "sha256": "e00f828e0a33de591a355ae6606d2625f5758da7d2c844db7821c9dd3e3647b6"

{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/licenses/opencv-Apache-2.0.txt",
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/licenses/opencv-Apache-2.0.txt",
"size": 11358,

@@ -87,3 +67,3 @@ "sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30"

{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/licenses/opencv-carotene-BSD-3-Clause.txt",
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/licenses/opencv-carotene-BSD-3-Clause.txt",
"size": 2010,

@@ -93,3 +73,3 @@ "sha256": "fb86be28d90bfef2fffcb86469f7c19962b7a367da9676a521cc1fc33f2996fc"

{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/licenses/opencv-COPYRIGHT.txt",
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/licenses/opencv-COPYRIGHT.txt",
"size": 733,

@@ -99,3 +79,3 @@ "sha256": "bba849c98da85a2b27b86113284a90812c959b1c1fc4ed67de9355475d1e6831"

{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/licenses/opencv-zlib.txt",
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/licenses/opencv-zlib.txt",
"size": 1002,

@@ -105,13 +85,13 @@ "sha256": "845efc77857d485d91fb3e0b884aaa929368c717ae8186b66fe1ed2495753243"

{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/licenses/PP-OCRv6-Apache-2.0.txt",
"size": 11376,
"sha256": "3840c5c0c61c294264d2dd77b8777be6ddd90121ef4e0e64abcd22edea581d6e"
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/licenses/pdfium-native-MIT.txt",
"size": 1064,
"sha256": "e0d1cbc5ab7f2a71622dc703e52642ef7c7e81b4b4caa9e382da4a1a2eb45c62"
},
{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/licenses/PP-OCRv6-MODEL-NOTICE.md",
"size": 312,
"sha256": "381c555aebec730789e4f7a60583024ba7d7c026a5a223ac938c91767e4e91ff"
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/licenses/pdfium-native-THIRD-PARTY-NOTICES.md",
"size": 2879,
"sha256": "01c3f30c69061d39f0f0a4c575b75f48ec33c77e27d9f4c0f4d05ffe4db9cb99"
},
{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/licenses/stb-MIT-or-Unlicense.txt",
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/licenses/stb-MIT-or-Unlicense.txt",
"size": 2510,

@@ -121,3 +101,3 @@ "sha256": "bebfe904b14301657e4e5d655c811d51fd31b97c455b9cc2d8600d6bac6cff63"

{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/native/libonnxruntime.1.22.0.dylib",
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/native/libonnxruntime.1.22.0.dylib",
"size": 33514304,

@@ -127,13 +107,13 @@ "sha256": "6c2f8af5def6e533f17383a4f07dc4eabbd4807d242a478b69f62fcfbe3c1dd3"

{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/native/light_ocr_node.node",
"size": 6083184,
"sha256": "b64be6cd370c482b225186139babb547579099cc5a3e0f1a33b9c26fdf63c21a"
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/native/light_ocr_node.node",
"size": 6120304,
"sha256": "27a0130c3063eb0421c36bef62e219f9cfbfa5fd94fd1735ab5c997beee4732c"
},
{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/native/runtime-descriptor.json",
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/native/runtime-descriptor.json",
"size": 1468,
"sha256": "bfd0caa1a921b0471fe12c1bebfe403552251e1389cc088274ee89e99c29b219"
"sha256": "61187535f0f0da1a74e6c9c4e35d68c541adc90f0153b6c3241aca650b82e58f"
},
{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/NOTICE",
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/NOTICE",
"size": 258,

@@ -143,8 +123,8 @@ "sha256": "24cb7b29285527efc05b8b85c3086fa589e06078dc3ad0075fb51546aa85f547"

{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/package.json",
"size": 866,
"sha256": "391490121c1da63510dd73ee066a14b5c261c62ac5632156b598b3f639c8fa30"
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/package.json",
"size": 919,
"sha256": "5379275035ddbfbdfddaf266e7abe7d75799a90655b61581732746bf0e182e73"
},
{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/README.md",
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/README.md",
"size": 321,

@@ -154,8 +134,8 @@ "sha256": "56f5c2fc3c0e018a22bff801a721f04632ad84b044a4f87514ae3bfc79f77e51"

{
"path": "facade/node_modules/@arcships/light-ocr-darwin-arm64/sbom.spdx.json",
"size": 4930,
"sha256": "87adbdae00b9fe7207ee1fa7e4e9ed73fd2d5ba111f936d9b78d9c82e58a2e2c"
"path": "engine/node_modules/@arcships/light-ocr-darwin-arm64/sbom.spdx.json",
"size": 6005,
"sha256": "002ceb7ae046d2a7d0737d78e900f24edc9554ff7d1aa102e1f1f08b272ea0a7"
},
{
"path": "facade/NOTICE",
"path": "engine/NOTICE",
"size": 258,

@@ -165,12 +145,52 @@ "sha256": "24cb7b29285527efc05b8b85c3086fa589e06078dc3ad0075fb51546aa85f547"

{
"path": "facade/package.json",
"size": 1275,
"sha256": "364529b17f7fd1472581182e8e22c69987fb210091be4213554f27daac692e6d"
"path": "engine/package.json",
"size": 1278,
"sha256": "fc4977c6a8b3136c6b362351f9df8588753fc4d9f666b1efa383ed0e8caed4f8"
},
{
"path": "facade/README.md",
"size": 342,
"sha256": "66be005f72634728895b63c9f0405728946416a5ed90b85f93ad5dc50b0141cd"
"path": "engine/README.md",
"size": 658,
"sha256": "90c9f5912170f2840893f47128ba35014f3f9012c4abf6bea96599614fab104a"
},
{
"path": "engine/src/cli.cjs",
"size": 24827,
"sha256": "e4a0c0ab3ce17f125a165bc64569b51a86359ced14db9d2671457090ce55265b"
},
{
"path": "engine/src/exif.cjs",
"size": 7777,
"sha256": "aaf541c9136e82f6c59f46013b30a6616a99d90447dbd17e0b54afdce6ac00b4"
},
{
"path": "engine/src/facade.cjs",
"size": 3896,
"sha256": "1ec1537f0914833ce04a37508f370537b15887857ee3088ea0023e1a6033c066"
},
{
"path": "engine/src/index.cjs",
"size": 5106,
"sha256": "74f4be1ece46a848d940d4be3add5fd35c379feb2f3706d6a78442feab196580"
},
{
"path": "engine/src/index.d.ts",
"size": 10330,
"sha256": "7d17a2dac4e812306f79f71d3d22b55fb33b5afb91475acf07dc000d1c3033f0"
},
{
"path": "engine/src/index.mjs",
"size": 116,
"sha256": "43f119a9043dddd3a32f1d1de3dbb85eba39a78b05903c5838067ff0cbb6f62a"
},
{
"path": "engine/src/load-native.cjs",
"size": 20019,
"sha256": "2ceecc0b6e10361196fb41e2a08697116c132af31d32d293a1d0b1232a6eb809"
},
{
"path": "engine/src/metadata.cjs",
"size": 73,
"sha256": "53ab1a77623a565640f2945f3edf9f3131f1cf64727fc09d85493bd0a9e503c2"
},
{
"path": "model/bundle/apple/detector-fp16.mlpackage/Data/com.apple.CoreML/model.mlmodel",

@@ -288,3 +308,3 @@ "size": 141330,

"size": 908,
"sha256": "44577d53570c75ad512a0b15f32480f89accd8af34b9ed93ec8f13d841e1ea2b"
"sha256": "b5ad8b677653e0cc9525677dfbf8c13078d1fdbb81c9fb30d7dfaa0026076bca"
},

@@ -298,4 +318,4 @@ {

"path": "native-metadata/artifact-hashes.json",
"size": 3334,
"sha256": "dfd772104faf9e84ba5afaa2310a3ddeed9571c1f3f0bca38f38bc4377663c75"
"size": 3809,
"sha256": "25bc7f02999ec0f8ab4a2eba310ad83a6c2c768850495e379558228a3fe39f56"
},

@@ -309,4 +329,4 @@ {

"path": "native-metadata/license-inventory.json",
"size": 1616,
"sha256": "45cb774e5492e547f17914007b77747d3c9c834851b57eac02ebe1e378673d06"
"size": 2020,
"sha256": "d36c7420b5582d08d71f47ce87608dcbc0ea7dca75a0fb5ad591574a36df6025"
},

@@ -354,10 +374,10 @@ {

{
"path": "native-metadata/licenses/PP-OCRv6-Apache-2.0.txt",
"size": 11376,
"sha256": "3840c5c0c61c294264d2dd77b8777be6ddd90121ef4e0e64abcd22edea581d6e"
"path": "native-metadata/licenses/pdfium-native-MIT.txt",
"size": 1064,
"sha256": "e0d1cbc5ab7f2a71622dc703e52642ef7c7e81b4b4caa9e382da4a1a2eb45c62"
},
{
"path": "native-metadata/licenses/PP-OCRv6-MODEL-NOTICE.md",
"size": 312,
"sha256": "381c555aebec730789e4f7a60583024ba7d7c026a5a223ac938c91767e4e91ff"
"path": "native-metadata/licenses/pdfium-native-THIRD-PARTY-NOTICES.md",
"size": 2879,
"sha256": "01c3f30c69061d39f0f0a4c575b75f48ec33c77e27d9f4c0f4d05ffe4db9cb99"
},

@@ -376,4 +396,4 @@ {

"path": "native-metadata/package.json",
"size": 866,
"sha256": "391490121c1da63510dd73ee066a14b5c261c62ac5632156b598b3f639c8fa30"
"size": 919,
"sha256": "5379275035ddbfbdfddaf266e7abe7d75799a90655b61581732746bf0e182e73"
},

@@ -387,6 +407,6 @@ {

"path": "native-metadata/sbom.spdx.json",
"size": 4930,
"sha256": "87adbdae00b9fe7207ee1fa7e4e9ed73fd2d5ba111f936d9b78d9c82e58a2e2c"
"size": 6005,
"sha256": "002ceb7ae046d2a7d0737d78e900f24edc9554ff7d1aa102e1f1f08b272ea0a7"
}
]
}

@@ -33,3 +33,3 @@ {

},
"version": "0.3.0"
"version": "0.3.4"
}

@@ -19,17 +19,7 @@ {

{
"bytes": 1616,
"bytes": 2020,
"path": "license-inventory.json",
"sha256": "45cb774e5492e547f17914007b77747d3c9c834851b57eac02ebe1e378673d06"
"sha256": "d36c7420b5582d08d71f47ce87608dcbc0ea7dca75a0fb5ad591574a36df6025"
},
{
"bytes": 11376,
"path": "licenses/PP-OCRv6-Apache-2.0.txt",
"sha256": "3840c5c0c61c294264d2dd77b8777be6ddd90121ef4e0e64abcd22edea581d6e"
},
{
"bytes": 312,
"path": "licenses/PP-OCRv6-MODEL-NOTICE.md",
"sha256": "381c555aebec730789e4f7a60583024ba7d7c026a5a223ac938c91767e4e91ff"
},
{
"bytes": 1110,

@@ -75,2 +65,12 @@ "path": "licenses/clipper-BSL-1.0.txt",

{
"bytes": 1064,
"path": "licenses/pdfium-native-MIT.txt",
"sha256": "e0d1cbc5ab7f2a71622dc703e52642ef7c7e81b4b4caa9e382da4a1a2eb45c62"
},
{
"bytes": 2879,
"path": "licenses/pdfium-native-THIRD-PARTY-NOTICES.md",
"sha256": "01c3f30c69061d39f0f0a4c575b75f48ec33c77e27d9f4c0f4d05ffe4db9cb99"
},
{
"bytes": 2510,

@@ -86,5 +86,5 @@ "path": "licenses/stb-MIT-or-Unlicense.txt",

{
"bytes": 6083184,
"bytes": 6120304,
"path": "native/light_ocr_node.node",
"sha256": "b64be6cd370c482b225186139babb547579099cc5a3e0f1a33b9c26fdf63c21a"
"sha256": "27a0130c3063eb0421c36bef62e219f9cfbfa5fd94fd1735ab5c997beee4732c"
},

@@ -94,13 +94,28 @@ {

"path": "native/runtime-descriptor.json",
"sha256": "bfd0caa1a921b0471fe12c1bebfe403552251e1389cc088274ee89e99c29b219"
"sha256": "61187535f0f0da1a74e6c9c4e35d68c541adc90f0153b6c3241aca650b82e58f"
},
{
"bytes": 866,
"bytes": 919,
"path": "package.json",
"sha256": "391490121c1da63510dd73ee066a14b5c261c62ac5632156b598b3f639c8fa30"
"sha256": "5379275035ddbfbdfddaf266e7abe7d75799a90655b61581732746bf0e182e73"
},
{
"bytes": 4930,
"bytes": 382,
"path": "pdfium/index.cjs",
"sha256": "d6d6ea1c607b0c56600ad33853d4910b7ed45934b4f6a8e1c40b4d4d735d8340"
},
{
"bytes": 7732848,
"path": "pdfium/libpdfium.dylib",
"sha256": "68e82322c55f745ef1d2ef2a93c0ba4ba2c6491d9cc16c65c2be587ec7a17622"
},
{
"bytes": 263720,
"path": "pdfium/pdfium.node",
"sha256": "ed36d230cda28b25dd443c3fe1b0083cbfca86b9d6c78de0e42ce0d78d9eb55c"
},
{
"bytes": 6005,
"path": "sbom.spdx.json",
"sha256": "87adbdae00b9fe7207ee1fa7e4e9ed73fd2d5ba111f936d9b78d9c82e58a2e2c"
"sha256": "002ceb7ae046d2a7d0737d78e900f24edc9554ff7d1aa102e1f1f08b272ea0a7"
}

@@ -110,3 +125,3 @@ ],

"schemaVersion": "1.0",
"version": "0.3.0"
"version": "0.5.5"
}

@@ -1,1 +0,60 @@

{"files":[{"component":"opencv","file":"licenses/opencv-Apache-2.0.txt","sha256":"cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30"},{"component":"opencv","file":"licenses/opencv-COPYRIGHT.txt","sha256":"bba849c98da85a2b27b86113284a90812c959b1c1fc4ed67de9355475d1e6831"},{"component":"zlib","file":"licenses/opencv-zlib.txt","sha256":"845efc77857d485d91fb3e0b884aaa929368c717ae8186b66fe1ed2495753243"},{"component":"clipper","file":"licenses/clipper-BSL-1.0.txt","sha256":"32ee7398e3123736fd14e9f08287edc2d97ace102ab54d8dc4edc8d31c651fa8"},{"component":"nlohmann-json","file":"licenses/nlohmann-json-MIT.txt","sha256":"86b998c792894ccb911a1cb7994f7a9652894e7a094c0b5e45be2f553f45cf14"},{"component":"onnxruntime","file":"licenses/onnxruntime-MIT.txt","sha256":"c250d6278f0b47a6439fb7592b08b58a55eb9f535aa49a1db63211c3f982b674"},{"component":"onnxruntime","file":"licenses/onnxruntime-ThirdPartyNotices.txt","sha256":"e00f828e0a33de591a355ae6606d2625f5758da7d2c844db7821c9dd3e3647b6"},{"component":"stb","file":"licenses/stb-MIT-or-Unlicense.txt","sha256":"bebfe904b14301657e4e5d655c811d51fd31b97c455b9cc2d8600d6bac6cff63"},{"component":"PP-OCRv6-models","file":"licenses/PP-OCRv6-Apache-2.0.txt","sha256":"3840c5c0c61c294264d2dd77b8777be6ddd90121ef4e0e64abcd22edea581d6e"},{"component":"PP-OCRv6-models","file":"licenses/PP-OCRv6-MODEL-NOTICE.md","sha256":"381c555aebec730789e4f7a60583024ba7d7c026a5a223ac938c91767e4e91ff"},{"component":"carotene","file":"licenses/opencv-carotene-BSD-3-Clause.txt","sha256":"fb86be28d90bfef2fffcb86469f7c19962b7a367da9676a521cc1fc33f2996fc"}],"schemaVersion":"1.0"}
{
"files": [
{
"component": "opencv",
"file": "licenses/opencv-Apache-2.0.txt",
"sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30"
},
{
"component": "opencv",
"file": "licenses/opencv-COPYRIGHT.txt",
"sha256": "bba849c98da85a2b27b86113284a90812c959b1c1fc4ed67de9355475d1e6831"
},
{
"component": "zlib",
"file": "licenses/opencv-zlib.txt",
"sha256": "845efc77857d485d91fb3e0b884aaa929368c717ae8186b66fe1ed2495753243"
},
{
"component": "clipper",
"file": "licenses/clipper-BSL-1.0.txt",
"sha256": "32ee7398e3123736fd14e9f08287edc2d97ace102ab54d8dc4edc8d31c651fa8"
},
{
"component": "nlohmann-json",
"file": "licenses/nlohmann-json-MIT.txt",
"sha256": "86b998c792894ccb911a1cb7994f7a9652894e7a094c0b5e45be2f553f45cf14"
},
{
"component": "onnxruntime",
"file": "licenses/onnxruntime-MIT.txt",
"sha256": "c250d6278f0b47a6439fb7592b08b58a55eb9f535aa49a1db63211c3f982b674"
},
{
"component": "onnxruntime",
"file": "licenses/onnxruntime-ThirdPartyNotices.txt",
"sha256": "e00f828e0a33de591a355ae6606d2625f5758da7d2c844db7821c9dd3e3647b6"
},
{
"component": "stb",
"file": "licenses/stb-MIT-or-Unlicense.txt",
"sha256": "bebfe904b14301657e4e5d655c811d51fd31b97c455b9cc2d8600d6bac6cff63"
},
{
"component": "carotene",
"file": "licenses/opencv-carotene-BSD-3-Clause.txt",
"sha256": "fb86be28d90bfef2fffcb86469f7c19962b7a367da9676a521cc1fc33f2996fc"
},
{
"component": "pdfium-native-0.6.1",
"file": "licenses/pdfium-native-MIT.txt",
"sha256": "e0d1cbc5ab7f2a71622dc703e52642ef7c7e81b4b4caa9e382da4a1a2eb45c62"
},
{
"component": "pdfium-native-0.6.1",
"file": "licenses/pdfium-native-THIRD-PARTY-NOTICES.md",
"sha256": "01c3f30c69061d39f0f0a4c575b75f48ec33c77e27d9f4c0f4d05ffe4db9cb99"
}
],
"schemaVersion": "1.0"
}

@@ -13,6 +13,8 @@ {

"exports": {
".": "./native/light_ocr_node.node"
".": "./native/light_ocr_node.node",
"./pdfium": "./pdfium/index.cjs"
},
"files": [
"native/",
"pdfium/",
"licenses/",

@@ -41,3 +43,3 @@ "license-inventory.json",

},
"version": "0.3.0"
"version": "0.5.5"
}

@@ -1,1 +0,180 @@

{"SPDXID":"SPDXRef-DOCUMENT","creationInfo":{"created":"2026-07-19T16:28:35Z","creators":["Tool: light-ocr-generate-release-metadata/1.0"]},"dataLicense":"CC0-1.0","documentDescribes":["SPDXRef-Package-light-ocr-core"],"documentNamespace":"https://light-ocr.invalid/spdx/f35e3d6f37da1c3e7924145ea08372bbe4aa7035a6728660d36a7f16ad8b4cda","name":"light-ocr-core-macos-arm64","packages":[{"SPDXID":"SPDXRef-Package-light-ocr-core","copyrightText":"Copyright 2026 light-ocr contributors","downloadLocation":"NOASSERTION","filesAnalyzed":false,"licenseConcluded":"Apache-2.0","licenseDeclared":"Apache-2.0","name":"light-ocr-core","versionInfo":"0.1.0"},{"SPDXID":"SPDXRef-Package-onnxruntime","checksums":[{"algorithm":"SHA256","checksumValue":"d571e63a2329baacb713f441e65ad75284de354db6e1ac435fe4bebbb417986a"}],"copyrightText":"NOASSERTION","downloadLocation":"https://api.nuget.org/v3-flatcontainer/microsoft.ml.onnxruntime/1.22.0/microsoft.ml.onnxruntime.1.22.0.nupkg","filesAnalyzed":false,"licenseConcluded":"MIT","licenseDeclared":"MIT","name":"onnxruntime","versionInfo":"1.22.0"},{"SPDXID":"SPDXRef-Package-opencv","checksums":[{"algorithm":"SHA256","checksumValue":"b2171af5be6b26f7a06b1229948bbb2bdaa74fcf5cd097e0af6378fce50a6eb9"}],"copyrightText":"NOASSERTION","downloadLocation":"https://codeload.github.com/opencv/opencv/tar.gz/refs/tags/4.10.0","filesAnalyzed":false,"licenseConcluded":"Apache-2.0","licenseDeclared":"Apache-2.0","name":"opencv","versionInfo":"4.10.0"},{"SPDXID":"SPDXRef-Package-opencv-zlib","copyrightText":"NOASSERTION","downloadLocation":"https://codeload.github.com/opencv/opencv/tar.gz/refs/tags/4.10.0","filesAnalyzed":false,"licenseConcluded":"Zlib","licenseDeclared":"Zlib","name":"zlib","versionInfo":"1.3.1"},{"SPDXID":"SPDXRef-Package-opencv-carotene","copyrightText":"NOASSERTION","downloadLocation":"https://codeload.github.com/opencv/opencv/tar.gz/refs/tags/4.10.0","filesAnalyzed":false,"licenseConcluded":"BSD-3-Clause","licenseDeclared":"BSD-3-Clause","name":"carotene","versionInfo":"0.0.1"},{"SPDXID":"SPDXRef-Package-clipper","checksums":[{"algorithm":"SHA256","checksumValue":"2be14496a1609fa8602d9d3672c83ee95d5ef44a08b765a60e65b93a68882ff6"}],"copyrightText":"NOASSERTION","downloadLocation":"https://codeload.github.com/fonttools/pyclipper/tar.gz/refs/tags/1.3.0.post6","filesAnalyzed":false,"licenseConcluded":"BSL-1.0","licenseDeclared":"BSL-1.0","name":"clipper","versionInfo":"6.4.2-pyclipper-1.3.0.post6"},{"SPDXID":"SPDXRef-Package-stb","checksums":[{"algorithm":"SHA256","checksumValue":"e4e3bba9c572a4a4148373a914d88ea0f0d11de8cc2c66739926e7eca0223319"}],"copyrightText":"NOASSERTION","downloadLocation":"https://codeload.github.com/nothings/stb/tar.gz/31c1ad37456438565541f4919958214b6e762fb4","filesAnalyzed":false,"licenseConcluded":"MIT OR Unlicense","licenseDeclared":"MIT OR Unlicense","name":"stb","versionInfo":"31c1ad37456438565541f4919958214b6e762fb4"},{"SPDXID":"SPDXRef-Package-nlohmann-json","checksums":[{"algorithm":"SHA256","checksumValue":"0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406"}],"copyrightText":"NOASSERTION","downloadLocation":"https://codeload.github.com/nlohmann/json/tar.gz/refs/tags/v3.11.3","filesAnalyzed":false,"licenseConcluded":"MIT","licenseDeclared":"MIT","name":"nlohmann-json","versionInfo":"3.11.3"},{"SPDXID":"SPDXRef-Package-PP-OCRv6-small-models","checksums":[{"algorithm":"SHA256","checksumValue":"e543b93bc4882f35b1564a71961e5bc55439ede6c2f33b4166acc15e6348712f"}],"copyrightText":"NOASSERTION","downloadLocation":"https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-OCRv6_small_det_onnx_infer.tar","filesAnalyzed":false,"licenseConcluded":"Apache-2.0","licenseDeclared":"Apache-2.0","name":"PP-OCRv6-small-ONNX-models","versionInfo":"ppocrv6-small-onnx-20260714.2"}],"relationships":[{"relatedSpdxElement":"SPDXRef-Package-onnxruntime","relationshipType":"DEPENDS_ON","spdxElementId":"SPDXRef-Package-light-ocr-core"},{"relatedSpdxElement":"SPDXRef-Package-opencv","relationshipType":"DEPENDS_ON","spdxElementId":"SPDXRef-Package-light-ocr-core"},{"relatedSpdxElement":"SPDXRef-Package-opencv-zlib","relationshipType":"CONTAINS","spdxElementId":"SPDXRef-Package-opencv"},{"relatedSpdxElement":"SPDXRef-Package-opencv-carotene","relationshipType":"CONTAINS","spdxElementId":"SPDXRef-Package-opencv"},{"relatedSpdxElement":"SPDXRef-Package-clipper","relationshipType":"DEPENDS_ON","spdxElementId":"SPDXRef-Package-light-ocr-core"},{"relatedSpdxElement":"SPDXRef-Package-stb","relationshipType":"DEPENDS_ON","spdxElementId":"SPDXRef-Package-light-ocr-core"},{"relatedSpdxElement":"SPDXRef-Package-nlohmann-json","relationshipType":"DEPENDS_ON","spdxElementId":"SPDXRef-Package-light-ocr-core"},{"relatedSpdxElement":"SPDXRef-Package-PP-OCRv6-small-models","relationshipType":"DEPENDS_ON","spdxElementId":"SPDXRef-Package-light-ocr-core"}],"spdxVersion":"SPDX-2.3"}
{
"SPDXID": "SPDXRef-DOCUMENT",
"creationInfo": {
"created": "2026-07-27T05:14:38Z",
"creators": [
"Tool: light-ocr-generate-release-metadata/1.0"
]
},
"dataLicense": "CC0-1.0",
"documentDescribes": [
"SPDXRef-Package-light-ocr-core"
],
"documentNamespace": "https://light-ocr.invalid/spdx/5f6a36e0414a4c6cb500ecb757041cf7a51c09e0737b67096201e061d1571b2b",
"name": "light-ocr-core-macos-arm64",
"packages": [
{
"SPDXID": "SPDXRef-Package-light-ocr-core",
"copyrightText": "Copyright 2026 light-ocr contributors",
"downloadLocation": "NOASSERTION",
"filesAnalyzed": false,
"licenseConcluded": "Apache-2.0",
"licenseDeclared": "Apache-2.0",
"name": "light-ocr-core",
"versionInfo": "0.1.0"
},
{
"SPDXID": "SPDXRef-Package-onnxruntime",
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "d571e63a2329baacb713f441e65ad75284de354db6e1ac435fe4bebbb417986a"
}
],
"copyrightText": "NOASSERTION",
"downloadLocation": "https://api.nuget.org/v3-flatcontainer/microsoft.ml.onnxruntime/1.22.0/microsoft.ml.onnxruntime.1.22.0.nupkg",
"filesAnalyzed": false,
"licenseConcluded": "MIT",
"licenseDeclared": "MIT",
"name": "onnxruntime",
"versionInfo": "1.22.0"
},
{
"SPDXID": "SPDXRef-Package-opencv",
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "b2171af5be6b26f7a06b1229948bbb2bdaa74fcf5cd097e0af6378fce50a6eb9"
}
],
"copyrightText": "NOASSERTION",
"downloadLocation": "https://codeload.github.com/opencv/opencv/tar.gz/refs/tags/4.10.0",
"filesAnalyzed": false,
"licenseConcluded": "Apache-2.0",
"licenseDeclared": "Apache-2.0",
"name": "opencv",
"versionInfo": "4.10.0"
},
{
"SPDXID": "SPDXRef-Package-opencv-zlib",
"copyrightText": "NOASSERTION",
"downloadLocation": "https://codeload.github.com/opencv/opencv/tar.gz/refs/tags/4.10.0",
"filesAnalyzed": false,
"licenseConcluded": "Zlib",
"licenseDeclared": "Zlib",
"name": "zlib",
"versionInfo": "1.3.1"
},
{
"SPDXID": "SPDXRef-Package-opencv-carotene",
"copyrightText": "NOASSERTION",
"downloadLocation": "https://codeload.github.com/opencv/opencv/tar.gz/refs/tags/4.10.0",
"filesAnalyzed": false,
"licenseConcluded": "BSD-3-Clause",
"licenseDeclared": "BSD-3-Clause",
"name": "carotene",
"versionInfo": "0.0.1"
},
{
"SPDXID": "SPDXRef-Package-clipper",
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "2be14496a1609fa8602d9d3672c83ee95d5ef44a08b765a60e65b93a68882ff6"
}
],
"copyrightText": "NOASSERTION",
"downloadLocation": "https://codeload.github.com/fonttools/pyclipper/tar.gz/refs/tags/1.3.0.post6",
"filesAnalyzed": false,
"licenseConcluded": "BSL-1.0",
"licenseDeclared": "BSL-1.0",
"name": "clipper",
"versionInfo": "6.4.2-pyclipper-1.3.0.post6"
},
{
"SPDXID": "SPDXRef-Package-stb",
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "e4e3bba9c572a4a4148373a914d88ea0f0d11de8cc2c66739926e7eca0223319"
}
],
"copyrightText": "NOASSERTION",
"downloadLocation": "https://codeload.github.com/nothings/stb/tar.gz/31c1ad37456438565541f4919958214b6e762fb4",
"filesAnalyzed": false,
"licenseConcluded": "MIT OR Unlicense",
"licenseDeclared": "MIT OR Unlicense",
"name": "stb",
"versionInfo": "31c1ad37456438565541f4919958214b6e762fb4"
},
{
"SPDXID": "SPDXRef-Package-nlohmann-json",
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406"
}
],
"copyrightText": "NOASSERTION",
"downloadLocation": "https://codeload.github.com/nlohmann/json/tar.gz/refs/tags/v3.11.3",
"filesAnalyzed": false,
"licenseConcluded": "MIT",
"licenseDeclared": "MIT",
"name": "nlohmann-json",
"versionInfo": "3.11.3"
},
{
"SPDXID": "SPDXRef-Package-pdfium-native",
"copyrightText": "Copyright (c) 2026 xonaman",
"downloadLocation": "https://github.com/xonaman/nodejs-pdfium-native/releases/tag/v0.6.1",
"filesAnalyzed": false,
"licenseConcluded": "MIT",
"licenseDeclared": "MIT",
"name": "pdfium-native",
"versionInfo": "0.6.1"
}
],
"relationships": [
{
"relatedSpdxElement": "SPDXRef-Package-onnxruntime",
"relationshipType": "DEPENDS_ON",
"spdxElementId": "SPDXRef-Package-light-ocr-core"
},
{
"relatedSpdxElement": "SPDXRef-Package-opencv",
"relationshipType": "DEPENDS_ON",
"spdxElementId": "SPDXRef-Package-light-ocr-core"
},
{
"relatedSpdxElement": "SPDXRef-Package-opencv-zlib",
"relationshipType": "CONTAINS",
"spdxElementId": "SPDXRef-Package-opencv"
},
{
"relatedSpdxElement": "SPDXRef-Package-opencv-carotene",
"relationshipType": "CONTAINS",
"spdxElementId": "SPDXRef-Package-opencv"
},
{
"relatedSpdxElement": "SPDXRef-Package-clipper",
"relationshipType": "DEPENDS_ON",
"spdxElementId": "SPDXRef-Package-light-ocr-core"
},
{
"relatedSpdxElement": "SPDXRef-Package-stb",
"relationshipType": "DEPENDS_ON",
"spdxElementId": "SPDXRef-Package-light-ocr-core"
},
{
"relatedSpdxElement": "SPDXRef-Package-nlohmann-json",
"relationshipType": "DEPENDS_ON",
"spdxElementId": "SPDXRef-Package-light-ocr-core"
},
{
"relatedSpdxElement": "SPDXRef-Package-pdfium-native",
"relationshipType": "DEPENDS_ON",
"spdxElementId": "SPDXRef-Package-light-ocr-core"
}
],
"spdxVersion": "SPDX-2.3"
}

@@ -22,4 +22,5 @@ ---

target window state before taking an action.
2. Act with the most specific target available. Prefer element/window scoped
actions over broad screen coordinates when the tool surface gives both.
2. Act with the most specific target available. Prefer a non-empty
`element_token` from the latest `get_window_state`, then `element_index`,
then window-scoped coordinates.
3. Verify after every action by reading the window state again.

@@ -29,2 +30,13 @@ 4. Report uncertainty when the post-action state does not prove the requested

## Element Tokens
- Treat `element_token` as an opaque per-snapshot handle. Never parse, construct,
modify, or reuse it after a newer snapshot.
- When both `element_token` and `element_index` are available, use the token.
`window_id` may be omitted when a valid token is present.
- Never send an empty `element_token`; omit it and use the latest snapshot's
index or coordinates instead.
- If an action reports a stale token, call `get_window_state` again and retry
once with the new token. Never fall back to an index from the stale snapshot.
## Desktop Rules

@@ -31,0 +43,0 @@

{
"name": "dimcode-darwin-arm64",
"version": "0.2.39",
"version": "0.3.0-beta.0",
"description": "dimcode binary for macOS ARM64 (Apple Silicon)",

@@ -5,0 +5,0 @@ "os": [

'use strict';
const fs = require('node:fs');
const path = require('node:path');
const { loadNative } = require('./load-native.cjs');
const DEFAULT_MODEL = 'ppocrv6-small';
const MODEL_PACKAGE = '@arcships/light-ocr-model-ppocrv6-small';
const CPU_BUNDLE_ID = 'ppocrv6-small-onnx-20260714.2';
const APPLE_BUNDLE_ID = 'ppocrv6-small-apple-20260715.1';
const WEBGPU_BUNDLE_ID = 'ppocrv6-small-webgpu-20260719.1';
const NATIVE_BUNDLE_ID = 'ppocrv6-small-native-20260719.1';
class OcrError extends Error {
constructor(code, message, detail) {
super(message);
this.name = 'OcrError';
this.code = code;
if (detail !== undefined && detail !== '') this.detail = detail;
}
}
function normalizeNativeError(error) {
if (error && error.name === 'OcrError') {
Object.setPrototypeOf(error, OcrError.prototype);
}
return error;
}
function deepFreeze(value) {
if (!value || typeof value !== 'object' || Object.isFrozen(value)) return value;
for (const child of Object.values(value)) deepFreeze(child);
return Object.freeze(value);
}
function validateSignal(signal) {
if (
signal === null ||
typeof signal !== 'object' ||
typeof signal.aborted !== 'boolean' ||
typeof signal.addEventListener !== 'function' ||
typeof signal.removeEventListener !== 'function'
) {
throw new OcrError('invalid_argument', 'signal must be an AbortSignal');
}
}
function abortReason(signal) {
return signal.reason === undefined
? new DOMException('The operation was aborted', 'AbortError')
: signal.reason;
}
function resolveBuiltInBundle(model, requireApple) {
if (model !== DEFAULT_MODEL) {
throw new OcrError(
'invalid_argument',
`model must be ${JSON.stringify(DEFAULT_MODEL)}`,
);
}
let manifestPath;
try {
manifestPath = require.resolve(`${MODEL_PACKAGE}/bundle/manifest.json`);
} catch (cause) {
throw new OcrError(
'package_load_failed',
`Unable to locate the built-in ${DEFAULT_MODEL} model`,
`Reinstall ${MODEL_PACKAGE}; ${cause instanceof Error ? cause.message : String(cause)}`,
);
}
let manifest;
try {
manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
} catch (cause) {
throw new OcrError(
'package_load_failed',
'Unable to read the built-in model manifest',
cause instanceof Error ? cause.message : String(cause),
);
}
const compatibleBundleIds = requireApple
? [APPLE_BUNDLE_ID, NATIVE_BUNDLE_ID]
: [CPU_BUNDLE_ID, APPLE_BUNDLE_ID, WEBGPU_BUNDLE_ID, NATIVE_BUNDLE_ID];
if (!compatibleBundleIds.includes(manifest.bundleId)) {
throw new OcrError(
'package_load_failed',
'The installed model package is incompatible with this light-ocr release',
`expected ${compatibleBundleIds.join(' or ')}, received ${String(manifest.bundleId)}`,
);
}
return path.dirname(manifestPath);
}
function resolveCreateOptions(options) {
if (options === undefined) options = {};
if (options === null || typeof options !== 'object' || Array.isArray(options)) {
throw new OcrError('invalid_argument', 'createEngine options must be an object');
}
const hasModel = Object.prototype.hasOwnProperty.call(options, 'model');
const hasBundlePath = Object.prototype.hasOwnProperty.call(options, 'bundlePath');
if (hasModel && hasBundlePath) {
throw new OcrError(
'invalid_argument',
'model and bundlePath cannot be used together',
);
}
if (hasBundlePath) return options;
const model = hasModel ? options.model : DEFAULT_MODEL;
const requireApple = options.execution?.provider === 'apple';
const resolved = { ...options, bundlePath: resolveBuiltInBundle(model, requireApple) };
delete resolved.model;
return resolved;
}
class OcrEngineImpl {
#native;
#closePromise;
constructor(nativeEngine) {
this.#native = nativeEngine;
this.info = deepFreeze(nativeEngine.info);
Object.defineProperty(this, 'info', { writable: false, configurable: false });
}
recognize(image, options = {}) {
return this.#recognize('recognize', image, options);
}
recognizeEncoded(data, options = {}) {
return this.#recognize('recognizeEncoded', data, options);
}
#recognize(nativeMethod, image, options) {
let signal;
let nativeOptions;
try {
if (options === null || typeof options !== 'object' || Array.isArray(options)) {
throw new OcrError('invalid_argument', 'recognize options must be an object');
}
signal = options.signal;
if (signal !== undefined) {
validateSignal(signal);
if (signal.aborted) return Promise.reject(abortReason(signal));
}
nativeOptions = { ...options };
delete nativeOptions.signal;
} catch (error) {
return Promise.reject(normalizeNativeError(error));
}
let operation;
try {
operation = this.#native[nativeMethod](image, nativeOptions);
} catch (error) {
return Promise.reject(normalizeNativeError(error));
}
return new Promise((resolve, reject) => {
let settled = false;
const cleanup = () => {
if (signal !== undefined) signal.removeEventListener('abort', onAbort);
};
const settle = (callback, value) => {
if (settled) return;
settled = true;
cleanup();
callback(value);
};
const onAbort = () => {
if (settled) return;
try {
this.#native.cancel(operation.requestId);
} catch {
// Public cancellation still wins. Native teardown owns any remaining work.
}
settle(reject, abortReason(signal));
};
operation.promise.then(
(value) => settle(resolve, value),
(error) => settle(reject, normalizeNativeError(error)),
);
if (signal !== undefined) {
signal.addEventListener('abort', onAbort, { once: true });
if (signal.aborted) onAbort();
}
});
}
close() {
if (this.#closePromise === undefined) {
try {
this.#closePromise = Promise.resolve(this.#native.close()).catch((error) => {
throw normalizeNativeError(error);
});
} catch (error) {
this.#closePromise = Promise.reject(normalizeNativeError(error));
}
}
return this.#closePromise;
}
}
let nativeRuntime;
async function createEngine(options) {
try {
const resolvedOptions = resolveCreateOptions(options);
if (!nativeRuntime) nativeRuntime = loadNative();
const nativeEngine = await nativeRuntime.binding.createEngine(
resolvedOptions,
nativeRuntime.runtimePolicy,
);
return new OcrEngineImpl(nativeEngine);
} catch (error) {
throw normalizeNativeError(error);
}
}
module.exports = { createEngine, OcrError };
/// <reference types="node" />
export type PixelFormat = 'gray8' | 'rgb8' | 'bgr8' | 'rgba8';
export type DetectionStrategy = 'bounded' | 'tiled' | 'upstreamExact';
export type BuiltInModel = 'ppocrv6-small';
export type ExecutionProvider = 'auto' | 'cpu' | 'apple' | 'webgpu';
export type SessionFallback = 'error' | 'cpu';
export type CpuPartition = 'allow' | 'forbid';
export type PerformanceHint = 'latency' | 'throughput';
/** WebGPU accepts auto/fp32; fp16 is reserved for the Apple provider. */
export type Precision = 'auto' | 'fp32' | 'fp16';
export interface DetectionOptions {
readonly strategy?: DetectionStrategy;
readonly maxSide?: number;
}
export interface ExecutionOptions {
/** Only providers shipped and qualified by this release appear in this union. */
readonly provider?: ExecutionProvider;
readonly sessionFallback?: SessionFallback;
readonly cpuPartition?: CpuPartition;
readonly deviceId?: number;
readonly performanceHint?: PerformanceHint;
readonly precision?: Precision;
}
export interface RawImage {
readonly data: Uint8Array;
readonly width: number;
readonly height: number;
readonly stride: number;
readonly pixelFormat: PixelFormat;
}
export interface ResourceLimits {
readonly maxWidth: number;
readonly maxHeight: number;
readonly maxPixels: number;
readonly maxDetectionSide: number;
readonly maxDetectionCandidates: number;
readonly maxDetectionTiles: number;
readonly maxRecognitionBatchSize: number;
readonly maxRecognitionWidth: number;
readonly maxTemporaryBytes: number;
}
export interface CreateEngineOptions {
readonly model?: BuiltInModel;
readonly bundlePath?: string;
readonly intraOpThreads?: number;
readonly interOpThreads?: number;
readonly recognitionScoreThreshold?: number;
readonly recognitionBatchSize?: number;
readonly reducedLimits?: Omit<ResourceLimits, 'maxDetectionTiles'> & {
/** Omission preserves the 0.1 reducedLimits source shape. */
readonly maxDetectionTiles?: number;
};
readonly queueCapacity?: number;
readonly maxPendingInputBytes?: number;
readonly detection?: DetectionOptions;
readonly execution?: ExecutionOptions;
}
export interface RecognizeOptions {
readonly recognitionScoreThreshold?: number;
readonly recognitionBatchSize?: number;
readonly includeDiagnostics?: boolean;
readonly signal?: AbortSignal;
readonly useTextlineOrientation?: boolean;
readonly detectionMaxSide?: number;
}
export interface Point { readonly x: number; readonly y: number }
export interface OcrLine {
readonly text: string;
readonly confidence: number;
readonly box: readonly [Point, Point, Point, Point];
}
export type RejectionReason = 'below_score_threshold' | 'empty_decode';
export interface RejectedLine { readonly line: OcrLine; readonly reason: RejectionReason }
export interface DiagnosticWarning { readonly code: string; readonly message: string }
export interface RecognitionBatchShape {
readonly batchSize: number;
readonly height: number;
readonly width: number;
readonly computeUnit: 'cpu' | 'ane' | 'gpu';
readonly modelId: string;
readonly shapeBucket: string;
}
export interface DetectionPassShape {
readonly tileOrdinal: number;
readonly x: number;
readonly y: number;
readonly width: number;
readonly height: number;
readonly tensorWidth: number;
readonly tensorHeight: number;
readonly contourCandidates: number;
readonly rawCandidates: number;
}
export interface Diagnostics {
readonly rejectedLines: readonly RejectedLine[];
readonly warnings: readonly DiagnosticWarning[];
readonly detectedCandidates: number;
readonly acceptedBoxes: number;
readonly detectionInputWidth: number;
readonly detectionInputHeight: number;
readonly rawDetectionBoxes: number;
readonly suppressedDuplicateBoxes: number;
readonly maxLiveDetectionPassBuffers: number;
readonly detectionPasses: readonly DetectionPassShape[];
readonly recognitionBatchShapes: readonly RecognitionBatchShape[];
}
export interface TimingUs {
readonly total: number;
readonly decode: number;
readonly inputValidation: number;
readonly detectionPreprocess: number;
readonly detectionInference: number;
readonly detectionPostprocess: number;
readonly detectionMerge: number;
readonly cropAndSort: number;
readonly recognitionPreprocess: number;
readonly recognitionInference: number;
readonly recognitionPostprocess: number;
}
export interface OcrResult {
readonly lines: readonly OcrLine[];
readonly imageWidth: number;
readonly imageHeight: number;
readonly modelBundleId: string;
readonly timingUs: TimingUs;
readonly diagnostics?: Diagnostics;
}
export interface TiledDetectionInfo {
readonly contractVersion: 'tiled-v1';
readonly tileSide: 1280;
readonly minimumOverlap: 128;
readonly artificialBoundaryMargin: 32;
readonly mergeIouThreshold: 0.5;
readonly mergeIosThreshold: 0.8;
}
export interface ProviderCapabilityInfo {
readonly provider: string;
readonly packageIncluded: boolean;
readonly deviceAvailable: boolean;
/** True only when this exact hardware family has reviewed qualification evidence. */
readonly deviceValidated: boolean;
}
export interface SessionExecutionInfo {
readonly requestedProvider: string;
readonly actualProviderChain: readonly string[];
readonly device: string;
readonly deviceFamily: string;
readonly operatingSystem: string;
readonly precision: string;
readonly shapePolicy: string;
readonly modelId: string;
readonly modelSha256: string;
readonly runtime: string;
readonly runtimeVersion: string;
readonly providerVersion: string;
readonly modelCacheStatus: string;
readonly qualificationId: string;
/** False means the open macOS compatibility path is experimental on this device. */
readonly deviceValidated: boolean;
readonly sessionFallback: boolean;
readonly fallbackReason?: string;
}
export type CreationReason =
| 'adapter_unavailable' | 'model_compute_unsupported'
| 'device_memory_insufficient' | 'driver_version_unsupported'
| 'package_corrupt' | 'artifact_hash_mismatch' | 'provider_abi_mismatch'
| 'internal_assertion_failed' | 'unrecoverable_load_failed';
export type CreationAttemptStatus = 'selected' | 'skipped' | 'fatal';
export interface CreationAttempt {
readonly provider: string;
readonly status: CreationAttemptStatus;
readonly creationReason?: CreationReason;
readonly errorCode?: CoreErrorCode;
}
export interface CreationTrace {
readonly requestedProvider: string;
readonly policyId?: string;
readonly policyVersion?: number;
readonly orderedCandidates: readonly string[];
readonly attempts: readonly CreationAttempt[];
readonly selectedProvider?: string;
}
export interface ExecutionInfo {
readonly requestedProvider: ExecutionProvider;
readonly sessionFallback: SessionFallback;
readonly cpuPartition: CpuPartition;
readonly deviceId?: number;
readonly performanceHint: PerformanceHint;
readonly requestedPrecision: Precision;
readonly providerCapabilities: readonly ProviderCapabilityInfo[];
readonly selectionTrace: CreationTrace;
readonly sessions: {
readonly detection: SessionExecutionInfo;
readonly recognition: SessionExecutionInfo;
};
}
export interface EngineInfo {
readonly coreVersion: string;
readonly modelBundleId: string;
readonly modelBundleSchemaVersion: string;
readonly normalizedConfigSchemaVersion: string;
readonly backend: string;
/** @deprecated Use execution.sessions for stage-specific provider details. */
readonly executionProvider: string;
readonly execution: ExecutionInfo;
readonly capabilities: {
readonly detection: boolean;
readonly recognition: boolean;
readonly textlineOrientation: boolean;
readonly tiledDetection: boolean;
};
readonly concurrencyMode: 'serialized_reject_when_busy';
readonly limits: ResourceLimits & { readonly maxConcurrentCalls: 1 };
readonly intraOpThreads: number;
readonly interOpThreads: number;
readonly detectionStrategy: DetectionStrategy;
readonly detectionMaxSide: number;
readonly tiledDetection?: TiledDetectionInfo;
readonly defaultRecognitionScoreThreshold: number;
readonly defaultRecognitionBatchSize: number;
readonly adapter: {
readonly scheduler: 'dedicated_fifo';
readonly queueCapacity: number;
readonly maxPendingInputBytes: number;
};
}
export type CoreErrorCode =
| 'invalid_argument' | 'invalid_image' | 'unsupported_pixel_format'
| 'unsupported_capability' | 'invalid_model_bundle' | 'unsupported_model'
| 'model_integrity_failed' | 'runtime_initialization_failed' | 'inference_failed'
| 'postprocess_failed' | 'resource_limit_exceeded' | 'invalid_engine'
| 'internal_error';
export type AdapterErrorCode =
| 'bundle_io_failed' | 'queue_full' | 'environment_closing'
| 'unsupported_platform' | 'package_load_failed';
export type OcrErrorCode = CoreErrorCode | AdapterErrorCode;
export class OcrError extends Error {
constructor(code: OcrErrorCode, message: string, detail?: string);
readonly name: 'OcrError';
readonly code: OcrErrorCode;
readonly detail?: string;
readonly creationTrace?: CreationTrace;
}
export interface OcrEngine {
readonly info: EngineInfo;
recognize(image: RawImage, options?: RecognizeOptions): Promise<OcrResult>;
recognizeEncoded(data: Uint8Array, options?: RecognizeOptions): Promise<OcrResult>;
close(): Promise<void>;
}
export function createEngine(options?: CreateEngineOptions): Promise<OcrEngine>;
import cjs from './index.cjs';
export const createEngine = cjs.createEngine;
export const OcrError = cjs.OcrError;
'use strict';
const crypto = require('node:crypto');
const fs = require('node:fs');
const path = require('node:path');
function adapterError(code, message, detail, cause) {
const error = new Error(message, cause === undefined ? undefined : { cause });
error.name = 'OcrError';
error.code = code;
if (detail) error.detail = detail;
return error;
}
function platformIdentity() {
const key = `${process.platform}-${process.arch}`;
const identities = {
'darwin-arm64': { id: 'macos-arm64', os: 'darwin', architecture: 'arm64' },
'darwin-x64': { id: 'macos-x64', os: 'darwin', architecture: 'x86_64' },
'win32-x64': { id: 'windows-x64', os: 'win32', architecture: 'x86_64' },
};
if (key === 'linux-x64') {
const report = process.report?.getReport?.();
if (report?.header?.glibcVersionRuntime) {
return { id: 'linux-x64', os: 'linux', architecture: 'x86_64', libc: 'glibc' };
}
throw adapterError(
'unsupported_platform',
'light-ocr currently supports Linux x64 with glibc only',
key,
);
}
const identity = identities[key];
if (!identity) {
throw adapterError('unsupported_platform', `light-ocr does not support ${key}`, key);
}
return identity;
}
function platformPackage() {
const packages = {
'macos-arm64': '@arcships/light-ocr-darwin-arm64',
'macos-x64': '@arcships/light-ocr-darwin-x64',
'windows-x64': '@arcships/light-ocr-win32-x64',
'linux-x64': '@arcships/light-ocr-linux-x64-gnu',
};
return packages[platformIdentity().id];
}
function exactKeys(value, expected, field) {
if (!value || typeof value !== 'object' || Array.isArray(value)) {
throw adapterError('package_load_failed', `${field} must be an object`);
}
const actual = Object.keys(value).sort();
const wanted = [...expected].sort();
if (actual.length !== wanted.length || actual.some((key, index) => key !== wanted[index])) {
throw adapterError('package_load_failed', `${field} fields are invalid`);
}
}
function safeArtifactPath(root, value, field) {
if (typeof value !== 'string' || value === '' || value.includes('\0')) {
throw adapterError('package_load_failed', `${field} must be a package-relative path`);
}
const normalized = value.replaceAll('\\', '/');
if (
path.posix.isAbsolute(normalized) ||
/^[A-Za-z]:/.test(normalized) ||
normalized.split('/').some((part) => part === '..' || part === '' || part === '.')
) {
throw adapterError('package_load_failed', `${field} escapes the native package`, value);
}
const resolved = path.resolve(root, ...normalized.split('/'));
const relative = path.relative(path.resolve(root), resolved);
if (relative.startsWith('..') || path.isAbsolute(relative)) {
throw adapterError('package_load_failed', `${field} escapes the native package`, value);
}
return resolved;
}
function sha256(filename) {
return crypto.createHash('sha256').update(fs.readFileSync(filename)).digest('hex');
}
function verifyArtifact(root, artifact, field) {
exactKeys(artifact, ['path', 'bytes', 'sha256'], field);
const filename = safeArtifactPath(root, artifact.path, `${field}.path`);
let stats;
try {
stats = fs.lstatSync(filename);
} catch (cause) {
throw adapterError('package_load_failed', 'Descriptor artifact is missing', artifact.path, cause);
}
if (!stats.isFile() || stats.isSymbolicLink()) {
throw adapterError('package_load_failed', 'Descriptor artifact is not a regular file', artifact.path);
}
if (!Number.isSafeInteger(artifact.bytes) || artifact.bytes < 1 || stats.size !== artifact.bytes) {
throw adapterError('package_load_failed', 'Descriptor artifact byte count mismatch', artifact.path);
}
if (!/^[a-f0-9]{64}$/.test(artifact.sha256 || '') || sha256(filename) !== artifact.sha256) {
throw adapterError('package_load_failed', 'Descriptor artifact hash mismatch', artifact.path);
}
return filename;
}
function sameArtifact(left, right) {
return left?.path === right?.path && left?.bytes === right?.bytes &&
left?.sha256 === right?.sha256;
}
function validateRuntimeDescriptor(descriptorPath) {
const absoluteDescriptor = path.resolve(descriptorPath);
const nativeDirectory = path.dirname(absoluteDescriptor);
if (
path.basename(absoluteDescriptor) !== 'runtime-descriptor.json' ||
path.basename(nativeDirectory) !== 'native'
) {
throw adapterError(
'package_load_failed',
'Native runtime descriptor must use the package native/runtime-descriptor.json path',
absoluteDescriptor,
);
}
let descriptor;
try {
const nativeStats = fs.lstatSync(nativeDirectory);
if (!nativeStats.isDirectory() || nativeStats.isSymbolicLink()) {
throw new Error('native payload root is not a regular directory');
}
const stats = fs.lstatSync(absoluteDescriptor);
if (!stats.isFile() || stats.isSymbolicLink()) throw new Error('not a regular file');
descriptor = JSON.parse(fs.readFileSync(absoluteDescriptor, 'utf8'));
} catch (cause) {
throw adapterError(
'package_load_failed',
'Unable to read the native runtime descriptor',
absoluteDescriptor,
cause,
);
}
exactKeys(
descriptor,
['schemaVersion', 'platform', 'runtime', 'qualificationOnly', 'released',
'autoPolicy', 'providers', 'addon'],
'runtime descriptor',
);
if (descriptor.schemaVersion !== '2.0') {
throw adapterError('package_load_failed', 'Unsupported native runtime descriptor schema');
}
const root = path.dirname(path.dirname(absoluteDescriptor));
const expected = platformIdentity();
const expectedPlatformKeys = expected.libc
? ['id', 'os', 'architecture', 'libc']
: ['id', 'os', 'architecture'];
exactKeys(descriptor.platform, expectedPlatformKeys, 'platform');
const actual = descriptor.platform;
if (
actual.id !== expected.id ||
actual.os !== expected.os ||
actual.architecture !== expected.architecture ||
(expected.libc && actual.libc !== expected.libc)
) {
throw adapterError('package_load_failed', 'Native runtime descriptor platform mismatch');
}
if (
typeof descriptor.released !== 'boolean' ||
typeof descriptor.qualificationOnly !== 'boolean' ||
descriptor.qualificationOnly === descriptor.released
) {
throw adapterError('package_load_failed', 'Native runtime descriptor release flags are invalid');
}
exactKeys(descriptor.autoPolicy, ['id', 'version', 'providers'], 'autoPolicy');
const policy = descriptor.autoPolicy;
if (
typeof policy.id !== 'string' || policy.id === '' ||
!Number.isSafeInteger(policy.version) || policy.version < 1 || policy.version > 0xffffffff ||
!Array.isArray(policy.providers) || policy.providers.length === 0 ||
policy.providers.length > 3 || policy.providers.at(-1) !== 'cpu' ||
new Set(policy.providers).size !== policy.providers.length
) {
throw adapterError('package_load_failed', 'Native runtime descriptor Auto policy is invalid');
}
exactKeys(descriptor.runtime, ['flavor', 'kind', 'version', 'abi', 'artifacts'], 'runtime');
const runtime = descriptor.runtime;
const expectedRuntimes = {
cpu: { kind: 'onnxruntime-cpu', version: '1.22.0', abi: 'onnxruntime-c-api-22' },
webgpu: {
kind: 'onnxruntime-plugin-webgpu',
version: '1.24.4',
abi: 'onnxruntime-c-api-24-plugin-ep-0.1',
},
};
const expectedRuntime = expectedRuntimes[runtime.flavor];
if (
!expectedRuntime || runtime.kind !== expectedRuntime.kind ||
runtime.version !== expectedRuntime.version || runtime.abi !== expectedRuntime.abi ||
!Array.isArray(runtime.artifacts) || runtime.artifacts.length === 0
) {
throw adapterError('package_load_failed', 'Native runtime descriptor ABI identity is invalid');
}
if (runtime.flavor === 'webgpu' && !['linux', 'win32'].includes(actual.os)) {
throw adapterError('package_load_failed', 'WebGPU runtime is not supported on this platform');
}
if (runtime.flavor !== 'webgpu' && descriptor.qualificationOnly) {
throw adapterError('package_load_failed', 'CPU runtime cannot be qualification-only');
}
const addon = verifyArtifact(root, descriptor.addon, 'addon');
const runtimePaths = new Set();
const verifiedRuntime = new Map();
runtime.artifacts.forEach((artifact, index) => {
const filename = verifyArtifact(root, artifact, `runtime.artifacts[${index}]`);
if (runtimePaths.has(artifact.path)) {
throw adapterError('package_load_failed', 'Runtime artifact inventory contains a duplicate path');
}
runtimePaths.add(artifact.path);
verifiedRuntime.set(artifact.path, filename);
});
exactKeys(descriptor.providers, Object.keys(descriptor.providers), 'providers');
const availableProviders = Object.keys(descriptor.providers);
if (
availableProviders.length === 0 ||
new Set(availableProviders).size !== availableProviders.length ||
availableProviders.some((provider) => !['cpu', 'apple', 'webgpu'].includes(provider)) ||
!descriptor.providers.cpu
) {
throw adapterError('package_load_failed', 'Native runtime descriptor provider policy is invalid');
}
let webgpuLibrary = '';
let webgpuProviderBytes = 0;
let webgpuProviderSha256 = '';
for (const [providerId, provider] of Object.entries(descriptor.providers)) {
const expectedKeys = providerId === 'webgpu'
? ['runtimeProvider', 'providerVersion', 'qualificationId', 'providerLibrary', 'artifacts']
: ['runtimeProvider', 'qualificationId', 'artifacts'];
exactKeys(provider, expectedKeys, `providers.${providerId}`);
if (
typeof provider.qualificationId !== 'string' || provider.qualificationId === '' ||
!Array.isArray(provider.artifacts) || provider.artifacts.length === 0
) {
throw adapterError('package_load_failed', `Provider ${providerId} identity is invalid`);
}
const expectedProviderName = {
cpu: 'CPUExecutionProvider',
apple: 'CoreML',
webgpu: 'WebGpuExecutionProvider',
}[providerId];
if (provider.runtimeProvider !== expectedProviderName) {
throw adapterError('package_load_failed', `Provider ${providerId} runtime identity is invalid`);
}
const providerPaths = new Set();
provider.artifacts.forEach((artifact, index) => {
verifyArtifact(root, artifact, `providers.${providerId}.artifacts[${index}]`);
if (providerPaths.has(artifact.path)) {
throw adapterError('package_load_failed', `Provider ${providerId} has duplicate artifacts`);
}
providerPaths.add(artifact.path);
if (providerId !== 'apple' && !runtimePaths.has(artifact.path)) {
throw adapterError('package_load_failed', `Provider ${providerId} artifact is outside runtime inventory`);
}
if (providerId === 'apple' && artifact.path !== descriptor.addon.path) {
throw adapterError('package_load_failed', 'Apple provider artifact must be the native addon');
}
});
if (providerId === 'webgpu') {
if (provider.providerVersion !== '0.1.0') {
throw adapterError('package_load_failed', 'WebGPU provider version is invalid');
}
webgpuLibrary = verifyArtifact(root, provider.providerLibrary, 'providers.webgpu.providerLibrary');
const declared = provider.artifacts.find(
(artifact) => artifact.path === provider.providerLibrary.path,
);
const expectedBasename = actual.os === 'win32'
? 'onnxruntime_providers_webgpu.dll'
: 'libonnxruntime_providers_webgpu.so';
if (
!declared || !sameArtifact(declared, provider.providerLibrary) ||
path.basename(webgpuLibrary) !== expectedBasename
) {
throw adapterError('package_load_failed', 'WebGPU provider library contract is invalid');
}
webgpuProviderBytes = provider.providerLibrary.bytes;
webgpuProviderSha256 = provider.providerLibrary.sha256;
}
}
const coreName = actual.os === 'win32'
? 'onnxruntime.dll'
: actual.os === 'darwin'
? 'libonnxruntime.1.22.0.dylib'
: 'libonnxruntime.so.1';
const runtimeNames = [...verifiedRuntime.values()].map((filename) => path.basename(filename)).sort();
const expectedRuntimeNames = runtime.flavor === 'webgpu'
? actual.os === 'win32'
? ['dxcompiler.dll', 'dxil.dll', 'onnxruntime.dll', 'onnxruntime_providers_webgpu.dll']
: ['libonnxruntime.so.1', 'libonnxruntime_providers_webgpu.so']
: [coreName];
if (
runtimeNames.length !== expectedRuntimeNames.length ||
runtimeNames.some((name, index) => name !== expectedRuntimeNames[index])
) {
throw adapterError('package_load_failed', 'Native runtime artifact set is incomplete');
}
const cpuArtifacts = descriptor.providers.cpu.artifacts;
if (
cpuArtifacts.length !== 1 ||
path.basename(safeArtifactPath(root, cpuArtifacts[0].path, 'CPU artifact path')) !== coreName
) {
throw adapterError('package_load_failed', 'CPU provider does not reference the core runtime');
}
const actualPayload = new Set();
const inventory = (directory, relativeDirectory) => {
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
const relative = `${relativeDirectory}/${entry.name}`;
const filename = path.join(directory, entry.name);
if (entry.isSymbolicLink()) {
throw adapterError('package_load_failed', 'Native runtime payload contains a symlink', relative);
}
if (entry.isDirectory()) {
inventory(filename, relative);
} else if (entry.isFile() && relative !== 'native/runtime-descriptor.json') {
actualPayload.add(relative);
} else if (!entry.isFile()) {
throw adapterError('package_load_failed', 'Native runtime payload is not a regular file', relative);
}
}
};
inventory(nativeDirectory, 'native');
const referenced = new Set([descriptor.addon.path, ...runtimePaths]);
if (
actualPayload.size !== referenced.size ||
[...actualPayload].some((filename) => !referenced.has(filename))
) {
throw adapterError('package_load_failed', 'Native runtime descriptor payload inventory mismatch');
}
const expectedPolicy = runtime.flavor === 'webgpu'
? ['webgpu', 'cpu']
: actual.id === 'macos-arm64'
? ['apple', 'cpu']
: ['cpu'];
const expectedAvailable = runtime.flavor === 'webgpu'
? ['cpu', 'webgpu']
: actual.id === 'macos-arm64'
? ['apple', 'cpu']
: ['cpu'];
const sortedAvailable = [...availableProviders].sort();
if (
policy.providers.length !== expectedPolicy.length ||
policy.providers.some((provider, index) => provider !== expectedPolicy[index]) ||
sortedAvailable.length !== expectedAvailable.length ||
sortedAvailable.some((provider, index) => provider !== expectedAvailable[index]) ||
policy.providers.some((provider) => !availableProviders.includes(provider))
) {
throw adapterError(
'package_load_failed',
'Native runtime descriptor providers disagree with platform capabilities',
);
}
const providerQualificationIds = sortedAvailable.map(
(providerId) => descriptor.providers[providerId].qualificationId,
);
const runtimePolicy = Object.freeze({
id: policy.id,
version: policy.version,
platformId: actual.id,
runtimeFlavor: runtime.flavor,
runtimeVersion: runtime.version,
runtimeAbi: runtime.abi,
qualificationOnly: descriptor.qualificationOnly,
released: descriptor.released,
orderedCandidates: Object.freeze([...policy.providers]),
availableProviders: Object.freeze(sortedAvailable),
providerQualificationIds: Object.freeze(providerQualificationIds),
webgpuProviderLibrary: webgpuLibrary,
webgpuProviderBytes,
webgpuProviderSha256,
});
return {
addon,
descriptor: Object.freeze(descriptor),
descriptorPath: absoluteDescriptor,
runtimePolicy,
};
}
function resolveDevelopmentInput() {
if (!process.env.LIGHT_OCR_NODE_BINARY) return undefined;
const binary = path.resolve(process.env.LIGHT_OCR_NODE_BINARY);
const descriptor = process.env.LIGHT_OCR_RUNTIME_DESCRIPTOR
? path.resolve(process.env.LIGHT_OCR_RUNTIME_DESCRIPTOR)
: path.join(path.dirname(binary), 'runtime-descriptor.json');
return { binary, descriptor };
}
function validateNativeContract(binding, runtimePolicy) {
const contract = binding?.runtimeContract;
const fields = [
'policyId',
'policyVersion',
'platformId',
'runtimeFlavor',
'runtimeVersion',
'runtimeAbi',
'qualificationOnly',
'released',
];
const policyFields = {
policyId: runtimePolicy.id,
policyVersion: runtimePolicy.version,
platformId: runtimePolicy.platformId,
runtimeFlavor: runtimePolicy.runtimeFlavor,
runtimeVersion: runtimePolicy.runtimeVersion,
runtimeAbi: runtimePolicy.runtimeAbi,
qualificationOnly: runtimePolicy.qualificationOnly,
released: runtimePolicy.released,
};
if (
!contract ||
typeof contract !== 'object' ||
fields.some((field) => contract[field] !== policyFields[field]) ||
!Array.isArray(contract.orderedCandidates) ||
!Array.isArray(contract.availableProviders) ||
!Array.isArray(contract.providerQualificationIds) ||
contract.orderedCandidates.length !== runtimePolicy.orderedCandidates.length ||
contract.orderedCandidates.some(
(provider, index) => provider !== runtimePolicy.orderedCandidates[index],
) ||
contract.availableProviders.length !== runtimePolicy.availableProviders.length ||
contract.availableProviders.some(
(provider, index) => provider !== runtimePolicy.availableProviders[index],
) ||
contract.providerQualificationIds.length !== runtimePolicy.providerQualificationIds.length ||
contract.providerQualificationIds.some(
(qualificationId, index) => qualificationId !== runtimePolicy.providerQualificationIds[index],
)
) {
throw adapterError(
'package_load_failed',
'Runtime descriptor is incompatible with the native addon ABI or capabilities',
);
}
}
function loadNative() {
const development = resolveDevelopmentInput();
let input;
if (development) {
input = development;
} else {
const packageName = platformPackage();
try {
const binary = require.resolve(packageName);
input = { binary, descriptor: path.join(path.dirname(binary), 'runtime-descriptor.json') };
} catch (cause) {
throw adapterError(
'package_load_failed',
`Unable to locate ${packageName}`,
'Reinstall @arcships/light-ocr without --omit=optional and verify that the current platform is supported.',
cause,
);
}
}
if (!fs.existsSync(input.binary)) {
throw adapterError('package_load_failed', 'Native addon is missing', input.binary);
}
const verified = validateRuntimeDescriptor(input.descriptor);
if (path.resolve(input.binary) !== path.resolve(verified.addon)) {
throw adapterError('package_load_failed', 'Runtime descriptor addon path mismatch', input.binary);
}
try {
const binding = require(verified.addon);
validateNativeContract(binding, verified.runtimePolicy);
return Object.freeze({ binding, runtimePolicy: verified.runtimePolicy });
} catch (cause) {
throw adapterError('package_load_failed', 'Unable to load the verified native addon', '', cause);
}
}
module.exports = { loadNative, validateRuntimeDescriptor };
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{
"files": [
{
"bytes": 11358,
"path": "LICENSE",
"sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30"
},
{
"bytes": 258,
"path": "NOTICE",
"sha256": "24cb7b29285527efc05b8b85c3086fa589e06078dc3ad0075fb51546aa85f547"
},
{
"bytes": 321,
"path": "README.md",
"sha256": "56f5c2fc3c0e018a22bff801a721f04632ad84b044a4f87514ae3bfc79f77e51"
},
{
"bytes": 1616,
"path": "license-inventory.json",
"sha256": "45cb774e5492e547f17914007b77747d3c9c834851b57eac02ebe1e378673d06"
},
{
"bytes": 11376,
"path": "licenses/PP-OCRv6-Apache-2.0.txt",
"sha256": "3840c5c0c61c294264d2dd77b8777be6ddd90121ef4e0e64abcd22edea581d6e"
},
{
"bytes": 312,
"path": "licenses/PP-OCRv6-MODEL-NOTICE.md",
"sha256": "381c555aebec730789e4f7a60583024ba7d7c026a5a223ac938c91767e4e91ff"
},
{
"bytes": 1110,
"path": "licenses/clipper-BSL-1.0.txt",
"sha256": "32ee7398e3123736fd14e9f08287edc2d97ace102ab54d8dc4edc8d31c651fa8"
},
{
"bytes": 1076,
"path": "licenses/nlohmann-json-MIT.txt",
"sha256": "86b998c792894ccb911a1cb7994f7a9652894e7a094c0b5e45be2f553f45cf14"
},
{
"bytes": 1094,
"path": "licenses/onnxruntime-MIT.txt",
"sha256": "c250d6278f0b47a6439fb7592b08b58a55eb9f535aa49a1db63211c3f982b674"
},
{
"bytes": 333022,
"path": "licenses/onnxruntime-ThirdPartyNotices.txt",
"sha256": "e00f828e0a33de591a355ae6606d2625f5758da7d2c844db7821c9dd3e3647b6"
},
{
"bytes": 11358,
"path": "licenses/opencv-Apache-2.0.txt",
"sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30"
},
{
"bytes": 733,
"path": "licenses/opencv-COPYRIGHT.txt",
"sha256": "bba849c98da85a2b27b86113284a90812c959b1c1fc4ed67de9355475d1e6831"
},
{
"bytes": 2010,
"path": "licenses/opencv-carotene-BSD-3-Clause.txt",
"sha256": "fb86be28d90bfef2fffcb86469f7c19962b7a367da9676a521cc1fc33f2996fc"
},
{
"bytes": 1002,
"path": "licenses/opencv-zlib.txt",
"sha256": "845efc77857d485d91fb3e0b884aaa929368c717ae8186b66fe1ed2495753243"
},
{
"bytes": 2510,
"path": "licenses/stb-MIT-or-Unlicense.txt",
"sha256": "bebfe904b14301657e4e5d655c811d51fd31b97c455b9cc2d8600d6bac6cff63"
},
{
"bytes": 33514304,
"path": "native/libonnxruntime.1.22.0.dylib",
"sha256": "6c2f8af5def6e533f17383a4f07dc4eabbd4807d242a478b69f62fcfbe3c1dd3"
},
{
"bytes": 6083184,
"path": "native/light_ocr_node.node",
"sha256": "b64be6cd370c482b225186139babb547579099cc5a3e0f1a33b9c26fdf63c21a"
},
{
"bytes": 1468,
"path": "native/runtime-descriptor.json",
"sha256": "bfd0caa1a921b0471fe12c1bebfe403552251e1389cc088274ee89e99c29b219"
},
{
"bytes": 866,
"path": "package.json",
"sha256": "391490121c1da63510dd73ee066a14b5c261c62ac5632156b598b3f639c8fa30"
},
{
"bytes": 4930,
"path": "sbom.spdx.json",
"sha256": "87adbdae00b9fe7207ee1fa7e4e9ed73fd2d5ba111f936d9b78d9c82e58a2e2c"
}
],
"package": "@arcships/light-ocr-darwin-arm64",
"schemaVersion": "1.0",
"version": "0.3.0"
}
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{"files":[{"component":"opencv","file":"licenses/opencv-Apache-2.0.txt","sha256":"cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30"},{"component":"opencv","file":"licenses/opencv-COPYRIGHT.txt","sha256":"bba849c98da85a2b27b86113284a90812c959b1c1fc4ed67de9355475d1e6831"},{"component":"zlib","file":"licenses/opencv-zlib.txt","sha256":"845efc77857d485d91fb3e0b884aaa929368c717ae8186b66fe1ed2495753243"},{"component":"clipper","file":"licenses/clipper-BSL-1.0.txt","sha256":"32ee7398e3123736fd14e9f08287edc2d97ace102ab54d8dc4edc8d31c651fa8"},{"component":"nlohmann-json","file":"licenses/nlohmann-json-MIT.txt","sha256":"86b998c792894ccb911a1cb7994f7a9652894e7a094c0b5e45be2f553f45cf14"},{"component":"onnxruntime","file":"licenses/onnxruntime-MIT.txt","sha256":"c250d6278f0b47a6439fb7592b08b58a55eb9f535aa49a1db63211c3f982b674"},{"component":"onnxruntime","file":"licenses/onnxruntime-ThirdPartyNotices.txt","sha256":"e00f828e0a33de591a355ae6606d2625f5758da7d2c844db7821c9dd3e3647b6"},{"component":"stb","file":"licenses/stb-MIT-or-Unlicense.txt","sha256":"bebfe904b14301657e4e5d655c811d51fd31b97c455b9cc2d8600d6bac6cff63"},{"component":"PP-OCRv6-models","file":"licenses/PP-OCRv6-Apache-2.0.txt","sha256":"3840c5c0c61c294264d2dd77b8777be6ddd90121ef4e0e64abcd22edea581d6e"},{"component":"PP-OCRv6-models","file":"licenses/PP-OCRv6-MODEL-NOTICE.md","sha256":"381c555aebec730789e4f7a60583024ba7d7c026a5a223ac938c91767e4e91ff"},{"component":"carotene","file":"licenses/opencv-carotene-BSD-3-Clause.txt","sha256":"fb86be28d90bfef2fffcb86469f7c19962b7a367da9676a521cc1fc33f2996fc"}],"schemaVersion":"1.0"}
The MIT License (MIT)
Copyright (c) 2015 Gregor Ratajc, Lukas Treyer, Maxime Chalton
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) 2013-2022 Niels Lohmann
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Sorry, the diff of this file is too big to display

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
/*
* By downloading, copying, installing or using the software you agree to this license.
* If you do not agree to this license, do not download, install,
* copy or use the software.
*
*
* License Agreement
* For Open Source Computer Vision Library
* (3-clause BSD License)
*
* Copyright (C) 2014-2015, NVIDIA Corporation, all rights reserved.
* Third party copyrights are property of their respective owners.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the names of the copyright holders nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* This software is provided by the copyright holders and contributors "as is" and
* any express or implied warranties, including, but not limited to, the implied
* warranties of merchantability and fitness for a particular purpose are disclaimed.
* In no event shall copyright holders or contributors be liable for any direct,
* indirect, incidental, special, exemplary, or consequential damages
* (including, but not limited to, procurement of substitute goods or services;
* loss of use, data, or profits; or business interruption) however caused
* and on any theory of liability, whether in contract, strict liability,
* or tort (including negligence or otherwise) arising in any way out of
* the use of this software, even if advised of the possibility of such damage.
*/
Copyright (C) 2000-2022, Intel Corporation, all rights reserved.
Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
Copyright (C) 2009-2016, NVIDIA Corporation, all rights reserved.
Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
Copyright (C) 2015-2023, OpenCV Foundation, all rights reserved.
Copyright (C) 2008-2016, Itseez Inc., all rights reserved.
Copyright (C) 2019-2023, Xperience AI, all rights reserved.
Copyright (C) 2019-2022, Shenzhen Institute of Artificial Intelligence and Robotics for Society, all rights reserved.
Copyright (C) 2022-2023, Southern University of Science And Technology, all rights reserved.
Third party copyrights are property of their respective owners.
Copyright notice:
(C) 1995-2022 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
PP-OCRv6 small ONNX model bundle
PaddleOCR revision: b03f46425e8ff4442b268ce449e3eef758146cd4
Detection model revision: 28fe5895c24fd108c19eb3e8479f4ab385fbfc62
Recognition model revision: b8f84f0b80c529de40b4fbb3544b84fa7233a513
Sources: official PaddlePaddle model ecology archives listed in bundles.lock.json
This software is available under 2 licenses -- choose whichever you prefer.
------------------------------------------------------------------------------
ALTERNATIVE A - MIT License
Copyright (c) 2017 Sean Barrett
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
------------------------------------------------------------------------------
ALTERNATIVE B - Public Domain (www.unlicense.org)
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
software, either in source code form or as a compiled binary, for any purpose,
commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this
software dedicate any and all copyright interest in the software to the public
domain. We make this dedication for the benefit of the public at large and to
the detriment of our heirs and successors. We intend this dedication to be an
overt act of relinquishment in perpetuity of all present and future rights to
this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

{
"addon": {
"bytes": 6083184,
"path": "native/light_ocr_node.node",
"sha256": "b64be6cd370c482b225186139babb547579099cc5a3e0f1a33b9c26fdf63c21a"
},
"autoPolicy": {
"id": "macos-arm64-v1",
"providers": [
"apple",
"cpu"
],
"version": 1
},
"platform": {
"architecture": "arm64",
"id": "macos-arm64",
"os": "darwin"
},
"providers": {
"apple": {
"artifacts": [
{
"bytes": 6083184,
"path": "native/light_ocr_node.node",
"sha256": "b64be6cd370c482b225186139babb547579099cc5a3e0f1a33b9c26fdf63c21a"
}
],
"qualificationId": "apple-open-macos-v1",
"runtimeProvider": "CoreML"
},
"cpu": {
"artifacts": [
{
"bytes": 33514304,
"path": "native/libonnxruntime.1.22.0.dylib",
"sha256": "6c2f8af5def6e533f17383a4f07dc4eabbd4807d242a478b69f62fcfbe3c1dd3"
}
],
"qualificationId": "cpu-baseline-v1",
"runtimeProvider": "CPUExecutionProvider"
}
},
"qualificationOnly": false,
"released": true,
"runtime": {
"abi": "onnxruntime-c-api-22",
"artifacts": [
{
"bytes": 33514304,
"path": "native/libonnxruntime.1.22.0.dylib",
"sha256": "6c2f8af5def6e533f17383a4f07dc4eabbd4807d242a478b69f62fcfbe3c1dd3"
}
],
"flavor": "cpu",
"kind": "onnxruntime-cpu",
"version": "1.22.0"
},
"schemaVersion": "2.0"
}
light-ocr
Copyright 2026 light-ocr contributors
This product includes software developed by the light-ocr contributors.
Third-party licenses and notices for packaged dependencies and model
artifacts are distributed with their respective release artifacts.
{
"bugs": {
"url": "https://github.com/arcships/light-ocr/issues"
},
"cpu": [
"arm64"
],
"description": "Native macos-arm64 runtime for @arcships/light-ocr",
"engines": {
"node": "^22.0.0 || ^24.0.0"
},
"exports": {
".": "./native/light_ocr_node.node"
},
"files": [
"native/",
"licenses/",
"license-inventory.json",
"sbom.spdx.json",
"artifact-hashes.json",
"README.md",
"LICENSE",
"NOTICE"
],
"homepage": "https://github.com/arcships/light-ocr#readme",
"license": "Apache-2.0",
"main": "./native/light_ocr_node.node",
"name": "@arcships/light-ocr-darwin-arm64",
"os": [
"darwin"
],
"publishConfig": {
"access": "public",
"provenance": true
},
"repository": {
"type": "git",
"url": "git+https://github.com/arcships/light-ocr.git"
},
"version": "0.3.0"
}
# @arcships/light-ocr-darwin-arm64
The prebuilt macos-arm64 native runtime for `@arcships/light-ocr`.
This is an internal distribution package for `@arcships/light-ocr`. Install
the facade package instead of depending on this package directly.
Documentation: https://github.com/arcships/light-ocr
License: Apache-2.0
{"SPDXID":"SPDXRef-DOCUMENT","creationInfo":{"created":"2026-07-19T16:28:35Z","creators":["Tool: light-ocr-generate-release-metadata/1.0"]},"dataLicense":"CC0-1.0","documentDescribes":["SPDXRef-Package-light-ocr-core"],"documentNamespace":"https://light-ocr.invalid/spdx/f35e3d6f37da1c3e7924145ea08372bbe4aa7035a6728660d36a7f16ad8b4cda","name":"light-ocr-core-macos-arm64","packages":[{"SPDXID":"SPDXRef-Package-light-ocr-core","copyrightText":"Copyright 2026 light-ocr contributors","downloadLocation":"NOASSERTION","filesAnalyzed":false,"licenseConcluded":"Apache-2.0","licenseDeclared":"Apache-2.0","name":"light-ocr-core","versionInfo":"0.1.0"},{"SPDXID":"SPDXRef-Package-onnxruntime","checksums":[{"algorithm":"SHA256","checksumValue":"d571e63a2329baacb713f441e65ad75284de354db6e1ac435fe4bebbb417986a"}],"copyrightText":"NOASSERTION","downloadLocation":"https://api.nuget.org/v3-flatcontainer/microsoft.ml.onnxruntime/1.22.0/microsoft.ml.onnxruntime.1.22.0.nupkg","filesAnalyzed":false,"licenseConcluded":"MIT","licenseDeclared":"MIT","name":"onnxruntime","versionInfo":"1.22.0"},{"SPDXID":"SPDXRef-Package-opencv","checksums":[{"algorithm":"SHA256","checksumValue":"b2171af5be6b26f7a06b1229948bbb2bdaa74fcf5cd097e0af6378fce50a6eb9"}],"copyrightText":"NOASSERTION","downloadLocation":"https://codeload.github.com/opencv/opencv/tar.gz/refs/tags/4.10.0","filesAnalyzed":false,"licenseConcluded":"Apache-2.0","licenseDeclared":"Apache-2.0","name":"opencv","versionInfo":"4.10.0"},{"SPDXID":"SPDXRef-Package-opencv-zlib","copyrightText":"NOASSERTION","downloadLocation":"https://codeload.github.com/opencv/opencv/tar.gz/refs/tags/4.10.0","filesAnalyzed":false,"licenseConcluded":"Zlib","licenseDeclared":"Zlib","name":"zlib","versionInfo":"1.3.1"},{"SPDXID":"SPDXRef-Package-opencv-carotene","copyrightText":"NOASSERTION","downloadLocation":"https://codeload.github.com/opencv/opencv/tar.gz/refs/tags/4.10.0","filesAnalyzed":false,"licenseConcluded":"BSD-3-Clause","licenseDeclared":"BSD-3-Clause","name":"carotene","versionInfo":"0.0.1"},{"SPDXID":"SPDXRef-Package-clipper","checksums":[{"algorithm":"SHA256","checksumValue":"2be14496a1609fa8602d9d3672c83ee95d5ef44a08b765a60e65b93a68882ff6"}],"copyrightText":"NOASSERTION","downloadLocation":"https://codeload.github.com/fonttools/pyclipper/tar.gz/refs/tags/1.3.0.post6","filesAnalyzed":false,"licenseConcluded":"BSL-1.0","licenseDeclared":"BSL-1.0","name":"clipper","versionInfo":"6.4.2-pyclipper-1.3.0.post6"},{"SPDXID":"SPDXRef-Package-stb","checksums":[{"algorithm":"SHA256","checksumValue":"e4e3bba9c572a4a4148373a914d88ea0f0d11de8cc2c66739926e7eca0223319"}],"copyrightText":"NOASSERTION","downloadLocation":"https://codeload.github.com/nothings/stb/tar.gz/31c1ad37456438565541f4919958214b6e762fb4","filesAnalyzed":false,"licenseConcluded":"MIT OR Unlicense","licenseDeclared":"MIT OR Unlicense","name":"stb","versionInfo":"31c1ad37456438565541f4919958214b6e762fb4"},{"SPDXID":"SPDXRef-Package-nlohmann-json","checksums":[{"algorithm":"SHA256","checksumValue":"0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406"}],"copyrightText":"NOASSERTION","downloadLocation":"https://codeload.github.com/nlohmann/json/tar.gz/refs/tags/v3.11.3","filesAnalyzed":false,"licenseConcluded":"MIT","licenseDeclared":"MIT","name":"nlohmann-json","versionInfo":"3.11.3"},{"SPDXID":"SPDXRef-Package-PP-OCRv6-small-models","checksums":[{"algorithm":"SHA256","checksumValue":"e543b93bc4882f35b1564a71961e5bc55439ede6c2f33b4166acc15e6348712f"}],"copyrightText":"NOASSERTION","downloadLocation":"https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/PP-OCRv6_small_det_onnx_infer.tar","filesAnalyzed":false,"licenseConcluded":"Apache-2.0","licenseDeclared":"Apache-2.0","name":"PP-OCRv6-small-ONNX-models","versionInfo":"ppocrv6-small-onnx-20260714.2"}],"relationships":[{"relatedSpdxElement":"SPDXRef-Package-onnxruntime","relationshipType":"DEPENDS_ON","spdxElementId":"SPDXRef-Package-light-ocr-core"},{"relatedSpdxElement":"SPDXRef-Package-opencv","relationshipType":"DEPENDS_ON","spdxElementId":"SPDXRef-Package-light-ocr-core"},{"relatedSpdxElement":"SPDXRef-Package-opencv-zlib","relationshipType":"CONTAINS","spdxElementId":"SPDXRef-Package-opencv"},{"relatedSpdxElement":"SPDXRef-Package-opencv-carotene","relationshipType":"CONTAINS","spdxElementId":"SPDXRef-Package-opencv"},{"relatedSpdxElement":"SPDXRef-Package-clipper","relationshipType":"DEPENDS_ON","spdxElementId":"SPDXRef-Package-light-ocr-core"},{"relatedSpdxElement":"SPDXRef-Package-stb","relationshipType":"DEPENDS_ON","spdxElementId":"SPDXRef-Package-light-ocr-core"},{"relatedSpdxElement":"SPDXRef-Package-nlohmann-json","relationshipType":"DEPENDS_ON","spdxElementId":"SPDXRef-Package-light-ocr-core"},{"relatedSpdxElement":"SPDXRef-Package-PP-OCRv6-small-models","relationshipType":"DEPENDS_ON","spdxElementId":"SPDXRef-Package-light-ocr-core"}],"spdxVersion":"SPDX-2.3"}
light-ocr
Copyright 2026 light-ocr contributors
This product includes software developed by the light-ocr contributors.
Third-party licenses and notices for packaged dependencies and model
artifacts are distributed with their respective release artifacts.
{
"bugs": {
"url": "https://github.com/arcships/light-ocr/issues"
},
"dependencies": {
"@arcships/light-ocr-model-ppocrv6-small": "0.3.0"
},
"description": "Offline PP-OCRv6 OCR for Node.js, powered by an embeddable C++ core",
"engines": {
"node": "^22.0.0 || ^24.0.0"
},
"exports": {
".": {
"import": "./js/index.mjs",
"require": "./js/index.cjs",
"types": "./js/index.d.ts"
}
},
"files": [
"js/",
"README.md",
"LICENSE",
"NOTICE"
],
"homepage": "https://github.com/arcships/light-ocr#readme",
"keywords": [
"ocr",
"offline-ocr",
"pp-ocrv6",
"paddleocr",
"node-api",
"napi"
],
"license": "Apache-2.0",
"main": "./js/index.cjs",
"module": "./js/index.mjs",
"name": "@arcships/light-ocr",
"optionalDependencies": {
"@arcships/light-ocr-darwin-arm64": "0.3.0",
"@arcships/light-ocr-darwin-x64": "0.3.0",
"@arcships/light-ocr-linux-x64-gnu": "0.3.0",
"@arcships/light-ocr-win32-x64": "0.3.0"
},
"publishConfig": {
"access": "public",
"provenance": true
},
"repository": {
"type": "git",
"url": "git+https://github.com/arcships/light-ocr.git"
},
"type": "commonjs",
"types": "./js/index.d.ts",
"version": "0.3.0"
}
# @arcships/light-ocr
Offline OCR for Node.js applications, powered by PP-OCRv6 Small.
```bash
npm install @arcships/light-ocr
```
The default PP-OCRv6 Small model is included as a required dependency; no
runtime model download or postinstall compilation is used.
Documentation: https://github.com/arcships/light-ocr
License: Apache-2.0
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
PP-OCRv6 small ONNX model bundle
PaddleOCR revision: b03f46425e8ff4442b268ce449e3eef758146cd4
Detection model revision: 28fe5895c24fd108c19eb3e8479f4ab385fbfc62
Recognition model revision: b8f84f0b80c529de40b4fbb3544b84fa7233a513
Sources: official PaddlePaddle model ecology archives listed in bundles.lock.json

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet