@aui.io/apollo 0.1.87 → 0.1.90

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 (236) 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 +290 -32
  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.js +8 -1
  31. package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.js.map +1 -1
  32. package/node_modules/@aui.io/apollo-core/dist/src/api/identity.d.ts +8 -0
  33. package/node_modules/@aui.io/apollo-core/dist/src/api/identity.js +7 -5
  34. package/node_modules/@aui.io/apollo-core/dist/src/api/identity.js.map +1 -1
  35. package/node_modules/@aui.io/apollo-core/dist/src/api/management.d.ts +18 -2
  36. package/node_modules/@aui.io/apollo-core/dist/src/api/management.js +45 -24
  37. package/node_modules/@aui.io/apollo-core/dist/src/api/management.js.map +1 -1
  38. package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.d.ts +3 -2
  39. package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.js +4 -2
  40. package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.js.map +1 -1
  41. package/node_modules/@aui.io/apollo-core/dist/src/api/timeouts.d.ts +26 -0
  42. package/node_modules/@aui.io/apollo-core/dist/src/api/timeouts.js +27 -0
  43. package/node_modules/@aui.io/apollo-core/dist/src/api/timeouts.js.map +1 -0
  44. package/node_modules/@aui.io/apollo-core/dist/src/api/transport.js +19 -9
  45. package/node_modules/@aui.io/apollo-core/dist/src/api/transport.js.map +1 -1
  46. package/node_modules/@aui.io/apollo-core/dist/src/browser.d.ts +12 -0
  47. package/node_modules/@aui.io/apollo-core/dist/src/browser.js +41 -0
  48. package/node_modules/@aui.io/apollo-core/dist/src/browser.js.map +1 -0
  49. package/node_modules/@aui.io/apollo-core/dist/src/bundle/baseline.d.ts +35 -0
  50. package/node_modules/@aui.io/apollo-core/dist/src/bundle/baseline.js +81 -2
  51. package/node_modules/@aui.io/apollo-core/dist/src/bundle/baseline.js.map +1 -1
  52. package/node_modules/@aui.io/apollo-core/dist/src/bundle/materialize.d.ts +2 -0
  53. package/node_modules/@aui.io/apollo-core/dist/src/bundle/materialize.js +2 -1
  54. package/node_modules/@aui.io/apollo-core/dist/src/bundle/materialize.js.map +1 -1
  55. package/node_modules/@aui.io/apollo-core/dist/src/bundle/patch.d.ts +25 -0
  56. package/node_modules/@aui.io/apollo-core/dist/src/bundle/patch.js +41 -0
  57. package/node_modules/@aui.io/apollo-core/dist/src/bundle/patch.js.map +1 -0
  58. package/node_modules/@aui.io/apollo-core/dist/src/config/index.js +3 -1
  59. package/node_modules/@aui.io/apollo-core/dist/src/config/index.js.map +1 -1
  60. package/node_modules/@aui.io/apollo-core/dist/src/config/types.d.ts +7 -0
  61. package/node_modules/@aui.io/apollo-core/dist/src/errors/index.d.ts +22 -0
  62. package/node_modules/@aui.io/apollo-core/dist/src/errors/index.js +39 -0
  63. package/node_modules/@aui.io/apollo-core/dist/src/errors/index.js.map +1 -1
  64. package/node_modules/@aui.io/apollo-core/dist/src/index.d.ts +3 -1
  65. package/node_modules/@aui.io/apollo-core/dist/src/index.js +3 -1
  66. package/node_modules/@aui.io/apollo-core/dist/src/index.js.map +1 -1
  67. package/node_modules/@aui.io/apollo-core/dist/src/runtime-version/index.d.ts +6 -0
  68. package/node_modules/@aui.io/apollo-core/dist/src/runtime-version/index.js +17 -1
  69. package/node_modules/@aui.io/apollo-core/dist/src/runtime-version/index.js.map +1 -1
  70. package/node_modules/@aui.io/apollo-core/dist/src/services/auth.d.ts +28 -0
  71. package/node_modules/@aui.io/apollo-core/dist/src/services/auth.js +42 -1
  72. package/node_modules/@aui.io/apollo-core/dist/src/services/auth.js.map +1 -1
  73. package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.d.ts +59 -2
  74. package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js +197 -14
  75. package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js.map +1 -1
  76. package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js +6 -0
  77. package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js.map +1 -1
  78. package/node_modules/@aui.io/apollo-core/dist/src/services/clone.js +9 -2
  79. package/node_modules/@aui.io/apollo-core/dist/src/services/clone.js.map +1 -1
  80. package/node_modules/@aui.io/apollo-core/dist/src/services/content.d.ts +111 -0
  81. package/node_modules/@aui.io/apollo-core/dist/src/services/content.js +220 -0
  82. package/node_modules/@aui.io/apollo-core/dist/src/services/content.js.map +1 -0
  83. package/node_modules/@aui.io/apollo-core/dist/src/services/doctor.js +9 -6
  84. package/node_modules/@aui.io/apollo-core/dist/src/services/doctor.js.map +1 -1
  85. package/node_modules/@aui.io/apollo-core/dist/src/services/hierarchy.d.ts +65 -8
  86. package/node_modules/@aui.io/apollo-core/dist/src/services/hierarchy.js +127 -11
  87. package/node_modules/@aui.io/apollo-core/dist/src/services/hierarchy.js.map +1 -1
  88. package/node_modules/@aui.io/apollo-core/dist/src/services/playground.d.ts +17 -0
  89. package/node_modules/@aui.io/apollo-core/dist/src/services/playground.js +23 -0
  90. package/node_modules/@aui.io/apollo-core/dist/src/services/playground.js.map +1 -0
  91. package/node_modules/@aui.io/apollo-core/dist/src/services/versions.d.ts +25 -5
  92. package/node_modules/@aui.io/apollo-core/dist/src/services/versions.js +125 -43
  93. package/node_modules/@aui.io/apollo-core/dist/src/services/versions.js.map +1 -1
  94. package/node_modules/@aui.io/apollo-core/node_modules/diff/CONTRIBUTING.md +28 -0
  95. package/node_modules/@aui.io/apollo-core/node_modules/diff/LICENSE +29 -0
  96. package/node_modules/@aui.io/apollo-core/node_modules/diff/README.md +378 -0
  97. package/node_modules/@aui.io/apollo-core/node_modules/diff/dist/diff.js +1674 -0
  98. package/node_modules/@aui.io/apollo-core/node_modules/diff/dist/diff.min.js +1 -0
  99. package/node_modules/@aui.io/apollo-core/node_modules/diff/eslint.config.mjs +182 -0
  100. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/convert/dmp.d.ts +8 -0
  101. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/convert/dmp.d.ts.map +1 -0
  102. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/convert/dmp.js +24 -0
  103. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/convert/xml.d.ts +6 -0
  104. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/convert/xml.d.ts.map +1 -0
  105. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/convert/xml.js +34 -0
  106. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/array.d.ts +19 -0
  107. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/array.d.ts.map +1 -0
  108. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/array.js +40 -0
  109. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/base.d.ts +20 -0
  110. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/base.d.ts.map +1 -0
  111. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/base.js +265 -0
  112. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/character.d.ts +19 -0
  113. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/character.d.ts.map +1 -0
  114. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/character.js +31 -0
  115. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/css.d.ts +18 -0
  116. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/css.d.ts.map +1 -0
  117. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/css.js +34 -0
  118. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/json.d.ts +24 -0
  119. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/json.d.ts.map +1 -0
  120. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/json.js +105 -0
  121. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/line.d.ts +24 -0
  122. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/line.d.ts.map +1 -0
  123. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/line.js +89 -0
  124. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/sentence.d.ts +21 -0
  125. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/sentence.d.ts.map +1 -0
  126. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/sentence.js +67 -0
  127. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/word.d.ts +35 -0
  128. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/word.d.ts.map +1 -0
  129. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/diff/word.js +307 -0
  130. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/index.d.ts +20 -0
  131. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/index.d.ts.map +1 -0
  132. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/index.js +61 -0
  133. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/package.json +1 -0
  134. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/apply.d.ts +62 -0
  135. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/apply.d.ts.map +1 -0
  136. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/apply.js +267 -0
  137. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/create.d.ts +100 -0
  138. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/create.d.ts.map +1 -0
  139. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/create.js +223 -0
  140. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/line-endings.d.ts +17 -0
  141. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/line-endings.d.ts.map +1 -0
  142. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/line-endings.js +61 -0
  143. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/parse.d.ts +8 -0
  144. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/parse.d.ts.map +1 -0
  145. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/parse.js +133 -0
  146. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/reverse.d.ts +9 -0
  147. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/reverse.d.ts.map +1 -0
  148. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/patch/reverse.js +37 -0
  149. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/types.d.ts +213 -0
  150. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/types.d.ts.map +1 -0
  151. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/types.js +2 -0
  152. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/array.d.ts +3 -0
  153. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/array.d.ts.map +1 -0
  154. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/array.js +21 -0
  155. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/distance-iterator.d.ts +2 -0
  156. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/distance-iterator.d.ts.map +1 -0
  157. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/distance-iterator.js +40 -0
  158. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/params.d.ts +4 -0
  159. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/params.d.ts.map +1 -0
  160. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/params.js +17 -0
  161. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/string.d.ts +18 -0
  162. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/string.d.ts.map +1 -0
  163. package/node_modules/@aui.io/apollo-core/node_modules/diff/libcjs/util/string.js +141 -0
  164. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/convert/dmp.d.ts +8 -0
  165. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/convert/dmp.d.ts.map +1 -0
  166. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/convert/dmp.js +21 -0
  167. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/convert/xml.d.ts +6 -0
  168. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/convert/xml.d.ts.map +1 -0
  169. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/convert/xml.js +31 -0
  170. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/array.d.ts +19 -0
  171. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/array.d.ts.map +1 -0
  172. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/array.js +16 -0
  173. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/base.d.ts +20 -0
  174. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/base.d.ts.map +1 -0
  175. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/base.js +253 -0
  176. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/character.d.ts +19 -0
  177. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/character.d.ts.map +1 -0
  178. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/character.js +7 -0
  179. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/css.d.ts +18 -0
  180. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/css.d.ts.map +1 -0
  181. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/css.js +10 -0
  182. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/json.d.ts +24 -0
  183. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/json.d.ts.map +1 -0
  184. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/json.js +78 -0
  185. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/line.d.ts +24 -0
  186. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/line.d.ts.map +1 -0
  187. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/line.js +65 -0
  188. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/sentence.d.ts +21 -0
  189. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/sentence.d.ts.map +1 -0
  190. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/sentence.js +43 -0
  191. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/word.d.ts +35 -0
  192. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/word.d.ts.map +1 -0
  193. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/diff/word.js +276 -0
  194. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/index.d.ts +20 -0
  195. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/index.d.ts.map +1 -0
  196. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/index.js +30 -0
  197. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/package.json +1 -0
  198. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/apply.d.ts +62 -0
  199. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/apply.d.ts.map +1 -0
  200. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/apply.js +257 -0
  201. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/create.d.ts +100 -0
  202. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/create.d.ts.map +1 -0
  203. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/create.js +201 -0
  204. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/line-endings.d.ts +17 -0
  205. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/line-endings.d.ts.map +1 -0
  206. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/line-endings.js +44 -0
  207. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/parse.d.ts +8 -0
  208. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/parse.d.ts.map +1 -0
  209. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/parse.js +130 -0
  210. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/reverse.d.ts +9 -0
  211. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/reverse.d.ts.map +1 -0
  212. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/patch/reverse.js +23 -0
  213. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/types.d.ts +213 -0
  214. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/types.d.ts.map +1 -0
  215. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/types.js +1 -0
  216. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/array.d.ts +3 -0
  217. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/array.d.ts.map +1 -0
  218. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/array.js +17 -0
  219. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/distance-iterator.d.ts +2 -0
  220. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/distance-iterator.d.ts.map +1 -0
  221. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/distance-iterator.js +37 -0
  222. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/params.d.ts +4 -0
  223. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/params.d.ts.map +1 -0
  224. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/params.js +14 -0
  225. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/string.d.ts +18 -0
  226. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/string.d.ts.map +1 -0
  227. package/node_modules/@aui.io/apollo-core/node_modules/diff/libesm/util/string.js +128 -0
  228. package/node_modules/@aui.io/apollo-core/node_modules/diff/package.json +131 -0
  229. package/node_modules/@aui.io/apollo-core/node_modules/diff/release-notes.md +397 -0
  230. package/node_modules/@aui.io/apollo-core/package.json +2 -1
  231. package/node_modules/@aui.io/apollo-tui/dist/src/author/data.js +2 -2
  232. package/node_modules/@aui.io/apollo-tui/dist/src/author/data.js.map +1 -1
  233. package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js +19 -30
  234. package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js.map +1 -1
  235. package/node_modules/@aui.io/apollo-tui/package.json +2 -2
  236. 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,0BAA0B,CAAC;SACvC,MAAM,CAAC,eAAe,EAAE,gCAAgC,CAAC;SACzD,MAAM,CAAC,iBAAiB,EAAE,mBAAmB,CAA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AC,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. ` +
@@ -546,34 +612,116 @@ export function registerBundles(program, runtime) {
546
612
  });
547
613
  program
548
614
  .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) => {
615
+ .description("Show what changed, line by line: local edits against the commit the checkout started from, the checkout against a commit, or two commits")
616
+ .argument("[ref]", "a commit to compare bundle/src with (fetched into bundle/tmp/versions/<tag>)")
617
+ .argument("[other]", "a second commit: compares ref → other, nothing local involved")
618
+ .option("--remote", "compare with the bound branch's newest commit")
619
+ .option("--name-only", "list the changed paths only (A/M/D), no lines")
620
+ .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")
621
+ .action(async (ref, other, options) => {
553
622
  const run = runtime();
554
623
  const management = createClients(run.context).management;
624
+ const nameOnly = options.nameOnly === true;
625
+ const color = Boolean(process.stdout.isTTY) && !run.output.options.json;
626
+ if (ref && other) {
627
+ const result = await commitDiff(run.context, management, ref, other);
628
+ run.output.result(nameOnly ? { from: result.from, to: result.to, ...pathsOf(result) } : result, () => [`${result.from} → ${result.to}`, renderContentDiff(result, nameOnly, color)].join("\n"));
629
+ return;
630
+ }
555
631
  if (ref) {
556
632
  const result = await diffAgainst(run.context, management, ref);
557
- run.output.result(result, () => [
633
+ run.output.result(nameOnly ? { ...result, diff: pathsOf(result.diff) } : result, () => [
558
634
  `${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),
