harborrag-core 2.0.0a1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. harborrag_core-2.0.0a1/.gitignore +252 -0
  2. harborrag_core-2.0.0a1/LICENSE +201 -0
  3. harborrag_core-2.0.0a1/PKG-INFO +74 -0
  4. harborrag_core-2.0.0a1/README.md +64 -0
  5. harborrag_core-2.0.0a1/pyproject.toml +16 -0
  6. harborrag_core-2.0.0a1/src/harborrag_core/__init__.py +29 -0
  7. harborrag_core-2.0.0a1/src/harborrag_core/base.py +111 -0
  8. harborrag_core-2.0.0a1/src/harborrag_core/chunking/__init__.py +60 -0
  9. harborrag_core-2.0.0a1/src/harborrag_core/chunking/errors.py +6 -0
  10. harborrag_core-2.0.0a1/src/harborrag_core/chunking/identity.py +198 -0
  11. harborrag_core-2.0.0a1/src/harborrag_core/chunking/metadata.py +61 -0
  12. harborrag_core-2.0.0a1/src/harborrag_core/chunking/record.py +118 -0
  13. harborrag_core-2.0.0a1/src/harborrag_core/chunking/schemas.py +240 -0
  14. harborrag_core-2.0.0a1/src/harborrag_core/chunking/source_schemas.py +102 -0
  15. harborrag_core-2.0.0a1/src/harborrag_core/chunking/table_schemas.py +73 -0
  16. harborrag_core-2.0.0a1/src/harborrag_core/contracts/__init__.py +49 -0
  17. harborrag_core-2.0.0a1/src/harborrag_core/contracts/chunking.py +126 -0
  18. harborrag_core-2.0.0a1/src/harborrag_core/contracts/errors.py +80 -0
  19. harborrag_core-2.0.0a1/src/harborrag_core/contracts/events.py +14 -0
  20. harborrag_core-2.0.0a1/src/harborrag_core/domain/__init__.py +42 -0
  21. harborrag_core-2.0.0a1/src/harborrag_core/domain/activity.py +28 -0
  22. harborrag_core-2.0.0a1/src/harborrag_core/domain/document.py +170 -0
  23. harborrag_core-2.0.0a1/src/harborrag_core/domain/element.py +26 -0
  24. harborrag_core-2.0.0a1/src/harborrag_core/domain/job.py +51 -0
  25. harborrag_core-2.0.0a1/src/harborrag_core/domain/member.py +28 -0
  26. harborrag_core-2.0.0a1/src/harborrag_core/domain/parser.py +57 -0
  27. harborrag_core-2.0.0a1/src/harborrag_core/domain/pending_effect.py +26 -0
  28. harborrag_core-2.0.0a1/src/harborrag_core/domain/project.py +42 -0
  29. harborrag_core-2.0.0a1/src/harborrag_core/domain/provenance.py +21 -0
  30. harborrag_core-2.0.0a1/src/harborrag_core/domain/provider.py +31 -0
  31. harborrag_core-2.0.0a1/src/harborrag_core/domain/raw_document.py +21 -0
  32. harborrag_core-2.0.0a1/src/harborrag_core/domain/retrieval.py +19 -0
  33. harborrag_core-2.0.0a1/src/harborrag_core/domain/settings.py +20 -0
  34. harborrag_core-2.0.0a1/src/harborrag_core/domain/source.py +17 -0
  35. harborrag_core-2.0.0a1/src/harborrag_core/domain/source_config.py +38 -0
  36. harborrag_core-2.0.0a1/src/harborrag_core/domain/table.py +171 -0
  37. harborrag_core-2.0.0a1/src/harborrag_core/domain/validation.py +90 -0
  38. harborrag_core-2.0.0a1/src/harborrag_core/indexing/__init__.py +61 -0
  39. harborrag_core-2.0.0a1/src/harborrag_core/ingestion/__init__.py +188 -0
  40. harborrag_core-2.0.0a1/src/harborrag_core/ingestion/artifact_contracts.py +111 -0
  41. harborrag_core-2.0.0a1/src/harborrag_core/ingestion/canonical_codec.py +101 -0
  42. harborrag_core-2.0.0a1/src/harborrag_core/ingestion/comments.py +42 -0
  43. harborrag_core-2.0.0a1/src/harborrag_core/ingestion/errors.py +57 -0
  44. harborrag_core-2.0.0a1/src/harborrag_core/ingestion/graph_attribute_validation.py +119 -0
  45. harborrag_core-2.0.0a1/src/harborrag_core/ingestion/identity.py +273 -0
  46. harborrag_core-2.0.0a1/src/harborrag_core/ingestion/lifecycle_contracts.py +143 -0
  47. harborrag_core-2.0.0a1/src/harborrag_core/ingestion/projection_contracts.py +333 -0
  48. harborrag_core-2.0.0a1/src/harborrag_core/ingestion/projection_vector.py +160 -0
  49. harborrag_core-2.0.0a1/src/harborrag_core/ingestion/representations.py +79 -0
  50. harborrag_core-2.0.0a1/src/harborrag_core/ingestion/source_contracts.py +116 -0
  51. harborrag_core-2.0.0a1/src/harborrag_core/ingestion/states.py +163 -0
  52. harborrag_core-2.0.0a1/src/harborrag_core/ingestion/task_query_contracts.py +44 -0
  53. harborrag_core-2.0.0a1/src/harborrag_core/invariants.py +25 -0
  54. harborrag_core-2.0.0a1/src/harborrag_core/models/__init__.py +191 -0
  55. harborrag_core-2.0.0a1/src/harborrag_core/models/capabilities.py +48 -0
  56. harborrag_core-2.0.0a1/src/harborrag_core/models/chat/__init__.py +47 -0
  57. harborrag_core-2.0.0a1/src/harborrag_core/models/chat/content.py +85 -0
  58. harborrag_core-2.0.0a1/src/harborrag_core/models/chat/enums.py +44 -0
  59. harborrag_core-2.0.0a1/src/harborrag_core/models/chat/messages.py +85 -0
  60. harborrag_core-2.0.0a1/src/harborrag_core/models/chat/requests.py +91 -0
  61. harborrag_core-2.0.0a1/src/harborrag_core/models/chat/responses.py +78 -0
  62. harborrag_core-2.0.0a1/src/harborrag_core/models/chat/tools.py +40 -0
  63. harborrag_core-2.0.0a1/src/harborrag_core/models/context.py +21 -0
  64. harborrag_core-2.0.0a1/src/harborrag_core/models/embed.py +148 -0
  65. harborrag_core-2.0.0a1/src/harborrag_core/models/errors.py +306 -0
  66. harborrag_core-2.0.0a1/src/harborrag_core/models/headers.py +27 -0
  67. harborrag_core-2.0.0a1/src/harborrag_core/models/metadata.py +15 -0
  68. harborrag_core-2.0.0a1/src/harborrag_core/models/rerank.py +136 -0
  69. harborrag_core-2.0.0a1/src/harborrag_core/models/usage.py +11 -0
  70. harborrag_core-2.0.0a1/src/harborrag_core/observability/__init__.py +0 -0
  71. harborrag_core-2.0.0a1/src/harborrag_core/observability/process_logging.py +77 -0
  72. harborrag_core-2.0.0a1/src/harborrag_core/ports/__init__.py +74 -0
  73. harborrag_core-2.0.0a1/src/harborrag_core/ports/agent_runs.py +107 -0
  74. harborrag_core-2.0.0a1/src/harborrag_core/ports/control_plane.py +219 -0
  75. harborrag_core-2.0.0a1/src/harborrag_core/ports/conversation.py +71 -0
  76. harborrag_core-2.0.0a1/src/harborrag_core/ports/events.py +30 -0
  77. harborrag_core-2.0.0a1/src/harborrag_core/ports/indexing.py +154 -0
  78. harborrag_core-2.0.0a1/src/harborrag_core/ports/memory.py +183 -0
  79. harborrag_core-2.0.0a1/src/harborrag_core/ports/model_clients.py +191 -0
  80. harborrag_core-2.0.0a1/src/harborrag_core/ports/retrieval.py +38 -0
  81. harborrag_core-2.0.0a1/src/harborrag_core/ports/secrets.py +23 -0
  82. harborrag_core-2.0.0a1/src/harborrag_core/retrieval/__init__.py +31 -0
  83. harborrag_core-2.0.0a1/src/harborrag_core/retrieval/graph.py +163 -0
  84. harborrag_core-2.0.0a1/src/harborrag_core/schemas/__init__.py +0 -0
  85. harborrag_core-2.0.0a1/src/harborrag_core/schemas/cache.py +28 -0
  86. harborrag_core-2.0.0a1/src/harborrag_core/schemas/documents.py +40 -0
  87. harborrag_core-2.0.0a1/src/harborrag_core/schemas/graph.py +67 -0
  88. harborrag_core-2.0.0a1/src/harborrag_core/schemas/ids.py +68 -0
  89. harborrag_core-2.0.0a1/src/harborrag_core/schemas/object_store.py +61 -0
  90. harborrag_core-2.0.0a1/src/harborrag_core/schemas/state.py +65 -0
  91. harborrag_core-2.0.0a1/src/harborrag_core/schemas/storage.py +99 -0
  92. harborrag_core-2.0.0a1/src/harborrag_core/schemas/telemetry.py +35 -0
  93. harborrag_core-2.0.0a1/src/harborrag_core/schemas/vector.py +191 -0
  94. harborrag_core-2.0.0a1/src/harborrag_core/security/__init__.py +17 -0
  95. harborrag_core-2.0.0a1/src/harborrag_core/security/context.py +19 -0
  96. harborrag_core-2.0.0a1/src/harborrag_core/security/field_names.py +25 -0
  97. harborrag_core-2.0.0a1/src/harborrag_core/security/redaction.py +73 -0
  98. harborrag_core-2.0.0a1/src/harborrag_core/security/remote_transport.py +76 -0
  99. harborrag_core-2.0.0a1/src/harborrag_core/security/url_policy.py +99 -0
  100. harborrag_core-2.0.0a1/src/harborrag_core/storage/__init__.py +15 -0
  101. harborrag_core-2.0.0a1/src/harborrag_core/testing/chunking.py +47 -0
  102. harborrag_core-2.0.0a1/src/harborrag_core/testing/control_plane_fakes.py +298 -0
  103. harborrag_core-2.0.0a1/src/harborrag_core/testing/fakes.py +131 -0
  104. harborrag_core-2.0.0a1/src/harborrag_core/testing/graph_fakes.py +253 -0
  105. harborrag_core-2.0.0a1/tests/chunking_test_fixtures.py +70 -0
  106. harborrag_core-2.0.0a1/tests/core_test_fixtures.py +177 -0
  107. harborrag_core-2.0.0a1/tests/test_canonical_document_table_contracts.py +226 -0
  108. harborrag_core-2.0.0a1/tests/test_canonical_ingestion_codec.py +112 -0
  109. harborrag_core-2.0.0a1/tests/test_chunking_contracts.py +47 -0
  110. harborrag_core-2.0.0a1/tests/test_chunking_identity.py +52 -0
  111. harborrag_core-2.0.0a1/tests/test_chunking_schemas.py +230 -0
  112. harborrag_core-2.0.0a1/tests/test_chunking_value_validation.py +170 -0
  113. harborrag_core-2.0.0a1/tests/test_contracts_errors.py +45 -0
  114. harborrag_core-2.0.0a1/tests/test_core_contracts_domain_security.py +242 -0
  115. harborrag_core-2.0.0a1/tests/test_domain_control_plane.py +77 -0
  116. harborrag_core-2.0.0a1/tests/test_domain_job.py +100 -0
  117. harborrag_core-2.0.0a1/tests/test_graph_schema_v2.py +115 -0
  118. harborrag_core-2.0.0a1/tests/test_ingestion_identity.py +178 -0
  119. harborrag_core-2.0.0a1/tests/test_model_contracts.py +197 -0
  120. harborrag_core-2.0.0a1/tests/test_observability_process_logging.py +84 -0
  121. harborrag_core-2.0.0a1/tests/test_ports_control_plane_fakes.py +323 -0
  122. harborrag_core-2.0.0a1/tests/test_ports_control_plane_pending_effect_fake.py +30 -0
  123. harborrag_core-2.0.0a1/tests/test_ports_fakes_queue_and_secrets.py +81 -0
  124. harborrag_core-2.0.0a1/tests/test_ports_graph_fakes.py +158 -0
  125. harborrag_core-2.0.0a1/tests/test_ports_memory.py +82 -0
  126. harborrag_core-2.0.0a1/tests/test_remote_transport.py +39 -0
  127. harborrag_core-2.0.0a1/tests/test_security_robustness_regressions.py +224 -0
  128. harborrag_core-2.0.0a1/tests/test_storage_schemas.py +92 -0
  129. harborrag_core-2.0.0a1/tests/test_table_artifact_contracts.py +208 -0
  130. harborrag_core-2.0.0a1/tests/test_testing_chunking.py +43 -0
