@aui.io/apollo 0.1.89 → 0.1.91

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 (238) hide show
  1. package/README.md +3 -0
  2. package/node_modules/@aui.io/apollo-cli/dist/src/commands/auth.js +36 -1
  3. package/node_modules/@aui.io/apollo-cli/dist/src/commands/auth.js.map +1 -1
  4. package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.d.ts +4 -0
  5. package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js +293 -33
  6. package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js.map +1 -1
  7. package/node_modules/@aui.io/apollo-cli/dist/src/commands/confirm.d.ts +25 -0
  8. package/node_modules/@aui.io/apollo-cli/dist/src/commands/confirm.js +36 -0
  9. package/node_modules/@aui.io/apollo-cli/dist/src/commands/confirm.js.map +1 -0
  10. package/node_modules/@aui.io/apollo-cli/dist/src/commands/hierarchy.js +54 -49
  11. package/node_modules/@aui.io/apollo-cli/dist/src/commands/hierarchy.js.map +1 -1
  12. package/node_modules/@aui.io/apollo-cli/dist/src/commands/kb.js +3 -2
  13. package/node_modules/@aui.io/apollo-cli/dist/src/commands/kb.js.map +1 -1
  14. package/node_modules/@aui.io/apollo-cli/dist/src/commands/mockdb.js +7 -6
  15. package/node_modules/@aui.io/apollo-cli/dist/src/commands/mockdb.js.map +1 -1
  16. package/node_modules/@aui.io/apollo-cli/dist/src/commands/open.d.ts +3 -0
  17. package/node_modules/@aui.io/apollo-cli/dist/src/commands/open.js +33 -0
  18. package/node_modules/@aui.io/apollo-cli/dist/src/commands/open.js.map +1 -0
  19. package/node_modules/@aui.io/apollo-cli/dist/src/commands/prompts.d.ts +2 -0
  20. package/node_modules/@aui.io/apollo-cli/dist/src/commands/prompts.js +7 -0
  21. package/node_modules/@aui.io/apollo-cli/dist/src/commands/prompts.js.map +1 -1
  22. package/node_modules/@aui.io/apollo-cli/dist/src/commands/vault.js +5 -7
  23. package/node_modules/@aui.io/apollo-cli/dist/src/commands/vault.js.map +1 -1
  24. package/node_modules/@aui.io/apollo-cli/dist/src/index.js +2 -0
  25. package/node_modules/@aui.io/apollo-cli/dist/src/index.js.map +1 -1
  26. package/node_modules/@aui.io/apollo-cli/package.json +3 -3
  27. package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.d.ts +2 -0
  28. package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.js +3 -0
  29. package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.js.map +1 -1
  30. package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.d.ts +6 -1
  31. package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.js +8 -1
  32. package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.js.map +1 -1
  33. package/node_modules/@aui.io/apollo-core/dist/src/api/identity.d.ts +8 -0
  34. package/node_modules/@aui.io/apollo-core/dist/src/api/identity.js +7 -5
  35. package/node_modules/@aui.io/apollo-core/dist/src/api/identity.js.map +1 -1
  36. package/node_modules/@aui.io/apollo-core/dist/src/api/management.d.ts +18 -2
  37. package/node_modules/@aui.io/apollo-core/dist/src/api/management.js +45 -24
  38. package/node_modules/@aui.io/apollo-core/dist/src/api/management.js.map +1 -1
  39. package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.d.ts +3 -2
  40. package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.js +4 -2
  41. package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.js.map +1 -1
  42. package/node_modules/@aui.io/apollo-core/dist/src/api/timeouts.d.ts +26 -0
  43. package/node_modules/@aui.io/apollo-core/dist/src/api/timeouts.js +27 -0
  44. package/node_modules/@aui.io/apollo-core/dist/src/api/timeouts.js.map +1 -0
  45. package/node_modules/@aui.io/apollo-core/dist/src/api/transport.js +19 -9
  46. package/node_modules/@aui.io/apollo-core/dist/src/api/transport.js.map +1 -1
  47. package/node_modules/@aui.io/apollo-core/dist/src/browser.d.ts +12 -0
  48. package/node_modules/@aui.io/apollo-core/dist/src/browser.js +41 -0
  49. package/node_modules/@aui.io/apollo-core/dist/src/browser.js.map +1 -0
  50. package/node_modules/@aui.io/apollo-core/dist/src/bundle/baseline.d.ts +35 -0
  51. package/node_modules/@aui.io/apollo-core/dist/src/bundle/baseline.js +81 -2
  52. package/node_modules/@aui.io/apollo-core/dist/src/bundle/baseline.js.map +1 -1
  53. package/node_modules/@aui.io/apollo-core/dist/src/bundle/materialize.d.ts +2 -0
  54. package/node_modules/@aui.io/apollo-core/dist/src/bundle/materialize.js +2 -1
  55. package/node_modules/@aui.io/apollo-core/dist/src/bundle/materialize.js.map +1 -1
  56. package/node_modules/@aui.io/apollo-core/dist/src/bundle/patch.d.ts +25 -0
  57. package/node_modules/@aui.io/apollo-core/dist/src/bundle/patch.js +41 -0
  58. package/node_modules/@aui.io/apollo-core/dist/src/bundle/patch.js.map +1 -0
  59. package/node_modules/@aui.io/apollo-core/dist/src/config/index.js +3 -1
  60. package/node_modules/@aui.io/apollo-core/dist/src/config/index.js.map +1 -1
  61. package/node_modules/@aui.io/apollo-core/dist/src/config/types.d.ts +7 -0
  62. package/node_modules/@aui.io/apollo-core/dist/src/errors/index.d.ts +22 -0
  63. package/node_modules/@aui.io/apollo-core/dist/src/errors/index.js +39 -0
  64. package/node_modules/@aui.io/apollo-core/dist/src/errors/index.js.map +1 -1
  65. package/node_modules/@aui.io/apollo-core/dist/src/index.d.ts +3 -1
  66. package/node_modules/@aui.io/apollo-core/dist/src/index.js +3 -1
  67. package/node_modules/@aui.io/apollo-core/dist/src/index.js.map +1 -1
  68. package/node_modules/@aui.io/apollo-core/dist/src/runtime-version/index.d.ts +6 -0
  69. package/node_modules/@aui.io/apollo-core/dist/src/runtime-version/index.js +14 -0
  70. package/node_modules/@aui.io/apollo-core/dist/src/runtime-version/index.js.map +1 -1
  71. package/node_modules/@aui.io/apollo-core/dist/src/services/auth.d.ts +28 -0
  72. package/node_modules/@aui.io/apollo-core/dist/src/services/auth.js +42 -1
  73. package/node_modules/@aui.io/apollo-core/dist/src/services/auth.js.map +1 -1
  74. package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.d.ts +59 -2
  75. package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js +197 -14
  76. package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js.map +1 -1
  77. package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js +6 -0
  78. package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js.map +1 -1
  79. package/node_modules/@aui.io/apollo-core/dist/src/services/clone.js +9 -2
  80. package/node_modules/@aui.io/apollo-core/dist/src/services/clone.js.map +1 -1
  81. package/node_modules/@aui.io/apollo-core/dist/src/services/content.d.ts +111 -0
  82. package/node_modules/@aui.io/apollo-core/dist/src/services/content.js +220 -0
  83. package/node_modules/@aui.io/apollo-core/dist/src/services/content.js.map +1 -0
  84. package/node_modules/@aui.io/apollo-core/dist/src/services/hierarchy.d.ts +65 -8
  85. package/node_modules/@aui.io/apollo-core/dist/src/services/hierarchy.js +127 -11
  86. package/node_modules/@aui.io/apollo-core/dist/src/services/hierarchy.js.map +1 -1
  87. package/node_modules/@aui.io/apollo-core/dist/src/services/playground.d.ts +17 -0
  88. package/node_modules/@aui.io/apollo-core/dist/src/services/playground.js +23 -0
  89. package/node_modules/@aui.io/apollo-core/dist/src/services/playground.js.map +1 -0
  90. package/node_modules/@aui.io/apollo-core/dist/src/services/runs.d.ts +4 -0
  91. package/node_modules/@aui.io/apollo-core/dist/src/services/runs.js +4 -2
  92. package/node_modules/@aui.io/apollo-core/dist/src/services/runs.js.map +1 -1
  93. package/node_modules/@aui.io/apollo-core/dist/src/services/versions.d.ts +25 -5
  94. package/node_modules/@aui.io/apollo-core/dist/src/services/versions.js +125 -43
  95. package/node_modules/@aui.io/apollo-core/dist/src/services/versions.js.map +1 -1
  96. package/node_modules/@aui.io/apollo-core/node_modules/diff/CONTRIBUTING.md +28 -0
  97. package/node_modules/@aui.io/apollo-core/node_modules/diff/LICENSE +29 -0
  98. package/node_modules/@aui.io/apollo-core/node_modules/diff/README.md +378 -0
  99. package/node_modules/@aui.io/apollo-core/node_modules/diff/dist/diff.js +1674 -0
  100. package/node_modules/@aui.io/apollo-core/node_modules/diff/dist/diff.min.js +1 -0
  101. package/node_modules/@aui.io/apollo-core/node_modules/diff/eslint.config.mjs +182 -0
  102. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/convert/dmp.d.ts +8 -0
  103. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/convert/dmp.d.ts.map +1 -0
  104. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/convert/dmp.js +24 -0
  105. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/convert/xml.d.ts +6 -0
  106. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/convert/xml.d.ts.map +1 -0
  107. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/convert/xml.js +34 -0
  108. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/array.d.ts +19 -0
  109. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/array.d.ts.map +1 -0
  110. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/array.js +40 -0
  111. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/base.d.ts +20 -0
  112. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/base.d.ts.map +1 -0
  113. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/base.js +265 -0
  114. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/character.d.ts +19 -0
  115. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/character.d.ts.map +1 -0
  116. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/character.js +31 -0
  117. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/css.d.ts +18 -0
  118. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/css.d.ts.map +1 -0
  119. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/css.js +34 -0
  120. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/json.d.ts +24 -0
  121. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/json.d.ts.map +1 -0
  122. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/json.js +105 -0
  123. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/line.d.ts +24 -0
  124. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/line.d.ts.map +1 -0
  125. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/line.js +89 -0
  126. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/sentence.d.ts +21 -0
  127. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/sentence.d.ts.map +1 -0
  128. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/sentence.js +67 -0
  129. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/word.d.ts +35 -0
  130. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/word.d.ts.map +1 -0
  131. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/word.js +307 -0
  132. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/index.d.ts +20 -0
  133. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/index.d.ts.map +1 -0
  134. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/index.js +61 -0
  135. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/package.json +1 -0
  136. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/apply.d.ts +62 -0
  137. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/apply.d.ts.map +1 -0
  138. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/apply.js +267 -0
  139. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/create.d.ts +100 -0
  140. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/create.d.ts.map +1 -0
  141. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/create.js +223 -0
  142. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/line-endings.d.ts +17 -0
  143. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/line-endings.d.ts.map +1 -0
  144. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/line-endings.js +61 -0
  145. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/parse.d.ts +8 -0
  146. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/parse.d.ts.map +1 -0
  147. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/parse.js +133 -0
  148. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/reverse.d.ts +9 -0
  149. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/reverse.d.ts.map +1 -0
  150. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/reverse.js +37 -0
  151. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/types.d.ts +213 -0
  152. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/types.d.ts.map +1 -0
  153. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/types.js +2 -0
  154. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/array.d.ts +3 -0
  155. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/array.d.ts.map +1 -0
  156. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/array.js +21 -0
  157. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/distance-iterator.d.ts +2 -0
  158. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/distance-iterator.d.ts.map +1 -0
  159. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/distance-iterator.js +40 -0
  160. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/params.d.ts +4 -0
  161. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/params.d.ts.map +1 -0
  162. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/params.js +17 -0
  163. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/string.d.ts +18 -0
  164. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/string.d.ts.map +1 -0
  165. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/string.js +141 -0
  166. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/convert/dmp.d.ts +8 -0
  167. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/convert/dmp.d.ts.map +1 -0
  168. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/convert/dmp.js +21 -0
  169. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/convert/xml.d.ts +6 -0
  170. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/convert/xml.d.ts.map +1 -0
  171. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/convert/xml.js +31 -0
  172. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/array.d.ts +19 -0
  173. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/array.d.ts.map +1 -0
  174. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/array.js +16 -0
  175. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/base.d.ts +20 -0
  176. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/base.d.ts.map +1 -0
  177. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/base.js +253 -0
  178. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/character.d.ts +19 -0
  179. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/character.d.ts.map +1 -0
  180. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/character.js +7 -0
  181. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/css.d.ts +18 -0
  182. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/css.d.ts.map +1 -0
  183. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/css.js +10 -0
  184. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/json.d.ts +24 -0
  185. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/json.d.ts.map +1 -0
  186. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/json.js +78 -0
  187. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/line.d.ts +24 -0
  188. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/line.d.ts.map +1 -0
  189. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/line.js +65 -0
  190. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/sentence.d.ts +21 -0
  191. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/sentence.d.ts.map +1 -0
  192. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/sentence.js +43 -0
  193. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/word.d.ts +35 -0
  194. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/word.d.ts.map +1 -0
  195. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/word.js +276 -0
  196. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/index.d.ts +20 -0
  197. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/index.d.ts.map +1 -0
  198. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/index.js +30 -0
  199. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/package.json +1 -0
  200. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/apply.d.ts +62 -0
  201. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/apply.d.ts.map +1 -0
  202. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/apply.js +257 -0
  203. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/create.d.ts +100 -0
  204. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/create.d.ts.map +1 -0
  205. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/create.js +201 -0
  206. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/line-endings.d.ts +17 -0
  207. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/line-endings.d.ts.map +1 -0
  208. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/line-endings.js +44 -0
  209. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/parse.d.ts +8 -0
  210. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/parse.d.ts.map +1 -0
  211. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/parse.js +130 -0
  212. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/reverse.d.ts +9 -0
  213. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/reverse.d.ts.map +1 -0
  214. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/reverse.js +23 -0
  215. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/types.d.ts +213 -0
  216. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/types.d.ts.map +1 -0
  217. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/types.js +1 -0
  218. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/array.d.ts +3 -0
  219. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/array.d.ts.map +1 -0
  220. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/array.js +17 -0
  221. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/distance-iterator.d.ts +2 -0
  222. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/distance-iterator.d.ts.map +1 -0
  223. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/distance-iterator.js +37 -0
  224. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/params.d.ts +4 -0
  225. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/params.d.ts.map +1 -0
  226. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/params.js +14 -0
  227. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/string.d.ts +18 -0
  228. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/string.d.ts.map +1 -0
  229. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/string.js +128 -0
  230. package/node_modules/@aui.io/apollo-core/node_modules/diff/package.json +131 -0
  231. package/node_modules/@aui.io/apollo-core/node_modules/diff/release-notes.md +397 -0
  232. package/node_modules/@aui.io/apollo-core/package.json +2 -1
  233. package/node_modules/@aui.io/apollo-tui/dist/src/author/data.js +2 -2
  234. package/node_modules/@aui.io/apollo-tui/dist/src/author/data.js.map +1 -1
  235. package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js +19 -30
  236. package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js.map +1 -1
  237. package/node_modules/@aui.io/apollo-tui/package.json +2 -2
  238. package/package.json +5 -5