635
+ renderContentDiff(result.diff, nameOnly, color),
560
636
  ].join("\n"));
561
637
  return;
562
638
  }
563
- const diff = options.remote
564
- ? await remoteDiff(run.context, management)
565
- : await localDiff(run.context);
566
- run.output.result(diff, (value) => renderDiff(value));
639
+ if (options.remote) {
640
+ const diff = await remoteDiff(run.context, management);
641
+ run.output.result(nameOnly ? pathsOf(diff) : diff, () => renderContentDiff(diff, nameOnly, color));
642
+ return;
643
+ }
644
+ if (nameOnly) {
645
+ const diff = await localDiff(run.context);
646
+ run.output.result(diff, () => renderDiff(diff));
647
+ return;
648
+ }
649
+ const diff = await localContentDiff(run.context, management);
650
+ if (diff.note)
651
+ run.output.warn(diff.note);
652
+ run.output.result(diff, () => renderContentDiff(diff, false, color));
653
+ });
654
+ program
655
+ .command("show")
656
+ .description("Show one commit: its branch and files — or, with a path, that file's text as the commit has it")
657
+ .argument("<ref>", "a commit (v3.7), a branch (v3 = its newest commit), a branch name, or live")
658
+ .argument("[file]", "a program path, as `apollo diff` prints it")
659
+ .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")
660
+ .action(async (ref, file) => {
661
+ const run = runtime();
662
+ const management = createClients(run.context).management;
663
+ if (file !== undefined) {
664
+ const shown = await showCommitFile(run.context, management, ref, file);
665
+ run.output.result(shown, () => shown.content.replace(/\n$/, ""));
666
+ return;
667
+ }
668
+ const shown = await showCommit(run.context, management, ref);
669
+ run.output.result(shown, () => [
670
+ `${shown.commit} — branch v${shown.branch.number}${shown.branch.label ? ` ("${shown.branch.label}")` : ""}, ${branchState(shown.branch.status)}; ${shown.files.length} file(s)`,
671
+ ...shown.files.map((item) => `${String(item.bytes).padStart(8)} ${item.path}`),
672
+ `\`apollo show ${shown.commit} <file>\` prints one; \`apollo diff ${shown.commit}\` compares it with your checkout.`,
673
+ ].join("\n"));
674
+ });
675
+ program
676
+ .command("restore")
677
+ .description("Put program files back the way the checkout's base commit has them — or another commit, with --source")
678
+ .argument("[files...]", "program paths, as `apollo diff` prints them")
679
+ .option("--all", "every changed or deleted program file (files the commit does not have are kept)")
680
+ .option("--source <ref>", "take the text from this commit instead of the checkout's base")
681
+ .option("--dry-run", "say what would be restored and write nothing")
682
+ .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")
683
+ .action(async (files, options) => {
684
+ const run = runtime();
685
+ if (options.all === true && files.length > 0) {
686
+ throw new ConfigError("Name files or pass --all, not both.");
687
+ }
688
+ if (options.all !== true && files.length === 0) {
689
+ throw new ConfigError("Name the files to restore, or pass --all.", "`apollo diff --name-only` lists what changed.");
690
+ }
691
+ const result = await restoreFiles(run.context, createClients(run.context).management, options.all === true ? "all" : files, {
692
+ ...(options.source ? { source: options.source } : {}),
693
+ dryRun: options.dryRun === true,
694
+ });
695
+ run.output.result(result, () => describeRestore(result));
567
696
  });
