openai4s 0.1.0__py3-none-any.whl

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 (445) hide show
  1. envs/README.md +21 -0
  2. envs/README_zh.md +18 -0
  3. envs/phylo.yml +30 -0
  4. envs/python.yml +54 -0
  5. envs/r.yml +19 -0
  6. envs/struct.yml +31 -0
  7. openai4s/README.md +61 -0
  8. openai4s/README_zh.md +61 -0
  9. openai4s/__init__.py +7 -0
  10. openai4s/__main__.py +7 -0
  11. openai4s/adapters/README.md +27 -0
  12. openai4s/adapters/README_zh.md +27 -0
  13. openai4s/adapters/__init__.py +3 -0
  14. openai4s/adapters/jupyter/README.md +25 -0
  15. openai4s/adapters/jupyter/README_zh.md +25 -0
  16. openai4s/adapters/jupyter/__init__.py +22 -0
  17. openai4s/adapters/jupyter/bridge.py +290 -0
  18. openai4s/adapters/jupyter/kernelspec.py +251 -0
  19. openai4s/agent/README.md +42 -0
  20. openai4s/agent/README_zh.md +42 -0
  21. openai4s/agent/__init__.py +23 -0
  22. openai4s/agent/actions.py +258 -0
  23. openai4s/agent/compaction.py +748 -0
  24. openai4s/agent/control.py +292 -0
  25. openai4s/agent/delegation.py +1349 -0
  26. openai4s/agent/engine.py +143 -0
  27. openai4s/agent/events.py +60 -0
  28. openai4s/agent/finalize.py +224 -0
  29. openai4s/agent/ledger.py +828 -0
  30. openai4s/agent/loop.py +627 -0
  31. openai4s/agent/models.py +127 -0
  32. openai4s/agent/ports.py +78 -0
  33. openai4s/agent/runtime.py +458 -0
  34. openai4s/artifact_restore.py +228 -0
  35. openai4s/bash_capability.py +20 -0
  36. openai4s/capabilities.py +210 -0
  37. openai4s/cli/README.md +23 -0
  38. openai4s/cli/README_zh.md +23 -0
  39. openai4s/cli/__init__.py +4 -0
  40. openai4s/cli/main.py +608 -0
  41. openai4s/compute/README.md +49 -0
  42. openai4s/compute/README_zh.md +49 -0
  43. openai4s/compute/__init__.py +4 -0
  44. openai4s/compute/manager.py +560 -0
  45. openai4s/compute/registry.py +230 -0
  46. openai4s/compute/templates/README.md +34 -0
  47. openai4s/compute/templates/README_zh.md +34 -0
  48. openai4s/compute/templates/run.sh.tmpl +5 -0
  49. openai4s/compute/templates/wrapper.sh.tmpl +178 -0
  50. openai4s/config.py +372 -0
  51. openai4s/egress.py +268 -0
  52. openai4s/execution/README.md +28 -0
  53. openai4s/execution/README_zh.md +28 -0
  54. openai4s/execution/__init__.py +32 -0
  55. openai4s/execution/coordinator.py +851 -0
  56. openai4s/execution/dependencies.py +740 -0
  57. openai4s/execution/models.py +51 -0
  58. openai4s/execution/watchdog.py +153 -0
  59. openai4s/host/README.md +50 -0
  60. openai4s/host/README_zh.md +50 -0
  61. openai4s/host/__init__.py +32 -0
  62. openai4s/host/bash.py +607 -0
  63. openai4s/host/completion.py +128 -0
  64. openai4s/host/credentials.py +116 -0
  65. openai4s/host/data.py +499 -0
  66. openai4s/host/delegation.py +189 -0
  67. openai4s/host/delegation_policy.py +343 -0
  68. openai4s/host/endpoints.py +218 -0
  69. openai4s/host/files.py +122 -0
  70. openai4s/host/llm.py +80 -0
  71. openai4s/host/mcp.py +193 -0
  72. openai4s/host/progress.py +161 -0
  73. openai4s/host/remote_capabilities.py +253 -0
  74. openai4s/host/remote_science.py +344 -0
  75. openai4s/host/science.py +658 -0
  76. openai4s/host/session.py +301 -0
  77. openai4s/host/skills.py +333 -0
  78. openai4s/host_dispatch.py +1915 -0
  79. openai4s/jobs.py +180 -0
  80. openai4s/kernel/README.md +51 -0
  81. openai4s/kernel/README_zh.md +51 -0
  82. openai4s/kernel/__init__.py +5 -0
  83. openai4s/kernel/background.py +183 -0
  84. openai4s/kernel/environment.py +229 -0
  85. openai4s/kernel/environments.py +309 -0
  86. openai4s/kernel/guards.py +193 -0
  87. openai4s/kernel/lazy.py +140 -0
  88. openai4s/kernel/manager.py +417 -0
  89. openai4s/kernel/preinstall.py +302 -0
  90. openai4s/kernel/provenance.py +497 -0
  91. openai4s/kernel/r_kernel.py +99 -0
  92. openai4s/kernel/r_worker.R +523 -0
  93. openai4s/kernel/recovery.py +1111 -0
  94. openai4s/kernel/supervisor.py +721 -0
  95. openai4s/kernel/worker.py +879 -0
  96. openai4s/llm/README.md +38 -0
  97. openai4s/llm/README_zh.md +38 -0
  98. openai4s/llm/__init__.py +132 -0
  99. openai4s/llm/capabilities.py +904 -0
  100. openai4s/llm/catalog.py +139 -0
  101. openai4s/llm/client.py +120 -0
  102. openai4s/llm/messages.py +322 -0
  103. openai4s/llm/models.py +7 -0
  104. openai4s/llm/providers/README.md +26 -0
  105. openai4s/llm/providers/README_zh.md +26 -0
  106. openai4s/llm/providers/__init__.py +13 -0
  107. openai4s/llm/providers/anthropic.py +78 -0
  108. openai4s/llm/providers/gemini.py +79 -0
  109. openai4s/llm/providers/openai.py +232 -0
  110. openai4s/llm/providers/responses.py +205 -0
  111. openai4s/llm/registry.py +132 -0
  112. openai4s/llm/tooling.py +307 -0
  113. openai4s/llm/transport.py +85 -0
  114. openai4s/mcp_client.py +348 -0
  115. openai4s/mcp_servers/README.md +23 -0
  116. openai4s/mcp_servers/README_zh.md +23 -0
  117. openai4s/mcp_servers/__init__.py +2 -0
  118. openai4s/mcp_servers/example_server.py +260 -0
  119. openai4s/onboarding.py +167 -0
  120. openai4s/permissions.py +737 -0
  121. openai4s/pkgscan.py +225 -0
  122. openai4s/prompts.py +196 -0
  123. openai4s/replay.py +191 -0
  124. openai4s/review.py +371 -0
  125. openai4s/sdk/README.md +44 -0
  126. openai4s/sdk/README_zh.md +44 -0
  127. openai4s/sdk/__init__.py +4 -0
  128. openai4s/sdk/bash.py +432 -0
  129. openai4s/sdk/compute.py +563 -0
  130. openai4s/sdk/host.py +1113 -0
  131. openai4s/security/README.md +49 -0
  132. openai4s/security/README_zh.md +49 -0
  133. openai4s/security/__init__.py +45 -0
  134. openai4s/security/audit_hook.py +206 -0
  135. openai4s/security/biosecurity.py +165 -0
  136. openai4s/security/classifier.py +410 -0
  137. openai4s/security/injection.py +137 -0
  138. openai4s/security/sandbox.py +795 -0
  139. openai4s/security/shellcheck.py +90 -0
  140. openai4s/server/README.md +83 -0
  141. openai4s/server/README_zh.md +83 -0
  142. openai4s/server/__init__.py +10 -0
  143. openai4s/server/action_timeline.py +434 -0
  144. openai4s/server/agent_run.py +591 -0
  145. openai4s/server/artifacts.py +804 -0
  146. openai4s/server/cell_run.py +646 -0
  147. openai4s/server/completions.py +372 -0
  148. openai4s/server/daemon.py +139 -0
  149. openai4s/server/execution_coordinator.py +457 -0
  150. openai4s/server/execution_views.py +309 -0
  151. openai4s/server/gateway.py +8975 -0
  152. openai4s/server/global_views.py +170 -0
  153. openai4s/server/model_discovery.py +221 -0
  154. openai4s/server/model_profiles.py +290 -0
  155. openai4s/server/notebook_export.py +304 -0
  156. openai4s/server/plans.py +510 -0
  157. openai4s/server/recovery_control.py +655 -0
  158. openai4s/server/recovery_execution.py +231 -0
  159. openai4s/server/recovery_recipe.py +452 -0
  160. openai4s/server/recovery_runtime.py +684 -0
  161. openai4s/server/renderers.py +206 -0
  162. openai4s/server/reviews.py +683 -0
  163. openai4s/server/session_branching.py +637 -0
  164. openai4s/server/session_deletion.py +284 -0
  165. openai4s/server/session_domain.py +984 -0
  166. openai4s/server/session_package.py +3042 -0
  167. openai4s/server/session_recovery.py +264 -0
  168. openai4s/server/session_runtime.py +52 -0
  169. openai4s/server/skill_sidecars.py +155 -0
  170. openai4s/server/skills.py +391 -0
  171. openai4s/server/titles.py +157 -0
  172. openai4s/server/variable_inspector.py +207 -0
  173. openai4s/server/webui/README.md +41 -0
  174. openai4s/server/webui/README_zh.md +41 -0
  175. openai4s/server/webui/app.js +7548 -0
  176. openai4s/server/webui/favicon.js +66 -0
  177. openai4s/server/webui/favicon_anim_64.gif +0 -0
  178. openai4s/server/webui/index.html +172 -0
  179. openai4s/server/webui/scientific_renderers.js +334 -0
  180. openai4s/server/webui/style.css +1433 -0
  181. openai4s/server/webui/vendor/3Dmol-min.js +2 -0
  182. openai4s/server/webui/vendor/fonts/AnthropicMono-Italic-Web-DHGc3er-.woff2 +0 -0
  183. openai4s/server/webui/vendor/fonts/AnthropicMono-Roman-Web-B88FVziN.woff2 +0 -0
  184. openai4s/server/webui/vendor/fonts/AnthropicSans-Italic-Variable-BI1hrwN4.woff2 +0 -0
  185. openai4s/server/webui/vendor/fonts/AnthropicSans-Roman-Variable-CFxw3nG7.woff2 +0 -0
  186. openai4s/server/webui/vendor/fonts/AnthropicSerif-Italic-Variable-DH94ugQz.woff2 +0 -0
  187. openai4s/server/webui/vendor/fonts/AnthropicSerif-Roman-Variable-C-BHYa_K.woff2 +0 -0
  188. openai4s/server/webui/vendor/fonts/anthropicons-variable-DICoRAgs.woff2 +0 -0
  189. openai4s/server/workbench_state.py +389 -0
  190. openai4s/skills_loader/README.md +26 -0
  191. openai4s/skills_loader/README_zh.md +26 -0
  192. openai4s/skills_loader/__init__.py +16 -0
  193. openai4s/skills_loader/loader.py +772 -0
  194. openai4s/skills_loader/versions.py +657 -0
  195. openai4s/storage/README.md +62 -0
  196. openai4s/storage/README_zh.md +62 -0
  197. openai4s/storage/__init__.py +52 -0
  198. openai4s/storage/actions.py +979 -0
  199. openai4s/storage/activation.py +409 -0
  200. openai4s/storage/agents.py +109 -0
  201. openai4s/storage/annotations.py +151 -0
  202. openai4s/storage/artifacts.py +1008 -0
  203. openai4s/storage/branch_projection.py +209 -0
  204. openai4s/storage/capabilities.py +374 -0
  205. openai4s/storage/checkpoint_state.py +1188 -0
  206. openai4s/storage/connectors.py +119 -0
  207. openai4s/storage/delegation.py +612 -0
  208. openai4s/storage/deletion.py +502 -0
  209. openai4s/storage/frames.py +850 -0
  210. openai4s/storage/kernels.py +438 -0
  211. openai4s/storage/memories.py +99 -0
  212. openai4s/storage/metadata.py +431 -0
  213. openai4s/storage/permissions.py +686 -0
  214. openai4s/storage/plans.py +187 -0
  215. openai4s/storage/recovery.py +169 -0
  216. openai4s/storage/settings.py +89 -0
  217. openai4s/storage/skills.py +541 -0
  218. openai4s/storage/snapshots.py +1150 -0
  219. openai4s/store.py +2570 -0
  220. openai4s/tools/README.md +63 -0
  221. openai4s/tools/README_zh.md +63 -0
  222. openai4s/tools/__init__.py +243 -0
  223. openai4s/tools/artifacts.py +199 -0
  224. openai4s/tools/background.py +135 -0
  225. openai4s/tools/base.py +261 -0
  226. openai4s/tools/capabilities.py +35 -0
  227. openai4s/tools/catalog.py +666 -0
  228. openai4s/tools/content_search.py +83 -0
  229. openai4s/tools/contexts.py +109 -0
  230. openai4s/tools/data.py +192 -0
  231. openai4s/tools/delegation.py +153 -0
  232. openai4s/tools/dynamic.py +1137 -0
  233. openai4s/tools/dynamic_control.py +201 -0
  234. openai4s/tools/dynamic_scopes.py +422 -0
  235. openai4s/tools/edit.py +102 -0
  236. openai4s/tools/env.py +19 -0
  237. openai4s/tools/env_create.py +67 -0
  238. openai4s/tools/env_list.py +91 -0
  239. openai4s/tools/env_use.py +92 -0
  240. openai4s/tools/fs.py +19 -0
  241. openai4s/tools/glob_files.py +54 -0
  242. openai4s/tools/list_directory.py +50 -0
  243. openai4s/tools/mcp.py +227 -0
  244. openai4s/tools/native.py +74 -0
  245. openai4s/tools/network_access.py +38 -0
  246. openai4s/tools/progress.py +122 -0
  247. openai4s/tools/read_text_file.py +69 -0
  248. openai4s/tools/registry.py +743 -0
  249. openai4s/tools/remote_capabilities.py +63 -0
  250. openai4s/tools/remote_compute.py +249 -0
  251. openai4s/tools/schema.py +459 -0
  252. openai4s/tools/science.py +114 -0
  253. openai4s/tools/search.py +15 -0
  254. openai4s/tools/session.py +210 -0
  255. openai4s/tools/skills.py +206 -0
  256. openai4s/tools/taxonomy.py +56 -0
  257. openai4s/tools/web.py +15 -0
  258. openai4s/tools/web_fetch.py +73 -0
  259. openai4s/tools/web_search.py +59 -0
  260. openai4s/tools/write_file.py +45 -0
  261. openai4s/webtools.py +802 -0
  262. openai4s-0.1.0.dist-info/METADATA +299 -0
  263. openai4s-0.1.0.dist-info/RECORD +445 -0
  264. openai4s-0.1.0.dist-info/WHEEL +5 -0
  265. openai4s-0.1.0.dist-info/entry_points.txt +2 -0
  266. openai4s-0.1.0.dist-info/licenses/LICENSE +21 -0
  267. openai4s-0.1.0.dist-info/top_level.txt +5 -0
  268. openai4s_compute_provider/README.md +40 -0
  269. openai4s_compute_provider/README_zh.md +40 -0
  270. openai4s_compute_provider/__init__.py +70 -0
  271. openai4s_compute_provider/__main__.py +45 -0
  272. openai4s_compute_provider/_channel.py +78 -0
  273. openai4s_compute_provider/_constants.py +92 -0
  274. openai4s_compute_provider/_protocol.py +104 -0
  275. openai4s_compute_provider/_resident.py +930 -0
  276. openai4s_worker_runtime/README.md +27 -0
  277. openai4s_worker_runtime/README_zh.md +27 -0
  278. openai4s_worker_runtime/__init__.py +71 -0
  279. skills/README.md +59 -0
  280. skills/README_zh.md +56 -0
  281. skills/admet_genetic/README.md +19 -0
  282. skills/admet_genetic/README_zh.md +19 -0
  283. skills/admet_genetic/SKILL.md +173 -0
  284. skills/admet_genetic/examples/README.md +18 -0
  285. skills/admet_genetic/examples/README_zh.md +18 -0
  286. skills/admet_genetic/examples/build_example.py +447 -0
  287. skills/admet_genetic/examples/optimization_dashboard.html +478 -0
  288. skills/admet_genetic/examples/report.md +94 -0
  289. skills/admet_genetic/kernel.py +994 -0
  290. skills/admet_genetic/references/README.md +11 -0
  291. skills/admet_genetic/references/README_zh.md +11 -0
  292. skills/admet_genetic/references/admet.md +93 -0
  293. skills/admet_genetic/references/data_contracts.md +102 -0
  294. skills/admet_genetic/references/ga.md +88 -0
  295. skills/alphafold2/README.md +13 -0
  296. skills/alphafold2/README_zh.md +13 -0
  297. skills/alphafold2/SKILL.md +100 -0
  298. skills/audit-dataset/README.md +12 -0
  299. skills/audit-dataset/README_zh.md +12 -0
  300. skills/audit-dataset/SKILL.md +62 -0
  301. skills/audit-dataset/kernel.py +175 -0
  302. skills/boltz/README.md +11 -0
  303. skills/boltz/README_zh.md +11 -0
  304. skills/boltz/SKILL.md +123 -0
  305. skills/borzoi/README.md +11 -0
  306. skills/borzoi/README_zh.md +11 -0
  307. skills/borzoi/SKILL.md +103 -0
  308. skills/catalyst_sar_screening/README.md +21 -0
  309. skills/catalyst_sar_screening/README_zh.md +21 -0
  310. skills/catalyst_sar_screening/SKILL.md +152 -0
  311. skills/catalyst_sar_screening/build_example.py +110 -0
  312. skills/catalyst_sar_screening/contcar_catalog.json +1 -0
  313. skills/catalyst_sar_screening/kernel.py +2197 -0
  314. skills/catalyst_sar_screening/metal_center_dissolution_dashboard.html +62 -0
  315. skills/catalyst_sar_screening/metal_center_dissolution_descriptions.json +5 -0
  316. skills/catalyst_sar_screening/metal_center_dissolution_report.md +42 -0
  317. skills/catalyst_sar_screening/metal_center_dissolution_summary.json +64 -0
  318. skills/chai1/README.md +11 -0
  319. skills/chai1/README_zh.md +11 -0
  320. skills/chai1/SKILL.md +112 -0
  321. skills/diffdock/README.md +17 -0
  322. skills/diffdock/README_zh.md +17 -0
  323. skills/diffdock/SKILL.md +97 -0
  324. skills/diffdock/references/README.md +9 -0
  325. skills/diffdock/references/README_zh.md +9 -0
  326. skills/diffdock/references/workflows.md +48 -0
  327. skills/esmfold2/README.md +17 -0
  328. skills/esmfold2/README_zh.md +17 -0
  329. skills/esmfold2/SKILL.md +229 -0
  330. skills/esmfold2/references/README.md +10 -0
  331. skills/esmfold2/references/README_zh.md +10 -0
  332. skills/esmfold2/references/design-hook.md +31 -0
  333. skills/esmfold2/references/esmc.md +73 -0
  334. skills/evaluate-model/README.md +12 -0
  335. skills/evaluate-model/README_zh.md +12 -0
  336. skills/evaluate-model/SKILL.md +52 -0
  337. skills/evaluate-model/kernel.py +197 -0
  338. skills/evo2/README.md +11 -0
  339. skills/evo2/README_zh.md +11 -0
  340. skills/evo2/SKILL.md +154 -0
  341. skills/example_stats/README.md +12 -0
  342. skills/example_stats/README_zh.md +12 -0
  343. skills/example_stats/SKILL.md +54 -0
  344. skills/example_stats/kernel.py +92 -0
  345. skills/fair-esm2/README.md +11 -0
  346. skills/fair-esm2/README_zh.md +11 -0
  347. skills/fair-esm2/SKILL.md +141 -0
  348. skills/figure-composer/README.md +12 -0
  349. skills/figure-composer/README_zh.md +12 -0
  350. skills/figure-composer/SKILL.md +142 -0
  351. skills/figure-composer/kernel.py +389 -0
  352. skills/figure-style/README.md +12 -0
  353. skills/figure-style/README_zh.md +12 -0
  354. skills/figure-style/SKILL.md +330 -0
  355. skills/figure-style/kernel.py +393 -0
  356. skills/indication-dossier/README.md +17 -0
  357. skills/indication-dossier/README_zh.md +17 -0
  358. skills/indication-dossier/SKILL.md +136 -0
  359. skills/indication-dossier/references/00-research-standards.md +25 -0
  360. skills/indication-dossier/references/01-meta-initialization.md +46 -0
  361. skills/indication-dossier/references/02-epidemiology-research.md +46 -0
  362. skills/indication-dossier/references/03-biology-soc-research.md +55 -0
  363. skills/indication-dossier/references/04-regulatory-trials-research.md +64 -0
  364. skills/indication-dossier/references/05-synthesis.md +164 -0
  365. skills/indication-dossier/references/06-writing-style.md +46 -0
  366. skills/indication-dossier/references/README.md +16 -0
  367. skills/indication-dossier/references/README_zh.md +16 -0
  368. skills/indication-dossier/references/waypoint-schemas.md +103 -0
  369. skills/ligandmpnn/README.md +11 -0
  370. skills/ligandmpnn/README_zh.md +11 -0
  371. skills/ligandmpnn/SKILL.md +124 -0
  372. skills/literature-review/README.md +12 -0
  373. skills/literature-review/README_zh.md +12 -0
  374. skills/literature-review/SKILL.md +71 -0
  375. skills/literature-review/kernel.py +359 -0
  376. skills/mineral_spectra_analysis/README.md +18 -0
  377. skills/mineral_spectra_analysis/README_zh.md +18 -0
  378. skills/mineral_spectra_analysis/SKILL.md +236 -0
  379. skills/mineral_spectra_analysis/examples/README.md +20 -0
  380. skills/mineral_spectra_analysis/examples/README_zh.md +20 -0
  381. skills/mineral_spectra_analysis/examples/build_example.py +125 -0
  382. skills/mineral_spectra_analysis/examples/case1/README.md +11 -0
  383. skills/mineral_spectra_analysis/examples/case1/README_zh.md +11 -0
  384. skills/mineral_spectra_analysis/examples/case1/truth.json +18 -0
  385. skills/mineral_spectra_analysis/examples/case1_analysis.json +124 -0
  386. skills/mineral_spectra_analysis/examples/case1_components.json +34 -0
  387. skills/mineral_spectra_analysis/examples/case1_mineral_spectra_report.md +56 -0
  388. skills/mineral_spectra_analysis/kernel.py +1205 -0
  389. skills/openfold3/README.md +11 -0
  390. skills/openfold3/README_zh.md +11 -0
  391. skills/openfold3/SKILL.md +185 -0
  392. skills/paper-narrative/README.md +12 -0
  393. skills/paper-narrative/README_zh.md +12 -0
  394. skills/paper-narrative/SKILL.md +47 -0
  395. skills/paper-narrative/kernel.py +187 -0
  396. skills/pdf-explore/README.md +12 -0
  397. skills/pdf-explore/README_zh.md +12 -0
  398. skills/pdf-explore/SKILL.md +273 -0
  399. skills/pdf-explore/kernel.py +1320 -0
  400. skills/plan-ml-experiment/README.md +12 -0
  401. skills/plan-ml-experiment/README_zh.md +12 -0
  402. skills/plan-ml-experiment/SKILL.md +58 -0
  403. skills/plan-ml-experiment/kernel.py +151 -0
  404. skills/protein-mutation-enhancement/README.md +12 -0
  405. skills/protein-mutation-enhancement/README_zh.md +12 -0
  406. skills/protein-mutation-enhancement/SKILL.md +170 -0
  407. skills/protein-mutation-enhancement/kernel.py +603 -0
  408. skills/proteinmpnn/README.md +11 -0
  409. skills/proteinmpnn/README_zh.md +11 -0
  410. skills/proteinmpnn/SKILL.md +95 -0
  411. skills/remote-compute-nvidia/README.md +13 -0
  412. skills/remote-compute-nvidia/README_zh.md +13 -0
  413. skills/remote-compute-nvidia/SKILL.md +224 -0
  414. skills/remote-compute-nvidia/provider.json +22 -0
  415. skills/remote-compute-nvidia/provider.py +384 -0
  416. skills/remote-compute-ssh/README.md +11 -0
  417. skills/remote-compute-ssh/README_zh.md +11 -0
  418. skills/remote-compute-ssh/SKILL.md +359 -0
  419. skills/retrosynthesis_planning/README.md +18 -0
  420. skills/retrosynthesis_planning/README_zh.md +18 -0
  421. skills/retrosynthesis_planning/SKILL.md +415 -0
  422. skills/retrosynthesis_planning/examples/README.md +13 -0
  423. skills/retrosynthesis_planning/examples/README_zh.md +13 -0
  424. skills/retrosynthesis_planning/examples/aspirin_annotations.json +361 -0
  425. skills/retrosynthesis_planning/examples/aspirin_retrosynthesis.html +1342 -0
  426. skills/retrosynthesis_planning/examples/aspirin_retrosynthesis_report.md +124 -0
  427. skills/retrosynthesis_planning/examples/aspirin_routes.json +206 -0
  428. skills/retrosynthesis_planning/examples/build_example.py +57 -0
  429. skills/retrosynthesis_planning/kernel.py +4115 -0
  430. skills/scgpt/README.md +11 -0
  431. skills/scgpt/README_zh.md +11 -0
  432. skills/scgpt/SKILL.md +150 -0
  433. skills/scvi-tools/README.md +12 -0
  434. skills/scvi-tools/README_zh.md +12 -0
  435. skills/scvi-tools/SKILL.md +171 -0
  436. skills/scvi-tools/kernel.py +56 -0
  437. skills/solublempnn/README.md +11 -0
  438. skills/solublempnn/README_zh.md +11 -0
  439. skills/solublempnn/SKILL.md +88 -0
  440. skills/using-model-endpoint/README.md +14 -0
  441. skills/using-model-endpoint/README_zh.md +14 -0
  442. skills/using-model-endpoint/SKILL.md +31 -0
  443. skills/using-model-endpoint/provider.json +12 -0
  444. skills/using-model-endpoint/provider.py +156 -0
  445. skills/using-model-endpoint/requirements.lock +33 -0