package/README.md CHANGED
@@ -147,6 +147,7 @@ Exit codes: `0` success · `1` runtime/API failure · `2` validation failure ·
147
147
  apollo login # browser sign-in via the Playground (default)
148
148
  apollo login --email you@example.com # email one-time code, then prompts for it
149
149
  apollo login --token "$ACCESS_TOKEN" # store a pre-issued access token
150
+ apollo whoami # who this session acts as, checked with identity
150
151
  apollo logout
151
152
  ```
152
153
 
@@ -156,6 +157,8 @@ Use profiles to keep several accounts side by side (`apollo profile use work`, o
156
157
 
157
158
  **CI and automation:** set `APOLLO_TOKEN` in the environment and run with
158
159
  `--json --no-input`; nothing prompts, and every result is a machine-readable envelope.
160
+ An `APOLLO_TOKEN` run never touches the saved login: an expired token fails with
161
+ `AUTH_ERROR` instead of refreshing into whoever is stored on disk.
159
162
 
160
163
  ## Working with coding agents
161
164
 
@@ -1,7 +1,7 @@
1
1
  import { homedir } from "node:os";
2
2
  import { environmentDefinition, readCredentials, writeCredentials, } from "@aui.io/apollo-core/config/index.js";
3
3
  import { ConfigError } from "@aui.io/apollo-core/errors/index.js";
4
- import { loginWithBrowser, loginWithOtp, loginWithToken, logout, requestOtp, } from "@aui.io/apollo-core/services/auth.js";
4
+ import { assertSavedSession, loginWithBrowser, loginWithOtp, loginWithToken, logout, requestOtp, whoami, } from "@aui.io/apollo-core/services/auth.js";
5
5
  import { createClients } from "@aui.io/apollo-core/services/clients.js";
6
6
  import { prompt } from "./prompts.js";
7
7
  export function registerAuth(program, runtime) {
@@ -53,6 +53,14 @@ export function registerAuth(program, runtime) {
53
53
  "Next: `apollo agent use` to enter a known agent, or `apollo agent import` to pull one.",
54
54
  ].join("\n"));
55
55
  });
56
+ program
57
+ .command("whoami")
58
+ .description("Show who this session acts as — checked with identity — and where its token came from")
59
+ .action(async () => {
60
+ const { context, output } = runtime();
61
+ const result = await whoami(context, createClients(context).identity);
62
+ output.result(result, () => renderWhoAmI(result));
63
+ });
56
64
  program
57
65
  .command("logout")
58
66
  .description("Remove the active Apollo session")
@@ -66,6 +74,7 @@ export function registerAuth(program, runtime) {
66
74
  });
67
75
  }
68
76
  export async function persistSwitchedToken(runtime, token, refreshToken) {
77
+ assertSavedSession(runtime.context, "an organization switch");
69
78
  const credentials = await readCredentials(homedir());
70
79
  const current = credentials[runtime.context.profile]?.[runtime.context.environment];
71
80
  credentials[runtime.context.profile] ??= {};
@@ -80,4 +89,30 @@ export async function persistSwitchedToken(runtime, token, refreshToken) {
80
89
  };
81
90
  await writeCredentials(homedir(), credentials);
82
91
  }
92
+ function renderWhoAmI(who) {
93
+ const organization = who.organization_id && who.token_organization_id && who.organization_id !== who.token_organization_id
94
+ ? `${who.organization_id} (token is scoped to ${who.token_organization_id})`
95
+ : (who.organization_id ?? "not selected");
96
+ const source = who.token_source === "env"
97
+ ? "APOLLO_TOKEN — it never refreshes; set a new one when it expires"
98
+ : who.refreshable
99
+ ? "saved login (`apollo login`), refreshes itself"
100
+ : "saved login (`apollo login`), no refresh token — log in again when it expires";
101
+ return [
102
+ `${who.email ?? "unknown email"} (user ${who.user_id ?? "unknown"})`,
103
+ `Environment: ${who.environment} (profile "${who.profile}")`,
104
+ `Organization: ${organization}`,
105
+ `Project: ${who.project_id ?? "not selected"}`,
106
+ `Token: ${source}`,
107
+ `Expires: ${who.expires_at ? expiry(who.expires_at) : "unknown"}`,
108
+ ].join("\n");
109
+ }
110
+ function expiry(at, now = Date.now()) {
111
+ const minutes = Math.round((Date.parse(at) - now) / 60_000);
112
+ if (Number.isNaN(minutes))
113
+ return at;
114
+ if (minutes <= 0)
115
+ return `${at} (expired)`;
116
+ return minutes < 120 ? `${at} (in ${minutes}m)` : `${at} (in ${Math.round(minutes / 60)}h)`;
117
+ }
83
118
  //# sourceMappingURL=auth.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIlC,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,gBAAgB,GAEjB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,MAAM,EACN,UAAU,GACX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAExE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAUtC,MAAM,UAAU,YAAY,CAC1B,OAAgB,EAChB,OAA6B;IAE7B,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,0B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C,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE;KACxE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,SAAS,MAAM,CAAC,EAAU,EAAE,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;IAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;IAC5D,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;QAAE,OAAO,EAAE,CAAC;IACrC,IAAI,OAAO,IAAI,CAAC;QAAE,OAAO,GAAG,EAAE,YAAY,CAAC;IAC3C,OAAO,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC;AAC9F,CAAC"}
@@ -12,4 +12,8 @@ export declare function renderRun(view: EvaluationView): string;
12
12
  * judge alone, and says so in the block's title. Rows settled before the
13
13
  * grades existed carry none, and the block stays away. */
14
14
  export declare function renderGrades(view: EvaluationView): string[];
15
+ /** A pulled or imported commit that still carries a secret file on the server
16
+ * (pushed before secret files stayed local): the file was not written and a
17
+ * local copy is untouched, but the values are stored with that commit. */
18
+ export declare function warnServerSecrets(run: CommandRuntime, files: string[] | undefined, tag: string): void;
15
19
  export declare function registerBundles(program: Command, runtime: () => CommandRuntime): void;
@@ -3,20 +3,25 @@ import { homedir } from "node:os";
3
3
  import path from "node:path";
4
4
  import { renderBundleAudit, renderValidation } from "@aui.io/apollo-core/bundle/validate.js";
5
5
  import { defaultCheckoutDir, listCheckouts, registerCheckout, } from "@aui.io/apollo-core/checkouts/registry.js";
6
- import { branchName, branchState, continuedName, parseVersionTag } from "@aui.io/apollo-core/api/management.js";
6
+ import { branchName, branchState, continuedName, findLiveVersion, liveCommitTag, parseVersionTag, } from "@aui.io/apollo-core/api/management.js";
7
7
  import { requireUserId } from "@aui.io/apollo-core/config/index.js";
8
8
  import { ConfigError, ValidationError } from "@aui.io/apollo-core/errors/index.js";
9
9
  import { assertRuntimeAvailable } from "@aui.io/apollo-core/runtime-version/availability.js";
10
+ import { compareRuntimeFamilies, familyOf } from "@aui.io/apollo-core/runtime-version/index.js";
10
11
  import { adviseLocalBundle } from "@aui.io/apollo-core/services/advisor.js";
11
12
  import { buildAgent } from "@aui.io/apollo-core/services/builds.js";
12
13
  import { annotateRun, awaitRun, pullRun, receiptId, resolveRunId, startEvaluation, startRegression, } from "@aui.io/apollo-core/services/runs.js";
13
14
  import { branchLog, importBundle, listVersions, localDiff, pullCheckout, pushBundle, remoteDiff, applyBundleFixes, bundleSourceRoot, validateLocalBundle, } from "@aui.io/apollo-core/services/bundles.js";
14
- import { describeMerge, diffAgainst, fetchVersion, mergeFrom, } from "@aui.io/apollo-core/services/versions.js";
15
+ import { abortMerge, describeMerge, diffAgainst, fetchVersion, mergeFrom, } from "@aui.io/apollo-core/services/versions.js";
16
+ import { commitDiff, localContentDiff, restoreFiles, showCommit, showCommitFile, } from "@aui.io/apollo-core/services/content.js";
15
17
  import { checkoutSchemasDir, installSchemas, } from "@aui.io/apollo-core/schemas/install.js";
16
18
  import { createClients } from "@aui.io/apollo-core/services/clients.js";
17
19
  import { agentRuntimeVersion, listAgents, useVersion, } from "@aui.io/apollo-core/services/hierarchy.js";
18
20
  import { installAgentsPage } from "@aui.io/apollo-core/skills/agents-page.js";
19
21
  import { installSkills, } from "@aui.io/apollo-core/skills/install.js";
22
+ import pc from "picocolors";
23
+ import { confirmConsequence } from "./confirm.js";
24
+ import { readStdin } from "./prompts.js";
20
25
  import { resolvePickerId } from "./picker.js";
21
26
  /** `branch log`'s default page, and apollo's internal page cap. */
22
27
  const COMMIT_PAGE = 20;
@@ -29,6 +34,51 @@ function renderDiff(diff) {
29
34
  ];
30
35
  return rows.length ? rows.join("\n") : "No changes.";
31
36
  }
37
+ /** A diff's paths, without its patches — what `--name-only` returns. */
38
+ function pathsOf(diff) {
39
+ return { added: diff.added, changed: diff.changed, removed: diff.removed };
40
+ }
41
+ /** The paths (A/M/D), then each patch — `git diff`'s order, colored at a terminal. */
42
+ function renderContentDiff(diff, nameOnly, color) {
43
+ const summary = renderDiff(diff);
44
+ if (nameOnly)
45
+ return summary;
46
+ const patches = Object.keys(diff.patches)
47
+ .sort()
48
+ .map((file) => colorPatch((diff.patches[file] ?? "").replace(/^=+\n/, "").replace(/\n$/, ""), color));
49
+ const byName = diff.nameOnly?.length ? [`Listed by name only: ${diff.nameOnly.join(", ")}.`] : [];
50
+ return [summary, ...(patches.length > 0 ? ["", patches.join("\n\n")] : []), ...byName].join("\n");
51
+ }
52
+ function colorPatch(patch, color) {
53
+ if (!color)
54
+ return patch;
55
+ return patch
56
+ .split("\n")
57
+ .map((line) => line.startsWith("+++") || line.startsWith("---")
58
+ ? pc.bold(line)
59
+ : line.startsWith("@@")
60
+ ? pc.cyan(line)
61
+ : line.startsWith("+")
62
+ ? pc.green(line)
63
+ : line.startsWith("-")
64
+ ? pc.red(line)
65
+ : line)
66
+ .join("\n");
67
+ }
68
+ function describeRestore(result) {
69
+ const verb = result.dryRun ? "Would restore" : "Restored";
70
+ return [
71
+ result.restored.length > 0
72
+ ? `${verb} ${result.restored.length} file(s) as ${result.source} has them:`
73
+ : `Nothing to restore — the files already match ${result.source}.`,
74
+ ...result.restored.map((file) => ` ${file}`),
75
+ ...(result.unchanged.length > 0 ? [`Already as ${result.source} has them: ${result.unchanged.join(", ")}.`] : []),
76
+ ...(result.kept.length > 0
77
+ ? [`Kept (not in ${result.source}): ${result.kept.join(", ")} — delete them yourself to discard them.`]
78
+ : []),
79
+ ...(result.backup ? [`Your versions are in ${result.backup}/.`] : []),
80
+ ].join("\n");
81
+ }
32
82
  /** The two advisory censuses that ride every green validation — one line
33
83
  * each when quiet, itemized when they have something to say. */
34
84
  function censusLines(result) {
@@ -179,10 +229,26 @@ async function runAction(run, builder, kind, root, options) {
179
229
  }
180
230
  return true;
181
231
  }
232
+ /**
233
+ * A pull that landed on a branch last pushed for a newer runtime family than
234
+ * this checkout's pin — or a stamped branch in an unpinned checkout — says so:
235
+ * the next push would move the branch backwards, and `push` refuses that (R6).
236
+ */
237
+ function runtimeDrift(tag, recorded, pinned) {
238
+ if (recorded === undefined)
239
+ return undefined;
240
+ const family = familyOf(recorded) ?? recorded;
241
+ if (pinned === undefined) {
242
+ return `${tag} was pushed for runtime ${recorded}, and this checkout has no runtime pin. Pin it before you push: \`apollo runtime use ${family}\`.`;
243
+ }
244
+ return (compareRuntimeFamilies(recorded, pinned) ?? 0) > 0
245
+ ? `${tag} was pushed for runtime ${recorded}; this checkout is pinned to ${pinned}, an older family. Move the pin before you push: \`apollo runtime use ${family}\`.`
246
+ : undefined;
247
+ }
182
248
  /** A pulled or imported commit that still carries a secret file on the server
183
249
  * (pushed before secret files stayed local): the file was not written and a
184
250
  * local copy is untouched, but the values are stored with that commit. */