568
697
  program
569
698
  .command("merge-from")
570
699
  .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")
700
+ .argument("[ref]", "the version to bring in — a tag, a line (v2), a name, or live")
572
701
  .option("--only <paths...>", "bring in only these program paths (a cherry-pick)")
573
702
  .option("--dry-run", "report what would change without writing")
574
703
  .option("--resolved", "every disputed region is decided at your text: a newer commit of your own branch becomes the checkout's base")
704
+ .option("--abort", "undo the last merge: its files go back, and a base it moved moves back")
705
+ .option("--force", "with --abort: undo even files edited since the merge (those edits are lost)")
575
706
  .action(async (ref, options) => {
576
707
  const run = runtime();
708
+ if (options.abort === true) {
709
+ if (ref !== undefined || options.only || options.dryRun || options.resolved) {
710
+ throw new ConfigError("--abort takes no ref and no other option but --force.");
711
+ }
712
+ const aborted = await abortMerge(run.context, { force: options.force === true });
713
+ run.output.result(aborted, () => [
714
+ `Undid the merge of ${aborted.ref}: ${aborted.restored.length} file(s) put back, ${aborted.removed.length} it created removed.`,
715
+ ...aborted.restored.map((item) => `M ${item}`),
716
+ ...aborted.removed.map((item) => `D ${item}`),
717
+ ...(aborted.baselineRestored ? [`The checkout starts from ${aborted.baselineRestored} again.`] : []),
718
+ ].join("\n"));
719
+ return;
720
+ }
721
+ if (ref === undefined)
722
+ throw new ConfigError("Name the commit to bring in, or pass --abort.");
723
+ if (options.force === true)
724
+ throw new ConfigError("--force goes with --abort.");
577
725
  const clients = createClients(run.context);
578
726
  const merged = await mergeFrom(run.context, clients, ref, {
579
727
  ...(options.only ? { only: options.only } : {}),
@@ -602,6 +750,9 @@ export function registerBundles(program, runtime) {
602
750
  schemas: options.schemas,
603
751
  });
604
752
  warnServerSecrets(run, result.serverSecretFiles, result.pull.version_tag);
753
+ const drift = runtimeDrift(result.pull.version_tag, result.recordedRuntime, run.context.runtimeVersion);
754
+ if (drift)
755
+ run.output.warn(drift);
605
756
  run.output.result(result, () => {
606
757
  const removed = result.removed.length > 0
607
758
  ? ` Removed ${result.removed.length} local file(s) not in the remote bundle.`
@@ -638,6 +789,8 @@ export function registerBundles(program, runtime) {
638
789
  .option("-m, --message <message>", "commit message — recorded on the revision the push mints (not the version's label)")
639
790
  .option("--dry-run", "validate and show the diff without pushing")
640
791
  .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)")
792
+ .option("--allow-runtime-downgrade", "push even when that moves the branch to an older runtime family, or strips its runtime stamp")
793
+ .option("--restamp", "commit the program even if unchanged, so the branch records this checkout's runtime pin (after `apollo runtime use`)")
641
794
  .action(async (options) => {
642
795
  const run = runtime();
643
796
  const clients = createClients(run.context);
@@ -647,6 +800,8 @@ export function registerBundles(program, runtime) {
647
800
  ...(options.message ? { commitMessage: options.message } : {}),
648
801
  dryRun: options.dryRun === true,
649
802
  ...(options.newVersion !== undefined ? { newVersion: options.newVersion } : {}),
803
+ ...(options.allowRuntimeDowngrade === true ? { allowRuntimeDowngrade: true } : {}),
804
+ ...(options.restamp === true ? { restamp: true } : {}),
650
805
  });
651
806
  run.output.result(result, () => {
652
807
  // One report, both lanes: program paths bare, build paths prefixed —
@@ -672,6 +827,9 @@ export function registerBundles(program, runtime) {
672
827
  // one place the CLI shows it, since `version list` lists versions
673
828
  // (label, notes) and a revision's commit message lives elsewhere.
674
829
  `Pushed ${result.push.new_version_tag}${result.runtimeVersion ? ` on runtime ${result.runtimeVersion}` : ""}${result.push.commit_message ? ` — "${result.push.commit_message}"` : ""}.`,
830
+ ...(result.recovered
831
+ ? [`The push's answer was lost on the way back; ${result.push.new_version_tag} is confirmed on the branch with exactly your files.`]
832
+ : []),
675
833
  ...(result.newBranch ? [newBranchLine(result.newBranch)] : []),
676
834
  ...(result.live
677
835
  ? [
@@ -680,6 +838,7 @@ export function registerBundles(program, runtime) {
680
838
  : []),
681
839
  ]
682
840
  : []),
841
+ ...(result.restamp ? [restampLine(result.restamp)] : []),
683
842
  ...(result.buildPush
684
843
  ? [
685
844
  `Pushed build bundle v${result.buildPush.version}` +
@@ -757,14 +916,20 @@ export function registerBundles(program, runtime) {
757
916
  // runtime the agent itself records. Pinned before anything the
758
917
  // runtime serves is fetched, so the schemas and skills below come
759
918
  // 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;
919
+ // An explicit --runtime-version / APOLLO_RUNTIME_VERSION wins; else the
920
+ // imported branch's own record (resolved inside the import), else the
921
+ // agent's — the same order `agent create` honours (R6).
922
+ const explicit = run.context.runtimeVersionSource === "flag" || run.context.runtimeVersionSource === "env";
923
+ const fallback = explicit ? run.context.runtimeVersion : await agentRuntimeVersion(clients, resolvedId);
764
924
  const imported = await importBundle(run.context, clients, resolvedId, destination, {
765
925
  ...(options.tag ? { tag: options.tag } : {}),
766
- ...(runtimeVersion ? { runtimeVersion } : {}),
926
+ ...(fallback ? { runtimeVersion: fallback } : {}),
927
+ runtimeVersionExplicit: explicit,
767
928
  });
929
+ const runtimeVersion = imported.binding.runtime_version;
930
+ const pinned = runtimeVersion
931
+ ? createClients({ ...run.context, runtimeVersion })
932
+ : clients;
768
933
  warnServerSecrets(run, imported.serverSecretFiles, imported.pull.version_tag);
769
934
  // The public floor, filtered by the wire: the index the install
770
935
  // fetches carries only public skills, and its sweep deletes managed
@@ -906,9 +1071,32 @@ function registerVersions(program, runtime) {
906
1071
  const run = runtime();
907
1072
  const management = createClients(run.context).management;
908
1073
  const agentId = requiredAgent(run);
909
- const selected = await management.resolveVersion(agentId, ref);
1074
+ const { version: selected, tag } = await management.resolveRef(agentId, ref);
910
1075
  const result = await management.updateVersion(agentId, selected.id, { label: name });
911
- run.output.result(result, () => `Renamed ${result.version_tag} to "${result.label ?? name}".`);
1076
+ run.output.result(result, () => `Renamed ${branchName(result)} to "${result.label ?? name}".${wholeBranch(tag, selected)}`);
1077
+ });
1078
+ version
1079
+ .command("notes")
1080
+ .argument("<ref>", "a branch (v2, its name, any of its commits, or live)")
1081
+ .argument("[text]", "the notes; - reads them from stdin")
1082
+ .option("--clear", "remove the branch's notes")
1083
+ .description("Set a branch's notes — what it is for and what to know before using it")
1084
+ .action(async (ref, text, options) => {
1085
+ const run = runtime();
1086
+ if (options.clear === true && text !== undefined) {
1087
+ throw new ConfigError("--clear takes no text.", `\`apollo branch notes ${ref} --clear\` removes them.`);
1088
+ }
1089
+ // Notes from a file or a heredoc end in a newline the branch should not keep.
1090
+ const notes = options.clear === true ? "" : (text === "-" ? await readStdin() : text)?.trimEnd();
1091
+ if (notes === undefined || (notes === "" && options.clear !== true)) {
1092
+ throw new ConfigError("No notes given.", `Pass them as text, \`-\` to read them from stdin, or --clear to remove them.`);
1093
+ }
1094
+ const management = createClients(run.context).management;
1095
+ const agentId = requiredAgent(run);
1096
+ const { version: selected, tag } = await management.resolveRef(agentId, ref);
1097
+ const result = await management.updateVersion(agentId, selected.id, { notes });
1098
+ run.output.result(result, () => `${notes ? `Notes set on ${branchName(result)}` : `Cleared the notes on ${branchName(result)}`}.${wholeBranch(tag, selected)}` +
1099
+ (notes ? ` \`apollo branch get ${branchName(result)}\` shows them.` : ""));
912
1100
  });
913
1101
  version
914
1102
  .command("lock")
@@ -918,9 +1106,9 @@ function registerVersions(program, runtime) {
918
1106
  const run = runtime();
919
1107
  const management = createClients(run.context).management;
920
1108
  const agentId = requiredAgent(run);
921
- const selected = await management.resolveVersion(agentId, ref);
1109
+ const { version: selected, tag } = await management.resolveRef(agentId, ref);
922
1110
  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. ` +
1111
+ 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
1112
  `\`apollo branch live <ref>\` picks the commit they get; \`apollo branch unlock ${branchName(result)}\` reopens this one; ` +
925
1113
  `\`apollo branch create --from ${branchName(result)}\` continues the work in a new draft.`);
926
1114
  });
@@ -932,22 +1120,34 @@ function registerVersions(program, runtime) {
932
1120
  const run = runtime();
933
1121
  const management = createClients(run.context).management;
934
1122
  const agentId = requiredAgent(run);
935
- const selected = await management.resolveVersion(agentId, ref);
1123
+ const { version: selected, tag } = await management.resolveRef(agentId, ref);
936
1124
  const result = await management.unlockVersion(agentId, selected.id);
937
- run.output.result(result, () => `Unlocked ${result.version_tag} — commits land on it again. ` +
1125
+ run.output.result(result, () => `Unlocked ${result.version_tag} — commits land on it again.${wholeBranch(tag, selected)} ` +
938
1126
  `What customers get is unchanged: live is a commit, not a branch's status.`);
939
1127
  });
940
1128
  version
941
1129
  .command("live")
942
1130
  .argument("<ref>")
1131
+ .option("--dry-run", "say what would change for customers, and change nothing")
943
1132
  .description("Make one COMMIT live — the exact bundle customers get (also how you roll back)")
944
- .action(async (ref) => {
1133
+ .action(async (ref, options) => {
945
1134
  const run = runtime();
946
1135
  const management = createClients(run.context).management;
947
1136
  const agentId = requiredAgent(run);
948
1137
  // A ref like `v3.7` names a COMMIT; `v3` or a label names the branch,
949
1138
  // and its newest commit goes live. `resolveRef` keeps the difference.
950
1139
  const { version: selected, tag } = await management.resolveRef(agentId, ref);
1140
+ const now = await customersGet(management, agentId);
1141
+ if (now.commit === tag) {
1142
+ run.output.result({ live: tag, changed: false }, () => `${tag} is already live for "${now.name}" — nothing to do.`);
1143
+ return;
1144
+ }
1145
+ const move = `customers of "${now.name}" (${run.context.environment}) move from ${now.commit ?? "nothing live"} to ${tag}`;
1146
+ if (options.dryRun === true) {
1147
+ run.output.result({ dry_run: true, from: now.commit ?? null, to: tag }, () => `Dry run: ${move}. Nothing changed.`);
1148
+ return;
1149
+ }
1150
+ await confirmConsequence(program, run.output, { summary: `Make ${tag} live: ${move}`, typed: tag });
951
1151
  const live = await management.activateSave(agentId, selected.id, tag);
952
1152
  run.output.result(live, () => {
953
1153
  const got = live.active_version_tag ?? tag;
@@ -988,11 +1188,23 @@ function registerVersions(program, runtime) {
988
1188
  .option("--notes <notes>")
989
1189
  .action(async (options) => {
990
1190
  const run = runtime();
991
- const management = createClients(run.context).management;
1191
+ const clients = createClients(run.context);
1192
+ const management = clients.management;
992
1193
  const agentId = requiredAgent(run);
993
1194
  const from = options.from ? await management.resolveRef(agentId, options.from) : undefined;
1195
+ // An empty or template branch is seeded by the registry, and the seed
1196
+ // follows the runtime it is told: say nothing and a runtime v2 agent
1197
+ // gets a runtime v1 skeleton (R15). The checkout's pin wins, else the
1198
+ // agent's own runtime; a cut from a commit keeps that commit's.
1199
+ const runtimeVersion = from
1200
+ ? undefined
1201
+ : (run.context.runtimeVersion ?? (await agentRuntimeVersion(clients, agentId)));
1202
+ if (!from && runtimeVersion === undefined) {
1203
+ throw new ConfigError("Cannot tell which engine the new branch should target.", "Pass --runtime-version <build> (see `apollo runtime list`).");
1204
+ }
994
1205
  const created = await management.createVersion(agentId, {
995
1206
  source: from ? "version" : options.template ? "template" : "empty",
1207
+ ...(runtimeVersion === undefined ? {} : { runtimeVersion }),
996
1208
  createdBy: requireUserId(run.context, "branch"),
997
1209
  ...(from ? { fromVersion: from.version.id, fromVersionTag: from.tag } : {}),
998
1210
  ...(options.template ? { fromTemplate: options.template } : {}),
@@ -1009,12 +1221,25 @@ function registerVersions(program, runtime) {
1009
1221
  version
1010
1222
  .command("publish")
1011
1223
  .argument("<tag>")
1224
+ .option("--dry-run", "say what would change for customers, and change nothing")
1012
1225
  .description("The old one-verb ladder: lock the branch AND ship its newest commit. Prefer `branch live`")
1013
- .action(async (tag) => {
1226
+ .action(async (tag, options) => {
1014
1227
  const run = runtime();
1015
1228
  const management = createClients(run.context).management;
1016
1229
  const agentId = requiredAgent(run);
1017
- const selected = await management.resolveVersion(agentId, tag);
1230
+ const { version: selected, tag: commit } = await management.resolveRef(agentId, tag);
1231
+ // publish ships the branch's NEWEST commit. Naming an older one used to
1232
+ // ship the newest anyway, with no word (R12).
1233
+ if (commit !== selected.version_tag) {
1234
+ 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.`);
1235
+ }
1236
+ const now = await customersGet(management, agentId);
1237
+ const move = `lock ${branchName(selected)}; customers of "${now.name}" (${run.context.environment}) move from ${now.commit ?? "nothing live"} to ${selected.version_tag}`;
1238
+ if (options.dryRun === true) {
1239
+ run.output.result({ dry_run: true, from: now.commit ?? null, to: selected.version_tag }, () => `Dry run: ${move}. Nothing changed.`);
1240
+ return;
1241
+ }
1242
+ await confirmConsequence(program, run.output, { summary: `Publish ${branchName(selected)}: ${move}`, typed: selected.version_tag });
1018
1243
  const result = await management.publishVersion(agentId, selected.id);
1019
1244
  run.output.result(result, () => `Published ${result.version_tag} — locked the branch and shipped its newest commit. ` +
1020
1245
  `\`apollo branch live <ref>\` ships a commit without locking anything, and can ship an older one.`);
@@ -1022,20 +1247,53 @@ function registerVersions(program, runtime) {
1022
1247
  version
1023
1248
  .command("archive")
1024
1249
  .argument("<tag>")
1025
- .action(async (tag) => {
1250
+ .option("--force", "archive it even when customers are on it")
1251
+ .description("Retire a branch — it takes no more commits and leaves the list")
1252
+ .action(async (tag, options) => {
1026
1253
  const run = runtime();
1027
1254
  const management = createClients(run.context).management;
1028
1255
  const agentId = requiredAgent(run);
1029
- const selected = await management.resolveVersion(agentId, tag);
1256
+ const [{ version: selected, tag: commit }, agent] = await Promise.all([
1257
+ management.resolveRef(agentId, tag),
1258
+ management.getAgent(agentId),
1259
+ ]);
1260
+ if (findLiveVersion(agent, [selected]) && options.force !== true) {
1261
+ 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.");
1262
+ }
1263
+ await confirmConsequence(program, run.output, {
1264
+ summary: `Archive ${branchName(selected)}${selected.label ? ` ("${selected.label}")` : ""} of "${agent.name}" (${run.context.environment})`,
1265
+ ...(options.force === true ? { force: true } : {}),
1266
+ });
1030
1267
  const result = await management.archiveVersion(agentId, selected.id);
1031
- run.output.result(result, () => `Archived ${result.version_tag}.`);
1268
+ run.output.result(result, () => `Archived ${branchName(result)}.${wholeBranch(commit, selected)}`);
1032
1269
  });
1033
1270
  }
1271
+ /** What customers get right now, and the agent's name — for a confirmation that says both. */
1272
+ async function customersGet(management, agentId) {
1273
+ const [agent, all] = await Promise.all([management.getAgent(agentId), management.listVersions(agentId)]);
1274
+ const live = findLiveVersion(agent, all.results);
1275
+ return { name: agent.name, commit: live ? liveCommitTag(agent, live) : undefined };
1276
+ }
1277
+ /** A note when an older commit named a branch-wide action: the whole branch is what changed. */
1278
+ function wholeBranch(ref, branch) {
1279
+ return ref !== branch.version_tag && parseVersionTag(ref)?.revision !== undefined
1280
+ ? ` (${ref} is one of its commits — this acts on branch ${branchName(branch)}, all of its commits.)`
1281
+ : "";
1282
+ }
1034
1283
  function requiredAgent(run) {
1035
1284
  if (!run.context.agentId)
1036
1285
  throw new ConfigError("Select or import an agent first.");
1037
1286
  return run.context.agentId;
1038
1287
  }
1288
+ /** What `push --restamp` did with an unchanged program; unpushed and still different is a dry run. */
1289
+ function restampLine(restamp) {
1290
+ const was = restamp.from ?? "no runtime";
1291
+ if (restamp.pushed)
1292
+ return `Re-stamped: the branch now records runtime ${restamp.to} (was ${was}); the program did not change.`;
1293
+ if (restamp.from === restamp.to)
1294
+ return `The branch already records runtime ${restamp.to} — nothing to re-stamp.`;
1295
+ return `Dry run: --restamp would commit the unchanged program so the branch records runtime ${restamp.to} (now ${was}).`;
1296
+ }
1039
1297
  /** What a push that started a branch says: which branch, cut from where, and why. */
1040
1298
  function newBranchLine(started) {
1041
1299
  const why = started.closed