@galaxyproject/orbit 0.0.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (451) hide show
  1. package/CHANGELOG.md +123 -0
  2. package/LICENSE +21 -0
  3. package/README.md +760 -5
  4. package/bin/legacy-mcp-config.js +363 -0
  5. package/bin/orbit.js +810 -0
  6. package/bin/pi-extension-path.d.ts +4 -0
  7. package/bin/pi-extension-path.js +44 -0
  8. package/bin/provider-auth.d.ts +22 -0
  9. package/bin/provider-auth.js +77 -0
  10. package/bin/thinking-pref.js +38 -0
  11. package/bin/update-check.d.ts +15 -0
  12. package/bin/update-check.js +137 -0
  13. package/extensions/cli-update/index.ts +32 -0
  14. package/extensions/orbit/activity-hooks.ts +141 -0
  15. package/extensions/orbit/activity.ts +116 -0
  16. package/extensions/orbit/agent-dir.ts +11 -0
  17. package/extensions/orbit/auto-resume.ts +352 -0
  18. package/extensions/orbit/config.ts +3 -0
  19. package/extensions/orbit/confusables.ts +1 -0
  20. package/extensions/orbit/context.ts +957 -0
  21. package/extensions/orbit/dashboard-commands.ts +191 -0
  22. package/extensions/orbit/dashboard-store.ts +473 -0
  23. package/extensions/orbit/dashboard-tools.ts +1185 -0
  24. package/extensions/orbit/empty-completion.ts +99 -0
  25. package/extensions/orbit/evidence-gate.ts +1276 -0
  26. package/extensions/orbit/evidence-override-command.ts +294 -0
  27. package/extensions/orbit/exec-guard/bash-risk.ts +1408 -0
  28. package/extensions/orbit/exec-guard/gate.ts +181 -0
  29. package/extensions/orbit/exec-guard/guardian-config.ts +54 -0
  30. package/extensions/orbit/exec-guard/index.ts +1 -0
  31. package/extensions/orbit/exec-guard/model-tier.ts +36 -0
  32. package/extensions/orbit/exec-guard/path-jail.ts +54 -0
  33. package/extensions/orbit/exec-guard/policy.ts +342 -0
  34. package/extensions/orbit/exec-guard/runtime-state.ts +15 -0
  35. package/extensions/orbit/exec-guard/sensitive-read.ts +525 -0
  36. package/extensions/orbit/exec-guard/types.ts +42 -0
  37. package/extensions/orbit/execution-commands.ts +134 -0
  38. package/extensions/orbit/feedback-command.ts +81 -0
  39. package/extensions/orbit/feedback.ts +96 -0
  40. package/extensions/orbit/galaxy-api.test.ts +122 -0
  41. package/extensions/orbit/galaxy-api.ts +606 -0
  42. package/extensions/orbit/galaxy-artifact-link-guidance.ts +5 -0
  43. package/extensions/orbit/galaxy-destructive-gate.ts +113 -0
  44. package/extensions/orbit/galaxy-enrich.ts +1108 -0
  45. package/extensions/orbit/galaxy-failure.ts +101 -0
  46. package/extensions/orbit/galaxy-fixture.ts +126 -0
  47. package/extensions/orbit/galaxy-history-guard.ts +233 -0
  48. package/extensions/orbit/galaxy-job-block.ts +347 -0
  49. package/extensions/orbit/galaxy-job-ops.ts +288 -0
  50. package/extensions/orbit/galaxy-live-source.ts +929 -0
  51. package/extensions/orbit/galaxy-markdown-adapter.ts +248 -0
  52. package/extensions/orbit/galaxy-op-policy.ts +332 -0
  53. package/extensions/orbit/galaxy-ops-tools.ts +326 -0
  54. package/extensions/orbit/galaxy-output-store.ts +80 -0
  55. package/extensions/orbit/galaxy-output.ts +346 -0
  56. package/extensions/orbit/galaxy-page-binding.ts +222 -0
  57. package/extensions/orbit/galaxy-page-markdown-guidance.ts +15 -0
  58. package/extensions/orbit/galaxy-page-ops.ts +159 -0
  59. package/extensions/orbit/galaxy-page-sync.test.ts +417 -0
  60. package/extensions/orbit/galaxy-page-sync.ts +318 -0
  61. package/extensions/orbit/galaxy-pages-api.ts +203 -0
  62. package/extensions/orbit/galaxy-pages-sync.ts +409 -0
  63. package/extensions/orbit/galaxy-poll-guard.ts +189 -0
  64. package/extensions/orbit/galaxy-poller.ts +706 -0
  65. package/extensions/orbit/galaxy-provenance.ts +623 -0
  66. package/extensions/orbit/galaxy-reconcile.ts +956 -0
  67. package/extensions/orbit/galaxy-recovery.ts +176 -0
  68. package/extensions/orbit/galaxy-repeat-guard.ts +55 -0
  69. package/extensions/orbit/galaxy-submission-capture.ts +707 -0
  70. package/extensions/orbit/galaxy-submission.ts +502 -0
  71. package/extensions/orbit/galaxy-tool-source.ts +78 -0
  72. package/extensions/orbit/galaxy-tool-wrap.ts +234 -0
  73. package/extensions/orbit/galaxy-udt-block.ts +127 -0
  74. package/extensions/orbit/galaxy-upload-tus.ts +334 -0
  75. package/extensions/orbit/galaxy-upload.ts +300 -0
  76. package/extensions/orbit/galaxy-version-capture.ts +65 -0
  77. package/extensions/orbit/git.ts +173 -0
  78. package/extensions/orbit/harness-block-fields.ts +597 -0
  79. package/extensions/orbit/index.ts +593 -0
  80. package/extensions/orbit/init-gate.ts +284 -0
  81. package/extensions/orbit/instructions-command.ts +136 -0
  82. package/extensions/orbit/invocation-failure-hint.ts +57 -0
  83. package/extensions/orbit/iwc-plan-check.ts +94 -0
  84. package/extensions/orbit/lesson-command.ts +303 -0
  85. package/extensions/orbit/lesson-hint.ts +245 -0
  86. package/extensions/orbit/lesson-nudge.ts +106 -0
  87. package/extensions/orbit/lessons/compose.ts +177 -0
  88. package/extensions/orbit/lessons/counters.ts +120 -0
  89. package/extensions/orbit/lessons/enabled.ts +116 -0
  90. package/extensions/orbit/lessons/matcher.ts +346 -0
  91. package/extensions/orbit/lessons/paths.ts +286 -0
  92. package/extensions/orbit/lessons/pi-event-contract.ts +105 -0
  93. package/extensions/orbit/lessons/propose-replay.ts +103 -0
  94. package/extensions/orbit/lessons/propose-tool.ts +222 -0
  95. package/extensions/orbit/lessons/propose.ts +502 -0
  96. package/extensions/orbit/lessons/replay.ts +89 -0
  97. package/extensions/orbit/lessons/reproduction-index.ts +83 -0
  98. package/extensions/orbit/lessons/search-tool.ts +99 -0
  99. package/extensions/orbit/lessons/search.ts +136 -0
  100. package/extensions/orbit/lessons/store.ts +415 -0
  101. package/extensions/orbit/lessons/text.ts +36 -0
  102. package/extensions/orbit/lessons/types.ts +69 -0
  103. package/extensions/orbit/lessons/user-dir.ts +24 -0
  104. package/extensions/orbit/lessons/user-lesson.ts +88 -0
  105. package/extensions/orbit/lessons/wrapper.ts +61 -0
  106. package/extensions/orbit/lessons-command.ts +147 -0
  107. package/extensions/orbit/local-exec.ts +39 -0
  108. package/extensions/orbit/mcp-output.ts +179 -0
  109. package/extensions/orbit/mcp-servers.test.ts +24 -0
  110. package/extensions/orbit/mcp-servers.ts +25 -0
  111. package/extensions/orbit/model-script.ts +351 -0
  112. package/extensions/orbit/notebook-anchors.ts +342 -0
  113. package/extensions/orbit/notebook-writer.ts +863 -0
  114. package/extensions/orbit/observation-allowlists.ts +1109 -0
  115. package/extensions/orbit/observation-replay.ts +148 -0
  116. package/extensions/orbit/observation-triggers.ts +563 -0
  117. package/extensions/orbit/observation-ui.ts +175 -0
  118. package/extensions/orbit/observations-command.ts +421 -0
  119. package/extensions/orbit/observations-config.ts +200 -0
  120. package/extensions/orbit/observations.ts +1381 -0
  121. package/extensions/orbit/profiles.ts +270 -0
  122. package/extensions/orbit/progress-updates.ts +95 -0
  123. package/extensions/orbit/proposal-commands.ts +882 -0
  124. package/extensions/orbit/provenance-fs-file.ts +59 -0
  125. package/extensions/orbit/provenance-fs.ts +32 -0
  126. package/extensions/orbit/provenance-memory-fs.ts +59 -0
  127. package/extensions/orbit/record-store-file.ts +177 -0
  128. package/extensions/orbit/record-store-page.ts +77 -0
  129. package/extensions/orbit/record-store-seam.ts +47 -0
  130. package/extensions/orbit/record-store.ts +149 -0
  131. package/extensions/orbit/registry-carrier.ts +107 -0
  132. package/extensions/orbit/registry-eligibility.ts +95 -0
  133. package/extensions/orbit/registry-evaluation.ts +403 -0
  134. package/extensions/orbit/registry-evaluator.ts +519 -0
  135. package/extensions/orbit/registry-import.ts +91 -0
  136. package/extensions/orbit/registry-lock.ts +221 -0
  137. package/extensions/orbit/registry-memory-fs.ts +42 -0
  138. package/extensions/orbit/registry-page-carrier.ts +103 -0
  139. package/extensions/orbit/registry-proposal.ts +1348 -0
  140. package/extensions/orbit/registry-runtime.ts +234 -0
  141. package/extensions/orbit/registry-schema.ts +735 -0
  142. package/extensions/orbit/registry-submitter.ts +59 -0
  143. package/extensions/orbit/registry-templates.ts +346 -0
  144. package/extensions/orbit/registry.ts +476 -0
  145. package/extensions/orbit/sandbox/index.ts +120 -0
  146. package/extensions/orbit/sandbox/sandbox-bash.ts +93 -0
  147. package/extensions/orbit/sandbox/sandbox-config.ts +87 -0
  148. package/extensions/orbit/sandbox/sandbox-init-message.ts +28 -0
  149. package/extensions/orbit/secret-redaction.ts +247 -0
  150. package/extensions/orbit/session-index/cwd.ts +18 -0
  151. package/extensions/orbit/session-index/db.ts +56 -0
  152. package/extensions/orbit/session-index/indexer.ts +154 -0
  153. package/extensions/orbit/session-index/is-enabled.ts +17 -0
  154. package/extensions/orbit/session-index/parse.ts +254 -0
  155. package/extensions/orbit/session-index/query.ts +209 -0
  156. package/extensions/orbit/session-index/schema.ts +72 -0
  157. package/extensions/orbit/session-index/tools.ts +152 -0
  158. package/extensions/orbit/session-lifecycle.ts +321 -0
  159. package/extensions/orbit/skill-triggers.ts +159 -0
  160. package/extensions/orbit/skills-command.ts +48 -0
  161. package/extensions/orbit/skills-discovery.ts +435 -0
  162. package/extensions/orbit/skills.ts +84 -0
  163. package/extensions/orbit/sra-import-gate.ts +77 -0
  164. package/extensions/orbit/state.ts +265 -0
  165. package/extensions/orbit/submission-replay.ts +147 -0
  166. package/extensions/orbit/sync-command.ts +157 -0
  167. package/extensions/orbit/teams/critic-parser.ts +93 -0
  168. package/extensions/orbit/teams/dispatcher.ts +210 -0
  169. package/extensions/orbit/teams/is-enabled.ts +22 -0
  170. package/extensions/orbit/teams/tool.ts +187 -0
  171. package/extensions/orbit/teams/types.ts +57 -0
  172. package/extensions/orbit/teams/validate.ts +42 -0
  173. package/extensions/orbit/tester-id-command.ts +133 -0
  174. package/extensions/orbit/tools-sync.ts +279 -0
  175. package/extensions/orbit/tools.ts +1300 -0
  176. package/extensions/orbit/types.ts +41 -0
  177. package/extensions/orbit/ui-bridge.ts +55 -0
  178. package/extensions/orbit/ulid.ts +60 -0
  179. package/extensions/orbit/user-instructions.ts +388 -0
  180. package/extensions/orbit/vendor/skills/_catalog.json +68 -0
  181. package/extensions/orbit/vendor/skills/_manifest.json +1106 -0
  182. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/SKILL.md +112 -0
  183. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/_provenance.json +218 -0
  184. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/_required_tools.json +33 -0
  185. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/_verify.json +4 -0
  186. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/cli/add.json +50 -0
  187. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/cli/draft-extract.json +51 -0
  188. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/cli/draft-next-step.json +42 -0
  189. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/cli/draft-validate.json +140 -0
  190. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/cli/list.json +32 -0
  191. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/notes/galaxy-tool-job-failure-reference.md +137 -0
  192. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/notes/open-requirements-ledger.md +173 -0
  193. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/schemas/galaxy-tool-summary.schema.json +175 -0
  194. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/schemas/galaxy-workflow-draft.schema.json +2727 -0
  195. package/extensions/orbit/vendor/skills/apply-galaxy-workflow-changeset/SKILL.md +82 -0
  196. package/extensions/orbit/vendor/skills/apply-galaxy-workflow-changeset/_provenance.json +133 -0
  197. package/extensions/orbit/vendor/skills/apply-galaxy-workflow-changeset/_required_tools.json +16 -0
  198. package/extensions/orbit/vendor/skills/apply-galaxy-workflow-changeset/_verify.json +4 -0
  199. package/extensions/orbit/vendor/skills/apply-galaxy-workflow-changeset/references/cli/draft-validate.json +140 -0
  200. package/extensions/orbit/vendor/skills/apply-galaxy-workflow-changeset/references/notes/galaxy-workflow-draft-format.md +135 -0
  201. package/extensions/orbit/vendor/skills/apply-galaxy-workflow-changeset/references/notes/open-requirements-ledger.md +173 -0
  202. package/extensions/orbit/vendor/skills/apply-galaxy-workflow-changeset/references/schemas/galaxy-workflow-draft.schema.json +2727 -0
  203. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/SKILL.md +84 -0
  204. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/_provenance.json +166 -0
  205. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/_verify.json +29 -0
  206. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/references/notes/galaxy-workflow-testability-design.md +136 -0
  207. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/references/notes/iwc-shortcuts-anti-patterns.md +357 -0
  208. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/references/notes/iwc-test-data-conventions.md +308 -0
  209. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/references/notes/planemo-asserts-idioms.md +246 -0
  210. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/references/notes/planemo-workflow-test-architecture.md +151 -0
  211. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/references/schemas/galaxy-workflow-test-plan.schema.json +552 -0
  212. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/references/schemas/summary-galaxy-workflow.schema.json +687 -0
  213. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/references/schemas/tests-format.schema.json +7328 -0
  214. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/SKILL.md +127 -0
  215. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/_provenance.json +198 -0
  216. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/_required_tools.json +16 -0
  217. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/_verify.json +4 -0
  218. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/references/cli/convert.json +123 -0
  219. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/references/notes/galaxy-data-flow-draft-contract.md +129 -0
  220. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/references/notes/iwc-shortcuts-anti-patterns.md +357 -0
  221. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/references/notes/iwc-test-data-conventions.md +308 -0
  222. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/references/notes/open-requirements-ledger.md +173 -0
  223. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/SKILL.md +73 -0
  224. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/_provenance.json +160 -0
  225. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/_verify.json +4 -0
  226. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/references/notes/galaxy-collection-semantics.md +43 -0
  227. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/references/notes/galaxy-collection-semantics.yml +1250 -0
  228. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/references/notes/galaxy-tool-job-failure-reference.md +137 -0
  229. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/references/notes/galaxy-workflow-invocation-failure-reference.md +138 -0
  230. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/references/notes/iwc-shortcuts-anti-patterns.md +357 -0
  231. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/references/notes/nextflow-operators-to-galaxy-collection-recipes.md +98 -0
  232. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/references/notes/planemo-asserts-idioms.md +246 -0
  233. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/references/notes/planemo-workflow-test-architecture.md +151 -0
  234. package/extensions/orbit/vendor/skills/discover-shed-tool/SKILL.md +174 -0
  235. package/extensions/orbit/vendor/skills/discover-shed-tool/_provenance.json +130 -0
  236. package/extensions/orbit/vendor/skills/discover-shed-tool/_required_tools.json +18 -0
  237. package/extensions/orbit/vendor/skills/discover-shed-tool/_verify.json +17 -0
  238. package/extensions/orbit/vendor/skills/discover-shed-tool/references/cli/tool-revisions.json +48 -0
  239. package/extensions/orbit/vendor/skills/discover-shed-tool/references/cli/tool-search.json +95 -0
  240. package/extensions/orbit/vendor/skills/discover-shed-tool/references/cli/tool-versions.json +39 -0
  241. package/extensions/orbit/vendor/skills/discover-shed-tool/references/notes/component-tool-shed-search.md +230 -0
  242. package/extensions/orbit/vendor/skills/discover-shed-tool/references/schemas/galaxy-tool-discovery.schema.json +231 -0
  243. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/SKILL.md +93 -0
  244. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/_provenance.json +201 -0
  245. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/_required_tools.json +28 -0
  246. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/_verify.json +17 -0
  247. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/cli/planemo.md +44 -0
  248. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/cli/validate-tests.json +40 -0
  249. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/notes/galaxy-workflow-testability-design.md +136 -0
  250. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/notes/iwc-shortcuts-anti-patterns.md +357 -0
  251. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/notes/iwc-test-data-conventions.md +308 -0
  252. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/notes/planemo-asserts-idioms.md +246 -0
  253. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/notes/planemo-workflow-test-architecture.md +151 -0
  254. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/schemas/galaxy-workflow-test-plan.schema.json +552 -0
  255. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/schemas/tests-format.schema.json +7328 -0
  256. package/extensions/orbit/vendor/skills/interview-to-galaxy-workflow-changeset/SKILL.md +81 -0
  257. package/extensions/orbit/vendor/skills/interview-to-galaxy-workflow-changeset/_provenance.json +93 -0
  258. package/extensions/orbit/vendor/skills/interview-to-galaxy-workflow-changeset/_verify.json +17 -0
  259. package/extensions/orbit/vendor/skills/interview-to-galaxy-workflow-changeset/references/notes/open-requirements-ledger.md +173 -0
  260. package/extensions/orbit/vendor/skills/interview-to-galaxy-workflow-changeset/references/schemas/summary-galaxy-workflow.schema.json +687 -0
  261. package/extensions/orbit/vendor/skills/pipeline-update-interview-to-galaxy/SKILL.md +81 -0
  262. package/extensions/orbit/vendor/skills/pipeline-update-interview-to-galaxy/_assembly.json +23 -0
  263. package/extensions/orbit/vendor/skills/run-workflow-test/SKILL.md +79 -0
  264. package/extensions/orbit/vendor/skills/run-workflow-test/_provenance.json +125 -0
  265. package/extensions/orbit/vendor/skills/run-workflow-test/_required_tools.json +28 -0
  266. package/extensions/orbit/vendor/skills/run-workflow-test/_verify.json +4 -0
  267. package/extensions/orbit/vendor/skills/run-workflow-test/references/cli/planemo.md +44 -0
  268. package/extensions/orbit/vendor/skills/run-workflow-test/references/cli/validate-tests.json +40 -0
  269. package/extensions/orbit/vendor/skills/run-workflow-test/references/notes/galaxy-workflow-invocation-failure-reference.md +138 -0
  270. package/extensions/orbit/vendor/skills/run-workflow-test/references/notes/planemo-asserts-idioms.md +246 -0
  271. package/extensions/orbit/vendor/skills/run-workflow-test/references/notes/planemo-workflow-test-architecture.md +151 -0
  272. package/extensions/orbit/vendor/skills/run-workflow-test/references/schemas/tests-format.schema.json +7328 -0
  273. package/extensions/orbit/vendor/skills/skills/LICENSE +21 -0
  274. package/extensions/orbit/vendor/skills/skills/collection-manipulation/README.md +39 -0
  275. package/extensions/orbit/vendor/skills/skills/collection-manipulation/SKILL.md +892 -0
  276. package/extensions/orbit/vendor/skills/skills/collection-manipulation/references/api-patterns.md +927 -0
  277. package/extensions/orbit/vendor/skills/skills/collection-manipulation/references/apply-rules.md +1482 -0
  278. package/extensions/orbit/vendor/skills/skills/collection-manipulation/references/test-patterns.md +996 -0
  279. package/extensions/orbit/vendor/skills/skills/collection-manipulation/references/tools.md +609 -0
  280. package/extensions/orbit/vendor/skills/skills/galaxy-data-libraries/SKILL.md +170 -0
  281. package/extensions/orbit/vendor/skills/skills/galaxy-integration/README.md +162 -0
  282. package/extensions/orbit/vendor/skills/skills/galaxy-integration/SKILL.md +99 -0
  283. package/extensions/orbit/vendor/skills/skills/galaxy-integration/examples/README.md +119 -0
  284. package/extensions/orbit/vendor/skills/skills/galaxy-integration/examples/tool-checking.md +419 -0
  285. package/extensions/orbit/vendor/skills/skills/galaxy-integration/examples/workflow-testing.md +617 -0
  286. package/extensions/orbit/vendor/skills/skills/galaxy-integration/galaxy-integration.md +614 -0
  287. package/extensions/orbit/vendor/skills/skills/galaxy-integration/jupyterlite/SKILL.md +144 -0
  288. package/extensions/orbit/vendor/skills/skills/galaxy-integration/jupyterlite/examples/average_col3.ipynb +68 -0
  289. package/extensions/orbit/vendor/skills/skills/galaxy-integration/jupyterlite/examples/extract_sample_metadata.ipynb +190 -0
  290. package/extensions/orbit/vendor/skills/skills/galaxy-integration/jupyterlite/examples/variant_annotation.ipynb +816 -0
  291. package/extensions/orbit/vendor/skills/skills/galaxy-integration/jupyterlite/examples/vcp_variant_map.ipynb +443 -0
  292. package/extensions/orbit/vendor/skills/skills/galaxy-integration/scripts/README.md +165 -0
  293. package/extensions/orbit/vendor/skills/skills/galaxy-integration/scripts/galaxy_tool_checker.py +521 -0
  294. package/extensions/orbit/vendor/skills/skills/galaxy-mcp-reference/SKILL.md +128 -0
  295. package/extensions/orbit/vendor/skills/skills/galaxy-mcp-reference/gotchas.md +135 -0
  296. package/extensions/orbit/vendor/skills/skills/galaxy-mcp-reference/history-access.md +132 -0
  297. package/extensions/orbit/vendor/skills/skills/reproduciblify/SKILL.md +146 -0
  298. package/extensions/orbit/vendor/skills/skills/reproduciblify/references/directives.yml +496 -0
  299. package/extensions/orbit/vendor/skills/skills/udt-authoring/SKILL.md +245 -0
  300. package/extensions/orbit/vendor/skills/skills/udt-authoring/examples/01-minimal-echo.yml +27 -0
  301. package/extensions/orbit/vendor/skills/skills/udt-authoring/examples/02-single-data-in-out.yml +27 -0
  302. package/extensions/orbit/vendor/skills/skills/udt-authoring/examples/03-multiple-data-js.yml +28 -0
  303. package/extensions/orbit/vendor/skills/skills/udt-authoring/examples/04-select-integer-boolean.yml +41 -0
  304. package/extensions/orbit/vendor/skills/skills/udt-authoring/examples/05-resource-requirements.yml +25 -0
  305. package/extensions/orbit/vendor/skills/skills/udt-authoring/examples/06-biocontainer-tool.yml +38 -0
  306. package/extensions/orbit/vendor/skills/skills/udt-authoring/examples/07-inline-python-script.yml +56 -0
  307. package/extensions/orbit/vendor/skills/skills/udt-authoring/examples/08-configfile-script.yml +74 -0
  308. package/extensions/orbit/vendor/skills/skills/udt-authoring/references/common-mistakes.md +76 -0
  309. package/extensions/orbit/vendor/skills/skills/udt-authoring/references/schema-reference.md +155 -0
  310. package/extensions/orbit/vendor/skills/skills/udt-authoring/references/templating.md +196 -0
  311. package/extensions/orbit/vendor/skills/skills/udt-authoring/scripts/validate.py +109 -0
  312. package/extensions/orbit/vendor/skills/skills/workflow-reports/README.md +71 -0
  313. package/extensions/orbit/vendor/skills/skills/workflow-reports/SKILL.md +190 -0
  314. package/extensions/orbit/vendor/skills/skills/workflow-reports/examples/histology-staining.md +145 -0
  315. package/extensions/orbit/vendor/skills/skills/workflow-reports/examples/tissue-microarray-analysis.md +176 -0
  316. package/extensions/orbit/vendor/skills/skills/workflow-reports/references/directives.md +415 -0
  317. package/extensions/orbit/vendor/skills/summarize-galaxy-workflow/SKILL.md +98 -0
  318. package/extensions/orbit/vendor/skills/summarize-galaxy-workflow/_provenance.json +93 -0
  319. package/extensions/orbit/vendor/skills/summarize-galaxy-workflow/_required_tools.json +28 -0
  320. package/extensions/orbit/vendor/skills/summarize-galaxy-workflow/_verify.json +17 -0
  321. package/extensions/orbit/vendor/skills/summarize-galaxy-workflow/references/cli/convert.json +123 -0
  322. package/extensions/orbit/vendor/skills/summarize-galaxy-workflow/references/cli/foundry.md +25 -0
  323. package/extensions/orbit/vendor/skills/summarize-galaxy-workflow/references/cli/validate.json +142 -0
  324. package/extensions/orbit/vendor/skills/summarize-galaxy-workflow/references/schemas/summary-galaxy-workflow.schema.json +687 -0
  325. package/extensions/orbit/vendor/skills/validate-galaxy-workflow/SKILL.md +74 -0
  326. package/extensions/orbit/vendor/skills/validate-galaxy-workflow/_provenance.json +71 -0
  327. package/extensions/orbit/vendor/skills/validate-galaxy-workflow/_required_tools.json +16 -0
  328. package/extensions/orbit/vendor/skills/validate-galaxy-workflow/_verify.json +4 -0
  329. package/extensions/orbit/vendor/skills/validate-galaxy-workflow/references/cli/validate.json +142 -0
  330. package/extensions/orbit/vendor/skills/validate-galaxy-workflow/references/notes/galaxy-workflow-invocation-failure-reference.md +138 -0
  331. package/extensions/orbit/vendor/skills/validate-galaxy-workflow/references/notes/galaxy-workflow-testability-design.md +136 -0
  332. package/extensions/orbit/vendor-skills.ts +283 -0
  333. package/extensions/orbit/workspace-state-dir.ts +46 -0
  334. package/extensions/orbit-handoff/index.ts +73 -0
  335. package/extensions/orbit-handoff/orbit-launcher.ts +142 -0
  336. package/extensions/whats-new/index.ts +98 -0
  337. package/lessons/LICENSE +17 -0
  338. package/lessons/README.md +117 -0
  339. package/lessons/SCHEMA.md +187 -0
  340. package/lessons/build-snapshot.mjs +311 -0
  341. package/lessons/data/downloaded-file-is-not-what-its-extension-says.md +61 -0
  342. package/lessons/galaxy-api/403-history-is-a-hard-stop.md +57 -0
  343. package/lessons/galaxy-api/collection-into-single-dataset-input.md +61 -0
  344. package/lessons/galaxy-api/connectedvalue-in-command-line.md +62 -0
  345. package/lessons/galaxy-api/hid-is-not-an-id.md +59 -0
  346. package/lessons/galaxy-api/invoke-workflow-inputs-not-params.md +60 -0
  347. package/lessons/galaxy-api/repeat-param-pipe-keys.md +63 -0
  348. package/lessons/galaxy-api/run-tool-returns-on-submit.md +61 -0
  349. package/lessons/galaxy-tools/reference-index-not-on-server.md +62 -0
  350. package/lessons/log.md +42 -0
  351. package/lessons/reproduction/input-population-mismatch.md +59 -0
  352. package/lessons/reproduction/methods-text-vs-executed-parameters.md +62 -0
  353. package/lessons/snapshot.json +1004 -0
  354. package/lessons/stats/de-contrast-direction-and-sample-labels.md +63 -0
  355. package/lessons/stats/na-coerced-to-zero-in-filters.md +59 -0
  356. package/lessons/validate.mjs +1219 -0
  357. package/package.json +103 -5
  358. package/shared/agent-prompt.d.ts +8 -0
  359. package/shared/agent-prompt.js +15 -0
  360. package/shared/approval-prompt.d.ts +4 -0
  361. package/shared/approval-prompt.js +61 -0
  362. package/shared/brain-env.d.ts +14 -0
  363. package/shared/brain-env.js +108 -0
  364. package/shared/brain-exit.d.ts +20 -0
  365. package/shared/brain-exit.js +149 -0
  366. package/shared/capability-profile.d.ts +16 -0
  367. package/shared/capability-profile.js +75 -0
  368. package/shared/config-source.d.ts +13 -0
  369. package/shared/config-source.js +17 -0
  370. package/shared/confusables.d.ts +3 -0
  371. package/shared/confusables.js +93 -0
  372. package/shared/custom-provider.d.ts +45 -0
  373. package/shared/custom-provider.js +169 -0
  374. package/shared/dashboard-contract.d.ts +123 -0
  375. package/shared/dashboard-contract.js +560 -0
  376. package/shared/dashboard-layout-store.d.ts +44 -0
  377. package/shared/dashboard-layout-store.js +281 -0
  378. package/shared/feedback-contract.d.ts +61 -0
  379. package/shared/feedback-contract.js +146 -0
  380. package/shared/galaxy-artifact-links.d.ts +30 -0
  381. package/shared/galaxy-artifact-links.js +166 -0
  382. package/shared/galaxy-credentials.d.ts +26 -0
  383. package/shared/galaxy-credentials.js +71 -0
  384. package/shared/galaxy-destructive.d.ts +21 -0
  385. package/shared/galaxy-destructive.js +269 -0
  386. package/shared/galaxy-guidance.d.ts +2 -0
  387. package/shared/galaxy-guidance.js +53 -0
  388. package/shared/galaxy-live-contract.d.ts +92 -0
  389. package/shared/galaxy-live-contract.js +180 -0
  390. package/shared/galaxy-page-cells.d.ts +2 -0
  391. package/shared/galaxy-page-cells.js +22 -0
  392. package/shared/galaxy-tool-family.d.ts +5 -0
  393. package/shared/galaxy-tool-family.js +27 -0
  394. package/shared/galaxy-url.d.ts +1 -0
  395. package/shared/galaxy-url.js +48 -0
  396. package/shared/gtn.d.ts +31 -0
  397. package/shared/gtn.js +253 -0
  398. package/shared/handled-prompt.d.ts +3 -0
  399. package/shared/handled-prompt.js +26 -0
  400. package/shared/known-provider.d.ts +11 -0
  401. package/shared/known-provider.js +89 -0
  402. package/shared/lesson-hint-marker.d.ts +7 -0
  403. package/shared/lesson-hint-marker.js +32 -0
  404. package/shared/lesson-rules.d.ts +150 -0
  405. package/shared/lesson-rules.js +203 -0
  406. package/shared/malformed-object-ids.d.ts +1 -0
  407. package/shared/malformed-object-ids.js +37 -0
  408. package/shared/markdown-sections.d.ts +10 -0
  409. package/shared/markdown-sections.js +118 -0
  410. package/shared/notebook-fences.d.ts +12 -0
  411. package/shared/notebook-fences.js +53 -0
  412. package/shared/observation-contract.d.ts +91 -0
  413. package/shared/observation-contract.js +544 -0
  414. package/shared/orbit-config.d.ts +226 -0
  415. package/shared/orbit-config.js +189 -0
  416. package/shared/orbit-env.d.ts +13 -0
  417. package/shared/orbit-env.js +124 -0
  418. package/shared/orbit-shell-contract.d.ts +74 -0
  419. package/shared/orbit-shell-contract.js +30 -0
  420. package/shared/page-content-hash.d.ts +1 -0
  421. package/shared/page-content-hash.js +13 -0
  422. package/shared/pi-default-model.d.ts +7 -0
  423. package/shared/pi-default-model.js +41 -0
  424. package/shared/prompt-blocks.d.ts +87 -0
  425. package/shared/prompt-blocks.js +898 -0
  426. package/shared/provider-auth-caps.d.ts +22 -0
  427. package/shared/provider-auth-caps.js +57 -0
  428. package/shared/random.d.ts +2 -0
  429. package/shared/random.js +15 -0
  430. package/shared/record-excerpt.d.ts +4 -0
  431. package/shared/record-excerpt.js +16 -0
  432. package/shared/redirect-guard.d.ts +36 -0
  433. package/shared/redirect-guard.js +235 -0
  434. package/shared/skills-pin.d.ts +8 -0
  435. package/shared/skills-pin.js +9 -0
  436. package/shared/skills-router.d.ts +17 -0
  437. package/shared/skills-router.js +63 -0
  438. package/shared/sra-import.d.ts +34 -0
  439. package/shared/sra-import.js +206 -0
  440. package/shared/state-dir.d.ts +21 -0
  441. package/shared/state-dir.js +240 -0
  442. package/shared/team-dispatch-contract.d.ts +28 -0
  443. package/shared/team-dispatch-contract.js +1 -0
  444. package/shared/truncate-middle.d.ts +11 -0
  445. package/shared/truncate-middle.js +68 -0
  446. package/shared/version-compare.d.ts +10 -0
  447. package/shared/version-compare.js +74 -0
  448. package/shared/whats-new.d.ts +31 -0
  449. package/shared/whats-new.js +83 -0
  450. package/shared/wsl.d.ts +10 -0
  451. package/shared/wsl.js +24 -0
