@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
package/package.json CHANGED
@@ -1,9 +1,107 @@
1
1
  {
2
2
  "name": "@galaxyproject/orbit",
3
- "version": "0.0.0",
4
- "description": "Placeholder -- Orbit (formerly Loom), the AI co-scientist for Galaxy. Use @galaxyproject/loom until the first real release.",
5
- "license": "MIT",
3
+ "version": "0.9.0",
4
+ "type": "module",
5
+ "description": "AI co-scientist for Galaxy bioinformatics, built on Pi.dev",
6
+ "keywords": [
7
+ "galaxy",
8
+ "bioinformatics",
9
+ "analysis",
10
+ "co-scientist"
11
+ ],
6
12
  "author": "Galaxy Team",
7
- "repository": { "type": "git", "url": "https://github.com/galaxyproject/loom" },
8
- "files": ["README.md"]
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/galaxyproject/orbit"
17
+ },
18
+ "engines": {
19
+ "node": ">=22.19"
20
+ },
21
+ "files": [
22
+ "bin/",
23
+ "extensions/",
24
+ "lessons/",
25
+ "shared/",
26
+ "CHANGELOG.md",
27
+ "README.md",
28
+ "LICENSE"
29
+ ],
30
+ "bin": {
31
+ "orbit": "./bin/orbit.js"
32
+ },
33
+ "pi": {
34
+ "extensions": [
35
+ "./extensions/orbit"
36
+ ]
37
+ },
38
+ "dependencies": {
39
+ "@anthropic-ai/sandbox-runtime": "^0.0.78",
40
+ "@earendil-works/pi-coding-agent": "^1.4.0",
41
+ "@earendil-works/pi-tui": "^1.4.0",
42
+ "@galaxyproject/galaxy-ops": "^0.3.1",
43
+ "@sinclair/typebox": "^0.34.49",
44
+ "better-sqlite3": "^12.9.0",
45
+ "chokidar": "^5.0.0",
46
+ "marked": "^18.0.0",
47
+ "pi-web-access": "^0.35.0",
48
+ "tus-js-client": "^3.1.0",
49
+ "uuid": "^14.0.0",
50
+ "yaml": "^2.8.2"
51
+ },
52
+ "scripts": {
53
+ "format": "prettier --write .",
54
+ "format:check": "prettier --check .",
55
+ "lint": "eslint .",
56
+ "lint:fix": "eslint . --fix",
57
+ "precommit": "lint-staged",
58
+ "prepare": "husky",
59
+ "check:install": "node scripts/install-freshness.mjs",
60
+ "pretest": "npm run check:install",
61
+ "test": "vitest run",
62
+ "test:watch": "vitest",
63
+ "evals": "tsx evals/run.ts",
64
+ "typecheck": "tsc --noEmit",
65
+ "check:versions": "node scripts/check-version-lockstep.mjs",
66
+ "smoke:pack": "node scripts/smoke-pack.mjs",
67
+ "prepublishOnly": "npm run typecheck && npm test && npm run smoke:pack",
68
+ "sync:skills": "node scripts/sync-skills.mjs",
69
+ "check:skills": "node scripts/sync-skills.mjs --check",
70
+ "build:lessons": "node lessons/build-snapshot.mjs",
71
+ "check:lessons": "node lessons/build-snapshot.mjs --check",
72
+ "measure:context": "node scripts/measure-context.mjs",
73
+ "sync:foundry-skills": "node scripts/sync-skills.mjs",
74
+ "check:foundry-skills": "node scripts/sync-skills.mjs --check"
75
+ },
76
+ "lint-staged": {
77
+ "*.{json,md,css,html,yml,yaml}": "prettier --write",
78
+ "*.{js,jsx,ts,tsx}": [
79
+ "prettier --write",
80
+ "eslint --fix"
81
+ ]
82
+ },
83
+ "devDependencies": {
84
+ "@earendil-works/pi-ai": "^1.4.0",
85
+ "@eslint/js": "^10.0.1",
86
+ "@types/better-sqlite3": "^7.6.13",
87
+ "dompurify": "^3.4.1",
88
+ "eslint": "^10.2.1",
89
+ "eslint-plugin-react-hooks": "^7.1.1",
90
+ "globals": "^17.5.0",
91
+ "happy-dom": "^20.10.2",
92
+ "husky": "^9.1.7",
93
+ "lint-staged": "^16.4.0",
94
+ "prettier": "^3.8.3",
95
+ "tsx": "^4.21.0",
96
+ "typescript": "^6.0.2",
97
+ "typescript-eslint": "^8.59.1",
98
+ "vitest": "^5.0.1"
99
+ },
100
+ "allowScripts": {
101
+ "better-sqlite3": true,
102
+ "esbuild": true,
103
+ "protobufjs": true,
104
+ "fsevents": true,
105
+ "@google/genai": true
106
+ }
9
107
  }
