sourcesql 0.1.0__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 (177) hide show
  1. sourcesql-0.1.0/.gitignore +28 -0
  2. sourcesql-0.1.0/AGENTS.md +13 -0
  3. sourcesql-0.1.0/LICENSE +202 -0
  4. sourcesql-0.1.0/NOTICE +10 -0
  5. sourcesql-0.1.0/PKG-INFO +223 -0
  6. sourcesql-0.1.0/README.md +195 -0
  7. sourcesql-0.1.0/apps/research/.vercelignore +46 -0
  8. sourcesql-0.1.0/apps/research/api/index.ts +39 -0
  9. sourcesql-0.1.0/apps/research/fixtures/legacy-snapshot.json +88 -0
  10. sourcesql-0.1.0/apps/research/fixtures/water-procurement.json +184 -0
  11. sourcesql-0.1.0/apps/research/index.html +12 -0
  12. sourcesql-0.1.0/apps/research/package-lock.json +3193 -0
  13. sourcesql-0.1.0/apps/research/package.json +42 -0
  14. sourcesql-0.1.0/apps/research/research.html +12 -0
  15. sourcesql-0.1.0/apps/research/scripts/build-vercel.ts +93 -0
  16. sourcesql-0.1.0/apps/research/scripts/build.ts +37 -0
  17. sourcesql-0.1.0/apps/research/scripts/inline-html.ts +36 -0
  18. sourcesql-0.1.0/apps/research/server/access.ts +38 -0
  19. sourcesql-0.1.0/apps/research/server/agent-guidance.ts +71 -0
  20. sourcesql-0.1.0/apps/research/server/app.ts +165 -0
  21. sourcesql-0.1.0/apps/research/server/engine.ts +305 -0
  22. sourcesql-0.1.0/apps/research/server/hosted-exa.ts +99 -0
  23. sourcesql-0.1.0/apps/research/server/hosted-search.ts +122 -0
  24. sourcesql-0.1.0/apps/research/server/http.ts +183 -0
  25. sourcesql-0.1.0/apps/research/server/main.ts +32 -0
  26. sourcesql-0.1.0/apps/research/server/mcp.ts +1277 -0
  27. sourcesql-0.1.0/apps/research/server/motherduck-schema.ts +16 -0
  28. sourcesql-0.1.0/apps/research/server/motherduck.ts +1367 -0
  29. sourcesql-0.1.0/apps/research/server/oauth.ts +160 -0
  30. sourcesql-0.1.0/apps/research/server/research.ts +136 -0
  31. sourcesql-0.1.0/apps/research/server/store.ts +1194 -0
  32. sourcesql-0.1.0/apps/research/server/ui-resource.ts +46 -0
  33. sourcesql-0.1.0/apps/research/src/agent-messaging.ts +44 -0
  34. sourcesql-0.1.0/apps/research/src/app.tsx +2328 -0
  35. sourcesql-0.1.0/apps/research/src/brand/sourcesql-mcp-icon-256.png +0 -0
  36. sourcesql-0.1.0/apps/research/src/branding.ts +5 -0
  37. sourcesql-0.1.0/apps/research/src/connection-errors.ts +9 -0
  38. sourcesql-0.1.0/apps/research/src/corrections.ts +132 -0
  39. sourcesql-0.1.0/apps/research/src/fonts/README.md +3 -0
  40. sourcesql-0.1.0/apps/research/src/fonts/stack-sans-headline-LICENSE.txt +93 -0
  41. sourcesql-0.1.0/apps/research/src/fonts/stack-sans-headline-latin.woff2 +0 -0
  42. sourcesql-0.1.0/apps/research/src/fonts/tasa-orbiter-LICENSE.txt +93 -0
  43. sourcesql-0.1.0/apps/research/src/fonts/tasa-orbiter-latin.woff2 +0 -0
  44. sourcesql-0.1.0/apps/research/src/host-auth.ts +122 -0
  45. sourcesql-0.1.0/apps/research/src/host.css +120 -0
  46. sourcesql-0.1.0/apps/research/src/host.ts +164 -0
  47. sourcesql-0.1.0/apps/research/src/navigation-read.ts +45 -0
  48. sourcesql-0.1.0/apps/research/src/presentation.ts +120 -0
  49. sourcesql-0.1.0/apps/research/src/research-links.ts +56 -0
  50. sourcesql-0.1.0/apps/research/src/research-tree-panel.tsx +210 -0
  51. sourcesql-0.1.0/apps/research/src/research-tree.ts +53 -0
  52. sourcesql-0.1.0/apps/research/src/schema.ts +509 -0
  53. sourcesql-0.1.0/apps/research/src/styles.css +1474 -0
  54. sourcesql-0.1.0/apps/research/src/typed-values.ts +130 -0
  55. sourcesql-0.1.0/apps/research/src/ui.tsx +72 -0
  56. sourcesql-0.1.0/apps/research/src/view-reconciliation.ts +86 -0
  57. sourcesql-0.1.0/apps/research/tests/agent-guidance.test.ts +170 -0
  58. sourcesql-0.1.0/apps/research/tests/agent-messaging.test.ts +85 -0
  59. sourcesql-0.1.0/apps/research/tests/async-jobs.test.ts +666 -0
  60. sourcesql-0.1.0/apps/research/tests/bridge.test.ts +114 -0
  61. sourcesql-0.1.0/apps/research/tests/build.test.ts +38 -0
  62. sourcesql-0.1.0/apps/research/tests/connection-errors.test.ts +22 -0
  63. sourcesql-0.1.0/apps/research/tests/helpers/concurrent-writer.ts +32 -0
  64. sourcesql-0.1.0/apps/research/tests/helpers/motherduck-sql-server.py +55 -0
  65. sourcesql-0.1.0/apps/research/tests/host-auth.test.ts +87 -0
  66. sourcesql-0.1.0/apps/research/tests/hosted-search.test.ts +123 -0
  67. sourcesql-0.1.0/apps/research/tests/motherduck-backend.test.ts +1887 -0
  68. sourcesql-0.1.0/apps/research/tests/motherduck-pool.test.ts +375 -0
  69. sourcesql-0.1.0/apps/research/tests/navigation-read.test.ts +157 -0
  70. sourcesql-0.1.0/apps/research/tests/navigation-store.test.ts +194 -0
  71. sourcesql-0.1.0/apps/research/tests/oauth-http.test.ts +217 -0
  72. sourcesql-0.1.0/apps/research/tests/oauth-metadata.test.ts +147 -0
  73. sourcesql-0.1.0/apps/research/tests/oauth.test.ts +293 -0
  74. sourcesql-0.1.0/apps/research/tests/presentation.test.ts +138 -0
  75. sourcesql-0.1.0/apps/research/tests/removal-tools.test.ts +90 -0
  76. sourcesql-0.1.0/apps/research/tests/research-links.test.ts +95 -0
  77. sourcesql-0.1.0/apps/research/tests/research-tree.test.ts +52 -0
  78. sourcesql-0.1.0/apps/research/tests/research.test.ts +607 -0
  79. sourcesql-0.1.0/apps/research/tests/row-lookup.test.ts +269 -0
  80. sourcesql-0.1.0/apps/research/tests/safety.test.ts +216 -0
  81. sourcesql-0.1.0/apps/research/tests/sourcesql.test.ts +1229 -0
  82. sourcesql-0.1.0/apps/research/tests/storage-backend.test.ts +260 -0
  83. sourcesql-0.1.0/apps/research/tests/ui-resource.test.ts +73 -0
  84. sourcesql-0.1.0/apps/research/tests/vercel.test.ts +801 -0
  85. sourcesql-0.1.0/apps/research/tests/view-reconciliation.test.ts +266 -0
  86. sourcesql-0.1.0/apps/research/tests/workflow.test.ts +569 -0
  87. sourcesql-0.1.0/apps/research/tsconfig.json +17 -0
  88. sourcesql-0.1.0/apps/research/ui-history/research-66390a91a9d5271f.html +309 -0
  89. sourcesql-0.1.0/apps/research/ui-history/research-b1349a13ba4d1fbe.html +309 -0
  90. sourcesql-0.1.0/apps/research/ui-history/research-b5ab74c900f06fdb.html +309 -0
  91. sourcesql-0.1.0/apps/research/ui-history/research-be8725d56a366d19.html +309 -0
  92. sourcesql-0.1.0/apps/research/ui-history/research-dfe1c3e8aec7c276.html +309 -0
  93. sourcesql-0.1.0/apps/research/vercel.json +33 -0
  94. sourcesql-0.1.0/assets/brand/README.md +17 -0
  95. sourcesql-0.1.0/docs/app-integration.md +98 -0
  96. sourcesql-0.1.0/docs/clients.md +103 -0
  97. sourcesql-0.1.0/docs/docker.md +160 -0
  98. sourcesql-0.1.0/docs/exa-research.md +155 -0
  99. sourcesql-0.1.0/docs/hosted-flight.md +186 -0
  100. sourcesql-0.1.0/docs/hosting.md +113 -0
  101. sourcesql-0.1.0/docs/language.md +45 -0
  102. sourcesql-0.1.0/docs/motherduck-backend.md +263 -0
  103. sourcesql-0.1.0/docs/motherduck-compatibility.md +117 -0
  104. sourcesql-0.1.0/docs/package.md +70 -0
  105. sourcesql-0.1.0/docs/personal-cloud-setup.md +285 -0
  106. sourcesql-0.1.0/docs/providers-hosted.md +77 -0
  107. sourcesql-0.1.0/docs/providers.md +71 -0
  108. sourcesql-0.1.0/docs/python-linux-qualification.md +121 -0
  109. sourcesql-0.1.0/docs/qualification.md +66 -0
  110. sourcesql-0.1.0/docs/roadmap.md +96 -0
  111. sourcesql-0.1.0/docs/vercel.md +238 -0
  112. sourcesql-0.1.0/examples/01_discovery.sql +12 -0
  113. sourcesql-0.1.0/examples/02_many_entities.sql +13 -0
  114. sourcesql-0.1.0/examples/03_refine_saved.sql +9 -0
  115. sourcesql-0.1.0/examples/04_private_join.sql +10 -0
  116. sourcesql-0.1.0/examples/05_expand_row.sql +9 -0
  117. sourcesql-0.1.0/examples/06_compare_snapshots.sql +9 -0
  118. sourcesql-0.1.0/examples/profiles.example.json +61 -0
  119. sourcesql-0.1.0/fixtures/research_sources.json +83 -0
  120. sourcesql-0.1.0/hatch_build.py +27 -0
  121. sourcesql-0.1.0/hosted/flight/build.py +323 -0
  122. sourcesql-0.1.0/hosted/flight/exa_profile.py +235 -0
  123. sourcesql-0.1.0/hosted/flight/runner.py +305 -0
  124. sourcesql-0.1.0/hosted/flight/tests/test_build.py +65 -0
  125. sourcesql-0.1.0/hosted/flight/tests/test_exa_profile.py +340 -0
  126. sourcesql-0.1.0/hosted/flight/tests/test_search_profiles.py +157 -0
  127. sourcesql-0.1.0/hosted/personal-cloud.mjs +1012 -0
  128. sourcesql-0.1.0/hosted/setup.mjs +452 -0
  129. sourcesql-0.1.0/provenance/reuse-manifest.json +67 -0
  130. sourcesql-0.1.0/pyproject.toml +95 -0
  131. sourcesql-0.1.0/spikes/motherduck-worker/README.md +65 -0
  132. sourcesql-0.1.0/spikes/motherduck-worker/src/gateway.mjs +173 -0
  133. sourcesql-0.1.0/spikes/motherduck-worker/src/worker.mjs +16 -0
  134. sourcesql-0.1.0/spikes/motherduck-worker/tests/gateway.test.mjs +358 -0
  135. sourcesql-0.1.0/spikes/sourcesql-vercel/README.md +46 -0
  136. sourcesql-0.1.0/src/sourcesql/__init__.py +2 -0
  137. sourcesql-0.1.0/src/sourcesql/bridge.py +87 -0
  138. sourcesql-0.1.0/src/sourcesql/cli.py +93 -0
  139. sourcesql-0.1.0/src/sourcesql/contracts.py +109 -0
  140. sourcesql-0.1.0/src/sourcesql/engine.py +1241 -0
  141. sourcesql-0.1.0/src/sourcesql/execution/linux_sandbox.py +280 -0
  142. sourcesql-0.1.0/src/sourcesql/execution/linux_syscalls.py +216 -0
  143. sourcesql-0.1.0/src/sourcesql/execution/planner.py +429 -0
  144. sourcesql-0.1.0/src/sourcesql/execution/worker.py +150 -0
  145. sourcesql-0.1.0/src/sourcesql/execution/worker_process.py +191 -0
  146. sourcesql-0.1.0/src/sourcesql/onboarding/__init__.py +191 -0
  147. sourcesql-0.1.0/src/sourcesql/providers/__init__.py +300 -0
  148. sourcesql-0.1.0/src/sourcesql/providers/common.py +346 -0
  149. sourcesql-0.1.0/src/sourcesql/providers/fixture.py +369 -0
  150. sourcesql-0.1.0/src/sourcesql/providers/search.py +539 -0
  151. sourcesql-0.1.0/src/sourcesql/providers/semantic.py +538 -0
  152. sourcesql-0.1.0/src/sourcesql/resources.py +133 -0
  153. sourcesql-0.1.0/src/sourcesql/sql/__init__.py +5 -0
  154. sourcesql-0.1.0/src/sourcesql/sql/admission.py +1049 -0
  155. sourcesql-0.1.0/src/sourcesql/storage/archive.py +98 -0
  156. sourcesql-0.1.0/src/sourcesql/storage/motherduck.py +507 -0
  157. sourcesql-0.1.0/src/sourcesql/storage/store.py +259 -0
  158. sourcesql-0.1.0/tests/adapters/test_budget_observer.py +34 -0
  159. sourcesql-0.1.0/tests/adapters/test_candidate_budget.py +103 -0
  160. sourcesql-0.1.0/tests/adapters/test_exa_contract.py +485 -0
  161. sourcesql-0.1.0/tests/adapters/test_providers.py +577 -0
  162. sourcesql-0.1.0/tests/integration/test_engine_plans.py +265 -0
  163. sourcesql-0.1.0/tests/integration/test_planner_execution.py +423 -0
  164. sourcesql-0.1.0/tests/packaging/qualify_distributions.py +210 -0
  165. sourcesql-0.1.0/tests/packaging/test_cli_setup.py +36 -0
  166. sourcesql-0.1.0/tests/packaging/test_resources.py +81 -0
  167. sourcesql-0.1.0/tests/security/test_durable_dispatch.py +109 -0
  168. sourcesql-0.1.0/tests/security/test_engine_boundaries.py +433 -0
  169. sourcesql-0.1.0/tests/security/test_final_audit.py +75 -0
  170. sourcesql-0.1.0/tests/security/test_linux_worker_isolation.py +626 -0
  171. sourcesql-0.1.0/tests/security/test_motherduck_store.py +486 -0
  172. sourcesql-0.1.0/tests/security/test_worker_isolation.py +130 -0
  173. sourcesql-0.1.0/tests/unit/test_personal_cloud_setup.py +183 -0
  174. sourcesql-0.1.0/tests/unit/test_remote_archive.py +222 -0
  175. sourcesql-0.1.0/tests/unit/test_sql_admission.py +200 -0
  176. sourcesql-0.1.0/tests/unit/test_sql_stage_limits.py +40 -0
  177. sourcesql-0.1.0/uv.lock +1051 -0