@@ -0,0 +1,606 @@
1
+ /**
2
+ * Galaxy API helper for authenticated calls from the extension process.
3
+ *
4
+ * Uses the same env-var pattern as the rest of the extension (GALAXY_URL, GALAXY_API_KEY).
5
+ * Provides typed wrappers for the specific endpoints used by invocation polling.
6
+ */
7
+
8
+ import {
9
+ createGalaxyContext,
10
+ GalaxyConnectionError,
11
+ GalaxyError,
12
+ getDatasetDetails,
13
+ getInvocations,
14
+ type GalaxyContext,
15
+ type GalaxyVersionReport,
16
+ type InvocationDetail,
17
+ } from "@galaxyproject/galaxy-ops";
18
+ import { RedirectRefusedError, fetchSameOriginOnly } from "../../shared/redirect-guard.js";
19
+ import { normalizeGalaxyUrl } from "../../shared/galaxy-url.js";
20
+ import { transportCode } from "./galaxy-failure";
21
+
22
+ // ─────────────────────────────────────────────────────────────────────────────
23
+ // Galaxy API response types
24
+ // ─────────────────────────────────────────────────────────────────────────────
25
+
26
+ export type { InvocationDetail } from "@galaxyproject/galaxy-ops";
27
+
28
+ /**
29
+ * Invocation states in which Galaxy has stopped scheduling steps
30
+ * (`InvocationState`). Anything else -- `new`, `ready`, `cancelling`, and
31
+ * whatever Galaxy adds next -- means more jobs may still appear.
32
+ *
33
+ * `completed` arrived in Galaxy 26.0 with workflow completion monitoring: a
34
+ * finished invocation moves on from `scheduled` to `completed` once all its
35
+ * jobs are terminal. Leaving it out meant a finished workflow on a 26.x server
36
+ * was never terminal to the poller, so it never transitioned or got enriched.
37
+ */
38
+ export const INVOCATION_SCHEDULING_DONE: ReadonlySet<string> = new Set([
39
+ "scheduled",
40
+ "completed",
41
+ "cancelled",
42
+ "failed",
43
+ ]);
44
+
45
+ /** States in which a finished invocation succeeded at scheduling everything. */
46
+ export const INVOCATION_SCHEDULED_OK: ReadonlySet<string> = new Set(["scheduled", "completed"]);
47
+
48
+ /**
49
+ * Subset of GET /api/jobs/{jobId} we actually read.
50
+ *
51
+ * `tool_version` is declared because the ORM emits it, but Galaxy's response
52
+ * model drops it (pydantic `extra="ignore"`), so on a real server it is
53
+ * absent. The submission response is where a version actually survives. The
54
+ * rest are only filled with `?full=true`; `inputs`/`outputs` are dicts keyed
55
+ * by the tool's input/output name, not lists.
56
+ */
57
+ export interface GalaxyJobDetailsResponse {
58
+ id: string;
59
+ state: string;
60
+ tool_id: string;
61
+ tool_version?: string;
62
+ params?: Record<string, unknown>;
63
+ exit_code?: number | null;
64
+ create_time?: string;
65
+ update_time?: string;
66
+ command_version?: string | null;
67
+ history_id?: string;
68
+ inputs?: Record<string, unknown>;
69
+ outputs?: Record<string, unknown>;
70
+ output_collections?: Record<string, unknown>;
71
+ }
72
+
73
+ // ─────────────────────────────────────────────────────────────────────────────
74
+ // Config
75
+ // ─────────────────────────────────────────────────────────────────────────────
76
+
77
+ export interface GalaxyConfig {
78
+ url: string;
79
+ apiKey: string;
80
+ }
81
+
82
+ /**
83
+ * How the redirect guard names things when it refuses one. `GALAXY_URL` is the
84
+ * right thing to name here even for a profile-configured server: `/connect`
85
+ * publishes the active profile into the env, so that is the value in play.
86
+ */
87
+ const GALAXY_REDIRECT_LABELS = {
88
+ serverLabel: "Galaxy",
89
+ urlSettingLabel: "GALAXY_URL",
90
+ } as const;
91
+
92
+ /** The Galaxy URL and key in play, as given -- not normalized, possibly unset. */
93
+ export interface GalaxyCredentials {
94
+ url: string | undefined;
95
+ apiKey: string | undefined;
96
+ }
97
+
98
+ /**
99
+ * The one place the brain reads Galaxy credentials. Without an argument it asks
100
+ * the transport, so a shell with no process env (the browser worker) can supply
101
+ * them, and falls back to GALAXY_URL/GALAXY_API_KEY. Pass `env` to read a given
102
+ * environment instead -- pure helpers and tests do. Writers (/connect,
103
+ * switchProfile) still publish into process.env.
104
+ */
105
+ export function galaxyCredentials(env?: NodeJS.ProcessEnv): GalaxyCredentials {
106
+ if (!env && transport.credentials) return transport.credentials();
107
+ const source = env ?? process.env;
108
+ return { url: source.GALAXY_URL, apiKey: source.GALAXY_API_KEY };
109
+ }
110
+
111
+ export function getGalaxyConfig(): GalaxyConfig | null {
112
+ const { url, apiKey } = galaxyCredentials();
113
+ if (!url || !apiKey) return null;
114
+ // Every request goes through here, galaxy-ops' included, so this is where a
115
+ // scheme-less host or a pasted `/api` root has to be caught, whatever the
116
+ // shell or transport handed over.
117
+ const normalized = normalizeGalaxyUrl(url);
118
+ return normalized ? { url: normalized, apiKey } : null;
119
+ }
120
+
121
+ // ─────────────────────────────────────────────────────────────────────────────
122
+ // Authenticated fetch
123
+ // ─────────────────────────────────────────────────────────────────────────────
124
+
125
+ /**
126
+ * An HTTP error from Galaxy, carrying the status code.
127
+ *
128
+ * The message is byte-identical to the plain Error this replaced, so callers
129
+ * that match on the text keep working; what's new is that a caller can tell
130
+ * "Galaxy says this id is not a thing" from "Galaxy didn't answer". Those two
131
+ * deserve opposite handling -- the first is a mistake to report, the second is
132
+ * a reason to try again later.
133
+ */
134
+ export class GalaxyApiError extends Error {
135
+ readonly status: number;
136
+
137
+ constructor(status: number, body: string, statusText: string) {
138
+ super(`Galaxy API ${status}: ${body || statusText}`);
139
+ this.name = "GalaxyApiError";
140
+ this.status = status;
141
+ }
142
+ }
143
+
144
+ type GalaxyFetch = (url: string, init: RequestInit) => Promise<Response>;
145
+
146
+ /**
147
+ * How the brain reaches Galaxy when process env and the network aren't the
148
+ * answer. Every part is optional; an empty transport is the default.
149
+ */
150
+ export interface GalaxyTransport {
151
+ /** Replaces the network for every Galaxy call made here, galaxy-ops' included. */
152
+ fetch?: GalaxyFetch;
153
+ /** Supplies the URL and key in place of GALAXY_URL/GALAXY_API_KEY. */
154
+ credentials?: () => GalaxyCredentials;
155
+ /** The answers are recorded, not live, so provenance marks them as fixtures. */
156
+ fixture?: boolean;
157
+ }
158
+
159
+ let transport: GalaxyTransport = {};
160
+ // The transport's own fetch while a fixture stands in for it.
161
+ let liveFetch: GalaxyFetch | undefined;
162
+
163
+ export function setGalaxyTransport(next: GalaxyTransport | null): void {
164
+ transport = next ?? {};
165
+ liveFetch = undefined;
166
+ }
167
+
168
+ /**
169
+ * Set only by the Tier-1 fixture seam (galaxy-fixture.ts) and by tests: the
170
+ * capture scenarios have to exercise reconcile and enrichment against recorded
171
+ * responses, and there is no other layer every one of those calls shares.
172
+ * Swaps only the fetch, so installed credentials survive both setting and
173
+ * clearing it, and clearing it puts back whatever fetch the transport had.
174
+ */
175
+ export function setGalaxyFetchOverride(fetchImpl: GalaxyFetch | null): void {
176
+ if (transport.fixture !== true) liveFetch = transport.fetch;
177
+ transport = fetchImpl
178
+ ? { ...transport, fetch: fetchImpl, fixture: true }
179
+ : { ...transport, fetch: liveFetch, fixture: false };
180
+ }
181
+
182
+ /** Whether Galaxy answers are coming from a recorded fixture rather than a server. */
183
+ export function isGalaxyFetchOverridden(): boolean {
184
+ return transport.fixture === true;
185
+ }
186
+
187
+ function galaxyFetch(url: string, init: RequestInit): Promise<Response> {
188
+ if (transport.fetch) return transport.fetch(url, init);
189
+ return fetchSameOriginOnly(url, init, GALAXY_REDIRECT_LABELS);
190
+ }
191
+
192
+ export async function galaxyGet<T = unknown>(path: string, signal?: AbortSignal): Promise<T> {
193
+ const config = getGalaxyConfig();
194
+ if (!config) throw new Error("Galaxy credentials not configured (GALAXY_URL, GALAXY_API_KEY)");
195
+
196
+ const url = `${config.url}/api${path}`;
197
+ const resp = await galaxyFetch(url, {
198
+ headers: { "x-api-key": config.apiKey },
199
+ signal,
200
+ });
201
+
202
+ if (!resp.ok) {
203
+ const body = await resp.text().catch(() => "");
204
+ throw new GalaxyApiError(resp.status, body, resp.statusText);
205
+ }
206
+
207
+ return resp.json() as Promise<T>;
208
+ }
209
+
210
+ async function galaxyMutate<T>(
211
+ method: "POST" | "PUT",
212
+ path: string,
213
+ body: Record<string, unknown>,
214
+ signal?: AbortSignal,
215
+ ): Promise<T> {
216
+ const config = getGalaxyConfig();
217
+ if (!config) throw new Error("Galaxy credentials not configured (GALAXY_URL, GALAXY_API_KEY)");
218
+
219
+ const url = `${config.url}/api${path}`;
220
+ const resp = await galaxyFetch(url, {
221
+ method,
222
+ headers: {
223
+ "x-api-key": config.apiKey,
224
+ "Content-Type": "application/json",
225
+ },
226
+ body: JSON.stringify(body),
227
+ signal,
228
+ });
229
+
230
+ if (!resp.ok) {
231
+ const text = await resp.text().catch(() => "");
232
+ throw new GalaxyApiError(resp.status, text, resp.statusText);
233
+ }
234
+
235
+ return resp.json() as Promise<T>;
236
+ }
237
+
238
+ export async function galaxyPost<T = unknown>(
239
+ path: string,
240
+ body: Record<string, unknown>,
241
+ signal?: AbortSignal,
242
+ ): Promise<T> {
243
+ return galaxyMutate<T>("POST", path, body, signal);
244
+ }
245
+
246
+ export async function galaxyPut<T = unknown>(
247
+ path: string,
248
+ body: Record<string, unknown>,
249
+ signal?: AbortSignal,
250
+ ): Promise<T> {
251
+ return galaxyMutate<T>("PUT", path, body, signal);
252
+ }
253
+
254
+ /**
255
+ * Fetch one job by id. The poller reads only `state`; enrichment asks for
256
+ * `full` to get the effective params and the input/output maps.
257
+ *
258
+ * Hand-rolled because galaxy-ops' `getJobDetails` takes a *dataset* id and
259
+ * resolves the job from it, mirroring galaxy-mcp 1.9.0; nothing there looks a
260
+ * job up by its own id.
261
+ */
262
+ export async function galaxyGetJobDetails(
263
+ jobId: string,
264
+ signal?: AbortSignal,
265
+ options: { full?: boolean } = {},
266
+ ): Promise<GalaxyJobDetailsResponse> {
267
+ const query = options.full ? "?full=true" : "";
268
+ return galaxyGet<GalaxyJobDetailsResponse>(`/jobs/${encodeURIComponent(jobId)}${query}`, signal);
269
+ }
270
+
271
+ /** One row of `GET /api/jobs` (collection view). Every field but `id` is optional on purpose. */
272
+ export interface GalaxyJobListing {
273
+ id: string;
274
+ state?: string;
275
+ tool_id?: string;
276
+ tool_version?: string;
277
+ history_id?: string;
278
+ create_time?: string;
279
+ update_time?: string;
280
+ exit_code?: number | null;
281
+ }
282
+
283
+ /**
284
+ * One page of a history's jobs, newest first (Galaxy sorts create_time descending).
285
+ *
286
+ * `date_range_min` is a day, not an instant: Galaxy filters it against
287
+ * `update_time` and its accepted formats have moved between releases, while a
288
+ * bare date has always parsed. That makes the page a superset of what the
289
+ * caller wants, and the caller filters on `create_time` itself.
290
+ *
291
+ * Hand-rolled because galaxy-ops has no job listing.
292
+ */
293
+ export async function galaxyListHistoryJobs(
294
+ params: { historyId: string; sinceDay?: string; limit: number; offset: number },
295
+ signal?: AbortSignal,
296
+ ): Promise<GalaxyJobListing[]> {
297
+ const query = new URLSearchParams({
298
+ history_id: params.historyId,
299
+ view: "collection",
300
+ order_by: "create_time",
301
+ limit: String(params.limit),
302
+ offset: String(params.offset),
303
+ });
304
+ if (params.sinceDay) query.set("date_range_min", params.sinceDay);
305
+ const rows = await galaxyGet<unknown>(`/jobs?${query.toString()}`, signal);
306
+ if (!Array.isArray(rows)) throw new Error("Galaxy's job index did not return a list");
307
+ return rows.filter(
308
+ (r): r is GalaxyJobListing =>
309
+ !!r && typeof r === "object" && typeof (r as { id?: unknown }).id === "string",
310
+ );
311
+ }
312
+
313
+ /**
314
+ * What one round trip decided about a run id: Galaxy has it, Galaxy says it
315
+ * doesn't, or we never got an answer. The third is not the second.
316
+ */
317
+ export type GalaxyRunVerification =
318
+ | { outcome: "found" }
319
+ | { outcome: "absent"; detail: string }
320
+ | { outcome: "unreachable"; detail: string };
321
+
322
+ /**
323
+ * Statuses that mean "no such run" rather than "ask again later".
324
+ *
325
+ * 404 is the obvious one. 400 is there because Galaxy decodes ids before it
326
+ * looks anything up, and `decode_id` raises MalformedId -- a 400 -- for a value
327
+ * that isn't a valid encoded id at all. That is the shape a hallucinated or
328
+ * truncated id actually arrives in, so treating 400 as "ask again later" would
329
+ * let exactly the ids this check exists to catch through as unverified.
330
+ */
331
+ const ABSENT_STATUSES: ReadonlySet<number> = new Set([400, 404]);
332
+
333
+ /**
334
+ * Galaxy's encoded ids are hex, which `galaxy-markdown-adapter.ts` already
335
+ * relies on for the same reason: a value like `.` or `../histories` survives
336
+ * `encodeURIComponent` unchanged, and URL dot-segment normalization then turns
337
+ * `/api/jobs/.` into `/api/jobs` -- the *collection* endpoint, which answers
338
+ * 200 with a list. Without this, `galaxy_job_record({jobId: "."})` records a
339
+ * verified block for a job that does not exist.
340
+ */
341
+ const ENCODED_ID_RE = /^[0-9a-fA-F]+$/;
342
+
343
+ /** Whether a value has the shape of a Galaxy encoded id. See ENCODED_ID_RE. */
344
+ export function isGalaxyEncodedId(value: unknown): value is string {
345
+ return typeof value === "string" && value.length <= 64 && ENCODED_ID_RE.test(value);
346
+ }
347
+
348
+ /**
349
+ * Ask Galaxy whether a run id exists, without caring what it says beyond that.
350
+ *
351
+ * Deliberately fails open on anything that isn't a definite no: a 500, a dead
352
+ * network, or missing credentials must not cost the user a record of a run they
353
+ * really did submit. The caller marks those `server_verified: false` and lets
354
+ * the poller settle it.
355
+ */
356
+ export async function verifyGalaxyRun(
357
+ kind: "invocation" | "job",
358
+ id: string,
359
+ signal?: AbortSignal,
360
+ ): Promise<GalaxyRunVerification> {
361
+ if (!ENCODED_ID_RE.test(id)) {
362
+ return { outcome: "absent", detail: `"${id}" is not a Galaxy id (they are hex)` };
363
+ }
364
+ if (!getGalaxyConfig()) {
365
+ return { outcome: "unreachable", detail: "Galaxy credentials are not configured" };
366
+ }
367
+ const path =
368
+ kind === "invocation"
369
+ ? `/invocations/${encodeURIComponent(id)}`
370
+ : `/jobs/${encodeURIComponent(id)}`;
371
+ try {
372
+ const body = await galaxyGet<{ id?: unknown }>(path, signal);
373
+ // A 200 is not the answer; a 200 *for this id* is. Anything else means the
374
+ // request landed on some other resource, which is how a path that survives
375
+ // encoding gets itself certified.
376
+ if (!body || typeof body !== "object" || Array.isArray(body) || body.id !== id) {
377
+ return { outcome: "absent", detail: `Galaxy answered for a different resource than ${id}` };
378
+ }
379
+ return { outcome: "found" };
380
+ } catch (error) {
381
+ if (error instanceof GalaxyApiError && ABSENT_STATUSES.has(error.status)) {
382
+ return { outcome: "absent", detail: error.message };
383
+ }
384
+ return {
385
+ outcome: "unreachable",
386
+ detail: error instanceof Error ? error.message : String(error),
387
+ };
388
+ }
389
+ }
390
+
391
+ /**
392
+ * Whether a block's recorded `galaxy_server_url` is the server we are polling.
393
+ *
394
+ * Every Galaxy call reads the *current* credentials, not the block's own url,
395
+ * so after a profile switch the poller happily asks server B about a block
396
+ * recorded against server A. It has always done that; what must not follow is
397
+ * B's answer certifying A's record. An empty url is no claim -- the block
398
+ * predates the field, or was written with no credentials -- so it matches
399
+ * whatever we have.
400
+ */
401
+ export function sameGalaxyServer(
402
+ blockUrl: string | undefined,
403
+ currentUrl: string | undefined,
404
+ ): boolean {
405
+ if (!blockUrl) return true;
406
+ if (!currentUrl) return false;
407
+ const norm = (u: string) => u.trim().replace(/\/+$/, "").toLowerCase();
408
+ return norm(blockUrl) === norm(currentUrl);
409
+ }
410
+
411
+ export interface GalaxyHistorySummary {
412
+ id: string;
413
+ name?: string;
414
+ }
415
+
416
+ /**
417
+ * The user's current (most-recently-used) history, resolved from just
418
+ * GALAXY_URL + GALAXY_API_KEY. Returns null when Galaxy reports none.
419
+ */
420
+ export async function galaxyGetMostRecentHistory(
421
+ signal?: AbortSignal,
422
+ ): Promise<GalaxyHistorySummary | null> {
423
+ const res = await galaxyGet<GalaxyHistorySummary | null>("/histories/most_recently_used", signal);
424
+ return res && typeof res.id === "string" && res.id.length > 0 ? res : null;
425
+ }
426
+
427
+ // ─────────────────────────────────────────────────────────────────────────────
428
+ // galaxy-ops
429
+ // ─────────────────────────────────────────────────────────────────────────────
430
+
431
+ /**
432
+ * The fetch galaxy-ops gets, so its requests keep the redirect guard every
433
+ * other Galaxy call here has: openapi-fetch hands over a Request carrying
434
+ * `x-api-key`, and Node would forward that header across origins on a 3xx.
435
+ *
436
+ * It also carries the caller's abort signal. galaxy-ops' ops don't all pass
437
+ * the context's signal to their requests (getInvocations doesn't, as of
438
+ * 0.3.1), so without this a cancelled check would keep its request running.
439
+ * Combined with the request's own signal, which galaxy-ops uses for timeouts.
440
+ */
441
+ function galaxyOpsFetch(callerSignal?: AbortSignal): typeof fetch {
442
+ return async (input, init) => {
443
+ const req = new Request(input, init);
444
+ const body =
445
+ req.method === "GET" || req.method === "HEAD" ? undefined : await req.arrayBuffer();
446
+ const signal = callerSignal ? AbortSignal.any([req.signal, callerSignal]) : req.signal;
447
+ try {
448
+ return await galaxyFetch(req.url, { method: req.method, headers: req.headers, body, signal });
449
+ } catch (err) {
450
+ throw withTransportCode(err);
451
+ }
452
+ };
453
+ }
454
+
455
+ /**
456
+ * undici's "fetch failed" with its cause code appended, since galaxy-ops builds the model's
457
+ * message from `.message` alone. Aborts and refused redirects keep their own wording.
458
+ */
459
+ function withTransportCode(err: unknown): unknown {
460
+ if (!(err instanceof Error) || err instanceof RedirectRefusedError) return err;
461
+ if (err.name === "AbortError" || err.name === "TimeoutError") return err;
462
+ const code = transportCode(err);
463
+ if (!code || err.message.includes(code)) return err;
464
+ const Ctor = err.constructor as new (message: string, options?: ErrorOptions) => Error;
465
+ return new Ctor(`${err.message} (${code})`, { cause: err.cause ?? err });
466
+ }
467
+
468
+ /**
469
+ * How long galaxy-ops' /api/version lookup may take. At least undici's 10 s connect timeout, so
470
+ * the probe cannot call a server unreachable that every other op would still reach -- and
471
+ * get_server_info is the one op that fails outright when the probe does.
472
+ */
473
+ export const GALAXY_VERSION_PROBE_MS = 15_000;
474
+
475
+ // galaxy-ops keeps a version report per context, and there is a context per call, so without
476
+ // this every call would probe again. The whole report is kept rather than handed back as
477
+ // `serverVersion`: a supplied version has no payload, so get_server_info would lose version_minor.
478
+ let versionCache: { url: string; report: GalaxyVersionReport } | undefined;
479
+ // Bumped by a reset, so a lookup that started before it cannot store an old server's answer.
480
+ let versionEpoch = 0;
481
+
482
+ /** Forget the cached Galaxy version, as a new session or a /connect must. */
483
+ export function resetGalaxyOpsVersion(): void {
484
+ versionCache = undefined;
485
+ versionEpoch++;
486
+ }
487
+
488
+ /** A galaxy-ops context on the configured server, or null without credentials. */
489
+ export function galaxyOpsContext(signal?: AbortSignal): GalaxyContext | null {
490
+ const config = getGalaxyConfig();
491
+ if (!config) return null;
492
+ const ctx = createGalaxyContext({
493
+ baseUrl: config.url,
494
+ apiKey: config.apiKey,
495
+ signal,
496
+ fetchImpl: galaxyOpsFetch(signal),
497
+ versionProbeTimeoutMs: GALAXY_VERSION_PROBE_MS,
498
+ });
499
+ const cached = versionCache?.url === config.url ? versionCache.report : undefined;
500
+ if (cached) return { ...ctx, galaxyVersion: () => Promise.resolve(cached) };
501
+ const lookup = ctx.galaxyVersion;
502
+ if (!lookup) return ctx;
503
+ const epoch = versionEpoch;
504
+ return {
505
+ ...ctx,
506
+ galaxyVersion: async () => {
507
+ const report = await lookup();
508
+ if (report.payload && epoch === versionEpoch) versionCache = { url: config.url, report };
509
+ return report;
510
+ },
511
+ };
512
+ }
513
+
514
+ /**
515
+ * A galaxy-ops failure, as the rest of the brain has always seen one. An HTTP
516
+ * failure becomes the GalaxyApiError galaxyGet throws -- same status, same
517
+ * message, built from the same raw body -- and a request that never got a
518
+ * reply (a refused redirect, an abort, a dead network) rethrows what fetch
519
+ * threw, which galaxy-ops had wrapped.
520
+ */
521
+ function asOrbitFailure(err: unknown): unknown {
522
+ if (!(err instanceof GalaxyError)) return err;
523
+ const http = err.http;
524
+ if (http && http.status !== null) {
525
+ return new GalaxyApiError(http.status, http.bodyText, http.reason ?? "");
526
+ }
527
+ if (err instanceof GalaxyConnectionError && err.cause !== undefined) return err.cause;
528
+ return err;
529
+ }
530
+
531
+ /**
532
+ * One invocation with each step's jobs. `stepDetails` matters: without it
533
+ * Galaxy answers with every step's `jobs` list empty, so a run still going
534
+ * looks like one with nothing left to do.
535
+ */
536
+ export async function galaxyGetInvocation(
537
+ invocationId: string,
538
+ signal?: AbortSignal,
539
+ ): Promise<InvocationDetail> {
540
+ const ctx = galaxyOpsContext(signal);
541
+ if (!ctx) throw new Error("Galaxy credentials not configured (GALAXY_URL, GALAXY_API_KEY)");
542
+ let result;
543
+ try {
544
+ result = await getInvocations({ invocationId, stepDetails: true }, ctx);
545
+ } catch (err) {
546
+ throw asOrbitFailure(err);
547
+ }
548
+ if (Array.isArray(result)) {
549
+ throw new Error(`Galaxy answered a listing for invocation ${invocationId}`);
550
+ }
551
+ return result;
552
+ }
553
+
554
+ /**
555
+ * One dataset's metadata (name, extension, dbkey, state, create time), through
556
+ * galaxy-ops. No preview: enrichment wants the facts about a dataset, never
557
+ * its content.
558
+ */
559
+ export async function galaxyGetDataset(
560
+ datasetId: string,
561
+ signal?: AbortSignal,
562
+ ): Promise<Record<string, unknown>> {
563
+ const ctx = galaxyOpsContext(signal);
564
+ if (!ctx) throw new Error("Galaxy credentials not configured (GALAXY_URL, GALAXY_API_KEY)");
565
+ try {
566
+ const result = await getDatasetDetails({ datasetId, includePreview: false }, ctx);
567
+ return result.dataset;
568
+ } catch (err) {
569
+ throw asOrbitFailure(err);
570
+ }
571
+ }
572
+
573
+ /**
574
+ * A page of one history's invocations, through galaxy-ops. galaxy-ops takes
575
+ * no offset or time filter, so this is the newest `limit` and the caller
576
+ * filters by `create_time`.
577
+ */
578
+ export async function galaxyListHistoryInvocations(
579
+ historyId: string,
580
+ limit: number,
581
+ signal?: AbortSignal,
582
+ ): Promise<
583
+ { id: string; create_time?: string; state?: string; workflow_id?: string; history_id?: string }[]
584
+ > {
585
+ const ctx = galaxyOpsContext(signal);
586
+ if (!ctx) throw new Error("Galaxy credentials not configured (GALAXY_URL, GALAXY_API_KEY)");
587
+ let result;
588
+ try {
589
+ result = await getInvocations({ historyId, limit, stepDetails: false }, ctx);
590
+ } catch (err) {
591
+ throw asOrbitFailure(err);
592
+ }
593
+ if (!Array.isArray(result)) throw new Error("Galaxy answered one invocation for a listing");
594
+ return result
595
+ .filter((r) => !!r && typeof r === "object" && typeof (r as { id?: unknown }).id === "string")
596
+ .map((r) => {
597
+ const row = r as Record<string, unknown>;
598
+ return {
599
+ id: row.id as string,
600
+ ...(typeof row.create_time === "string" ? { create_time: row.create_time } : {}),
601
+ ...(typeof row.state === "string" ? { state: row.state } : {}),
602
+ ...(typeof row.workflow_id === "string" ? { workflow_id: row.workflow_id } : {}),
603
+ ...(typeof row.history_id === "string" ? { history_id: row.history_id } : {}),
604
+ };
605
+ });
606
+ }
@@ -0,0 +1,5 @@
1
+ import { artifactLinkGuidance } from "../../shared/prompt-blocks.js";
2
+
3
+ /** Brain-owned output convention, shared by every shell through context injection. */
4
+ export const GALAXY_ARTIFACT_LINK_GUIDANCE = `${artifactLinkGuidance()}
5
+ `;