@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,26 @@
1
+ import type { OrbitConfig } from "./orbit-config.js";
2
+
3
+ export interface GalaxyCredentials {
4
+ url: string;
5
+ apiKey: string;
6
+ source: "env" | "profile";
7
+ }
8
+
9
+ export interface ResolveGalaxyCredentialsInput {
10
+ config: Pick<OrbitConfig, "galaxy"> | null | undefined;
11
+ /**
12
+ * The active profile's key as the caller can read it. Omit to use the
13
+ * profile's plaintext `apiKey`; pass null when the caller knows it has none.
14
+ */
15
+ profileApiKey?: string | null;
16
+ env: NodeJS.ProcessEnv | Record<string, string | undefined> | undefined;
17
+ prefer: "env" | "profile";
18
+ }
19
+
20
+ export function resolveGalaxyCredentials(
21
+ input: ResolveGalaxyCredentialsInput,
22
+ ): GalaxyCredentials | null;
23
+
24
+ export function describeMissingGalaxyCredentials(
25
+ input: Pick<ResolveGalaxyCredentialsInput, "config" | "env">,
26
+ ): string | null;
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Which Galaxy server and API key a brain session uses.
3
+ *
4
+ * The URL and the key always come from the same place. Resolving them
5
+ * separately once paired an exported GALAXY_API_KEY with the saved profile's
6
+ * URL -- a key for one server sent to another -- whenever the profile's own key
7
+ * was encrypted and so unreadable by the CLI.
8
+ *
9
+ * Two sources:
10
+ * - env: GALAXY_URL and GALAXY_API_KEY, both set.
11
+ * - profile: the active config profile's URL plus a key for it. The CLI can
12
+ * only use a plaintext `apiKey`; the desktop passes the key it decrypted.
13
+ *
14
+ * `prefer` picks the winner when both are usable. The CLI prefers env, so
15
+ * `GALAXY_URL=... GALAXY_API_KEY=... orbit` reaches any server without editing
16
+ * config. The desktop prefers the profile picked in its UI, then hands the
17
+ * brain the result as an env pair, which the brain's CLI layer takes as is.
18
+ *
19
+ * The URL comes back normalized (shared/galaxy-url.js), so a pasted `/api` root
20
+ * or a bare host from either source reaches every client in one spelling.
21
+ */
22
+
23
+ import { normalizeGalaxyUrl } from "./galaxy-url.js";
24
+
25
+ /**
26
+ * @param {import("./galaxy-credentials.js").ResolveGalaxyCredentialsInput} input
27
+ * @returns {import("./galaxy-credentials.js").GalaxyCredentials | null}
28
+ */
29
+ export function resolveGalaxyCredentials({ config, profileApiKey, env, prefer }) {
30
+ const envUrl = normalizeGalaxyUrl(env?.GALAXY_URL ?? "");
31
+ const envKey = env?.GALAXY_API_KEY?.trim();
32
+ const fromEnv = envUrl && envKey ? { url: envUrl, apiKey: envKey, source: "env" } : null;
33
+
34
+ const active = config?.galaxy?.active;
35
+ const profile = active ? config?.galaxy?.profiles?.[active] : undefined;
36
+ const key = profileApiKey === undefined ? profile?.apiKey : profileApiKey;
37
+ const profileUrl = normalizeGalaxyUrl(profile?.url ?? "");
38
+ const fromProfile =
39
+ profileUrl && key ? { url: profileUrl, apiKey: key, source: "profile" } : null;
40
+
41
+ return prefer === "profile" ? (fromProfile ?? fromEnv) : (fromEnv ?? fromProfile);
42
+ }
43
+
44
+ /**
45
+ * Why an exported env pair wasn't used, or why nothing resolved, when the
46
+ * cause is something the user should hear about -- a half-set env pair, or a
47
+ * profile whose key only Orbit desktop can read. Null when there's nothing to
48
+ * say, including when nothing Galaxy-related is configured at all.
49
+ *
50
+ * @param {Pick<import("./galaxy-credentials.js").ResolveGalaxyCredentialsInput, "config" | "env">} input
51
+ * @returns {string | null}
52
+ */
53
+ export function describeMissingGalaxyCredentials({ config, env }) {
54
+ const envUrl = env?.GALAXY_URL?.trim();
55
+ const envKey = env?.GALAXY_API_KEY?.trim();
56
+ if (envKey && !envUrl) {
57
+ return "GALAXY_API_KEY is set without GALAXY_URL, so it was ignored. Set both to choose a server.";
58
+ }
59
+ if (envUrl && !envKey) {
60
+ return "GALAXY_URL is set without GALAXY_API_KEY, so it was ignored. Set both to choose a server.";
61
+ }
62
+ const active = config?.galaxy?.active;
63
+ const profile = active ? config?.galaxy?.profiles?.[active] : undefined;
64
+ if (profile?.url && !profile.apiKey && profile.apiKeyEncrypted) {
65
+ return (
66
+ `The active Galaxy profile "${active}" (${profile.url}) has a key only Orbit desktop can ` +
67
+ "decrypt. Export GALAXY_URL and GALAXY_API_KEY, or run /connect."
68
+ );
69
+ }
70
+ return null;
71
+ }
@@ -0,0 +1,21 @@
1
+ export type GalaxyDestructiveKind =
2
+ | "history-delete"
3
+ | "history-purge"
4
+ | "dataset-delete"
5
+ | "dataset-purge"
6
+ | "collection-delete"
7
+ | "collection-purge";
8
+ export interface GalaxyDestructiveOp {
9
+ kind: GalaxyDestructiveKind;
10
+ historyId?: string;
11
+ datasetId?: string;
12
+ collectionId?: string;
13
+ irreversible: boolean;
14
+ }
15
+ export const GALAXY_ARGS_CLASSIFIED_OPS: readonly string[];
16
+ export function classifyGalaxyDestructive(
17
+ toolName: string,
18
+ input: Record<string, unknown>,
19
+ ): GalaxyDestructiveOp | null;
20
+ export function describeGalaxyDestructive(op: GalaxyDestructiveOp): { headline: string };
21
+ export function isGalaxyDestructiveCurl(command: string): GalaxyDestructiveOp | null;
@@ -0,0 +1,269 @@
1
+ // Shared, shell-neutral classifier for destructive Galaxy operations. Used by BOTH
2
+ // tool_call gates -- the brain's exec-guard (Orbit/CLI) and the web-mode-gate (remote) --
3
+ // so "what counts as destructive" has a single home instead of a denylist duplicated per
4
+ // shell. Closes the #338 gap: a destructive Galaxy mutation (whole-history delete/purge)
5
+ // must be confirmed (or, where no confirm UI exists, blocked) regardless of model tier.
6
+ //
7
+ // Two confidence levels here:
8
+ // - RELIABLE: structured JSON we can read exactly -- a direct tool call, the same op
9
+ // through any MCP server a user configures themselves, or one wrapped in a generic
10
+ // `mcp({tool, args})` proxy (args is a JSON string) -- Orbit ships neither, but
11
+ // pi-mcp-adapter installed as a pi package brings the proxy back.
12
+ // - BEST-EFFORT GUARDRAIL: free-form strings we can only pattern-match -- a raw curl/wget
13
+ // DELETE, or code-mode's run_galaxy_tool(code=<python>) script. Trivially evadable
14
+ // (obfuscation, a different client, method override); the goal is to catch the obvious
15
+ // reach-for-the-nearest-tool case, not to be a security boundary.
16
+ //
17
+ // The op catalog is deliberately tiny and data-driven so it can later defer to galaxy-ops
18
+ // `destructiveHint` metadata (galaxy-mcp PR #61) instead of being hand-maintained here.
19
+
20
+ /**
21
+ * @typedef {"history-delete" | "history-purge" | "dataset-delete" | "dataset-purge" | "collection-delete" | "collection-purge"} GalaxyDestructiveKind
22
+ * @typedef {{ kind: GalaxyDestructiveKind, historyId?: string, datasetId?: string, collectionId?: string, irreversible: boolean }} GalaxyDestructiveOp
23
+ */
24
+
25
+ // Op-name -> predicate over its input args, returning the destructive shape or null.
26
+ // NOTE: galaxy-ops' `update_history` exposes only `deleted` (a soft, recoverable delete) --
27
+ // there is no `purged` param there, so a tool-path history delete is always presented as
28
+ // recoverable. `purged` is still checked defensively (a future tool
29
+ // version or a direct API caller could supply it); irreversible purge in practice comes via
30
+ // the raw curl/code paths below, which carry the purge flag in the query or request body.
31
+ const DESTRUCTIVE_OPS = {
32
+ /** @param {Record<string, unknown>} args */
33
+ update_history(args) {
34
+ if (args.purged === true) return { kind: "history-purge", irreversible: true };
35
+ if (args.deleted === true) return { kind: "history-delete", irreversible: false };
36
+ return null;
37
+ },
38
+ };
39
+
40
+ /** The ops whose arguments decide whether a call is destructive. A gate reading galaxy-ops'
41
+ * `destructiveHint` leaves these to the classifier: the hint marks the op, not the call, and
42
+ * would ask about a rename as if it were a delete.
43
+ * @type {readonly string[]} */
44
+ export const GALAXY_ARGS_CLASSIFIED_OPS = Object.freeze(Object.keys(DESTRUCTIVE_OPS));
45
+
46
+ /** Lowercase + drop a leading `mcp__<server>__` and `galaxy_` so the bare op name, Orbit's
47
+ * `galaxy_` spelling and the same op behind an MCP server a user added themselves (and either
48
+ * gate's casing) resolve the same. Any server counts: a non-Galaxy op that lands on a
49
+ * destructive name costs an extra confirm, never a missed one. The strip is greedy because a
50
+ * server name may itself contain `__` (`galaxy__prod`) while op names never do.
51
+ * @param {unknown} toolName @returns {string} */
52
+ function normalize(toolName) {
53
+ return String(toolName == null ? "" : toolName)
54
+ .trim()
55
+ .toLowerCase()
56
+ .replace(/^mcp__[a-z0-9_-]+__/, "")
57
+ .replace(/^galaxy_/, "");
58
+ }
59
+
60
+ /** @param {unknown} v @returns {Record<string, unknown>} */
61
+ function asObject(v) {
62
+ return v && typeof v === "object" ? /** @type {Record<string, unknown>} */ (v) : {};
63
+ }
64
+
65
+ /** The adapter's generic proxy passes args as a JSON string; tolerate objects and junk.
66
+ * @param {unknown} v @returns {Record<string, unknown>} */
67
+ function parseArgs(v) {
68
+ if (v && typeof v === "object") return /** @type {Record<string, unknown>} */ (v);
69
+ if (typeof v !== "string") return {};
70
+ try {
71
+ const parsed = JSON.parse(v);
72
+ return parsed && typeof parsed === "object" ? parsed : {};
73
+ } catch {
74
+ return {};
75
+ }
76
+ }
77
+
78
+ /** @param {string} opName @param {Record<string, unknown>} args @returns {GalaxyDestructiveOp | null} */
79
+ function classifyOp(opName, args) {
80
+ const predicate = DESTRUCTIVE_OPS[opName];
81
+ if (!predicate) return null;
82
+ const hit = predicate(args);
83
+ if (!hit) return null;
84
+ /** @type {GalaxyDestructiveOp} */
85
+ const op = { kind: hit.kind, irreversible: hit.irreversible };
86
+ if (typeof args.history_id === "string") op.historyId = args.history_id;
87
+ return op;
88
+ }
89
+
90
+ /** Dispatch a resolved (name, args) pair: the code-mode meta-tool routes to the script
91
+ * guardrail, everything else to the structured op table.
92
+ * @param {string} name @param {Record<string, unknown>} args @returns {GalaxyDestructiveOp | null} */
93
+ function classifyNamed(name, args) {
94
+ if (name === "run_galaxy_tool") return classifyCode(args.code);
95
+ return classifyOp(name, args);
96
+ }
97
+
98
+ /**
99
+ * Classify a Galaxy tool call. Handles three shapes:
100
+ * - direct: update_history({ deleted, history_id })
101
+ * - mcp proxy: mcp({ tool: "galaxy_update_history", args: "<json string>" }) --
102
+ * pi-mcp-adapter's gateway tool, a bypass if left unhandled (#338 F1)
103
+ * - code mode: run_galaxy_tool({ code: "<python calling call_tool(...)>" }) (#338 F2)
104
+ * @param {string} toolName @param {Record<string, unknown>} input @returns {GalaxyDestructiveOp | null}
105
+ */
106
+ export function classifyGalaxyDestructive(toolName, input) {
107
+ const name = normalize(toolName);
108
+ const inputObj = asObject(input);
109
+ if (name === "mcp") {
110
+ return classifyNamed(normalize(inputObj.tool), parseArgs(inputObj.args));
111
+ }
112
+ return classifyNamed(name, inputObj);
113
+ }
114
+
115
+ /**
116
+ * Honest, user-facing description for a confirmation prompt. Purge wording states it cannot
117
+ * be undone; delete wording flags the whole-history scope and that it's usually recoverable
118
+ * -- so the user is not misled either way (a soft delete is not a purge).
119
+ * @param {GalaxyDestructiveOp} op @returns {{ headline: string }}
120
+ */
121
+ export function describeGalaxyDestructive(op) {
122
+ if (op.kind === "collection-delete" || op.kind === "collection-purge") {
123
+ const target = op.collectionId ? `collection ${op.collectionId}` : "this collection";
124
+ if (op.irreversible) {
125
+ return {
126
+ headline: `Permanently PURGE ${target} -- this deletes all of its datasets and cannot be undone.`,
127
+ };
128
+ }
129
+ return {
130
+ headline:
131
+ `Mark ${target} (and all of its datasets) as deleted. ` +
132
+ `Recoverable via Undelete on most Galaxy servers.`,
133
+ };
134
+ }
135
+ const dataset = op.kind === "dataset-delete" || op.kind === "dataset-purge";
136
+ if (dataset) {
137
+ const target = op.datasetId ? `dataset ${op.datasetId}` : "this dataset";
138
+ if (op.irreversible) {
139
+ return { headline: `Permanently PURGE ${target} -- this cannot be undone.` };
140
+ }
141
+ return {
142
+ headline: `Mark ${target} as deleted. Recoverable via Undelete on most Galaxy servers.`,
143
+ };
144
+ }
145
+ if (op.irreversible) {
146
+ const target = op.historyId ? `history ${op.historyId}` : "the entire history";
147
+ return {
148
+ headline: `Permanently PURGE ${target} -- this deletes all of its datasets and cannot be undone.`,
149
+ };
150
+ }
151
+ const id = op.historyId ? ` (${op.historyId})` : "";
152
+ return {
153
+ headline:
154
+ `Mark the entire history${id} as deleted -- not just specific datasets. ` +
155
+ `Recoverable via Undelete on most Galaxy servers, but it affects the whole history.`,
156
+ };
157
+ }
158
+
159
+ // Whether a `purge`/`purged` flag is set to a non-falsy value -- in a URL query
160
+ // (?purge=true|1|yes|on), a JSON/body/kwarg field ("purge": true / 'purged': True / purge=1),
161
+ // or carried in a request-body file we can't read (-d @file). Galaxy treats true/1/yes/on as
162
+ // truthy; only an explicit false/0/no/off (or no purge token at all) is a recoverable soft
163
+ // delete. An UNKNOWABLE value (shell variable, file body) is treated as a purge -- the safe,
164
+ // honest direction: over-warn rather than mislabel an irreversible purge as recoverable.
165
+ /** @param {string} s @returns {boolean} */
166
+ function hasPurge(s) {
167
+ const falsy = /^(false|0|no|off)$/i;
168
+ const q = s.match(/[?&]purged?=([^&\s"']*)/i);
169
+ if (q) return !falsy.test(q[1]);
170
+ const b = s.match(/["']?purged?["']?\s*[:=]\s*["']?([\w$.{}]+)/i);
171
+ if (b) return !falsy.test(b[1]);
172
+ // A DELETE whose body comes from a file we can't inspect could carry {"purge": true}.
173
+ if (/(?:-d|--data(?:-raw|-binary|-urlencode)?|--json)[=\s]+@/i.test(s)) return true;
174
+ return false;
175
+ }
176
+
177
+ // A clean literal id only -- never surface a shell variable / interpolation as the "id".
178
+ /** @param {string | undefined} raw @returns {string | undefined} */
179
+ function literalId(raw) {
180
+ return raw && /^[A-Za-z0-9]+$/.test(raw) ? raw : undefined;
181
+ }
182
+
183
+ /**
184
+ * BEST-EFFORT guardrail for the raw-bash path: an HTTP DELETE issued by curl/wget against a
185
+ * Galaxy history, a dataset, or a dataset collection. Targets are checked most-severe first
186
+ * so a less-severe URL in the same command can't conceal a worse one (a whole-history delete
187
+ * wins over a dataset URL). Covers the history (`/api/histories/{id}`), contents
188
+ * (`/contents[/datasets|/dataset_collections]/{id}`), and singleton/batch dataset
189
+ * (`/api/datasets[/{id}]`) routes. Reversibility is read from a purge flag (query, body, or
190
+ * an unreadable body file). Requires an actual curl/wget verb so a stray URL in `echo`/text
191
+ * doesn't trip it; ids are surfaced only when literal (a `$VAR` is matched but not echoed as
192
+ * a fake id).
193
+ * @param {string} command @returns {GalaxyDestructiveOp | null}
194
+ */
195
+ export function isGalaxyDestructiveCurl(command) {
196
+ const cmd = String(command == null ? "" : command);
197
+ if (!/\b(?:curl|wget)\b/i.test(cmd)) return null;
198
+ const isDelete =
199
+ /(?:-X|--request)[=\s]+["']?DELETE\b/i.test(cmd) ||
200
+ /-X["']?DELETE\b/i.test(cmd) ||
201
+ /--method[=\s]+["']?DELETE\b/i.test(cmd);
202
+ if (!isDelete) return null;
203
+ const irreversible = hasPurge(cmd);
204
+
205
+ // Whole-history delete wins (most severe): a bare /api/histories/{id} -- one NOT followed
206
+ // by a sub-resource path. The lookahead requires a query/space/quote/end after the id, so
207
+ // the history prefix of a /contents/... URL does not match here.
208
+ const wholeHistory = cmd.match(/\/api\/histories\/([^/\s"'?]+)(?=[?\s"']|$)/);
209
+ if (wholeHistory) {
210
+ /** @type {GalaxyDestructiveOp} */
211
+ const op = { kind: irreversible ? "history-purge" : "history-delete", irreversible };
212
+ const id = literalId(wholeHistory[1]);
213
+ if (id) op.historyId = id;
214
+ return op;
215
+ }
216
+
217
+ // A dataset COLLECTION (a recursive container -- understating it would be dishonest):
218
+ // /api/histories/{hid}/contents/dataset_collections/{cid}.
219
+ const coll = cmd.match(
220
+ /\/api\/histories\/[^/\s"'?]+\/contents\/dataset_collections\/([^/\s"'?]+)/,
221
+ );
222
+ if (coll) {
223
+ /** @type {GalaxyDestructiveOp} */
224
+ const op = { kind: irreversible ? "collection-purge" : "collection-delete", irreversible };
225
+ const id = literalId(coll[1]);
226
+ if (id) op.collectionId = id;
227
+ return op;
228
+ }
229
+
230
+ // A single dataset: in-history contents (legacy /contents/{id} or typed
231
+ // /contents/datasets/{id}) or the top-level singleton/batch /api/datasets[/{id}] routes.
232
+ const inHistory = cmd.match(
233
+ /\/api\/histories\/[^/\s"'?]+\/contents\/(?:datasets\/)?([^/\s"'?]+)/,
234
+ );
235
+ const singleton = inHistory ? null : cmd.match(/\/api\/datasets\/([^/\s"'?]+)/);
236
+ const batch = inHistory || singleton ? false : /\/api\/datasets(?=[?\s"']|$)/.test(cmd);
237
+ if (inHistory || singleton || batch) {
238
+ /** @type {GalaxyDestructiveOp} */
239
+ const op = { kind: irreversible ? "dataset-purge" : "dataset-delete", irreversible };
240
+ const id = literalId(inHistory ? inHistory[1] : singleton ? singleton[1] : undefined);
241
+ if (id) op.datasetId = id;
242
+ return op;
243
+ }
244
+
245
+ return null;
246
+ }
247
+
248
+ /**
249
+ * BEST-EFFORT guardrail for code mode: run_galaxy_tool(code=<python>) where the only callable
250
+ * is call_tool(name, params). Flags a script that calls update_history with deleted/purge
251
+ * true. Coarse by nature (arbitrary Python); over-detection just yields an extra confirm.
252
+ * @param {unknown} code @returns {GalaxyDestructiveOp | null}
253
+ */
254
+ function classifyCode(code) {
255
+ const s = String(code == null ? "" : code);
256
+ // Tolerate the tool name appearing as a positional or kwarg, with or without a
257
+ // prefix: call_tool('update_history', ...) / call_tool(name="galaxy_update_history", ...).
258
+ if (!/call_tool\([^)]*["'](?:galaxy_|mcp__\w+?__)?update_history["']/.test(s)) return null;
259
+ const purge = hasPurge(s);
260
+ if (!purge && !/["']?deleted["']?\s*[:=]\s*["']?true\b/i.test(s)) return null;
261
+ /** @type {GalaxyDestructiveOp} */
262
+ const op = {
263
+ kind: purge ? "history-purge" : "history-delete",
264
+ irreversible: purge,
265
+ };
266
+ const idm = s.match(/["']?history_id["']?\s*[:=]\s*["']([A-Za-z0-9]+)["']/);
267
+ if (idm) op.historyId = idm[1];
268
+ return op;
269
+ }
@@ -0,0 +1,2 @@
1
+ export function findingAWorkflow(options?: { tool?: (name: string) => string }): string;
2
+ export function invokingWorkflow(options?: { tool?: (name: string) => string }): string;
@@ -0,0 +1,53 @@
1
+ // Galaxy workflow guidance both shells put in the system prompt. The text is the browser's, byte for
2
+ // byte; `tool` maps a Galaxy tool name to what the shell offers it as (both shells offer the bare
3
+ // name today).
4
+
5
+ /** @param {string} name */
6
+ const bare = (name) => name;
7
+
8
+ /** @param {{ tool?: (name: string) => string }} [options] @returns {string} */
9
+ export function findingAWorkflow({ tool = bare } = {}) {
10
+ return `### Finding a community workflow (IWC)
11
+
12
+ When the user describes an analysis they want run on their data -- even as
13
+ a question ("which genes changed between my samples?") rather than a
14
+ request for a plan -- check the IWC registry before assembling tools by hand:
15
+
16
+ 1. \`${tool("recommend_iwc_workflows")}({ intent, limit: 5 })\` with their goal in
17
+ plain words. It ranks by word overlap and always returns something, so a
18
+ ranked hit is a candidate, not a match.
19
+ 2. \`${tool("get_iwc_workflow_details")}({ trs_id })\` on the plausible ones, for
20
+ the **inputs**. Compare them with the data the user actually has (reads vs
21
+ count tables, paired vs single-end, collection vs dataset). The right
22
+ analysis with the wrong starting point is not a match -- though it may be
23
+ the second half of one, after a workflow that produces its inputs.
24
+ 3. Offer the one or two that fit, in plain language: what each does and what
25
+ it needs from them. If none fit, say so and draft step-by-step.
26
+ 4. Once they choose: \`${tool("import_workflow_from_iwc")}({ trs_id })\`, then invoke
27
+ it as below.
28
+
29
+ \`${tool("search_iwc_workflows")}\` is plain keyword search for when the user
30
+ names a workflow or tool; it has no limit, so prefer recommend for a goal.`;
31
+ }
32
+
33
+ /** @param {{ tool?: (name: string) => string }} [options] @returns {string} */
34
+ export function invokingWorkflow({ tool = bare } = {}) {
35
+ return `### Invoking a Galaxy workflow
36
+
37
+ Call \`${tool("get_workflow_input_template")}\` before \`${tool("invoke_workflow")}\`. Take the
38
+ \`inputs_template\` map out of what it returns -- that field, not the whole wrapper --
39
+ keep its keys, replace every placeholder (\`<value>\`, \`<dataset_id>\`,
40
+ \`<collection_id>\`) with a real value, and pass that map as \`inputs\`:
41
+
42
+ - Data **and** non-data slots both belong in \`inputs\`, keyed by step index: a
43
+ collection slot takes \`{"src":"hdca","id":"<collection_id>"}\`, an
44
+ integer/text/genome slot takes the bare scalar (\`5\`, \`"hg38"\`). Slots the template
45
+ marks \`optional\` may be left out.
46
+ - Pass \`inputs_by="step_index|step_uuid"\` verbatim -- the pipe-separated form is one
47
+ valid value, not a choice between two.
48
+ - **Don't route workflow inputs through \`params\`.** It is the legacy per-step
49
+ tool-override map, typed \`dict[str, dict]\`, so a scalar value fails with
50
+ \`Input should be a valid dictionary in ('body','parameters',<key>)\`. Re-keying by
51
+ label, index, or uuid won't fix that -- the key was never the problem. Put the
52
+ value in \`inputs\`.`;
53
+ }
@@ -0,0 +1,92 @@
1
+ export const GALAXY_LIVE_SCHEMA_VERSION: 1;
2
+ export const GALAXY_LIVE_MAX_ITEMS: number;
3
+ export const GALAXY_LIVE_MAX_NAME: number;
4
+ export const GALAXY_LIVE_MAX_TOKEN: number;
5
+
6
+ export type GalaxyLiveState =
7
+ | "new"
8
+ | "upload"
9
+ | "queued"
10
+ | "running"
11
+ | "ok"
12
+ | "empty"
13
+ | "error"
14
+ | "paused"
15
+ | "setting_metadata"
16
+ | "failed_metadata"
17
+ | "deferred"
18
+ | "discarded"
19
+ | "other";
20
+
21
+ export const GALAXY_LIVE_STATES: readonly GalaxyLiveState[];
22
+ export const GALAXY_LIVE_ACTIVE_STATES: readonly GalaxyLiveState[];
23
+
24
+ export type GalaxyLiveUnavailable =
25
+ | "not-configured"
26
+ | "no-history"
27
+ | "unreachable"
28
+ /** 401 -- Galaxy rejected the key itself. */
29
+ | "unauthorized"
30
+ /** 403 -- the key is valid but this history is not the user's. */
31
+ | "forbidden";
32
+ export const GALAXY_LIVE_UNAVAILABLE: readonly GalaxyLiveUnavailable[];
33
+
34
+ export interface GalaxyLiveItem {
35
+ /** Galaxy encoded id. Opaque to the renderer; used only as a DOM key. */
36
+ id: string;
37
+ hid: number;
38
+ name: string;
39
+ state: GalaxyLiveState;
40
+ extension: string;
41
+ kind: "dataset" | "collection";
42
+ /** Present for collections only. */
43
+ elementCount?: number;
44
+ }
45
+
46
+ export interface GalaxyLiveHistory {
47
+ id: string;
48
+ name: string;
49
+ /** Galaxy's own update_time, used for change detection and staleness. */
50
+ updateTime: string;
51
+ /**
52
+ * state -> count over exactly the rows in `items`, never a server-side
53
+ * histogram. Galaxy's `contents_states` scores a collection by the
54
+ * collection's own state while the row beneath it is scored by the worst job
55
+ * inside it, which put "10 failed" above a list of 19 red rows on a real
56
+ * history. Counting the rows keeps the header and the list honest.
57
+ */
58
+ counts: Partial<Record<GalaxyLiveState, number>>;
59
+ /** False when `items` is a page of a longer history, so `counts` is a page count. */
60
+ countsComplete: boolean;
61
+ /** Newest-first, capped at GALAXY_LIVE_MAX_ITEMS. */
62
+ items: GalaxyLiveItem[];
63
+ /** How many further items exist beyond `items`. */
64
+ truncated: number;
65
+ /** False when `truncated` is a lower bound rather than the real figure. */
66
+ truncatedExact: boolean;
67
+ }
68
+
69
+ export interface GalaxyLivePayload {
70
+ version: 1;
71
+ /** Host only. Never the full URL, never credentials. */
72
+ serverHost: string | null;
73
+ history: GalaxyLiveHistory | null;
74
+ unavailable?: GalaxyLiveUnavailable;
75
+ /**
76
+ * When this payload was produced (ISO). On a successful read that is when
77
+ * the brain last heard from Galaxy, which is what the panel's "checked N ago"
78
+ * line reports -- a number nobody has refreshed and a number that has not
79
+ * changed look identical otherwise.
80
+ */
81
+ updatedAt: string;
82
+ }
83
+
84
+ export function normalizeState(s: unknown): GalaxyLiveState;
85
+ export function isActiveState(s: GalaxyLiveState): boolean;
86
+ export function clampText(v: unknown, max?: number): string;
87
+ /**
88
+ * Coerce a decoded payload into something drawable, or null. Never throws.
89
+ * The brain ships independently of the shell, so a payload this build does not
90
+ * recognise is a thing that happens rather than a thing that cannot.
91
+ */
92
+ export function normalizeGalaxyLivePayload(raw: unknown): GalaxyLivePayload | null;