@@ -0,0 +1,8 @@
1
+ export interface AgentPromptOptions {
2
+ streamingBehavior?: "steer" | "followUp";
3
+ }
4
+
5
+ export function agentPromptPayload(
6
+ message: string,
7
+ options?: AgentPromptOptions,
8
+ ): { type: "prompt"; message: string; streamingBehavior: "steer" | "followUp" };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * A renderer can briefly think a turn is idle after an `agent_end` from a
3
+ * failed model attempt, while Pi is already retrying. Always supply a queue
4
+ * policy: Pi ignores it when idle and queues behind an active turn otherwise.
5
+ *
6
+ * @param {string} message
7
+ * @param {{ streamingBehavior?: "steer" | "followUp" }} [options]
8
+ */
9
+ export function agentPromptPayload(message, options) {
10
+ return {
11
+ type: "prompt",
12
+ message,
13
+ streamingBehavior: options?.streamingBehavior === "steer" ? "steer" : "followUp",
14
+ };
15
+ }
@@ -0,0 +1,4 @@
1
+ export const APPROVAL_DETAIL_LIMIT: number;
2
+ export function truncateApprovalDetail(detail: string, limit?: number): string;
3
+ export function buildApprovalPrompt(heading: string, detail: string, limit?: number): string;
4
+ export function splitApprovalPrompt(title: string): { heading: string; detail: string };
@@ -0,0 +1,61 @@
1
+ // Shell-neutral formatting for the exec-guard approval prompt.
2
+ //
3
+ // pi's `ctx.ui.select` carries one title string and a list of options -- there
4
+ // is no detail/body field to thread the thing being approved through -- so the
5
+ // command (or path) rides in the title, below a blank line. The CLI selector
6
+ // wraps the whole string verbatim; Orbit splits it back apart and renders the
7
+ // detail in its scrollable modal body. A shell that knows nothing about the
8
+ // convention still shows the full text, just less prettily. #399
9
+
10
+ /** How much of the approved command a prompt shows before cutting it out. */
11
+ export const APPROVAL_DETAIL_LIMIT = 2000;
12
+
13
+ /** Characters of the cut-out region's tail to keep, so a suffix can't hide. */
14
+ const TAIL_SHARE = 0.2;
15
+
16
+ /**
17
+ * @param {string} detail
18
+ * @param {number} [limit]
19
+ * @returns {string}
20
+ */
21
+ export function truncateApprovalDetail(detail, limit = APPROVAL_DETAIL_LIMIT) {
22
+ // No trimming: what's shown has to be byte-for-byte what gets approved.
23
+ const text = String(detail ?? "");
24
+ const max = Math.max(0, limit);
25
+ if (text.length <= max) return text;
26
+ // Cut the middle, not the tail -- a head-only cut is exactly where you'd
27
+ // hide the destructive half of a long command. Never truncate silently:
28
+ // approving what you can't see is the whole bug.
29
+ const tail = Math.floor(max * TAIL_SHARE);
30
+ const head = max - tail;
31
+ const hidden = text.length - max;
32
+ const marker = `\n... (truncated -- ${hidden} of ${text.length} characters not shown) ...\n`;
33
+ return tail > 0
34
+ ? `${text.slice(0, head)}${marker}${text.slice(-tail)}`
35
+ : `${text.slice(0, head)}${marker.trimEnd()}`;
36
+ }
37
+
38
+ /**
39
+ * @param {string} heading
40
+ * @param {string} detail
41
+ * @param {number} [limit]
42
+ * @returns {string}
43
+ */
44
+ export function buildApprovalPrompt(heading, detail, limit = APPROVAL_DETAIL_LIMIT) {
45
+ const body = truncateApprovalDetail(detail, limit);
46
+ return body ? `${String(heading)}\n\n${body}` : String(heading);
47
+ }
48
+
49
+ /**
50
+ * @param {string} title
51
+ * @returns {{ heading: string, detail: string }}
52
+ */
53
+ export function splitApprovalPrompt(title) {
54
+ const text = String(title ?? "");
55
+ const sep = text.match(/\r?\n[ \t]*\r?\n/);
56
+ if (!sep || sep.index === undefined) return { heading: text, detail: "" };
57
+ return {
58
+ heading: text.slice(0, sep.index),
59
+ detail: text.slice(sep.index + sep[0].length),
60
+ };
61
+ }
@@ -0,0 +1,14 @@
1
+ export const BRAIN_ENV_PASSTHROUGH: ReadonlySet<string>;
2
+ export const BRAIN_ENV_PREFIXES: readonly string[];
3
+ export const PROVIDER_KEY_VARS: Readonly<Record<string, string>>;
4
+ export const PROVIDER_API_KEY_NAMES: ReadonlySet<string>;
5
+
6
+ export interface BuildBrainEnvOptions {
7
+ /** Forward ANTHROPIC_API_KEY / OPENAI_API_KEY / etc. from the source env. */
8
+ includeProviderKeys?: boolean;
9
+ }
10
+
11
+ export function buildBrainEnv(
12
+ sourceEnv?: NodeJS.ProcessEnv,
13
+ opts?: BuildBrainEnvOptions,
14
+ ): NodeJS.ProcessEnv;
@@ -0,0 +1,108 @@
1
+ import { mirrorToLegacyEnv } from "./orbit-env.js";
2
+
3
+ /**
4
+ * Curated allowlist for the env that gets forwarded into the brain subprocess.
5
+ * Forwarding the caller's process.env wholesale leaks unrelated secrets
6
+ * (AWS_*, GITHUB_TOKEN, GOOGLE_APPLICATION_CREDENTIALS, ...) to every MCP
7
+ * subprocess the brain spawns. The set below is the cross-shell baseline;
8
+ * each caller (Electron main, web server) layers its own additions on top.
9
+ */
10
+
11
+ export const BRAIN_ENV_PASSTHROUGH = new Set([
12
+ // Process basics
13
+ "PATH",
14
+ "HOME",
15
+ "USER",
16
+ "LOGNAME",
17
+ "SHELL",
18
+ "TMPDIR",
19
+ "TMP",
20
+ "TEMP",
21
+ "TERM",
22
+ "PWD",
23
+ // Locale
24
+ "LANG",
25
+ "LC_ALL",
26
+ "LC_CTYPE",
27
+ "LC_MESSAGES",
28
+ // Display (the brain itself rarely needs it, but tools spawned by the
29
+ // brain -- e.g. matplotlib via the bash tool -- sometimes do)
30
+ "DISPLAY",
31
+ "WAYLAND_DISPLAY",
32
+ "XDG_RUNTIME_DIR",
33
+ // Node
34
+ "NODE_OPTIONS",
35
+ "NODE_TLS_REJECT_UNAUTHORIZED",
36
+ // Conda / mamba (per-analysis env activation in tools)
37
+ "CONDA_EXE",
38
+ "CONDA_PREFIX",
39
+ "CONDA_DEFAULT_ENV",
40
+ "MAMBA_EXE",
41
+ "MAMBA_ROOT_PREFIX",
42
+ // CA bundles (corporate proxies)
43
+ "SSL_CERT_FILE",
44
+ "SSL_CERT_DIR",
45
+ "REQUESTS_CA_BUNDLE",
46
+ "NODE_EXTRA_CA_CERTS",
47
+ ]);
48
+
49
+ export const BRAIN_ENV_PREFIXES = ["LOOM_", "ORBIT_", "GALAXY_", "PI_"];
50
+
51
+ // Built-in provider -> the env var its API key lives in. Mirrors the brain's
52
+ // PROVIDER_ENV_MAP (bin/orbit.js / app/src/main/agent.ts).
53
+ //
54
+ // Don't try to derive these by uppercasing the provider name: google's key is
55
+ // GEMINI_API_KEY, not GOOGLE_API_KEY, so a name-derived guess silently fails to
56
+ // find a perfectly good key (and, worse, routes a supplied one somewhere the
57
+ // brain never reads).
58
+ export const PROVIDER_KEY_VARS = {
59
+ anthropic: "ANTHROPIC_API_KEY",
60
+ openai: "OPENAI_API_KEY",
61
+ google: "GEMINI_API_KEY",
62
+ mistral: "MISTRAL_API_KEY",
63
+ groq: "GROQ_API_KEY",
64
+ xai: "XAI_API_KEY",
65
+ deepseek: "DEEPSEEK_API_KEY",
66
+ };
67
+
68
+ // Must stay a superset of the brain's built-in provider->env-key map
69
+ // (PROVIDER_ENV_MAP in bin/orbit.js / app/src/main/agent.ts): a provider key
70
+ // that isn't listed here is dropped at this boundary, so in remote mode -- where
71
+ // creds are env-only -- the brain would fail its credential check and refuse to
72
+ // launch. brain-env.test.ts guards the superset relationship. Derived from the
73
+ // map above so the two can't drift; AI_GATEWAY_API_KEY has no provider name of
74
+ // its own (it's the brain's fallback var) so it's listed separately.
75
+ export const PROVIDER_API_KEY_NAMES = new Set([
76
+ ...Object.values(PROVIDER_KEY_VARS),
77
+ "AI_GATEWAY_API_KEY",
78
+ ]);
79
+
80
+ /**
81
+ * Build a curated brain env from a source env. Forwards the named baseline
82
+ * and any LOOM_/ORBIT_/GALAXY_/PI_-prefixed vars. Provider API keys are opt-in
83
+ * because desktop sources them from the OS keychain, not the shell.
84
+ *
85
+ * @param {NodeJS.ProcessEnv} [sourceEnv]
86
+ * @param {{ includeProviderKeys?: boolean }} [opts]
87
+ * @returns {NodeJS.ProcessEnv}
88
+ */
89
+ export function buildBrainEnv(sourceEnv = process.env, opts = {}) {
90
+ const env = {};
91
+ for (const key of BRAIN_ENV_PASSTHROUGH) {
92
+ const v = sourceEnv[key];
93
+ if (v !== undefined) env[key] = v;
94
+ }
95
+ for (const [k, v] of Object.entries(sourceEnv)) {
96
+ if (v === undefined) continue;
97
+ if (BRAIN_ENV_PREFIXES.some((p) => k.startsWith(p))) env[k] = v;
98
+ }
99
+ // pi reads a custom provider's key from LOOM_ACTIVE_LLM_API_KEY only.
100
+ mirrorToLegacyEnv(env, "ACTIVE_LLM_API_KEY");
101
+ if (opts.includeProviderKeys) {
102
+ for (const key of PROVIDER_API_KEY_NAMES) {
103
+ const v = sourceEnv[key];
104
+ if (v !== undefined) env[key] = v;
105
+ }
106
+ }
107
+ return env;
108
+ }
@@ -0,0 +1,20 @@
1
+ /** sysexits.h EX_CONFIG -- the brain's "this is a config problem, retrying won't help". */
2
+ export const EX_CONFIG: number;
3
+
4
+ export function isConfigFailure(code: number | null | undefined): boolean;
5
+
6
+ /** Cap on the rolling stderr window a shell keeps, in characters. */
7
+ export const STDERR_BUFFER_LIMIT: number;
8
+
9
+ export function appendStderr(buffer: string, text: string, limit?: number): string;
10
+
11
+ export function stderrTail(
12
+ stderr: string | null | undefined,
13
+ opts?: { maxLines?: number; maxChars?: number },
14
+ ): string;
15
+
16
+ /** A startup failure split by destination: `detail` for the chat pane, `summary` for the status pill. */
17
+ export function summarizeStartupFailure(
18
+ code: number | null | undefined,
19
+ stderr?: string,
20
+ ): { summary: string; detail: string };
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Telling a deterministic startup failure apart from a crash, and turning the
3
+ * brain's own stderr into something a shell can show.
4
+ *
5
+ * #439: every nonzero exit looked identical to Orbit, so a missing credential
6
+ * got three silent restarts and a generic "crashed repeatedly" box while the
7
+ * brain's perfectly clear explanation sat unread in a stderr buffer. Retrying a
8
+ * config problem cannot fix it -- it only buries the reason under two more
9
+ * attempts.
10
+ */
11
+
12
+ /**
13
+ * sysexits.h EX_CONFIG. The brain exits with this when it has diagnosed the
14
+ * problem and knows another attempt will reach the same conclusion: no usable
15
+ * credential, a key it can't decrypt, a provider that needs a sign-in nobody
16
+ * has done. Distinct from 1, which stays "something went wrong" and is what an
17
+ * unhandled throw or a pi-side failure still produces.
18
+ */
19
+ export const EX_CONFIG = 78;
20
+
21
+ /** Should a shell suppress its retry budget for this exit code? */
22
+ export function isConfigFailure(code) {
23
+ return code === EX_CONFIG;
24
+ }
25
+
26
+ /**
27
+ * How much of the brain's stderr a shell keeps. The buffer exists to explain a
28
+ * failure, and only the end of it does that, so it holds a window rather than
29
+ * the whole stream -- a long session logs to stderr indefinitely, and a shell
30
+ * that concatenates without a bound is just a slow leak.
31
+ */
32
+ export const STDERR_BUFFER_LIMIT = 64 * 1024;
33
+
34
+ /** Append to a rolling stderr buffer, discarding from the front past the limit. */
35
+ export function appendStderr(buffer, text, limit = STDERR_BUFFER_LIMIT) {
36
+ const next = `${buffer ?? ""}${text ?? ""}`;
37
+ return next.length <= limit ? next : next.slice(next.length - limit);
38
+ }
39
+
40
+ // Escape-anchored on purpose: matching a bare "[0m"-shaped run would eat
41
+ // ordinary bracketed prose out of an error message.
42
+ const ANSI_PATTERN = /\[[0-9;]*[A-Za-z]/g;
43
+
44
+ /**
45
+ * The tail of a stderr buffer, shaped for a chat pane.
46
+ *
47
+ * Tail rather than head because the fatal message is the last thing written
48
+ * before the process exits -- anything earlier is startup noise. Generous
49
+ * enough (40 lines) to keep the headline of the brain's longest credential
50
+ * message attached to the fix hint under it, since a hint whose first line has
51
+ * been cut off explains nothing.
52
+ */
53
+ export function stderrTail(stderr, { maxLines = 40, maxChars = 2000 } = {}) {
54
+ if (typeof stderr !== "string") return "";
55
+ const lines = stderr
56
+ .replace(ANSI_PATTERN, "")
57
+ .split("\n")
58
+ .map((line) => line.trimEnd());
59
+ // Blank lines inside the message are load-bearing (they separate the headline
60
+ // from the hint block); only the padding at either end goes.
61
+ while (lines.length && !lines[0].trim()) lines.shift();
62
+ while (lines.length && !lines[lines.length - 1].trim()) lines.pop();
63
+ if (!lines.length) return "";
64
+
65
+ let kept = lines.slice(-maxLines);
66
+ let truncated = kept.length < lines.length;
67
+ let text = kept.join("\n");
68
+ while (text.length > maxChars && kept.length > 1) {
69
+ kept = kept.slice(1);
70
+ truncated = true;
71
+ text = kept.join("\n");
72
+ }
73
+ // A single line longer than the cap still has to fit somewhere.
74
+ if (text.length > maxChars) {
75
+ text = text.slice(text.length - maxChars);
76
+ truncated = true;
77
+ }
78
+ return truncated ? `[...]\n${text}` : text;
79
+ }
80
+
81
+ /**
82
+ * Squeeze a failure down to one line for the footer status pill.
83
+ *
84
+ * The pill is width-capped and renders as a single run of text, so a multi-line
85
+ * message arrives there as an unreadable marquee -- and for an "error" status
86
+ * Orbit overrides the hover tooltip with "Click to open Preferences", so the
87
+ * long form has nowhere to hide either. The brain hard-wraps its messages for a
88
+ * terminal, so this unwraps the first paragraph rather than taking line one and
89
+ * cutting mid-sentence.
90
+ */
91
+ function badgeSummary(detail, maxChars = 160) {
92
+ const paragraph = [];
93
+ for (const line of detail.split("\n")) {
94
+ if (!line.trim()) {
95
+ if (paragraph.length) break; // end of the first paragraph
96
+ continue; // padding before it
97
+ }
98
+ paragraph.push(line.trim());
99
+ }
100
+ let text = stripCliPrefix(
101
+ paragraph
102
+ .join(" ")
103
+ .replace(/^\[\.\.\.\]\s*/, "")
104
+ .replace(/\s+/g, " ")
105
+ .trim(),
106
+ );
107
+ if (!text) return "";
108
+ return text.length > maxChars ? `${text.slice(0, maxChars).trimEnd()}...` : text;
109
+ }
110
+
111
+ /**
112
+ * Drop the brain's "orbit:" argv0 prefix ("loom:" from an older bundle) and
113
+ * re-capitalize what follows.
114
+ *
115
+ * Essential in a terminal, where it says which program is talking; noise in a
116
+ * GUI, where the message is already inside a labelled error card. Applied to
117
+ * both the pill and the chat text so one sentence doesn't appear two ways in
118
+ * the same window.
119
+ */
120
+ function stripCliPrefix(text) {
121
+ const stripped = text.replace(/^(?:orbit|loom):\s*/i, "");
122
+ if (!stripped) return "";
123
+ return stripped[0].toUpperCase() + stripped.slice(1);
124
+ }
125
+
126
+ /**
127
+ * What a shell shows when the brain fails to start, split by where it goes.
128
+ *
129
+ * `detail` is the brain's own words -- it already knows which of the four
130
+ * credential situations it hit and printed the fix for that one, so a generic
131
+ * shell message would be strictly worse. It belongs in the chat pane, which
132
+ * renders multi-line text. `summary` is the same failure at pill length.
133
+ *
134
+ * The fallbacks only cover a child that died saying nothing at all.
135
+ */
136
+ export function summarizeStartupFailure(code, stderr) {
137
+ const raw = stderrTail(stderr);
138
+ // Only the first line carries the prefix; the wrapped continuation and the
139
+ // fix hint below it are left exactly as the brain wrote them.
140
+ const [head, ...rest] = raw.split("\n");
141
+ const detail = raw ? [stripCliPrefix(head), ...rest].join("\n") : raw;
142
+ if (!detail) {
143
+ const fallback = isConfigFailure(code)
144
+ ? "The agent couldn't start: it found no usable LLM credential. Open Preferences to set one."
145
+ : `The agent exited with code ${code} without reporting a reason.`;
146
+ return { summary: fallback, detail: fallback };
147
+ }
148
+ return { summary: badgeSummary(detail) || `The agent exited with code ${code}.`, detail };
149
+ }
@@ -0,0 +1,16 @@
1
+ export interface CapabilityProfile {
2
+ shell: boolean;
3
+ files: boolean;
4
+ notebook: "file" | "page";
5
+ network: boolean;
6
+ /** pi's MCP layer, for the servers Orbit brings (brc-analytics). */
7
+ mcpServers: boolean;
8
+ ui: "desktop" | "terminal" | "worker";
9
+ }
10
+
11
+ export function profileFromEnv(env?: Record<string, string | undefined>): CapabilityProfile;
12
+ /** The installed profile when a shell set one and no env was passed, else profileFromEnv(env). */
13
+ export function capabilityProfile(env?: Record<string, string | undefined>): CapabilityProfile;
14
+ export function setCapabilityProfile(profile: CapabilityProfile | null): void;
15
+ /** The installed profile itself, or null when env is in charge. */
16
+ export function installedCapabilityProfile(): CapabilityProfile | null;
@@ -0,0 +1,75 @@
1
+ import { isDesktopShell, readEnv } from "./orbit-env.js";
2
+
3
+ /**
4
+ * What the shell running the brain can do, in one place, so the brain asks
5
+ * "is there a local shell?" rather than which env var a particular shell sets.
6
+ *
7
+ * Today only the Node shells exist, and they describe themselves through env:
8
+ * - LOCAL_EXEC=off: no local execution surface at all (the web/container
9
+ * remote shell), so no local files and the shell owns the tool_call gate.
10
+ * - LOCAL_SHELL=off: files stay, the bash shell goes (the Windows remote-only
11
+ * desktop).
12
+ * The two are read independently, as they always have been: LOCAL_EXEC=off
13
+ * does not by itself mark the shell unavailable. Both fail safe -- only the
14
+ * exact value "off" turns a surface off.
15
+ *
16
+ * The other fields have one value under every Node shell and no env var behind
17
+ * them; they are here so a shell that differs (the browser worker) has
18
+ * somewhere to say so. The browser worker has no env to set, so it installs
19
+ * its profile as an object with setCapabilityProfile instead.
20
+ *
21
+ * @typedef {object} CapabilityProfile
22
+ * @property {boolean} shell a local bash shell
23
+ * @property {boolean} files a local file surface, which exec-guard jails
24
+ * @property {"file" | "page"} notebook where the notebook lives
25
+ * @property {boolean} network direct outbound network from the brain
26
+ * @property {boolean} mcpServers pi's MCP layer, for the servers Orbit brings
27
+ * (brc-analytics)
28
+ * @property {"desktop" | "terminal" | "worker"} ui the surface a human answers prompts on
29
+ */
30
+
31
+ /**
32
+ * @param {Record<string, string | undefined>} [env]
33
+ * @returns {CapabilityProfile}
34
+ */
35
+ export function profileFromEnv(env = process.env) {
36
+ return {
37
+ shell: readEnv("LOCAL_SHELL", env) !== "off",
38
+ files: readEnv("LOCAL_EXEC", env) !== "off",
39
+ notebook: "file",
40
+ network: true,
41
+ mcpServers: true,
42
+ ui: isDesktopShell(env) ? "desktop" : "terminal",
43
+ };
44
+ }
45
+
46
+ let installed = null;
47
+
48
+ /**
49
+ * The shell's own description of itself; null puts env back in charge.
50
+ * @param {CapabilityProfile | null} profile
51
+ */
52
+ export function setCapabilityProfile(profile) {
53
+ installed = profile ? { ...profile } : null;
54
+ }
55
+
56
+ /**
57
+ * The installed profile itself (the same object capabilityProfile() returns),
58
+ * or null when env is in charge.
59
+ * @returns {CapabilityProfile | null}
60
+ */
61
+ export function installedCapabilityProfile() {
62
+ return installed;
63
+ }
64
+
65
+ /**
66
+ * The profile the brain acts on: the installed one, else env. An explicit env
67
+ * always means "read env", the way galaxyCredentials(env) does, so pure helpers
68
+ * and tests never see a shell's object.
69
+ * @param {Record<string, string | undefined>} [env]
70
+ * @returns {CapabilityProfile}
71
+ */
72
+ export function capabilityProfile(env) {
73
+ if (!env && installed) return installed;
74
+ return profileFromEnv(env);
75
+ }
@@ -0,0 +1,13 @@
1
+ import type { OrbitConfig } from "./orbit-config.js";
2
+
3
+ export interface ConfigSource {
4
+ /** The raw config object; loadConfig() clones it and applies the same migrations and defaults as the file. */
5
+ load(): Partial<OrbitConfig>;
6
+ /** Absent means the shell owns the config and nothing here may write it. */
7
+ save?(config: OrbitConfig): void;
8
+ /** Secret values the shell holds that are in neither the config nor process.env. */
9
+ secrets?(): string[];
10
+ }
11
+
12
+ export function setConfigSource(source: ConfigSource | null): void;
13
+ export function installedConfigSource(): ConfigSource | null;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Where the brain's config comes from when not from ~/.orbit/config.json: a
3
+ * shell with no home directory (the browser worker) installs a source here and
4
+ * loadConfig() reads it instead of the file. Node-free on purpose, so the
5
+ * worker can install a source without loading the file backend.
6
+ */
7
+
8
+ let installed = null;
9
+
10
+ /** @param {import("./config-source.js").ConfigSource | null} source */
11
+ export function setConfigSource(source) {
12
+ installed = source;
13
+ }
14
+
15
+ export function installedConfigSource() {
16
+ return installed;
17
+ }
@@ -0,0 +1,3 @@
1
+ export function foldConfusables(s: string): string;
2
+ export function hasConfusables(s: string): boolean;
3
+ export function findConfusablesMatch(badName: string, candidateNames: string[]): string | undefined;