185
- function warnServerSecrets(run, files, tag) {
251
+ export function warnServerSecrets(run, files, tag) {
186
252
  if (!files?.length)
187
253
  return;
188
254
  run.output.warn(`${tag} still carries ${files.join(", ")} on the server, pushed before secret files stayed local. ` +
@@ -384,7 +450,8 @@ export function registerBundles(program, runtime) {
384
450
  .option("--max-turns <n>", "most customer messages per conversation")
385
451
  .option("--seed <n>", "base seed for the world draws — same seed, same callers")
386
452
  .option("--world <pins>", "slot=value pins applied to every simulation, e.g. persona=irate,subject=vase")
387
- .option("--return <shape>", "the report structure wanted back, in your words")).action(async (first, second, options) => {
453
+ .option("--return <shape>", "the report structure wanted back, in your words")
454
+ .option("--plan-from <evaluation-id>", "replay that evaluation's banked plan against this checkout: the same simulated callers (its seed, turns and pins travel with it), no planning — pairs two runs on identical callers")).action(async (first, second, options) => {
388
455
  const run = runtime();
389
456
  const clients = createClients(run.context);
390
457
  const builder = clients.builder;
@@ -419,6 +486,7 @@ export function registerBundles(program, runtime) {
419
486
  config,
420
487
  ...(options.message ? { message: options.message } : {}),
421
488
  ...(options.versionTag ? { versionTag: options.versionTag } : {}),
489
+ ...(options.planFrom ? { planFrom: options.planFrom } : {}),
422
490
  });
423
491
  const runId = receiptId(receipt);
424
492
  if (!options.follow) {
@@ -546,34 +614,116 @@ export function registerBundles(program, runtime) {
546
614
  });
547
615
  program
548
616
  .command("diff")
549
- .description("Compare local files with the last baseline, or with another version (a tag, a name, or live)")
550
- .argument("[ref]", "a version to compare bundle/src with (fetched into bundle/tmp/versions/<tag>)")
551
- .option("--remote", "compare with the selected remote version")
552
- .action(async (ref, options) => {
617
+ .description("Show what changed, line by line: local edits against the commit the checkout started from, the checkout against a commit, or two commits")
618
+ .argument("[ref]", "a commit to compare bundle/src with (fetched into bundle/tmp/versions/<tag>)")
619
+ .argument("[other]", "a second commit: compares ref → other, nothing local involved")
620
+ .option("--remote", "compare with the bound branch's newest commit")
621
+ .option("--name-only", "list the changed paths only (A/M/D), no lines")
622
+ .addHelpText("after", "\nExamples:\n apollo diff your edits since the last pull or push\n apollo diff v3.5 v3.5 → your checkout\n apollo diff v3.4 v3.5 what v3.5 changed\n apollo diff --name-only paths only")
623
+ .action(async (ref, other, options) => {
553
624
  const run = runtime();
554
625
  const management = createClients(run.context).management;
626
+ const nameOnly = options.nameOnly === true;
627
+ const color = Boolean(process.stdout.isTTY) && !run.output.options.json;
628
+ if (ref && other) {
629
+ const result = await commitDiff(run.context, management, ref, other);
630
+ run.output.result(nameOnly ? { from: result.from, to: result.to, ...pathsOf(result) } : result, () => [`${result.from} → ${result.to}`, renderContentDiff(result, nameOnly, color)].join("\n"));
631
+ return;
632
+ }
555
633
  if (ref) {
556
634
  const result = await diffAgainst(run.context, management, ref);
557
- run.output.result(result, () => [
635
+ run.output.result(nameOnly ? { ...result, diff: pathsOf(result.diff) } : result, () => [
558
636
  `${result.fetched.tag} → bundle/src${result.fetched.relation ? ` (${result.fetched.relation}${result.fetched.base ? `; common base ${result.fetched.base}` : ""})` : ""}; their copy: bundle/tmp/versions/${result.fetched.tag}/`,
559
- renderDiff(result.diff),
637
+ renderContentDiff(result.diff, nameOnly, color),
560
638
  ].join("\n"));
561
639
  return;
562
640
  }
563
- const diff = options.remote
564
- ? await remoteDiff(run.context, management)
565
- : await localDiff(run.context);
566
- run.output.result(diff, (value) => renderDiff(value));
641
+ if (options.remote) {
642
+ const diff = await remoteDiff(run.context, management);
643
+ run.output.result(nameOnly ? pathsOf(diff) : diff, () => renderContentDiff(diff, nameOnly, color));
644
+ return;
645
+ }
646
+ if (nameOnly) {
647
+ const diff = await localDiff(run.context);
648
+ run.output.result(diff, () => renderDiff(diff));
649
+ return;
650
+ }
651
+ const diff = await localContentDiff(run.context, management);
652
+ if (diff.note)
653
+ run.output.warn(diff.note);
654
+ run.output.result(diff, () => renderContentDiff(diff, false, color));
655
+ });
656
+ program
657
+ .command("show")
658
+ .description("Show one commit: its branch and files — or, with a path, that file's text as the commit has it")
659
+ .argument("<ref>", "a commit (v3.7), a branch (v3 = its newest commit), a branch name, or live")
660
+ .argument("[file]", "a program path, as `apollo diff` prints it")
661
+ .addHelpText("after", "\nExamples:\n apollo show v3.5 its files\n apollo show v3.5 program.yaml the file, verbatim\n apollo show live program.yaml > live.yaml")
662
+ .action(async (ref, file) => {
663
+ const run = runtime();
664
+ const management = createClients(run.context).management;
665
+ if (file !== undefined) {
666
+ const shown = await showCommitFile(run.context, management, ref, file);
667
+ run.output.result(shown, () => shown.content.replace(/\n$/, ""));
668
+ return;
669
+ }
670
+ const shown = await showCommit(run.context, management, ref);
671
+ run.output.result(shown, () => [
672
+ `${shown.commit} — branch v${shown.branch.number}${shown.branch.label ? ` ("${shown.branch.label}")` : ""}, ${branchState(shown.branch.status)}; ${shown.files.length} file(s)`,
673
+ ...shown.files.map((item) => `${String(item.bytes).padStart(8)} ${item.path}`),
674
+ `\`apollo show ${shown.commit} <file>\` prints one; \`apollo diff ${shown.commit}\` compares it with your checkout.`,
675
+ ].join("\n"));
676
+ });
677
+ program
678
+ .command("restore")
679
+ .description("Put program files back the way the checkout's base commit has them — or another commit, with --source")
680
+ .argument("[files...]", "program paths, as `apollo diff` prints them")
681
+ .option("--all", "every changed or deleted program file (files the commit does not have are kept)")
682
+ .option("--source <ref>", "take the text from this commit instead of the checkout's base")
683
+ .option("--dry-run", "say what would be restored and write nothing")
684
+ .addHelpText("after", "\nExamples:\n apollo restore program.yaml discard your edits to one file\n apollo restore --all discard every program edit\n apollo restore policies/refunds.yaml --source v3.5")
685
+ .action(async (files, options) => {
686
+ const run = runtime();
687
+ if (options.all === true && files.length > 0) {
688
+ throw new ConfigError("Name files or pass --all, not both.");
689
+ }
690
+ if (options.all !== true && files.length === 0) {
691
+ throw new ConfigError("Name the files to restore, or pass --all.", "`apollo diff --name-only` lists what changed.");
692
+ }
693
+ const result = await restoreFiles(run.context, createClients(run.context).management, options.all === true ? "all" : files, {
694
+ ...(options.source ? { source: options.source } : {}),
695
+ dryRun: options.dryRun === true,
696
+ });
697
+ run.output.result(result, () => describeRestore(result));
567
698
  });
568
699
  program
569
700
  .command("merge-from")
570
701
  .description("Bring another branch's changes into bundle/src (three-way over the commit both came from); disputed regions keep your text and are listed")
571
- .argument("<ref>", "the version to bring in — a tag, a line (v2), a name, or live")
702
+ .argument("[ref]", "the version to bring in — a tag, a line (v2), a name, or live")
572
703
  .option("--only <paths...>", "bring in only these program paths (a cherry-pick)")
573
704
  .option("--dry-run", "report what would change without writing")
574
705
  .option("--resolved", "every disputed region is decided at your text: a newer commit of your own branch becomes the checkout's base")
706
+ .option("--abort", "undo the last merge: its files go back, and a base it moved moves back")
707
+ .option("--force", "with --abort: undo even files edited since the merge (those edits are lost)")
575
708
  .action(async (ref, options) => {
576
709
  const run = runtime();
710
+ if (options.abort === true) {
711
+ if (ref !== undefined || options.only || options.dryRun || options.resolved) {
712
+ throw new ConfigError("--abort takes no ref and no other option but --force.");
713
+ }
714
+ const aborted = await abortMerge(run.context, { force: options.force === true });
715
+ run.output.result(aborted, () => [
716
+ `Undid the merge of ${aborted.ref}: ${aborted.restored.length} file(s) put back, ${aborted.removed.length} it created removed.`,
717
+ ...aborted.restored.map((item) => `M ${item}`),
718
+ ...aborted.removed.map((item) => `D ${item}`),
719
+ ...(aborted.baselineRestored ? [`The checkout starts from ${aborted.baselineRestored} again.`] : []),
720
+ ].join("\n"));
721
+ return;
722
+ }
723
+ if (ref === undefined)
724
+ throw new ConfigError("Name the commit to bring in, or pass --abort.");
725
+ if (options.force === true)
726
+ throw new ConfigError("--force goes with --abort.");
577
727
  const clients = createClients(run.context);
578
728
  const merged = await mergeFrom(run.context, clients, ref, {
579
729
  ...(options.only ? { only: options.only } : {}),
@@ -602,6 +752,9 @@ export function registerBundles(program, runtime) {
602
752
  schemas: options.schemas,
603
753
  });
604
754
  warnServerSecrets(run, result.serverSecretFiles, result.pull.version_tag);
755
+ const drift = runtimeDrift(result.pull.version_tag, result.recordedRuntime, run.context.runtimeVersion);
756
+ if (drift)
757
+ run.output.warn(drift);
605
758
  run.output.result(result, () => {
606
759
  const removed = result.removed.length > 0
607
760
  ? ` Removed ${result.removed.length} local file(s) not in the remote bundle.`
@@ -638,6 +791,8 @@ export function registerBundles(program, runtime) {
638
791
  .option("-m, --message <message>", "commit message — recorded on the revision the push mints (not the version's label)")
639
792
  .option("--dry-run", "validate and show the diff without pushing")
640
793
  .option("--new-version [name]", "push these changes as a new branch cut from the commit they are based on (the way out when the branch moved)")
794
+ .option("--allow-runtime-downgrade", "push even when that moves the branch to an older runtime family, or strips its runtime stamp")
795
+ .option("--restamp", "commit the program even if unchanged, so the branch records this checkout's runtime pin (after `apollo runtime use`)")
641
796
  .action(async (options) => {
642
797
  const run = runtime();
643
798
  const clients = createClients(run.context);
@@ -647,6 +802,8 @@ export function registerBundles(program, runtime) {
647
802
  ...(options.message ? { commitMessage: options.message } : {}),
648
803
  dryRun: options.dryRun === true,
649
804
  ...(options.newVersion !== undefined ? { newVersion: options.newVersion } : {}),
805
+ ...(options.allowRuntimeDowngrade === true ? { allowRuntimeDowngrade: true } : {}),
806
+ ...(options.restamp === true ? { restamp: true } : {}),
650
807
  });
651
808
  run.output.result(result, () => {
652
809
  // One report, both lanes: program paths bare, build paths prefixed —
@@ -672,6 +829,9 @@ export function registerBundles(program, runtime) {
672
829
  // one place the CLI shows it, since `version list` lists versions
673
830
  // (label, notes) and a revision's commit message lives elsewhere.
674
831
  `Pushed ${result.push.new_version_tag}${result.runtimeVersion ? ` on runtime ${result.runtimeVersion}` : ""}${result.push.commit_message ? ` — "${result.push.commit_message}"` : ""}.`,
832
+ ...(result.recovered
833
+ ? [`The push's answer was lost on the way back; ${result.push.new_version_tag} is confirmed on the branch with exactly your files.`]
834
+ : []),
675
835
  ...(result.newBranch ? [newBranchLine(result.newBranch)] : []),
676
836
  ...(result.live
677
837
  ? [
@@ -680,6 +840,7 @@ export function registerBundles(program, runtime) {
680
840
  : []),
681
841
  ]
682
842
  : []),
843
+ ...(result.restamp ? [restampLine(result.restamp)] : []),
683
844
  ...(result.buildPush
684
845
  ? [
685
846
  `Pushed build bundle v${result.buildPush.version}` +
@@ -757,14 +918,20 @@ export function registerBundles(program, runtime) {
757
918
  // runtime the agent itself records. Pinned before anything the
758
919
  // runtime serves is fetched, so the schemas and skills below come
759
920
  // from that engine rather than the gateway default.
760
- const runtimeVersion = await agentRuntimeVersion(clients, resolvedId);
761
- const pinned = runtimeVersion
762
- ? createClients({ ...run.context, runtimeVersion })
763
- : clients;
921
+ // An explicit --runtime-version / APOLLO_RUNTIME_VERSION wins; else the
922
+ // imported branch's own record (resolved inside the import), else the
923
+ // agent's — the same order `agent create` honours (R6).
924
+ const explicit = run.context.runtimeVersionSource === "flag" || run.context.runtimeVersionSource === "env";
925
+ const fallback = explicit ? run.context.runtimeVersion : await agentRuntimeVersion(clients, resolvedId);
764
926
  const imported = await importBundle(run.context, clients, resolvedId, destination, {
765
927
  ...(options.tag ? { tag: options.tag } : {}),
766
- ...(runtimeVersion ? { runtimeVersion } : {}),
928
+ ...(fallback ? { runtimeVersion: fallback } : {}),
929
+ runtimeVersionExplicit: explicit,
767
930
  });
931
+ const runtimeVersion = imported.binding.runtime_version;
932
+ const pinned = runtimeVersion
933
+ ? createClients({ ...run.context, runtimeVersion })
934
+ : clients;
768
935
  warnServerSecrets(run, imported.serverSecretFiles, imported.pull.version_tag);
769
936
  // The public floor, filtered by the wire: the index the install
770
937
  // fetches carries only public skills, and its sweep deletes managed
@@ -906,9 +1073,32 @@ function registerVersions(program, runtime) {
906
1073
  const run = runtime();
907
1074
  const management = createClients(run.context).management;
908
1075
  const agentId = requiredAgent(run);
909
- const selected = await management.resolveVersion(agentId, ref);
1076
+ const { version: selected, tag } = await management.resolveRef(agentId, ref);
910
1077
  const result = await management.updateVersion(agentId, selected.id, { label: name });
911
- run.output.result(result, () => `Renamed ${result.version_tag} to "${result.label ?? name}".`);
1078
+ run.output.result(result, () => `Renamed ${branchName(result)} to "${result.label ?? name}".${wholeBranch(tag, selected)}`);
1079
+ });
1080
+ version
1081
+ .command("notes")
1082
+ .argument("<ref>", "a branch (v2, its name, any of its commits, or live)")
1083
+ .argument("[text]", "the notes; - reads them from stdin")
1084
+ .option("--clear", "remove the branch's notes")
1085
+ .description("Set a branch's notes — what it is for and what to know before using it")
1086
+ .action(async (ref, text, options) => {
1087
+ const run = runtime();
1088
+ if (options.clear === true && text !== undefined) {
1089
+ throw new ConfigError("--clear takes no text.", `\`apollo branch notes ${ref} --clear\` removes them.`);
1090
+ }
1091
+ // Notes from a file or a heredoc end in a newline the branch should not keep.
1092
+ const notes = options.clear === true ? "" : (text === "-" ? await readStdin() : text)?.trimEnd();
1093
+ if (notes === undefined || (notes === "" && options.clear !== true)) {
1094
+ throw new ConfigError("No notes given.", `Pass them as text, \`-\` to read them from stdin, or --clear to remove them.`);
1095
+ }
1096
+ const management = createClients(run.context).management;
1097
+ const agentId = requiredAgent(run);
1098
+ const { version: selected, tag } = await management.resolveRef(agentId, ref);
1099
+ const result = await management.updateVersion(agentId, selected.id, { notes });
1100
+ run.output.result(result, () => `${notes ? `Notes set on ${branchName(result)}` : `Cleared the notes on ${branchName(result)}`}.${wholeBranch(tag, selected)}` +
1101
+ (notes ? ` \`apollo branch get ${branchName(result)}\` shows them.` : ""));
912
1102
  });
913
1103
  version
914
1104
  .command("lock")
@@ -918,9 +1108,9 @@ function registerVersions(program, runtime) {
918
1108
  const run = runtime();
919
1109
  const management = createClients(run.context).management;
920
1110
  const agentId = requiredAgent(run);
921
- const selected = await management.resolveVersion(agentId, ref);
1111
+ const { version: selected, tag } = await management.resolveRef(agentId, ref);
922
1112
  const result = await management.lockVersion(agentId, selected.id, run.context.userId ?? "apollo-cli");
923
- run.output.result(result, () => `Locked ${result.version_tag} — no more commits land on it, and what customers get has not changed. ` +
1113
+ run.output.result(result, () => `Locked ${result.version_tag} — no more commits land on it, and what customers get has not changed.${wholeBranch(tag, selected)} ` +
924
1114
  `\`apollo branch live <ref>\` picks the commit they get; \`apollo branch unlock ${branchName(result)}\` reopens this one; ` +
925
1115
  `\`apollo branch create --from ${branchName(result)}\` continues the work in a new draft.`);
926
1116
  });
@@ -932,22 +1122,34 @@ function registerVersions(program, runtime) {
932
1122
  const run = runtime();
933
1123
  const management = createClients(run.context).management;
934
1124
  const agentId = requiredAgent(run);
935
- const selected = await management.resolveVersion(agentId, ref);
1125
+ const { version: selected, tag } = await management.resolveRef(agentId, ref);
936
1126
  const result = await management.unlockVersion(agentId, selected.id);
937
- run.output.result(result, () => `Unlocked ${result.version_tag} — commits land on it again. ` +
1127
+ run.output.result(result, () => `Unlocked ${result.version_tag} — commits land on it again.${wholeBranch(tag, selected)} ` +
938
1128
  `What customers get is unchanged: live is a commit, not a branch's status.`);
939
1129
  });
940
1130
  version
941
1131
  .command("live")
942
1132
  .argument("<ref>")
1133
+ .option("--dry-run", "say what would change for customers, and change nothing")
943
1134
  .description("Make one COMMIT live — the exact bundle customers get (also how you roll back)")
944
- .action(async (ref) => {
1135
+ .action(async (ref, options) => {
945
1136
  const run = runtime();
946
1137
  const management = createClients(run.context).management;
947
1138
  const agentId = requiredAgent(run);
948
1139
  // A ref like `v3.7` names a COMMIT; `v3` or a label names the branch,
949
1140
  // and its newest commit goes live. `resolveRef` keeps the difference.
950
1141
  const { version: selected, tag } = await management.resolveRef(agentId, ref);
1142
+ const now = await customersGet(management, agentId);
1143
+ if (now.commit === tag) {
1144
+ run.output.result({ live: tag, changed: false }, () => `${tag} is already live for "${now.name}" — nothing to do.`);
1145
+ return;
1146
+ }
1147
+ const move = `customers of "${now.name}" (${run.context.environment}) move from ${now.commit ?? "nothing live"} to ${tag}`;
1148
+ if (options.dryRun === true) {
1149
+ run.output.result({ dry_run: true, from: now.commit ?? null, to: tag }, () => `Dry run: ${move}. Nothing changed.`);
1150
+ return;
1151
+ }
1152
+ await confirmConsequence(program, run.output, { summary: `Make ${tag} live: ${move}`, typed: tag });
951
1153
  const live = await management.activateSave(agentId, selected.id, tag);
952
1154
  run.output.result(live, () => {
953
1155
  const got = live.active_version_tag ?? tag;
@@ -988,11 +1190,23 @@ function registerVersions(program, runtime) {
988
1190
  .option("--notes <notes>")
989
1191
  .action(async (options) => {
990
1192
  const run = runtime();
991
- const management = createClients(run.context).management;
1193
+ const clients = createClients(run.context);
1194
+ const management = clients.management;
992
1195
  const agentId = requiredAgent(run);
993
1196
  const from = options.from ? await management.resolveRef(agentId, options.from) : undefined;
1197
+ // An empty or template branch is seeded by the registry, and the seed
1198
+ // follows the runtime it is told: say nothing and a runtime v2 agent
1199
+ // gets a runtime v1 skeleton (R15). The checkout's pin wins, else the
1200
+ // agent's own runtime; a cut from a commit keeps that commit's.
1201
+ const runtimeVersion = from
1202
+ ? undefined
1203
+ : (run.context.runtimeVersion ?? (await agentRuntimeVersion(clients, agentId)));
1204
+ if (!from && runtimeVersion === undefined) {
1205
+ throw new ConfigError("Cannot tell which engine the new branch should target.", "Pass --runtime-version <build> (see `apollo runtime list`).");
1206
+ }
994
1207
  const created = await management.createVersion(agentId, {
995
1208
  source: from ? "version" : options.template ? "template" : "empty",
1209
+ ...(runtimeVersion === undefined ? {} : { runtimeVersion }),
996
1210
  createdBy: requireUserId(run.context, "branch"),
997
1211
  ...(from ? { fromVersion: from.version.id, fromVersionTag: from.tag } : {}),
998
1212
  ...(options.template ? { fromTemplate: options.template } : {}),
@@ -1009,12 +1223,25 @@ function registerVersions(program, runtime) {
1009
1223
  version
1010
1224
  .command("publish")
1011
1225
  .argument("<tag>")
1226
+ .option("--dry-run", "say what would change for customers, and change nothing")
1012
1227
  .description("The old one-verb ladder: lock the branch AND ship its newest commit. Prefer `branch live`")
1013
- .action(async (tag) => {
1228
+ .action(async (tag, options) => {
1014
1229
  const run = runtime();
1015
1230
  const management = createClients(run.context).management;
1016
1231
  const agentId = requiredAgent(run);
1017
- const selected = await management.resolveVersion(agentId, tag);
1232
+ const { version: selected, tag: commit } = await management.resolveRef(agentId, tag);
1233
+ // publish ships the branch's NEWEST commit. Naming an older one used to
1234
+ // ship the newest anyway, with no word (R12).
1235
+ if (commit !== selected.version_tag) {
1236
+ throw new ConfigError(`publish ships ${selected.version_tag}, the newest commit of ${branchName(selected)} — not ${commit}.`, `To ship ${commit}, run \`apollo branch live ${commit}\`: it ships that exact commit and locks nothing.`);
1237
+ }
1238
+ const now = await customersGet(management, agentId);
1239
+ const move = `lock ${branchName(selected)}; customers of "${now.name}" (${run.context.environment}) move from ${now.commit ?? "nothing live"} to ${selected.version_tag}`;
1240
+ if (options.dryRun === true) {
1241
+ run.output.result({ dry_run: true, from: now.commit ?? null, to: selected.version_tag }, () => `Dry run: ${move}. Nothing changed.`);
1242
+ return;
1243
+ }
1244
+ await confirmConsequence(program, run.output, { summary: `Publish ${branchName(selected)}: ${move}`, typed: selected.version_tag });
1018
1245
  const result = await management.publishVersion(agentId, selected.id);
1019
1246
  run.output.result(result, () => `Published ${result.version_tag} — locked the branch and shipped its newest commit. ` +
1020
1247
  `\`apollo branch live <ref>\` ships a commit without locking anything, and can ship an older one.`);
@@ -1022,20 +1249,53 @@ function registerVersions(program, runtime) {
1022
1249
  version
1023
1250
  .command("archive")
1024
1251
  .argument("<tag>")
1025
- .action(async (tag) => {
1252
+ .option("--force", "archive it even when customers are on it")
1253
+ .description("Retire a branch — it takes no more commits and leaves the list")
1254
+ .action(async (tag, options) => {
1026
1255
  const run = runtime();
1027
1256
  const management = createClients(run.context).management;
1028
1257
  const agentId = requiredAgent(run);
1029
- const selected = await management.resolveVersion(agentId, tag);
1258
+ const [{ version: selected, tag: commit }, agent] = await Promise.all([
1259
+ management.resolveRef(agentId, tag),
1260
+ management.getAgent(agentId),
1261
+ ]);
1262
+ if (findLiveVersion(agent, [selected]) && options.force !== true) {
1263
+ throw new ConfigError(`${branchName(selected)} serves what customers get (${liveCommitTag(agent, selected)}) — archiving it would retire the live branch.`, "Make another commit live first (`apollo branch live <ref>`), or pass --force to archive it anyway.");
1264
+ }
1265
+ await confirmConsequence(program, run.output, {
1266
+ summary: `Archive ${branchName(selected)}${selected.label ? ` ("${selected.label}")` : ""} of "${agent.name}" (${run.context.environment})`,
1267
+ ...(options.force === true ? { force: true } : {}),
1268
+ });
1030
1269
  const result = await management.archiveVersion(agentId, selected.id);
1031
- run.output.result(result, () => `Archived ${result.version_tag}.`);
1270
+ run.output.result(result, () => `Archived ${branchName(result)}.${wholeBranch(commit, selected)}`);
1032
1271
  });
1033
1272
  }
1273
+ /** What customers get right now, and the agent's name — for a confirmation that says both. */
1274
+ async function customersGet(management, agentId) {
1275
+ const [agent, all] = await Promise.all([management.getAgent(agentId), management.listVersions(agentId)]);
1276
+ const live = findLiveVersion(agent, all.results);
1277
+ return { name: agent.name, commit: live ? liveCommitTag(agent, live) : undefined };
1278
+ }
1279
+ /** A note when an older commit named a branch-wide action: the whole branch is what changed. */
1280
+ function wholeBranch(ref, branch) {
1281
+ return ref !== branch.version_tag && parseVersionTag(ref)?.revision !== undefined
1282
+ ? ` (${ref} is one of its commits — this acts on branch ${branchName(branch)}, all of its commits.)`
1283
+ : "";
1284
+ }
1034
1285
  function requiredAgent(run) {
1035
1286
  if (!run.context.agentId)
1036
1287
  throw new ConfigError("Select or import an agent first.");
1037
1288
  return run.context.agentId;
1038
1289
  }
1290
+ /** What `push --restamp` did with an unchanged program; unpushed and still different is a dry run. */
1291
+ function restampLine(restamp) {
1292
+ const was = restamp.from ?? "no runtime";
1293
+ if (restamp.pushed)
1294
+ return `Re-stamped: the branch now records runtime ${restamp.to} (was ${was}); the program did not change.`;
1295
+ if (restamp.from === restamp.to)
1296
+ return `The branch already records runtime ${restamp.to} — nothing to re-stamp.`;
1297
+ return `Dry run: --restamp would commit the unchanged program so the branch records runtime ${restamp.to} (now ${was}).`;
1298
+ }
1039
1299
  /** What a push that started a branch says: which branch, cut from where, and why. */
1040
1300
  function newBranchLine(started) {
1041
1301
  const why = started.closed