envs/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # Scientific kernel environments
2
+
3
+ [中文说明](README_zh.md)
4
+
5
+ The four conda specs that `openai4s setup` turns into optional task
6
+ environments. They live in the execution plane; the standard-library control
7
+ plane runs without any of them.
8
+
9
+ ## Files
10
+
11
+ | File | Purpose |
12
+ | --- | --- |
13
+ | `python.yml` | Python 3.11 for general data analysis and plotting. Carries the single-cell stack (scanpy, anndata, leidenalg, umap-learn), scikit-learn and the usual numerics, and pulls rdkit and fair-esm from pip. |
14
+ | `phylo.yml` | Python 3.11 for phylogenetics and bioinformatics. Alongside biopython, dendropy and ete3 it installs the command-line tools a tree pipeline needs: mafft, iqtree, fasttree, trimal. |
15
+ | `r.yml` | R 4.5.3 and the packages the independent R kernel channel expects: tidyverse, data.table, ggplot2, knitr/rmarkdown, jsonlite. conda-forge only, no bioconda. |
16
+ | `struct.yml` | Python 3.13 for structural biology and protein language models. biotite and biotraj come from conda; torch and fair-esm come from pip, deliberately as the portable CPU build. Substitute a conda pytorch build for a GPU-accelerated one. |
17
+
18
+ Selecting an environment changes which interpreter the worker runs under.
19
+ Routing, permissions, storage and Host RPC stay with the daemon. New optional
20
+ packages belong in these files rather than as hard imports in the
21
+ zero-dependency core.
envs/README_zh.md ADDED
@@ -0,0 +1,18 @@
1
+ # 科学内核环境
2
+
3
+ [English](README.md)
4
+
5
+ `openai4s setup` 就是从这四份 conda 规格创建出四个可选任务环境的。它们属于执行平面;
6
+ 标准库控制平面不依赖其中任何一个。
7
+
8
+ ## 文件
9
+
10
+ | 文件 | 职责 |
11
+ | --- | --- |
12
+ | `python.yml` | Python 3.11,用于常规数据分析与绘图。带上了单细胞栈(scanpy、anndata、leidenalg、umap-learn)、scikit-learn 和常用数值库,rdkit 与 fair-esm 由 pip 装入。 |
13
+ | `phylo.yml` | Python 3.11,面向系统发育与生物信息学。除 biopython、dendropy、ete3 外,还装了建树流程要用的命令行工具:mafft、iqtree、fasttree、trimal。 |
14
+ | `r.yml` | R 4.5.3,以及独立 R 内核通道所需的包:tidyverse、data.table、ggplot2、knitr/rmarkdown、jsonlite。只用 conda-forge,不引入 bioconda。 |
15
+ | `struct.yml` | Python 3.13,面向结构生物学与蛋白质语言模型。biotite、biotraj 来自 conda;torch 与 fair-esm 走 pip,有意选可移植的 CPU 构建。想要 GPU 加速就换成 conda 的 pytorch 构建。 |
16
+
17
+ 选定哪个环境,决定的是 worker 跑在哪个解释器上;路由、权限、存储与 Host RPC 仍然归
18
+ daemon 所有。新的可选依赖包应该写进这些文件,而不是变成零依赖核心里的硬导入。
envs/phylo.yml ADDED
@@ -0,0 +1,30 @@
1
+ # phylo — phylogenetics / bioinformatics (Python 3.11)
2
+ #
3
+ # Derived from all_env_packages.csv. Lists the headline scientific packages
4
+ # only; conda resolves the full dependency tree (system libs, fonts, blas, …).
5
+ # Versions match the CSV where they are meaningful top-level packages.
6
+ name: phylo
7
+ channels:
8
+ - conda-forge
9
+ - bioconda
10
+ dependencies:
11
+ - python=3.11
12
+ # sequence / tree tooling
13
+ - biopython=1.87
14
+ - dendropy=5.0.8
15
+ - ete3=3.1.3
16
+ - logomaker=0.8.6
17
+ # alignment + tree-building CLIs (bioconda)
18
+ - mafft=7.526
19
+ - iqtree=3.1.2
20
+ - fasttree=2.2.0
21
+ - trimal=1.5.1
22
+ # general scientific stack
23
+ - numpy
24
+ - pandas
25
+ - scipy
26
+ - matplotlib
27
+ - seaborn
28
+ - statsmodels
29
+ - lxml
30
+ - requests
envs/python.yml ADDED
@@ -0,0 +1,54 @@
1
+ # python — general data science + single-cell + cheminformatics (Python 3.11)
2
+ #
3
+ # This is the DEFAULT kernel env. It includes the portable top-level dependency
4
+ # intent from Claude Science's Python environment plus OpenAI4S's broader
5
+ # single-cell, cheminformatics, IO, and plotting stack. Conda resolves native
6
+ # and platform-specific transitive dependencies for the target machine; do not
7
+ # copy build strings or macOS-only toolchain packages into this shared spec.
8
+ name: python
9
+ channels:
10
+ - conda-forge
11
+ - bioconda
12
+ dependencies:
13
+ - python=3.11
14
+ # single-cell stack
15
+ - scanpy
16
+ - anndata
17
+ - leidenalg
18
+ - python-igraph
19
+ - umap-learn
20
+ - numba
21
+ # cheminformatics — conda-forge, NOT the pip `rdkit-pypi` wheel: that project
22
+ # is frozen at 2022.9.5 and is built against the NumPy 1.x C ABI, so it
23
+ # segfaults the kernel worker against the NumPy 2.x this spec now resolves.
24
+ - rdkit
25
+ # machine learning + numerics
26
+ - scikit-learn
27
+ - numpy
28
+ - scipy
29
+ - pandas<3
30
+ # plotting
31
+ - matplotlib
32
+ - seaborn
33
+ - plotly
34
+ - pillow
35
+ # bio + IO + web
36
+ - biopython
37
+ - h5py
38
+ - zarr
39
+ - pyarrow
40
+ - openpyxl
41
+ - pypdf
42
+ - beautifulsoup4
43
+ - httpx
44
+ - socksio
45
+ - pysocks
46
+ - tqdm
47
+ - statsmodels
48
+ - networkx
49
+ # pip-only packages
50
+ - pip
51
+ - pip:
52
+ - fair-esm==2.0.0
53
+ # from PyPI so pip selects the bundled PDFium wheel matching this platform.
54
+ - pypdfium2==5.9.0
envs/r.yml ADDED
@@ -0,0 +1,19 @@
1
+ # r — R data science (R 4.5.3)
2
+ #
3
+ # Portable top-level manifest matching Claude Science's R environment, with
4
+ # OpenAI4S's reporting packages made explicit. r-tidyverse resolves the full R
5
+ # package family; Conda resolves platform-specific compilers and native system
6
+ # libraries, which must not be copied from a single-machine full export.
7
+ name: r
8
+ channels:
9
+ - conda-forge
10
+ dependencies:
11
+ - r-base=4.5.3
12
+ - r-tidyverse=2.0.0
13
+ - r-data.table
14
+ - r-ggplot2
15
+ - r-rmarkdown
16
+ - r-knitr
17
+ - r-jsonlite
18
+ # rmarkdown needs a real renderer, not just the R package.
19
+ - pandoc=3.10
envs/struct.yml ADDED
@@ -0,0 +1,31 @@
1
+ # struct — structural biology / ESM / torch (Python 3.13)
2
+ #
3
+ # Derived from all_env_packages.csv. Lists the headline scientific packages
4
+ # only; conda resolves the full dependency tree. Versions match the CSV where
5
+ # they are meaningful top-level packages.
6
+ #
7
+ # NOTE: torch is installed via pip (the safest portable CPU build). To use a
8
+ # GPU/accelerated build instead, substitute a conda pytorch build here, e.g.
9
+ # dependencies:
10
+ # - pytorch=2.12.1 # (from the conda-forge / pytorch channel)
11
+ # and drop torch from the pip: section below.
12
+ name: struct
13
+ channels:
14
+ - conda-forge
15
+ - bioconda
16
+ dependencies:
17
+ - python=3.13
18
+ # structural biology
19
+ - biotite=1.7.1
20
+ - biotraj=1.2.2
21
+ # numerics / plotting
22
+ - numpy
23
+ - scipy
24
+ - matplotlib
25
+ - networkx
26
+ - sympy
27
+ # pip-only packages (torch via pip = safest portable CPU build)
28
+ - pip
29
+ - pip:
30
+ - torch==2.12.1
31
+ - fair-esm==2.0.0
openai4s/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # `openai4s` package
2
+
3
+ [中文说明](README_zh.md)
4
+
5
+ This is the top-level Python package. The core is implemented, and the extension surfaces that are still Partial are marked as such where they are described. The outer agent loop, the native JSON control tools, the persistent scientific kernels, the Host RPC services, storage, security, and the Web/CLI adapters all hang off this directory, and the control plane that composes them is standard-library only.
6
+
7
+ ## Where this fits
8
+
9
+ OpenAI4S has two nested loops. The outer loop in [`agent/`](./agent/) accepts at most one routed action per model step: an ordered native-tool batch, an Engine-owned `finalize_response`, or one complete Python/R cell. The inner loop in [`kernel/`](./kernel/) keeps the language workers alive and answers synchronous `host.*` calls while a Python cell is still running. [`host_dispatch.py`](./host_dispatch.py) is the compatibility and composition boundary between those two planes; the behavior behind it lives in the focused services under [`host/`](./host/).
10
+
11
+ Control-only work can finish through the Engine-owned finalizer. From inside a Python Cell, `host.submit_output(...)` is the only thing that completes a task, and a later sole valid `finalize_response` can still close the Engine after earlier Cells have run. Ordinary prose, native-tool results, R cells, cancellation, and turn exhaustion are not themselves completion signals.
12
+
13
+ ## Files
14
+
15
+ | File | Responsibility |
16
+ | --- | --- |
17
+ | [`__init__.py`](./__init__.py) | Names the package and holds its version. Importing it starts nothing. |
18
+ | [`__main__.py`](./__main__.py) | Makes `python -m openai4s` work by handing off to the CLI entry point. |
19
+ | [`artifact_restore.py`](./artifact_restore.py) | The one Artifact restore path, shared by the native and Web routes. It verifies the historical snapshot before it copies those bytes back inside the workspace. What it records is a fresh version. History is never rewritten. |
20
+ | [`bash_capability.py`](./bash_capability.py) | Holds the language-neutral version marker and command digest that bind a short-lived, one-shot shell capability. |
21
+ | [`capabilities.py`](./capabilities.py) | Resolves whether a scoped capability or specialist profile is enabled, going through repository ports. |
22
+ | [`config.py`](./config.py) | Loads `.env` with no dependencies and defines the `LLMConfig`, `SecurityConfig`, and global `Config` dataclasses. Only the LLM credential, base URL, and model id resolve through a layered chain: the per-provider variable, then the generic `OPENAI4S_LLM_*` one, then the provider's built-in default — and for the key, the provider's own conventional variable (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, …) as a last resort. Every other field follows its own default: ports and turn budgets read one variable and fall back to a literal, `data_dir` and `skills_dir` fall back to computed paths (`~/.openai4s` and the repo's `skills/`), and `egress_allowlist` reads no variable at all because it is copied from `egress.EGRESS_GROUPS`. |
23
+ | [`egress.py`](./egress.py) | The Host-owned allowlist of outbound domains. The Web and shell policy boundaries consult it, but it is opt-in: unless `OPENAI4S_EGRESS` is set to an enforcing value (`allowlist`, `on`, `1`, `enforce`, …), the mode is `off` and outbound calls fail open with no allowlist check. When it is on, it complements the OS sandbox rather than replacing it. |
24
+ | [`host_dispatch.py`](./host_dispatch.py) | The compatibility and composition facade for the kernel's `host_call` RPC. A call passes permission, approval, audit, replay, screening, and step-event policy here before it reaches a focused Host service. |
25
+ | [`jobs.py`](./jobs.py) | Runs background compute jobs process-locally and keeps their output buffers bounded. The working files a job leaves behind may persist, but the registry itself only lives in memory. |
26
+ | [`mcp_client.py`](./mcp_client.py) | A pure-stdlib MCP stdio JSON-RPC client, plus the process-wide manager that keeps one connection per connector for tools, resources, and prompts. Server-initiated sampling is out of scope. |
27
+ | [`onboarding.py`](./onboarding.py) | The first-run model and provider configuration used by the headless CLI, kept as a small service so it can be tested. |
28
+ | [`permissions.py`](./permissions.py) | The process-wide permission broker. It resolves allow/deny/ask rules; when a user has to answer, it persists a durable approval request and blocks the turn, and it handles cancellation and timeouts. Unattended execution fails closed by default, and only by default: an operator who sets `OPENAI4S_UNATTENDED_APPROVAL=allow` opts into fail-open, and every unanswerable prompt is then allowed. |
29
+ | [`pkgscan.py`](./pkgscan.py) | Scans Python, conda, and R environments for normalized package availability, without importing any of those packages into the core. |
30
+ | [`prompts.py`](./prompts.py) | The small single-purpose prompts the core sends on its own: compaction, review gates, provenance, Skill retrieval, extraction, editing, and security. |
31
+ | [`replay.py`](./replay.py) | Records successful `host.*` results into an offline replay tape — internal plumbing calls such as provenance edges and credential reads are deliberately excluded — and detects call-order drift when an exported notebook replays that tape. |
32
+ | [`review.py`](./review.py) | Runs one bounded, tool-free review over the evidence of a completed turn and normalizes the JSON verdict. The reviewer cannot mutate the workspace. |
33
+ | [`store.py`](./store.py) | The compatibility facade over persistence. One SQLite connection lives here, and so do the schema, the migrations, and the guarded read queries. The focused storage repositories are handed that same connection and the same lock. |
34
+ | [`webtools.py`](./webtools.py) | Host-side web search and fetch. Transports are stdlib-first. Content conversion happens here, and this is also where the network switches, the SSRF checks, and egress enforcement bite. |
35
+
36
+ ## Subdirectories
37
+
38
+ | Directory | Responsibility |
39
+ | --- | --- |
40
+ | [`adapters/`](./adapters/) | Optional ecosystem adapters kept outside the stdlib runtime core. |
41
+ | [`agent/`](./agent/) | The provider-neutral outer loop. It routes actions and finalizes them, compacts context past a token threshold, fans work out to sub-agents, and composes the local runtime. |
42
+ | [`cli/`](./cli/) | Command-line lifecycle and one-shot task entry points. |
43
+ | [`compute/`](./compute/) | Host-side registry and job orchestration for BYOC/remote compute. General remote compute remains a Prototype surface. |
44
+ | [`execution/`](./execution/) | What a scientific cell goes through outside the kernel: admission, cancellation, dependency projection, result values, and timeout recovery. |
45
+ | [`host/`](./host/) | Focused services behind the `HostDispatcher` composition facade. |
46
+ | [`kernel/`](./kernel/) | Home of the persistent Python and R workers. The language-neutral manager protocol lives here too, along with environment selection, sandbox integration, and the in-cell Host RPC. |
47
+ | [`llm/`](./llm/) | The provider-neutral LLM client. Capabilities, normalized messages and tools, and a stdlib transport sit above one wire adapter per provider. |
48
+ | [`mcp_servers/`](./mcp_servers/) | Bundled pure-stdlib example MCP server used for demonstration and tests. |
49
+ | [`sdk/`](./sdk/) | Compatible `host` facade injected into Python cells and the remote-compute namespace. |
50
+ | [`security/`](./security/) | Sandboxing and child-environment isolation. It also screens code and content, checks for injection, and carries the policy helpers those layers lean on. Each layer is independent, and several can fail open. |
51
+ | [`server/`](./server/) | The stdlib HTTP/WebSocket workbench: session services, projections, recovery, and the static UI. Several specialized UI and recovery workflows remain Partial. |
52
+ | [`skills_loader/`](./skills_loader/) | Finds Skills and discloses them progressively: name and summary first, the body only on load. It also validates sidecars, installs versions, and rolls them back. |
53
+ | [`storage/`](./storage/) | Focused SQLite repositories used through `Store`. |
54
+ | [`tools/`](./tools/) | Class-based provider-native control tools. Each one carries its own schema. Around them sit the registry, the dynamic-tool lifecycle, and compatibility support for fenced calls. |
55
+
56
+ ## Change rules
57
+
58
+ - Keep the core importable with nothing but the Python standard library; guard optional science dependencies at each use site.
59
+ - Put new domain behavior in its focused service, repository, or tool. Do not rewrite `host_dispatch.py` or `store.py` wholesale.
60
+ - The kernel protocol has invariants: one frame reader, ID-routed responses, the transaction lock, and the generation checks. Leave them intact.
61
+ - Read the security and persistence labels literally. A best-effort projection or a Partial surface must never be documented as a guarantee.
openai4s/README_zh.md ADDED
@@ -0,0 +1,61 @@
1
+ # `openai4s` 包
2
+
3
+ [English](README.md)
4
+
5
+ 这里是 OpenAI4S 的顶层 Python 包。核心已经实现,扩展面中仍为 Partial 的部分都会在各自的说明里标出。外层 Agent 循环、原生 JSON 控制工具、持久化科学内核、Host RPC 服务、存储、安全层以及 Web/CLI 适配器都挂在这个目录下,把它们组合起来的控制平面只用标准库。
6
+
7
+ ## 在架构中的位置
8
+
9
+ OpenAI4S 有两个嵌套循环。[`agent/`](./agent/) 里的外层循环在每个模型步骤中最多接受一个经过路由的动作:一个有序的原生工具批次、Engine 自有的 `finalize_response`,或者一个完整的 Python/R Cell。[`kernel/`](./kernel/) 里的内层循环让语言 worker 一直活着,并在 Python Cell 尚未结束时应答同步的 `host.*` 调用。[`host_dispatch.py`](./host_dispatch.py) 是这两个平面之间的兼容与组合边界,边界背后的具体行为放在 [`host/`](./host/) 下的聚焦服务里。
10
+
11
+ 纯控制类的工作可以由 Engine 自有的 finalizer 收尾。在 Python Cell 内部,只有 `host.submit_output(...)` 能发出完成信号;即使前面已经执行过 Cell,之后单独且有效的一次 `finalize_response` 仍然可以关闭 Engine。普通文本、原生工具结果、R Cell、取消和回合耗尽,本身都不是完成信号。
12
+
13
+ ## 文件
14
+
15
+ | 文件 | 职责 |
16
+ | --- | --- |
17
+ | [`__init__.py`](./__init__.py) | 声明包名与版本。导入它不会启动任何服务。 |
18
+ | [`__main__.py`](./__main__.py) | 让 `python -m openai4s` 可用,转交给 CLI 入口。 |
19
+ | [`artifact_restore.py`](./artifact_restore.py) | Artifact 恢复的唯一路径,原生控制平面和 Web 都走这里。它先校验历史快照,再把那些字节复制回工作区。落库的是一个新版本。历史不会被改写。 |
20
+ | [`bash_capability.py`](./bash_capability.py) | 保存语言无关的版本标记和命令摘要,短时、一次性的 shell capability 靠它们完成绑定。 |
21
+ | [`capabilities.py`](./capabilities.py) | 通过仓储接口判定某个 capability 或 specialist profile 在给定作用域下是否启用。 |
22
+ | [`config.py`](./config.py) | 零依赖加载 `.env`,并定义 `LLMConfig`、`SecurityConfig` 和全局 `Config` 数据类。只有 LLM 的 key、base URL 和 model id 走分层解析:先按供应商的变量,再看通用的 `OPENAI4S_LLM_*`,再退到供应商的内置默认值;key 还会最后兜底到该供应商惯用的变量(`ANTHROPIC_API_KEY`、`OPENAI_API_KEY` 等)。其余字段各按自己的默认值来:端口和回合上限读一个环境变量,读不到就用字面默认值;`data_dir` 和 `skills_dir` 退回算出来的路径(`~/.openai4s` 和仓库里的 `skills/`);`egress_allowlist` 根本不读环境变量,它直接复制自 `egress.EGRESS_GROUPS`。 |
23
+ | [`egress.py`](./egress.py) | Host 持有的出站域名允许名单。Web 与 shell 的策略边界会查它,但它要显式打开才生效:除非 `OPENAI4S_EGRESS` 被设成生效值(`allowlist`、`on`、`1`、`enforce` 等),模式就是 `off`,出站调用不做任何允许名单检查,一律放行。真正打开时,它是 OS 沙箱的补充,不是替代。 |
24
+ | [`host_dispatch.py`](./host_dispatch.py) | 内核 `host_call` RPC 的兼容与组合 facade。一次调用要先过权限、审批、审计、回放、筛查和步骤事件策略,才会落到具体的 Host 服务上。 |
25
+ | [`jobs.py`](./jobs.py) | 在进程内运行后台计算任务,并限制其输出缓冲的大小。任务留下的工作文件可以持久化,但注册表本身只在内存里。 |
26
+ | [`mcp_client.py`](./mcp_client.py) | 纯标准库的 MCP stdio JSON-RPC 客户端,外加进程级的连接 manager:每个 connector 保持一条连接,覆盖工具、资源和 prompt。服务器发起的 sampling 不在范围内。 |
27
+ | [`onboarding.py`](./onboarding.py) | 无界面 CLI 使用的首次模型/供应商配置,做成一个小服务是为了可测试。 |
28
+ | [`permissions.py`](./permissions.py) | 进程级的权限 broker。它解析 allow/deny/ask 规则;需要用户拍板时,持久化一条审批请求并阻塞当前回合,同时处理取消与超时。无人值守的执行默认失败即拒绝,也仅仅是默认:运维把 `OPENAI4S_UNATTENDED_APPROVAL` 设成 `allow`,就等于主动选择了失败即放行,此后每一条无人应答的审批都会被放过。 |
29
+ | [`pkgscan.py`](./pkgscan.py) | 扫描 Python、conda 和 R 环境里包的可用性并做名称归一化,全程不把这些包导入核心。 |
30
+ | [`prompts.py`](./prompts.py) | 核心自己要发的那批小型单用途 prompt:压缩、审查 gate、溯源、Skill 检索、抽取、编辑和安全。 |
31
+ | [`replay.py`](./replay.py) | 把成功的 `host.*` 结果记进离线回放 tape(溯源、凭据读取这类内部管道调用刻意不入 tape);导出的 notebook 回放这盘 tape 时,它负责发现调用顺序的漂移。 |
32
+ | [`review.py`](./review.py) | 对已完成回合的证据做一次有界、无工具的审查,并把 JSON verdict 标准化。审查者动不了工作区。 |
33
+ | [`store.py`](./store.py) | 持久化层的兼容 facade。唯一那条 SQLite 连接放在这里,schema 与 migration、受保护的只读查询也放在这里。各个聚焦的 storage 仓储拿到的是同一条连接和同一把锁。 |
34
+ | [`webtools.py`](./webtools.py) | Host 侧的 Web 搜索与抓取。transport 优先走标准库。内容转换在这里做,网络开关、SSRF 检查和 egress 强制也都在这里生效。 |
35
+
36
+ ## 子目录
37
+
38
+ | 目录 | 职责 |
39
+ | --- | --- |
40
+ | [`adapters/`](./adapters/) | 位于标准库运行时核心之外的可选生态适配器。 |
41
+ | [`agent/`](./agent/) | 供应商中立的外层循环。它路由动作并收尾,在超过 token 阈值时压缩上下文,把活儿分发给子 Agent,也负责组合本地运行时。 |
42
+ | [`cli/`](./cli/) | 命令行生命周期和一次性任务入口。 |
43
+ | [`compute/`](./compute/) | Host 侧的 BYOC/远程计算注册表与任务编排;通用远程计算仍是 Prototype 能力面。 |
44
+ | [`execution/`](./execution/) | 科学 Cell 在内核之外要经过的环节:准入、取消、依赖投影、结果值和超时恢复。 |
45
+ | [`host/`](./host/) | `HostDispatcher` 组合 facade 背后的聚焦服务。 |
46
+ | [`kernel/`](./kernel/) | 常驻 Python/R worker 的所在地。语言无关的 manager 协议也在这里,还有环境选择、沙箱集成和 Cell 内的 Host RPC。 |
47
+ | [`llm/`](./llm/) | 供应商中立的 LLM 客户端。capabilities、标准化的消息与工具,以及标准库 transport,都架在每家供应商各自的 wire 适配器之上。 |
48
+ | [`mcp_servers/`](./mcp_servers/) | 用于演示和测试的内置纯标准库 MCP 示例服务器。 |
49
+ | [`sdk/`](./sdk/) | 注入 Python Cell 的兼容 `host` facade 和远程计算命名空间。 |
50
+ | [`security/`](./security/) | 沙箱和子进程环境隔离。它也筛查代码与内容、检查注入,并提供这些层要用的策略辅助模块。每一层都是独立的,其中有几层会失败即放行。 |
51
+ | [`server/`](./server/) | 标准库 HTTP/WebSocket workbench:session 服务、投影、恢复和静态 UI。若干专用的 UI/恢复工作流仍为 Partial。 |
52
+ | [`skills_loader/`](./skills_loader/) | 发现 Skill,并渐进披露:先只给名称和摘要,正文要等到真正加载。它同时负责 sidecar 校验、版本化安装和回滚。 |
53
+ | [`storage/`](./storage/) | 通过 `Store` 使用的聚焦 SQLite 仓储。 |
54
+ | [`tools/`](./tools/) | 基于类的供应商原生控制工具。每个工具自带 schema。围着它们的是注册表、动态工具生命周期,以及对 fenced 调用的兼容支持。 |
55
+
56
+ ## 修改规则
57
+
58
+ - 核心只能靠 Python 标准库导入;可选的科学依赖必须在每一个使用点上加保护。
59
+ - 新的领域行为写进对应的聚焦 service/repository/tool,不要整体重写 `host_dispatch.py` 或 `store.py`。
60
+ - 内核协议有几条不变量:只有一方读取 frame、响应按 ID 路由、事务锁、generation 检查。改动时不要破坏它们。
61
+ - 安全与持久化标签按字面理解:尽力而为的投影和 Partial 能力面,不能写成保证。
openai4s/__init__.py ADDED
@@ -0,0 +1,7 @@
1
+ """openai4s — a Code-as-Action independent agent system.
2
+
3
+ A pure-Python agent whose action space is Turing-complete code running in a
4
+ persistent kernel. Linux daemon form-factor.
5
+ """
6
+
7
+ __version__ = "0.1.0"
openai4s/__main__.py ADDED
@@ -0,0 +1,7 @@
1
+ """Enable `python -m openai4s...` as the CLI entrypoint."""
2
+ import sys
3
+
4
+ from openai4s.cli import main
5
+
6
+ if __name__ == "__main__":
7
+ sys.exit(main())
@@ -0,0 +1,27 @@
1
+ # Ecosystem adapters
2
+
3
+ [中文说明](README_zh.md)
4
+
5
+ This package is the extension boundary: optional integrations that attach an external ecosystem to runtime contracts OpenAI4S already has. Importing this package adds no third-party dependency to the standard-library core.
6
+
7
+ ## Where this fits
8
+
9
+ An adapter sits at the edge of the system and owns neither loop. It may drive an outer-loop or kernel interface that already exists, but it must not reimplement orchestration, route around Host policy, or quietly widen what counts as completion. Third-party imports belong at the point where the adapter is actually launched.
10
+
11
+ ## Files
12
+
13
+ | File | Responsibility |
14
+ | --- | --- |
15
+ | [`__init__.py`](./__init__.py) | Marks the namespace for optional adapters. It exports nothing eagerly, on purpose. |
16
+
17
+ ## Subdirectories
18
+
19
+ | Directory | Responsibility |
20
+ | --- | --- |
21
+ | [`jupyter/`](./jupyter/) | The optional Jupyter wire bridge, which drives the Python and R worker managers that already exist, plus pure-stdlib KernelSpec generation that writes the `kernel.json` files launching it. |
22
+
23
+ ## Extension contract
24
+
25
+ - Reuse a core port or manager. Do not stand up a second execution engine.
26
+ - Keep third-party imports lazy, so a plain `openai4s` import stays stdlib-only.
27
+ - Say plainly what an integration does not support. An adapter is not automatically equivalent to the Web workbench.
@@ -0,0 +1,27 @@
1
+ # 生态适配器
2
+
3
+ [English](README.md)
4
+
5
+ 这里是扩展边界,放的是可选集成:把外部生态接到 OpenAI4S 已有的运行时契约上。导入本包不会给标准库核心引入任何第三方依赖。
6
+
7
+ ## 在架构中的位置
8
+
9
+ 适配器待在系统的边界上,两层循环都不归它管。它可以去驱动已有的外层循环接口或内核接口,但不能自己再实现一套编排,不能绕开 Host 策略,也不能悄悄放宽完成语义的判定。第三方 import 应该放在真正启动适配器的那个位置。
10
+
11
+ ## 文件
12
+
13
+ | 文件 | 职责 |
14
+ | --- | --- |
15
+ | [`__init__.py`](./__init__.py) | 标记可选适配器的命名空间。它有意不预先导出任何集成。 |
16
+
17
+ ## 子目录
18
+
19
+ | 目录 | 职责 |
20
+ | --- | --- |
21
+ | [`jupyter/`](./jupyter/) | 可选的 Jupyter wire bridge:它驱动已有的 Python/R worker manager。另有纯标准库的 KernelSpec 生成,负责写出用来启动 bridge 的 `kernel.json`。 |
22
+
23
+ ## 扩展契约
24
+
25
+ - 复用核心已有的 port 或 manager,不要另起一套执行引擎。
26
+ - 第三方 import 一律延迟加载,让普通的 `openai4s` 导入仍然只依赖标准库。
27
+ - 不支持的集成语义要明确写出来:适配器不会自动等同于 Web workbench。
@@ -0,0 +1,3 @@
1
+ """Optional ecosystem adapters kept outside the stdlib runtime core."""
2
+
3
+ __all__: list[str] = []
@@ -0,0 +1,25 @@
1
+ # Optional Jupyter adapter
2
+
3
+ [中文说明](README_zh.md)
4
+
5
+ This adapter is an optional bridge. It exports and installs Python/R KernelSpecs, and when Jupyter launches one, it adapts Jupyter's messages onto the existing OpenAI4S kernel managers. The bridge stands alone on purpose. It does not attach to a Web session, and it exposes no Host RPC, no Gateway Artifact capture, no Action Ledger history, and no Engine completion semantics.
6
+
7
+ ## Where this fits
8
+
9
+ The bridge is a host-side adapter around the inner-loop workers in [`../../kernel/`](../../kernel/). Scientific code still travels through `Kernel` and the hardened JSON-per-line worker protocol. The Jupyter frontend is not an alternative OpenAI4S outer agent loop: there are no provider-native tool batches or `finalize_response` actions here.
10
+
11
+ `kernelspec.py` remains standard-library-only. `bridge.py` imports `ipykernel`/ZeroMQ only when a Jupyter process actually launches it.
12
+
13
+ ## Files
14
+
15
+ | File | Responsibility |
16
+ | --- | --- |
17
+ | [`__init__.py`](./__init__.py) | Re-exports the KernelSpec helpers: describe, status, write, install. Importing the package pulls in no Jupyter, IPython, or ZeroMQ. |
18
+ | [`bridge.py`](./bridge.py) | The `ipykernel` bridge itself, plus the CLI a KernelSpec launches. It spawns an OpenAI4S Python or R runtime and maps Jupyter's execute, interrupt and shutdown messages onto it. An interrupt goes to that exact child worker rather than to the bridge's own process group. |
19
+ | [`kernelspec.py`](./kernelspec.py) | Builds the Python and R `kernel.json` documents, resolves the per-user or explicit-prefix destination, and writes each spec directory atomically. An existing destination is an error unless the caller passes `replace`, which rewrites `kernel.json` and never recursively deletes user files. It also reports whether the optional dependency is installed. |
20
+
21
+ ## Boundaries for contributors
22
+
23
+ - Keep KernelSpec generation importable without Jupyter installed.
24
+ - Route execution through the existing kernel manager; do not speak directly to worker file descriptors from frontend code.
25
+ - Do not describe this standalone bridge as sharing Web notebook state, Host capabilities, or Artifact provenance unless those integrations are implemented end to end.
@@ -0,0 +1,25 @@
1
+ # 可选 Jupyter 适配器
2
+
3
+ [English](README.md)
4
+
5
+ 这个适配器是一个可选的 bridge。它负责导出并安装 Python/R 的 KernelSpec;Jupyter 启动其中一个之后,它把 Jupyter 的消息适配到现有的 OpenAI4S 内核 manager 上。这个 bridge 刻意保持独立:它不挂到 Web session 上,也不提供 Host RPC、Gateway 的 Artifact 捕获、Action Ledger 历史或 Engine 的完成语义。
6
+
7
+ ## 在架构中的位置
8
+
9
+ 该 bridge 是 [`../../kernel/`](../../kernel/) 里内层循环 worker 之上的 Host 侧适配器。科学代码仍然经过 `Kernel` 和加固过的逐行 JSON worker 协议。Jupyter 前端不是 OpenAI4S 外层 Agent 循环的另一种实现:这里没有供应商原生工具批次,也没有 `finalize_response` 动作。
10
+
11
+ `kernelspec.py` 仍然只依赖标准库。`bridge.py` 只在 Jupyter 进程真正启动它的时候才导入 `ipykernel`/ZeroMQ。
12
+
13
+ ## 文件
14
+
15
+ | 文件 | 职责 |
16
+ | --- | --- |
17
+ | [`__init__.py`](./__init__.py) | 重新导出 KernelSpec 的描述、状态、写入和安装辅助函数。导入这个包不会连带导入 Jupyter、IPython 或 ZeroMQ。 |
18
+ | [`bridge.py`](./bridge.py) | `ipykernel` bridge 本身,以及 KernelSpec 启动的那个 CLI。它拉起一个 OpenAI4S 的 Python 或 R 运行时,把 Jupyter 的执行、中断、关闭消息映射到它上面。中断发给确切的那个子 worker,而不是发给 bridge 自己所在的进程组。 |
19
+ | [`kernelspec.py`](./kernelspec.py) | 生成 Python 和 R 两份 `kernel.json`,解析用户目录或显式 prefix 目标,再把每个 spec 目录原子地写进去。目标已存在时直接报错,除非调用方显式要求 `replace`;即便 replace 也只重写 `kernel.json`,不会递归删除用户文件。它还负责报告可选依赖是否已安装。 |
20
+
21
+ ## 贡献者边界
22
+
23
+ - 没装 Jupyter 时,KernelSpec 的生成代码也必须能正常导入。
24
+ - 执行一律走现有的内核 manager;前端代码不要直接去读写 worker 的文件描述符。
25
+ - 在这些集成真正端到端做完之前,不要把这个独立 bridge 说成共享 Web notebook 状态、Host capability 或 Artifact 溯源。
@@ -0,0 +1,22 @@
1
+ """Optional Jupyter compatibility for OpenAI4S scientific workers.
2
+
3
+ Importing this package never imports Jupyter, IPython, ZeroMQ, or ``ipykernel``.
4
+ KernelSpec generation and installation stay stdlib-only; the wire dependency is
5
+ loaded only when a Jupyter frontend launches :mod:`.bridge`.
6
+ """
7
+
8
+ from openai4s.adapters.jupyter.kernelspec import (
9
+ KERNEL_NAMES,
10
+ adapter_status,
11
+ install_kernelspecs,
12
+ kernel_spec,
13
+ write_kernelspecs,
14
+ )
15
+
16
+ __all__ = [
17
+ "KERNEL_NAMES",
18
+ "adapter_status",
19
+ "install_kernelspecs",
20
+ "kernel_spec",
21
+ "write_kernelspecs",
22
+ ]