@@ -0,0 +1,252 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ *.lcov
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+ harborrag_control.db
65
+ harborrag_control.db-journal
66
+
67
+ # Flask stuff:
68
+ instance/
69
+ .webassets-cache
70
+
71
+ # Scrapy stuff:
72
+ .scrapy
73
+
74
+ # Sphinx documentation
75
+ docs/_build/
76
+
77
+ # PyBuilder
78
+ .pybuilder/
79
+ target/
80
+
81
+ # Jupyter Notebook
82
+ .ipynb_checkpoints
83
+
84
+ # IPython
85
+ profile_default/
86
+ ipython_config.py
87
+
88
+ # pyenv
89
+ # For a library or package, you might want to ignore these files since the code is
90
+ # intended to run in multiple environments; otherwise, check them in:
91
+ # .python-version
92
+
93
+ # pipenv
94
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
96
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
97
+ # install all needed dependencies.
98
+ # Pipfile.lock
99
+
100
+ # UV
101
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
102
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
103
+ # commonly ignored for libraries.
104
+ # uv.lock
105
+
106
+ # poetry
107
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
108
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
109
+ # commonly ignored for libraries.
110
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
111
+ # poetry.lock
112
+ # poetry.toml
113
+
114
+ # pdm
115
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
116
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
117
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
118
+ # pdm.lock
119
+ # pdm.toml
120
+ .pdm-python
121
+ .pdm-build/
122
+
123
+ # pixi
124
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
125
+ # pixi.lock
126
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
127
+ # in the .venv directory. It is recommended not to include this directory in version control.
128
+ .pixi/*
129
+ !.pixi/config.toml
130
+
131
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
132
+ __pypackages__/
133
+
134
+ # Celery stuff
135
+ celerybeat-schedule*
136
+ celerybeat.pid
137
+
138
+ # Redis
139
+ *.rdb
140
+ *.aof
141
+ *.pid
142
+
143
+ # RabbitMQ
144
+ mnesia/
145
+ rabbitmq/
146
+ rabbitmq-data/
147
+
148
+ # ActiveMQ
149
+ activemq-data/
150
+
151
+ # SageMath parsed files
152
+ *.sage.py
153
+
154
+ # Environments
155
+ .env
156
+ .envrc
157
+ .venv
158
+ env
159
+ venv/
160
+ ENV/
161
+ env.bak/
162
+ venv.bak/
163
+
164
+ # HarborRAG local runtime state and ingested object data
165
+ /.harborrag/
166
+ /.local/
167
+ # ...and the same, wherever a package nests its own local runtime state.
168
+ **/.local/
169
+
170
+ # Spyder project settings
171
+ .spyderproject
172
+ .spyproject
173
+
174
+ # Rope project settings
175
+ .ropeproject
176
+
177
+ # mkdocs documentation
178
+ /site
179
+
180
+ # mypy
181
+ .mypy_cache/
182
+ .dmypy.json
183
+ dmypy.json
184
+
185
+ # Pyre type checker
186
+ .pyre/
187
+
188
+ # pytype static type analyzer
189
+ .pytype/
190
+
191
+ # Cython debug symbols
192
+ cython_debug/
193
+
194
+ # PyCharm
195
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
196
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
197
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
198
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
199
+ # .idea/
200
+
201
+ # Abstra
202
+ # Abstra is an AI-powered process automation framework.
203
+ # Ignore directories containing user credentials, local state, and settings.
204
+ # Learn more at https://abstra.io/docs
205
+ .abstra/
206
+
207
+ # Visual Studio Code
208
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
209
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
210
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
211
+ # you could uncomment the following to ignore the entire vscode folder
212
+ .vscode/
213
+ # Temporary file for partial code execution
214
+ tempCodeRunnerFile.py
215
+
216
+ # Ruff stuff:
217
+ .ruff_cache/
218
+
219
+ # PyPI configuration file
220
+ .pypirc
221
+
222
+ # Marimo
223
+ marimo/_static/
224
+ marimo/_lsp/
225
+ __marimo__/
226
+
227
+ # Streamlit
228
+ .streamlit/secrets.toml
229
+
230
+ .claude/**
231
+ .agents/
232
+
233
+ examples/
234
+
235
+ # OS / editor noise
236
+ .DS_Store
237
+ .~lock.*#
238
+
239
+ # Generated API contract artifact (exported by make openapi)
240
+ openapi.json
241
+ clients/typescript/src/schema.d.ts
242
+ clients/typescript/dist/
243
+ clients/typescript/node_modules/
244
+
245
+ # Internal architecture working notes (kept out of the repo per team decision)
246
+ docs/developers/architecture/http_backend/
247
+
248
+ # Docling image output (config/parsers.yaml pdf-docling.image_output_dir)
249
+ /data/docling-images/
250
+
251
+ # Local macOS-compatible copy of dev.sh (bash 3.2 / BSD sed tweaks)
252
+ scripts/deployment/dev-mac.sh
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,74 @@
1
+ Metadata-Version: 2.5
2
+ Name: harborrag-core
3
+ Version: 2.0.0a1
4
+ Summary: Core contracts, domain, ports, execution, observability, and security for HarborRAG.
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.12
8
+ Requires-Dist: pydantic<3,>=2.13
9
+ Description-Content-Type: text/markdown
10
+
11
+ # harborrag-core
12
+
13
+ The provider-neutral foundation of [HarborRAG](https://github.com/cbtw-apac/HarborRAG):
14
+ domain models, protocol contracts, storage schemas, and security helpers. It has no
15
+ provider SDK dependencies, so importing it pulls in nothing heavy and performs no I/O.
16
+
17
+ Every other HarborRAG package depends on this one. You rarely install it alone - install
18
+ [`harborrag`](https://pypi.org/project/harborrag/) instead - but you import from it
19
+ whenever you write an adapter or type a function signature against HarborRAG data.
20
+
21
+ ```bash
22
+ pip install harborrag-core
23
+ ```
24
+
25
+ ## What it exports
26
+
27
+ ```python
28
+ from harborrag_core import Document, HarborError, RetrievalQuery, RetrievalResult
29
+ ```
30
+
31
+ | Group | Names |
32
+ | --- | --- |
33
+ | Documents | `Document`, `DocumentElement`, `DocumentProvenance`, `DocumentRelation`, `RawDocument`, `SourceRecord` |
34
+ | Retrieval | `RetrievalQuery`, `RetrievalResult` |
35
+ | Errors | `HarborError` - the base of every HarborRAG exception |
36
+ | Security | `URLPolicy`, `URLPolicyError`, `redact_secrets`, `redact_mapping` |
37
+
38
+ Deeper contracts stay in submodules rather than the package root:
39
+
40
+ | Submodule | Contains |
41
+ | --- | --- |
42
+ | `harborrag_core.ports.*` | protocols adapters implement - `ports.model_clients`, `ports.memory`, `ports.conversation`, and the repository ports |
43
+ | `harborrag_core.domain.*` | domain models shared by more than one package |
44
+ | `harborrag_core.contracts.errors` | the full exception family re-exported as `HarborError` and its subclasses |
45
+ | `harborrag_core.base` | `StrictModel` and `ExtensibleModel`, the validated-model base classes |
46
+
47
+ ## Contributing to this package
48
+
49
+ - Add only stable, dependency-light contracts here.
50
+ - Keep provider SDKs out of this package.
51
+ - Add protocols in `harborrag_core.ports.*` when adapters need a shared model contract;
52
+ model-client protocols live in `harborrag_core.ports.model_clients`.
53
+ - Add domain models in `harborrag_core.domain.*` only when multiple packages need them.
54
+ - Reuse `StrictModel` or `ExtensibleModel` from `harborrag_core.base` for validated models.
55
+ - Add package-wide exceptions to `harborrag_core.contracts.errors`; keep subsystem error
56
+ families near their subsystem.
57
+
58
+ **Hard rule:** `harborrag-core` must never import `harborrag-adapters`, `harborrag-engine`,
59
+ `harborrag-runtime`, `harborrag-app`, `harborrag-mcp-server`, or the `harborrag`
60
+ meta-package. `scripts/check_dependency_direction.py` enforces this in CI.
61
+
62
+ ## Development
63
+
64
+ Tests for this package live in `packages/harborrag-core/tests/`. Run them from the
65
+ repository root:
66
+
67
+ ```bash
68
+ uv run pytest packages/harborrag-core/tests
69
+ ```
70
+
71
+ See [Extending HarborRAG](https://cbtw-apac.github.io/HarborRAG/docs/developers/extending/README.html)
72
+ for how contracts here relate to adapter implementations.
73
+
74
+ Licensed under the Apache License 2.0.
@@ -0,0 +1,64 @@
1
+ # harborrag-core
2
+
3
+ The provider-neutral foundation of [HarborRAG](https://github.com/cbtw-apac/HarborRAG):
4
+ domain models, protocol contracts, storage schemas, and security helpers. It has no
5
+ provider SDK dependencies, so importing it pulls in nothing heavy and performs no I/O.
6
+
7
+ Every other HarborRAG package depends on this one. You rarely install it alone - install
8
+ [`harborrag`](https://pypi.org/project/harborrag/) instead - but you import from it
9
+ whenever you write an adapter or type a function signature against HarborRAG data.
10
+
11
+ ```bash
12
+ pip install harborrag-core
13
+ ```
14
+
15
+ ## What it exports
16
+
17
+ ```python
18
+ from harborrag_core import Document, HarborError, RetrievalQuery, RetrievalResult
19
+ ```
20
+
21
+ | Group | Names |
22
+ | --- | --- |
23
+ | Documents | `Document`, `DocumentElement`, `DocumentProvenance`, `DocumentRelation`, `RawDocument`, `SourceRecord` |
24
+ | Retrieval | `RetrievalQuery`, `RetrievalResult` |
25
+ | Errors | `HarborError` - the base of every HarborRAG exception |
26
+ | Security | `URLPolicy`, `URLPolicyError`, `redact_secrets`, `redact_mapping` |
27
+
28
+ Deeper contracts stay in submodules rather than the package root:
29
+
30
+ | Submodule | Contains |
31
+ | --- | --- |
32
+ | `harborrag_core.ports.*` | protocols adapters implement - `ports.model_clients`, `ports.memory`, `ports.conversation`, and the repository ports |
33
+ | `harborrag_core.domain.*` | domain models shared by more than one package |
34
+ | `harborrag_core.contracts.errors` | the full exception family re-exported as `HarborError` and its subclasses |
35
+ | `harborrag_core.base` | `StrictModel` and `ExtensibleModel`, the validated-model base classes |
36
+
37
+ ## Contributing to this package
38
+
39
+ - Add only stable, dependency-light contracts here.
40
+ - Keep provider SDKs out of this package.
41
+ - Add protocols in `harborrag_core.ports.*` when adapters need a shared model contract;
42
+ model-client protocols live in `harborrag_core.ports.model_clients`.
43
+ - Add domain models in `harborrag_core.domain.*` only when multiple packages need them.
44
+ - Reuse `StrictModel` or `ExtensibleModel` from `harborrag_core.base` for validated models.
45
+ - Add package-wide exceptions to `harborrag_core.contracts.errors`; keep subsystem error
46
+ families near their subsystem.
47
+
48
+ **Hard rule:** `harborrag-core` must never import `harborrag-adapters`, `harborrag-engine`,
49
+ `harborrag-runtime`, `harborrag-app`, `harborrag-mcp-server`, or the `harborrag`
50
+ meta-package. `scripts/check_dependency_direction.py` enforces this in CI.
51
+
52
+ ## Development
53
+
54
+ Tests for this package live in `packages/harborrag-core/tests/`. Run them from the
55
+ repository root:
56
+
57
+ ```bash
58
+ uv run pytest packages/harborrag-core/tests
59
+ ```
60
+
61
+ See [Extending HarborRAG](https://cbtw-apac.github.io/HarborRAG/docs/developers/extending/README.html)
62
+ for how contracts here relate to adapter implementations.
63
+
64
+ Licensed under the Apache License 2.0.
@@ -0,0 +1,16 @@
1
+ [project]
2
+ name = "harborrag-core"
3
+ version = "2.0.0a1"
4
+ description = "Core contracts, domain, ports, execution, observability, and security for HarborRAG."
5
+ requires-python = ">=3.12"
6
+ readme = "README.md"
7
+ license = "Apache-2.0"
8
+ license-files = ["LICENSE"]
9
+ dependencies = ["pydantic>=2.13,<3"]
10
+
11
+ [build-system]
12
+ requires = ["hatchling"]
13
+ build-backend = "hatchling.build"
14
+
15
+ [tool.hatch.build.targets.wheel]
16
+ packages = ["src/harborrag_core"]
@@ -0,0 +1,29 @@
1
+ from harborrag_core.contracts.errors import HarborError
2
+ from harborrag_core.domain import (
3
+ Document,
4
+ DocumentElement,
5
+ DocumentProvenance,
6
+ DocumentRelation,
7
+ RawDocument,
8
+ RetrievalQuery,
9
+ RetrievalResult,
10
+ SourceRecord,
11
+ )
12
+ from harborrag_core.security.redaction import redact_mapping, redact_secrets
13
+ from harborrag_core.security.url_policy import URLPolicy, URLPolicyError
14
+
15
+ __all__ = [
16
+ "Document",
17
+ "DocumentElement",
18
+ "DocumentProvenance",
19
+ "DocumentRelation",
20
+ "HarborError",
21
+ "RawDocument",
22
+ "RetrievalQuery",
23
+ "RetrievalResult",
24
+ "SourceRecord",
25
+ "URLPolicy",
26
+ "URLPolicyError",
27
+ "redact_mapping",
28
+ "redact_secrets",
29
+ ]