@@ -0,0 +1,28 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ .mypy_cache/
7
+ .agents/
8
+ skills-lock.json
9
+ .DS_Store
10
+ local/
11
+ artifacts/
12
+ dist/
13
+ .env*
14
+ !.env.example
15
+ .dev.vars*
16
+ !.dev.vars.example
17
+ spikes/*/node_modules/
18
+ spikes/*/.wrangler/
19
+ spikes/*/dist/
20
+ spikes/*/generated/
21
+ spikes/*/.vercel/
22
+ apps/research/node_modules
23
+ apps/research/dist/
24
+ apps/research/.ui-builds/
25
+ apps/research/.data/
26
+ apps/research/.tunnel/
27
+ apps/research/.vercel/
28
+ apps/research/.vercel-assets/
@@ -0,0 +1,13 @@
1
+ # sourcesQL implementation
2
+
3
+ The owner authorized local implementation on 2026-10-13, including subagents. Build a working independent engine and integrate an isolated copy of the existing Results Demo. Preserve the original app and memoriesQL checkouts.
4
+
5
+ Fixture mode is the default. Live provider calls require explicit configured credentials, destination permissions and an owner-approved total budget. No publication, upstream modification or external messages are implied. Keep private handoff documents, operator state and credentials outside public artifacts.
6
+
7
+ The host authors research SQL; the engine owns AST admission, typed staged evaluation, finite execution and immutable results. Use SQLGlot 30.19.0; never prefix/regex-only admission. No network UDFs in DuckDB, arbitrary file readers or query-owned policy. Unknown and failed are distinct; exact quotes establish textual support rather than truth. Corrections append revisions in the app store. Exports and result reuse reauthorize complete dependencies.
8
+
9
+ Delegate only nonoverlapping file lanes; root owns shared contracts, storage/worker/coordinator, integration and release evidence. Advertise only tested implemented behavior. Full live/host qualification is separate from fixture tests. Surface consequential product decisions, continue independent work, and keep STATUS.md accurate.
10
+
11
+ Public product naming is sourcesQL. Keep competitor research, comparison plans, benchmark evidence and results in ignored local files; do not commit or publish them. Preserve SQL syntax and ordinary UI selection terminology when cleaning up product names.
12
+
13
+ When asked to cut a PR, create it open and ready for review, subscribe to comments, and fix/respond to Codex Code Review comments.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
sourcesql-0.1.0/NOTICE ADDED
@@ -0,0 +1,10 @@
1
+ sourcesQL
2
+ Copyright 2026 John Inniger
3
+
4
+ SQL admission, immutable result, accounting and evidence invariants are informed
5
+ by selected public memoriesQL contracts and tests, Apache-2.0, at commit
6
+ 539fde637249fec68629ab25cbab5ffc95d5d055. Specific reuse is recorded in provenance/.
7
+
8
+ SQLGlot is a separately installed MIT dependency; its source is not bundled.
9
+ The research app derives from the owner's existing Results Demo source; its
10
+ origin and modifications are recorded in provenance/app-reuse.json.
@@ -0,0 +1,223 @@
1
+ Metadata-Version: 2.4
2
+ Name: sourcesql
3
+ Version: 0.1.0
4
+ Summary: Provider-independent SQL research with durable evidence
5
+ Project-URL: Repository, https://github.com/JohnnyFiv3r/sourcesQL
6
+ Project-URL: Documentation, https://github.com/JohnnyFiv3r/sourcesQL/blob/main/README.md
7
+ Project-URL: Issues, https://github.com/JohnnyFiv3r/sourcesQL/issues
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ License-File: NOTICE
11
+ Keywords: duckdb,mcp,sql,web-research
12
+ Classifier: Operating System :: MacOS
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Topic :: Database
18
+ Requires-Python: <3.15,>=3.12
19
+ Requires-Dist: duckdb==1.5.0
20
+ Requires-Dist: httpx==0.28.1
21
+ Requires-Dist: pyarrow==23.0.1
22
+ Requires-Dist: pydantic-ai-slim[openai]==2.27.0
23
+ Requires-Dist: pydantic==2.13.3
24
+ Requires-Dist: sqlglot==30.19.0
25
+ Provides-Extra: motherduck
26
+ Requires-Dist: psycopg[binary]==3.3.3; extra == 'motherduck'
27
+ Description-Content-Type: text/markdown
28
+
29
+ <p align="center">
30
+ <img src="https://raw.githubusercontent.com/JohnnyFiv3r/sourcesQL/main/assets/brand/sourcesql-mcp-icon.png" width="112" alt="sourcesQL logo">
31
+ </p>
32
+
33
+ # sourcesQL
34
+
35
+ **Web research you can query, inspect and keep working with.**
36
+
37
+ sourcesQL is an open-source research engine and MCP App. A connected assistant turns your request into SQL, searches the web, builds a structured dataset and presents the finished table in chat. You can inspect its sources, expand a row into a follow-up investigation, amend a field, review a later refresh and move the saved research between compatible installations.
38
+
39
+ Use it when the answer needs rows: a vendor comparison, a project pipeline, an organization inventory or a collection of claims with supporting sources. The result stays available for further SQL instead of becoming another table trapped in a conversation.
40
+
41
+ <p>
42
+ <a href="https://github.com/JohnnyFiv3r/sourcesQL/blob/main/LICENSE"><img alt="License: Apache 2.0" src="https://img.shields.io/badge/License-Apache%202.0-9AE4C2?style=flat-square&amp;labelColor=0E221D"></a>
43
+ <a href="https://github.com/JohnnyFiv3r/sourcesQL/blob/main/docs/python-linux-qualification.md"><img alt="Python: 3.12–3.14" src="https://img.shields.io/badge/Python-3.12%E2%80%933.14-9AE4C2?style=flat-square&amp;labelColor=0E221D"></a>
44
+ </p>
45
+
46
+ ## Keep working with saved research
47
+
48
+ Saved research includes the result, its supporting sources and the investigations that follow from it.
49
+
50
+ - **Expand.** Choose a row or a field within it and ask a follow-up question. The findings open in a linked child table, with the research tree keeping the path back to the parent. For example, expand one company into a table of its announced facilities.
51
+ - **Amend.** Correct a value and record why. Amendments have a separate revision history, so original observations stay available. Follow-up SQL can use the original result or a pinned amended view.
52
+ - **Refresh.** Check a field, row or table again, then review the proposed changes. Explicitly accept supported updates or keep the current values; earlier observations and amendments remain available.
53
+ - **Portable snapshots.** Export a research tree as a bundle and restore it in another compatible sourcesQL store. Bundles carry original results, sources, amendments, linked investigations and refresh decisions. Reopen saved findings without repeating web discovery.
54
+
55
+ See the [research lifecycle](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/docs/app-integration.md#contracts-and-lifecycle) and [snapshot/export contracts](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/docs/app-integration.md#snapshots-presentation-and-export) for supported scopes, review behavior and bundle limits.
56
+
57
+ ## How research works
58
+
59
+ The assistant plans the search terms. sourcesQL executes the query and keeps the data, evidence and execution receipt.
60
+
61
+ 1. **Discover broadly.** Use complementary search terms across terminology, source types and angles. Search results are candidate pages, not verified entities.
62
+ 2. **Reduce with SQL.** Merge overlapping results, deduplicate sources, filter available fields and join saved datasets before spending on semantic processing.
63
+ 3. **Extract selectively.** Apply semantic matching, extraction, scoring or normalization to candidates that still need it, using explicitly configured models.
64
+ 4. **Present the finished table.** Keep intermediate work behind the scenes. Open the final selection with readable labels, useful source links and an intentional row order.
65
+ 5. **Continue from saved research.** Reopen, query, correct, expand or refresh a result without repeating discovery unnecessarily.
66
+
67
+ SQL filters run before semantic work where the admitted query plan permits it. A final `LIMIT` bounds returned rows; it does not make earlier search or model work cheaper.
68
+
69
+ This query runs against the included **fictional fixtures**, with no API keys or network calls:
70
+
71
+ ```sql
72
+ SELECT
73
+ SEM_EXTRACT(content, 'project name explicitly stated') AS project,
74
+ SEM_EXTRACT(
75
+ content,
76
+ 'planned capacity in MW, number only',
77
+ type := 'DOUBLE'
78
+ ) AS planned_capacity_mw,
79
+ url AS source_url
80
+ FROM WEB_SEARCH('fictional Aurora Birch campuses')
81
+ WHERE SEM_MATCH(content, 'describes a specific data-center campus')
82
+ ORDER BY project, source_url;
83
+ ```
84
+
85
+ The engine supports `WEB_SEARCH`, `WEB_FETCH`, `SEM_MATCH`, `SEM_EXTRACT`, `SEM_EXTRACT_ALL`, `SEM_SCORE` and `SEM_NORM`. It accepts an explicit subset of DuckDB-style `SELECT` and nonrecursive `WITH` queries. See the [SQL reference](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/docs/language.md) for signatures, supported staging and refusals. Operator availability also depends on the selected provider profile.
86
+
87
+ ## The interactive workspace
88
+
89
+ The MCP App adds an interactive table to compatible clients, including ChatGPT. Use contextual table actions or ask the connected assistant to continue from a saved result. Linked tables are accessible through the research tree. Other MCP clients can use the same tools without rendering the app.
90
+
91
+ The app decorates column labels and source addresses without rewriting data. Missing values stay missing. Search excerpts remain identified as excerpts, and a supporting quote establishes what a source says rather than proving the claim true.
92
+
93
+ ## Choose an installation
94
+
95
+ | Path | You run | Best starting point |
96
+ | --- | --- | --- |
97
+ | **Local Docker** | App, MCP server and Python engine in containers; local persistent volumes | Try the workspace without installing Python or Node |
98
+ | **Python / source checkout** | CLI or Python engine; optional Node app | Build queries, integrate the engine or develop the project |
99
+ | **Personal cloud** | Vercel gateway, MotherDuck storage and Flights; OAuth for ChatGPT | Use a hosted MCP endpoint without keeping Docker running |
100
+
101
+ Every path starts in **fixture mode**. Live search and model calls require credentials, an enabled trusted profile and explicit execution budgets.
102
+
103
+ ### Local Docker
104
+
105
+ Clone this repository and run from its root with Docker running:
106
+
107
+ ```sh
108
+ git clone https://github.com/JohnnyFiv3r/sourcesQL.git
109
+ cd sourcesQL
110
+ docker compose up --build -d sourcesql-app
111
+ ```
112
+
113
+ Open **[localhost:3117](http://127.0.0.1:3117)**. The initial workspace uses synthetic data. Its named volume preserves results and corrections across restarts.
114
+
115
+ To connect a local MCP client over stdio, first build the app image:
116
+
117
+ ```sh
118
+ docker compose build sourcesql-mcp
119
+ ```
120
+
121
+ Then configure the client to run `docker compose run --rm -T --no-deps sourcesql-mcp` from this checkout. The [Docker guide](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/docs/docker.md#mcp-over-stdio) includes a complete MCP configuration, storage details and the CLI container. The default stdio container has no network; live providers require deliberate network and credential configuration.
122
+
123
+ A local endpoint alone is not reachable by hosted ChatGPT. Use the hosted path below for a remotely accessible, authenticated connection.
124
+
125
+ ### Python and CLI
126
+
127
+ Install with Python 3.12–3.14 on macOS or Linux:
128
+
129
+ ```sh
130
+ python -m pip install sourcesql
131
+ sourcesql --store ./research-data demo --output ./research-demo
132
+ sourcesql --store ./research-data capabilities --json
133
+ ```
134
+
135
+ The installed demo includes fictional sources and needs no credentials or checkout. Each successful query returns an immutable `result_id`, typed columns, a bounded row preview and an execution receipt. Use the ID printed by `demo` to reopen or export it:
136
+
137
+ ```sh
138
+ sourcesql --store ./research-data read RESULT_ID --offset 0 --limit 100
139
+ sourcesql --store ./research-data export --result RESULT_ID --output result-bundle.json
140
+ sourcesql --store ./restored import result-bundle.json --no-network
141
+ ```
142
+
143
+ For source development, clone this repository, install [uv](https://docs.astral.sh/uv/) and run `uv sync --frozen`. Then use `uv run sourcesql` in place of `sourcesql`. See [package installation and release checks](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/docs/package.md).
144
+
145
+ For Python integration, import `Engine` from `sourcesql.engine`. The [examples](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/examples/) cover discovery, saved-result refinement, row expansion and snapshot comparison.
146
+
147
+ To run the app from source, install **Node.js 24**, prepare the root Python environment with `uv sync --frozen`, then run:
148
+
149
+ ```sh
150
+ cd apps/research
151
+ npm ci
152
+ npm run build
153
+ npm start
154
+ ```
155
+
156
+ Open [localhost:3117](http://127.0.0.1:3117), or use `npm run stdio` with a local MCP client. See the [example client configuration](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/apps/research/mcp-config.example.json). CLI and app stores are separate by default; use the MCP query/result-reference workflow for app research, or research bundles to move it between stores.
157
+
158
+ Actual SQL execution requires the supported OS protections: macOS `sandbox-exec`, or Linux Landlock and seccomp. Missing protection causes a refusal. Use Docker on Windows. See [runtime qualification](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/docs/python-linux-qualification.md) for the tested environments.
159
+
160
+ ### Personal cloud: Vercel + MotherDuck
161
+
162
+ This path uses your own accounts and one owner workspace:
163
+
164
+ ```text
165
+ ChatGPT / MCP client
166
+ │
167
+ ▼
168
+ Vercel: MCP tools, app UI, authentication
169
+ │
170
+ ▼
171
+ MotherDuck: saved research, evidence, corrections, jobs
172
+ │
173
+ └── on-demand Flight: Python research execution
174
+ ```
175
+
176
+ Ordinary reads, tree navigation and corrections use stored records without starting Python. Research runs as a bounded asynchronous job. One job runs at a time per owner namespace; queued jobs resume explicitly. A lost response is recovered using the same request and job IDs.
177
+
178
+ The installed package includes guided setup:
179
+
180
+ ```sh
181
+ sourcesql setup personal-cloud --help
182
+ sourcesql setup personal-cloud plan --config personal.json --workspace ./my-cloud
183
+ sourcesql setup personal-cloud apply --workspace ./my-cloud --approve-plan PLAN_SHA256
184
+ ```
185
+
186
+ Follow the [personal-cloud setup guide](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/docs/personal-cloud-setup.md) to prepare your accounts, owner identity and token-free configuration. The plan records the exact destination, public source hashes, execution policy and proposed changes before applying them. Repeating an approved plan recovers its saved resources; uncertain creation stops for inspection.
187
+
188
+ Setup provisions a Vercel Preview gateway and a bounded MotherDuck Flight. It keeps credentials server-side, defaults to fixture mode and leaves account creation, OAuth registration and the exact-domain protection exception as visible account steps. Verify one fixture job and reopen its stored result before enabling live research. The [client guide](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/docs/clients.md) covers ChatGPT, Claude and Cursor, including which host interactions have actually been qualified.
189
+
190
+ Eligible personal, non-commercial adopters can choose Vercel Hobby; no Pro-only feature is required by this configuration. MotherDuck, search and model consumption are separate. Included allowances may cover light use, but application budgets do not guarantee that a platform account with billing enabled stops before overage.
191
+
192
+ ## Configure live search and models
193
+
194
+ Start with the [provider guide](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/docs/providers.md) and [profile template](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/examples/profiles.example.json). Keep real configuration and secrets outside version control.
195
+
196
+ | Capability | Configuration |
197
+ | --- | --- |
198
+ | Local live search | Exa, Brave or Serper adapter; its API key, live permission and finite budget |
199
+ | Semantic extraction / matching / normalization | An explicitly named model and its credential |
200
+ | Semantic scoring | An explicitly configured embedding adapter |
201
+ | Hosted Exa, Brave or Serper | Choose one live provider per reviewed Flight; bind its secret and matching gateway policy |
202
+
203
+ For search-only work, omit model and embedding settings. An Exa API key does not enable semantic operators or authorize spending. Request budgets must fit the trusted profile; source fetching also requires approved destination hosts.
204
+
205
+ The existing owner deployment’s qualified hosted profile, **`exa-search.v1`**, uses Exa Auto and retained excerpts. It permits **two searches and ten candidate pages per job**, with no extra fetches or model calls. It is a small search-only configuration, not broad entity-research capacity. Larger fanout and semantic research need separately configured and qualified execution profiles. The [hosted provider guide](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/docs/providers-hosted.md) describes the new Brave/Serper options and their qualification limits; see also the [hosted policy](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/docs/hosted-flight.md#opt-in-exa-search) and [Exa research notes](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/docs/exa-research.md).
206
+
207
+ ## Status and development
208
+
209
+ The project includes the Python package, local Docker app, guided personal-cloud setup, durable MotherDuck jobs and storage, and hosted ChatGPT OAuth/app rendering. Fixture tests, live provider quality and host integration are different checks; the [current status](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/STATUS.md) records their scope and remaining gaps. Broad live research quality, hosted semantic models and Claude rendering are not qualified by the small Exa integration.
210
+
211
+ Run local checks from the repository root:
212
+
213
+ ```sh
214
+ uv run pytest -q
215
+ npm ci --prefix apps/research
216
+ npm --prefix apps/research run check
217
+ ```
218
+
219
+ Positive SQL worker tests need permission to launch the OS sandbox. A sandbox refusal is not a passing execution test. See [qualification](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/docs/qualification.md) and [app integration](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/docs/app-integration.md) for the execution, evidence and storage contracts.
220
+
221
+ The [roadmap](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/docs/roadmap.md) puts compact research checkpoints and manual evidence-backed updates after adoption. These extend saved research; they are planned capabilities.
222
+
223
+ Licensed under [Apache 2.0](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/LICENSE). Attribution and source reuse are recorded in [NOTICE](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/NOTICE) and [provenance](https://github.com/JohnnyFiv3r/sourcesQL/blob/main/provenance/).