@aui.io/apollo 0.1.4

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 (194) hide show
  1. package/bin/apollo.js +13 -0
  2. package/node_modules/@aui.io/apollo-cli/bin/apollo.js +79 -0
  3. package/node_modules/@aui.io/apollo-cli/dist/src/commands/auth.d.ts +4 -0
  4. package/node_modules/@aui.io/apollo-cli/dist/src/commands/auth.js +99 -0
  5. package/node_modules/@aui.io/apollo-cli/dist/src/commands/auth.js.map +1 -0
  6. package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.d.ts +3 -0
  7. package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js +234 -0
  8. package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js.map +1 -0
  9. package/node_modules/@aui.io/apollo-cli/dist/src/commands/env.d.ts +3 -0
  10. package/node_modules/@aui.io/apollo-cli/dist/src/commands/env.js +34 -0
  11. package/node_modules/@aui.io/apollo-cli/dist/src/commands/env.js.map +1 -0
  12. package/node_modules/@aui.io/apollo-cli/dist/src/commands/hierarchy.d.ts +3 -0
  13. package/node_modules/@aui.io/apollo-cli/dist/src/commands/hierarchy.js +175 -0
  14. package/node_modules/@aui.io/apollo-cli/dist/src/commands/hierarchy.js.map +1 -0
  15. package/node_modules/@aui.io/apollo-cli/dist/src/commands/mockdb.d.ts +3 -0
  16. package/node_modules/@aui.io/apollo-cli/dist/src/commands/mockdb.js +251 -0
  17. package/node_modules/@aui.io/apollo-cli/dist/src/commands/mockdb.js.map +1 -0
  18. package/node_modules/@aui.io/apollo-cli/dist/src/commands/operate.d.ts +3 -0
  19. package/node_modules/@aui.io/apollo-cli/dist/src/commands/operate.js +138 -0
  20. package/node_modules/@aui.io/apollo-cli/dist/src/commands/operate.js.map +1 -0
  21. package/node_modules/@aui.io/apollo-cli/dist/src/commands/profile.d.ts +3 -0
  22. package/node_modules/@aui.io/apollo-cli/dist/src/commands/profile.js +51 -0
  23. package/node_modules/@aui.io/apollo-cli/dist/src/commands/profile.js.map +1 -0
  24. package/node_modules/@aui.io/apollo-cli/dist/src/commands/prompts.d.ts +6 -0
  25. package/node_modules/@aui.io/apollo-cli/dist/src/commands/prompts.js +20 -0
  26. package/node_modules/@aui.io/apollo-cli/dist/src/commands/prompts.js.map +1 -0
  27. package/node_modules/@aui.io/apollo-cli/dist/src/commands/runtime.d.ts +6 -0
  28. package/node_modules/@aui.io/apollo-cli/dist/src/commands/runtime.js +2 -0
  29. package/node_modules/@aui.io/apollo-cli/dist/src/commands/runtime.js.map +1 -0
  30. package/node_modules/@aui.io/apollo-cli/dist/src/commands/shell.d.ts +10 -0
  31. package/node_modules/@aui.io/apollo-cli/dist/src/commands/shell.js +36 -0
  32. package/node_modules/@aui.io/apollo-cli/dist/src/commands/shell.js.map +1 -0
  33. package/node_modules/@aui.io/apollo-cli/dist/src/commands/status.d.ts +3 -0
  34. package/node_modules/@aui.io/apollo-cli/dist/src/commands/status.js +57 -0
  35. package/node_modules/@aui.io/apollo-cli/dist/src/commands/status.js.map +1 -0
  36. package/node_modules/@aui.io/apollo-cli/dist/src/commands/upgrade.d.ts +3 -0
  37. package/node_modules/@aui.io/apollo-cli/dist/src/commands/upgrade.js +35 -0
  38. package/node_modules/@aui.io/apollo-cli/dist/src/commands/upgrade.js.map +1 -0
  39. package/node_modules/@aui.io/apollo-cli/dist/src/commands/workspace.d.ts +3 -0
  40. package/node_modules/@aui.io/apollo-cli/dist/src/commands/workspace.js +170 -0
  41. package/node_modules/@aui.io/apollo-cli/dist/src/commands/workspace.js.map +1 -0
  42. package/node_modules/@aui.io/apollo-cli/dist/src/index.d.ts +10 -0
  43. package/node_modules/@aui.io/apollo-cli/dist/src/index.js +107 -0
  44. package/node_modules/@aui.io/apollo-cli/dist/src/index.js.map +1 -0
  45. package/node_modules/@aui.io/apollo-cli/dist/src/meta.d.ts +4 -0
  46. package/node_modules/@aui.io/apollo-cli/dist/src/meta.js +65 -0
  47. package/node_modules/@aui.io/apollo-cli/dist/src/meta.js.map +1 -0
  48. package/node_modules/@aui.io/apollo-cli/dist/src/output/welcome.d.ts +13 -0
  49. package/node_modules/@aui.io/apollo-cli/dist/src/output/welcome.js +53 -0
  50. package/node_modules/@aui.io/apollo-cli/dist/src/output/welcome.js.map +1 -0
  51. package/node_modules/@aui.io/apollo-cli/package.json +47 -0
  52. package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.d.ts +6 -0
  53. package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.js +23 -0
  54. package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.js.map +1 -0
  55. package/node_modules/@aui.io/apollo-core/dist/src/api/client-types.d.ts +23 -0
  56. package/node_modules/@aui.io/apollo-core/dist/src/api/client-types.js +2 -0
  57. package/node_modules/@aui.io/apollo-core/dist/src/api/client-types.js.map +1 -0
  58. package/node_modules/@aui.io/apollo-core/dist/src/api/identity.d.ts +48 -0
  59. package/node_modules/@aui.io/apollo-core/dist/src/api/identity.js +131 -0
  60. package/node_modules/@aui.io/apollo-core/dist/src/api/identity.js.map +1 -0
  61. package/node_modules/@aui.io/apollo-core/dist/src/api/management.d.ts +92 -0
  62. package/node_modules/@aui.io/apollo-core/dist/src/api/management.js +126 -0
  63. package/node_modules/@aui.io/apollo-core/dist/src/api/management.js.map +1 -0
  64. package/node_modules/@aui.io/apollo-core/dist/src/api/mock-db.d.ts +65 -0
  65. package/node_modules/@aui.io/apollo-core/dist/src/api/mock-db.js +183 -0
  66. package/node_modules/@aui.io/apollo-core/dist/src/api/mock-db.js.map +1 -0
  67. package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.d.ts +98 -0
  68. package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.js +70 -0
  69. package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.js.map +1 -0
  70. package/node_modules/@aui.io/apollo-core/dist/src/api/transport.d.ts +40 -0
  71. package/node_modules/@aui.io/apollo-core/dist/src/api/transport.js +205 -0
  72. package/node_modules/@aui.io/apollo-core/dist/src/api/transport.js.map +1 -0
  73. package/node_modules/@aui.io/apollo-core/dist/src/argv.d.ts +5 -0
  74. package/node_modules/@aui.io/apollo-core/dist/src/argv.js +43 -0
  75. package/node_modules/@aui.io/apollo-core/dist/src/argv.js.map +1 -0
  76. package/node_modules/@aui.io/apollo-core/dist/src/bundle/baseline.d.ts +17 -0
  77. package/node_modules/@aui.io/apollo-core/dist/src/bundle/baseline.js +48 -0
  78. package/node_modules/@aui.io/apollo-core/dist/src/bundle/baseline.js.map +1 -0
  79. package/node_modules/@aui.io/apollo-core/dist/src/bundle/files.d.ts +7 -0
  80. package/node_modules/@aui.io/apollo-core/dist/src/bundle/files.js +69 -0
  81. package/node_modules/@aui.io/apollo-core/dist/src/bundle/files.js.map +1 -0
  82. package/node_modules/@aui.io/apollo-core/dist/src/bundle/materialize.d.ts +14 -0
  83. package/node_modules/@aui.io/apollo-core/dist/src/bundle/materialize.js +196 -0
  84. package/node_modules/@aui.io/apollo-core/dist/src/bundle/materialize.js.map +1 -0
  85. package/node_modules/@aui.io/apollo-core/dist/src/bundle/validate.d.ts +30 -0
  86. package/node_modules/@aui.io/apollo-core/dist/src/bundle/validate.js +36 -0
  87. package/node_modules/@aui.io/apollo-core/dist/src/bundle/validate.js.map +1 -0
  88. package/node_modules/@aui.io/apollo-core/dist/src/config/index.d.ts +11 -0
  89. package/node_modules/@aui.io/apollo-core/dist/src/config/index.js +193 -0
  90. package/node_modules/@aui.io/apollo-core/dist/src/config/index.js.map +1 -0
  91. package/node_modules/@aui.io/apollo-core/dist/src/config/mockdb-keys.d.ts +14 -0
  92. package/node_modules/@aui.io/apollo-core/dist/src/config/mockdb-keys.js +54 -0
  93. package/node_modules/@aui.io/apollo-core/dist/src/config/mockdb-keys.js.map +1 -0
  94. package/node_modules/@aui.io/apollo-core/dist/src/config/store.d.ts +18 -0
  95. package/node_modules/@aui.io/apollo-core/dist/src/config/store.js +99 -0
  96. package/node_modules/@aui.io/apollo-core/dist/src/config/store.js.map +1 -0
  97. package/node_modules/@aui.io/apollo-core/dist/src/config/types.d.ts +62 -0
  98. package/node_modules/@aui.io/apollo-core/dist/src/config/types.js +2 -0
  99. package/node_modules/@aui.io/apollo-core/dist/src/config/types.js.map +1 -0
  100. package/node_modules/@aui.io/apollo-core/dist/src/errors/index.d.ts +42 -0
  101. package/node_modules/@aui.io/apollo-core/dist/src/errors/index.js +74 -0
  102. package/node_modules/@aui.io/apollo-core/dist/src/errors/index.js.map +1 -0
  103. package/node_modules/@aui.io/apollo-core/dist/src/index.d.ts +32 -0
  104. package/node_modules/@aui.io/apollo-core/dist/src/index.js +32 -0
  105. package/node_modules/@aui.io/apollo-core/dist/src/index.js.map +1 -0
  106. package/node_modules/@aui.io/apollo-core/dist/src/output/index.d.ts +29 -0
  107. package/node_modules/@aui.io/apollo-core/dist/src/output/index.js +49 -0
  108. package/node_modules/@aui.io/apollo-core/dist/src/output/index.js.map +1 -0
  109. package/node_modules/@aui.io/apollo-core/dist/src/services/auth.d.ts +10 -0
  110. package/node_modules/@aui.io/apollo-core/dist/src/services/auth.js +83 -0
  111. package/node_modules/@aui.io/apollo-core/dist/src/services/auth.js.map +1 -0
  112. package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.d.ts +37 -0
  113. package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js +161 -0
  114. package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js.map +1 -0
  115. package/node_modules/@aui.io/apollo-core/dist/src/services/clients.d.ts +15 -0
  116. package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js +95 -0
  117. package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js.map +1 -0
  118. package/node_modules/@aui.io/apollo-core/dist/src/services/env.service.d.ts +11 -0
  119. package/node_modules/@aui.io/apollo-core/dist/src/services/env.service.js +19 -0
  120. package/node_modules/@aui.io/apollo-core/dist/src/services/env.service.js.map +1 -0
  121. package/node_modules/@aui.io/apollo-core/dist/src/services/hierarchy.d.ts +29 -0
  122. package/node_modules/@aui.io/apollo-core/dist/src/services/hierarchy.js +117 -0
  123. package/node_modules/@aui.io/apollo-core/dist/src/services/hierarchy.js.map +1 -0
  124. package/node_modules/@aui.io/apollo-core/dist/src/services/messaging.d.ts +17 -0
  125. package/node_modules/@aui.io/apollo-core/dist/src/services/messaging.js +99 -0
  126. package/node_modules/@aui.io/apollo-core/dist/src/services/messaging.js.map +1 -0
  127. package/node_modules/@aui.io/apollo-core/dist/src/services/mockdb.d.ts +71 -0
  128. package/node_modules/@aui.io/apollo-core/dist/src/services/mockdb.js +274 -0
  129. package/node_modules/@aui.io/apollo-core/dist/src/services/mockdb.js.map +1 -0
  130. package/node_modules/@aui.io/apollo-core/dist/src/services/profile.service.d.ts +16 -0
  131. package/node_modules/@aui.io/apollo-core/dist/src/services/profile.service.js +29 -0
  132. package/node_modules/@aui.io/apollo-core/dist/src/services/profile.service.js.map +1 -0
  133. package/node_modules/@aui.io/apollo-core/dist/src/services/status.service.d.ts +26 -0
  134. package/node_modules/@aui.io/apollo-core/dist/src/services/status.service.js +109 -0
  135. package/node_modules/@aui.io/apollo-core/dist/src/services/status.service.js.map +1 -0
  136. package/node_modules/@aui.io/apollo-core/dist/src/services/upgrade.d.ts +23 -0
  137. package/node_modules/@aui.io/apollo-core/dist/src/services/upgrade.js +74 -0
  138. package/node_modules/@aui.io/apollo-core/dist/src/services/upgrade.js.map +1 -0
  139. package/node_modules/@aui.io/apollo-core/dist/src/services/workspace.service.d.ts +44 -0
  140. package/node_modules/@aui.io/apollo-core/dist/src/services/workspace.service.js +148 -0
  141. package/node_modules/@aui.io/apollo-core/dist/src/services/workspace.service.js.map +1 -0
  142. package/node_modules/@aui.io/apollo-core/dist/src/skills/install.d.ts +6 -0
  143. package/node_modules/@aui.io/apollo-core/dist/src/skills/install.js +48 -0
  144. package/node_modules/@aui.io/apollo-core/dist/src/skills/install.js.map +1 -0
  145. package/node_modules/@aui.io/apollo-core/dist/src/workspace/store.d.ts +33 -0
  146. package/node_modules/@aui.io/apollo-core/dist/src/workspace/store.js +246 -0
  147. package/node_modules/@aui.io/apollo-core/dist/src/workspace/store.js.map +1 -0
  148. package/node_modules/@aui.io/apollo-core/package.json +48 -0
  149. package/node_modules/@aui.io/apollo-tui/bin/apollo-tui.js +5 -0
  150. package/node_modules/@aui.io/apollo-tui/dist/src/components/glyph.d.ts +19 -0
  151. package/node_modules/@aui.io/apollo-tui/dist/src/components/glyph.js +41 -0
  152. package/node_modules/@aui.io/apollo-tui/dist/src/components/glyph.js.map +1 -0
  153. package/node_modules/@aui.io/apollo-tui/dist/src/index.d.ts +5 -0
  154. package/node_modules/@aui.io/apollo-tui/dist/src/index.js +46 -0
  155. package/node_modules/@aui.io/apollo-tui/dist/src/index.js.map +1 -0
  156. package/node_modules/@aui.io/apollo-tui/dist/src/lib/attractor.d.ts +82 -0
  157. package/node_modules/@aui.io/apollo-tui/dist/src/lib/attractor.js +231 -0
  158. package/node_modules/@aui.io/apollo-tui/dist/src/lib/attractor.js.map +1 -0
  159. package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.d.ts +34 -0
  160. package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.js +100 -0
  161. package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.js.map +1 -0
  162. package/node_modules/@aui.io/apollo-tui/dist/src/lib/scope.d.ts +14 -0
  163. package/node_modules/@aui.io/apollo-tui/dist/src/lib/scope.js +25 -0
  164. package/node_modules/@aui.io/apollo-tui/dist/src/lib/scope.js.map +1 -0
  165. package/node_modules/@aui.io/apollo-tui/dist/src/lib/sheet.d.ts +25 -0
  166. package/node_modules/@aui.io/apollo-tui/dist/src/lib/sheet.js +99 -0
  167. package/node_modules/@aui.io/apollo-tui/dist/src/lib/sheet.js.map +1 -0
  168. package/node_modules/@aui.io/apollo-tui/dist/src/lib/tabs.d.ts +10 -0
  169. package/node_modules/@aui.io/apollo-tui/dist/src/lib/tabs.js +19 -0
  170. package/node_modules/@aui.io/apollo-tui/dist/src/lib/tabs.js.map +1 -0
  171. package/node_modules/@aui.io/apollo-tui/dist/src/opentui-app.d.ts +1 -0
  172. package/node_modules/@aui.io/apollo-tui/dist/src/opentui-app.js +449 -0
  173. package/node_modules/@aui.io/apollo-tui/dist/src/opentui-app.js.map +1 -0
  174. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/bundle.d.ts +1 -0
  175. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/bundle.js +4 -0
  176. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/bundle.js.map +1 -0
  177. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/chat.d.ts +1 -0
  178. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/chat.js +4 -0
  179. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/chat.js.map +1 -0
  180. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/index.d.ts +5 -0
  181. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/index.js +6 -0
  182. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/index.js.map +1 -0
  183. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/mockdb.d.ts +1 -0
  184. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/mockdb.js +4 -0
  185. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/mockdb.js.map +1 -0
  186. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/overview.d.ts +1 -0
  187. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/overview.js +4 -0
  188. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/overview.js.map +1 -0
  189. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/scope.d.ts +1 -0
  190. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/scope.js +4 -0
  191. package/node_modules/@aui.io/apollo-tui/dist/src/tabs/scope.js.map +1 -0
  192. package/node_modules/@aui.io/apollo-tui/package.json +53 -0
  193. package/package.json +42 -0
  194. package/scripts/setup-shell.mjs +68 -0
@@ -0,0 +1,65 @@
1
+ import { createRequire } from "node:module";
2
+ import { readFileSync } from "node:fs";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ /** The only package published to npm — CLI + TUI are bundled inside it. */
6
+ export const APOLLO_PACKAGE_NAME = "@aui.io/apollo";
7
+ function readJson(path) {
8
+ try {
9
+ const raw = JSON.parse(readFileSync(path, "utf8"));
10
+ if (typeof raw.name === "string" && typeof raw.version === "string") {
11
+ return { name: raw.name, version: raw.version };
12
+ }
13
+ }
14
+ catch {
15
+ // missing / unreadable
16
+ }
17
+ return undefined;
18
+ }
19
+ /**
20
+ * Prefer the installed `@aui.io/apollo` version (global/meta install). Fall
21
+ * back to the workspace apollo package, then the local cli package version
22
+ * (dev / path install).
23
+ */
24
+ function loadApolloMeta() {
25
+ try {
26
+ const require = createRequire(import.meta.url);
27
+ const fromInstall = readJson(require.resolve(`${APOLLO_PACKAGE_NAME}/package.json`));
28
+ if (fromInstall)
29
+ return { name: APOLLO_PACKAGE_NAME, version: fromInstall.version };
30
+ }
31
+ catch {
32
+ // not installed as the meta package
33
+ }
34
+ let dir = dirname(fileURLToPath(import.meta.url));
35
+ for (let i = 0; i < 8; i++) {
36
+ const sibling = readJson(join(dir, "apollo", "package.json"));
37
+ if (sibling?.name === APOLLO_PACKAGE_NAME) {
38
+ return { name: APOLLO_PACKAGE_NAME, version: sibling.version };
39
+ }
40
+ const here = readJson(join(dir, "package.json"));
41
+ if (here?.name === APOLLO_PACKAGE_NAME) {
42
+ return { name: APOLLO_PACKAGE_NAME, version: here.version };
43
+ }
44
+ const parent = dirname(dir);
45
+ if (parent === dir)
46
+ break;
47
+ dir = parent;
48
+ }
49
+ // Last resort: workspace cli version (kept in sync with apollo).
50
+ dir = dirname(fileURLToPath(import.meta.url));
51
+ for (let i = 0; i < 5; i++) {
52
+ const here = readJson(join(dir, "package.json"));
53
+ if (here)
54
+ return { name: APOLLO_PACKAGE_NAME, version: here.version };
55
+ const parent = dirname(dir);
56
+ if (parent === dir)
57
+ break;
58
+ dir = parent;
59
+ }
60
+ throw new Error("Unable to locate @aui.io/apollo package version.");
61
+ }
62
+ const meta = loadApolloMeta();
63
+ export const CLI_PACKAGE_NAME = APOLLO_PACKAGE_NAME;
64
+ export const CLI_VERSION = meta.version;
65
+ //# sourceMappingURL=meta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.js","sourceRoot":"","sources":["../../src/meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,2EAA2E;AAC3E,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAOpD,SAAS,QAAQ,CAAC,IAAY;IAC5B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAGhD,CAAC;QACF,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;YACpE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;QAClD,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,uBAAuB;IACzB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc;IACrB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,mBAAmB,eAAe,CAAC,CAA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AC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC;QACjD,IAAI,IAAI;YAAE,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;QACtE,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM;QAC1B,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;AAE9B,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AACpD,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC"}
@@ -0,0 +1,13 @@
1
+ interface WelcomeHint {
2
+ command: string;
3
+ summary: string;
4
+ }
5
+ export interface WelcomeData {
6
+ name: string;
7
+ package: string;
8
+ version: string;
9
+ hints: WelcomeHint[];
10
+ }
11
+ export declare function welcomeData(): WelcomeData;
12
+ export declare function renderWelcome(color?: boolean): string;
13
+ export {};
@@ -0,0 +1,53 @@
1
+ import pc from "picocolors";
2
+ import { CLI_PACKAGE_NAME, CLI_VERSION } from "../meta.js";
3
+ const LOGO = `
4
+ ·
5
+ ╱ ╲
6
+ ●───●
7
+ ╲ ╱
8
+ ·
9
+ `.trimEnd();
10
+ const HINTS = [
11
+ { command: "apollo login", summary: "authenticate with your Apollo account" },
12
+ { command: "apollo status --check", summary: "inspect context and service health" },
13
+ { command: "apollo agent import", summary: "pull an agent into the local workspace" },
14
+ { command: "apollo chat", summary: "message an agent (REPL or one-shot)" },
15
+ { command: "apollo upgrade", summary: "install the latest CLI from npm" },
16
+ ];
17
+ export function welcomeData() {
18
+ return {
19
+ name: "apollo",
20
+ package: CLI_PACKAGE_NAME,
21
+ version: CLI_VERSION,
22
+ hints: HINTS,
23
+ };
24
+ }
25
+ export function renderWelcome(color = true) {
26
+ const paint = color
27
+ ? {
28
+ brand: pc.cyan,
29
+ dim: pc.dim,
30
+ bold: pc.bold,
31
+ cmd: pc.bold,
32
+ }
33
+ : {
34
+ brand: (value) => value,
35
+ dim: (value) => value,
36
+ bold: (value) => value,
37
+ cmd: (value) => value,
38
+ };
39
+ const lines = [
40
+ paint.brand(LOGO),
41
+ "",
42
+ `${paint.bold("apollo")} ${paint.dim(`v${CLI_VERSION}`)}`,
43
+ paint.dim("Manage and operate Apollo agents"),
44
+ "",
45
+ paint.dim("Get started"),
46
+ ...HINTS.map((hint) => ` ${paint.cmd(hint.command.padEnd(24))} ${paint.dim(hint.summary)}`),
47
+ "",
48
+ `${paint.dim("Full command list:")} apollo --help`,
49
+ `${paint.dim("Docs / package:")} ${CLI_PACKAGE_NAME}`,
50
+ ];
51
+ return `${lines.join("\n")}\n`;
52
+ }
53
+ //# sourceMappingURL=welcome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"welcome.js","sourceRoot":"","sources":["../../../src/output/welcome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE3D,MAAM,IAAI,GAAG;;;;;;CAMZ,CAAC,OAAO,EAAE,CAAC;AAOZ,MAAM,KAAK,GAAkB;IAC3B,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,uCAAuC,EAAE;IAC7E,EAAE,OAAO,EAAE,uBAAuB,EAAE,OAAO,EAAE,oCAAoC,EAAE;IACnF,EAAE,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,wCAAwC,EAAE;IACrF,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,qCAAqC,EAAE;IAC1E,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,iCAAiC,EAAE;CAC1E,CAAC;AASF,MAAM,UAAU,WAAW;IACzB,OAAO;QACL,IAAI,EA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AE;KACzD,CAAC;IACF,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC"}
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@aui.io/apollo-cli",
3
+ "version": "0.1.4",
4
+ "private": true,
5
+ "description": "Command-line client for the Apollo runtime",
6
+ "type": "module",
7
+ "engines": {
8
+ "node": ">=20"
9
+ },
10
+ "bin": {
11
+ "apollo": "./bin/apollo.js"
12
+ },
13
+ "exports": {
14
+ "./bin/apollo.js": "./bin/apollo.js"
15
+ },
16
+ "files": [
17
+ "bin",
18
+ "dist"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+ssh://git@bitbucket.org/getstuff/runtime-v2.git",
23
+ "directory": "console/cli"
24
+ },
25
+ "homepage": "https://bitbucket.org/getstuff/runtime-v2/src/main/console/cli/",
26
+ "scripts": {
27
+ "build": "tsc -p tsconfig.json",
28
+ "lint": "eslint .",
29
+ "test": "vitest run"
30
+ },
31
+ "dependencies": {
32
+ "@aui.io/apollo-core": "0.1.4",
33
+ "commander": "^14.0.3",
34
+ "picocolors": "^1.1.1"
35
+ },
36
+ "optionalDependencies": {
37
+ "@aui.io/apollo-tui": "0.1.4"
38
+ },
39
+ "devDependencies": {
40
+ "@eslint/js": "^9.39.5",
41
+ "@types/node": "^24.13.3",
42
+ "eslint": "^9.39.5",
43
+ "typescript": "^5.9.3",
44
+ "typescript-eslint": "^8.65.0",
45
+ "vitest": "^3.2.7"
46
+ }
47
+ }
@@ -0,0 +1,6 @@
1
+ import type { HttpClient } from "./client-types.js";
2
+ export declare class AgentSettingsClient {
3
+ private readonly http;
4
+ constructor(http: HttpClient);
5
+ pullSchemas(): Promise<Record<string, unknown>>;
6
+ }
@@ -0,0 +1,23 @@
1
+ const SCHEMAS = {
2
+ tools: "/v1/agent-tools/schema",
3
+ entities: "/v1/scope-entities/view/schema",
4
+ parameters: "/v1/parameters/view/schema",
5
+ integrations: "/v1/integrations/view/schema",
6
+ agent: "/v1/agent-tools/general-settings/schema",
7
+ rules: "/v1/agent-tools/rules/schema",
8
+ computations: "/v1/agent-tools/computations/schema",
9
+ };
10
+ export class AgentSettingsClient {
11
+ http;
12
+ constructor(http) {
13
+ this.http = http;
14
+ }
15
+ async pullSchemas() {
16
+ const entries = await Promise.all(Object.entries(SCHEMAS).map(async ([name, endpoint]) => [
17
+ name,
18
+ await this.http.request(endpoint),
19
+ ]));
20
+ return Object.fromEntries(entries);
21
+ }
22
+ }
23
+ //# sourceMappingURL=agent-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-settings.js","sourceRoot":"","sources":["../../../src/api/agent-settings.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG;IACd,KAAK,EAAE,wBAAwB;IAC/B,QAAQ,EAAE,gCAAgC;IAC1C,UAAU,EAAE,4BAA4B;IACxC,YAAY,EAAE,8BAA8B;IAC5C,KAAK,EAAE,yCAAyC;IAChD,KAAK,EAAE,8BAA8B;IACrC,YAAY,EAAE,qCAAqC;CAC3C,CAAC;AAEX,MAAM,OAAO,mBAAmB;IACM;IAApC,YAAoC,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,KAAK,CAAC,WAAW;QACtB,MAAM,OAAO,GAAmC,MAAM,OAAO,CAAC,GAAG,CAC/D,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CACzB,KAAK,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAuC,EAAE,CAAC;YAC/D,IAAI;YACJ,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAU,QAAQ,CAAC;SAC3C,CACF,CACF,CAAC;QACF,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACF"}
@@ -0,0 +1,23 @@
1
+ export interface RequestOptions {
2
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
3
+ query?: Record<string, string | number | boolean | undefined>;
4
+ headers?: Record<string, string>;
5
+ body?: unknown;
6
+ authenticated?: boolean;
7
+ attribution?: boolean;
8
+ }
9
+ export interface HttpClient {
10
+ request<T>(path: string, options?: RequestOptions): Promise<T>;
11
+ }
12
+ export interface Page<T> {
13
+ results: T[];
14
+ meta?: {
15
+ has_more: boolean;
16
+ after_cursor?: string | null;
17
+ before_cursor?: string | null;
18
+ };
19
+ links?: {
20
+ next?: string | null;
21
+ prev?: string | null;
22
+ };
23
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=client-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-types.js","sourceRoot":"","sources":["../../../src/api/client-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,48 @@
1
+ import type { HttpClient } from "./client-types.js";
2
+ interface IdentityEnvelope<T> {
3
+ status?: boolean;
4
+ data: T;
5
+ message?: string;
6
+ }
7
+ export interface LoginResult {
8
+ token: string;
9
+ refreshToken?: string;
10
+ user: {
11
+ _id?: string;
12
+ id?: string;
13
+ email?: string;
14
+ };
15
+ organizationId?: string;
16
+ }
17
+ export interface Organization {
18
+ _id?: string;
19
+ id?: string;
20
+ name: string;
21
+ }
22
+ export declare class IdentityClient {
23
+ private readonly http;
24
+ constructor(http: HttpClient);
25
+ sendOtp(email: string): Promise<IdentityEnvelope<{
26
+ email: string;
27
+ }>>;
28
+ loginWithOtp(email: string, otp: string): Promise<LoginResult>;
29
+ refresh(refreshToken: string): Promise<{
30
+ token: string;
31
+ refreshToken: string;
32
+ }>;
33
+ logout(): Promise<void>;
34
+ switchOrganization(organizationId: string): Promise<{
35
+ token?: string;
36
+ refreshToken?: string;
37
+ }>;
38
+ listOrganizations(): Promise<Organization[]>;
39
+ }
40
+ declare function openBrowser(target: string): void;
41
+ export declare function browserLogin(playgroundUrl: string, timeoutMs?: number, open?: typeof openBrowser): Promise<{
42
+ loginUrl: string;
43
+ result: Promise<{
44
+ token: string;
45
+ refreshToken?: string;
46
+ }>;
47
+ }>;
48
+ export {};
@@ -0,0 +1,131 @@
1
+ import { createServer } from "node:http";
2
+ import { createServer as createTcpServer } from "node:net";
3
+ import { spawn } from "node:child_process";
4
+ export class IdentityClient {
5
+ http;
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ sendOtp(email) {
10
+ return this.http.request("/identity/user/otp/email", {
11
+ method: "POST",
12
+ authenticated: false,
13
+ body: { email },
14
+ });
15
+ }
16
+ async loginWithOtp(email, otp) {
17
+ const response = await this.http.request("/identity/user/login", {
18
+ method: "POST",
19
+ authenticated: false,
20
+ body: { email, password: otp, isOTP: true },
21
+ });
22
+ return response.data;
23
+ }
24
+ async refresh(refreshToken) {
25
+ const response = await this.http.request("/identity/user/token/refresh", {
26
+ method: "POST",
27
+ authenticated: false,
28
+ body: { refreshToken },
29
+ });
30
+ return response.data;
31
+ }
32
+ async logout() {
33
+ await this.http.request("/identity/user/logout", {
34
+ method: "POST",
35
+ body: {},
36
+ });
37
+ }
38
+ async switchOrganization(organizationId) {
39
+ const response = await this.http.request("/identity/user/switch-organization", {
40
+ method: "POST",
41
+ body: { organization: organizationId },
42
+ });
43
+ const token = response.data?.token ??
44
+ response.data?.accessToken ??
45
+ response.token ??
46
+ response.accessToken;
47
+ if (!token &&
48
+ response.data?.organizationId !== organizationId) {
49
+ throw new Error("Identity did not return an organization-scoped token.");
50
+ }
51
+ return {
52
+ ...(token ? { token } : {}),
53
+ ...(response.data?.refreshToken
54
+ ? { refreshToken: response.data.refreshToken }
55
+ : {}),
56
+ };
57
+ }
58
+ async listOrganizations() {
59
+ const organizations = [];
60
+ for (let page = 1;; page += 1) {
61
+ const response = await this.http.request("/identity/memberships/my/organizations", {
62
+ query: { page, limit: 50, sortOrder: "ASC", sortBy: "createdAt" },
63
+ });
64
+ organizations.push(...response.data.docs);
65
+ if (!response.data.hasNextPage)
66
+ return organizations;
67
+ }
68
+ }
69
+ }
70
+ function freePort() {
71
+ return new Promise((resolve, reject) => {
72
+ const server = createTcpServer();
73
+ server.on("error", reject);
74
+ server.listen(0, "127.0.0.1", () => {
75
+ const address = server.address();
76
+ if (!address || typeof address === "string") {
77
+ reject(new Error("Could not allocate a login callback port."));
78
+ return;
79
+ }
80
+ server.close(() => resolve(address.port));
81
+ });
82
+ });
83
+ }
84
+ function openBrowser(target) {
85
+ const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
86
+ const args = process.platform === "win32" ? ["/c", "start", "", target] : [target];
87
+ const child = spawn(command, args, { detached: true, stdio: "ignore" });
88
+ child.unref();
89
+ }
90
+ export async function browserLogin(playgroundUrl, timeoutMs = 120_000, open = openBrowser) {
91
+ const port = await freePort();
92
+ const callback = `http://127.0.0.1:${port}/callback`;
93
+ const loginUrl = `${playgroundUrl.replace(/\/+$/, "")}/cli-login?redirect=${encodeURIComponent(callback)}`;
94
+ const result = new Promise((resolve, reject) => {
95
+ const timer = setTimeout(() => {
96
+ server.close();
97
+ server.closeAllConnections();
98
+ reject(new Error("Browser login timed out."));
99
+ }, timeoutMs);
100
+ const server = createServer((request, response) => {
101
+ const requestUrl = new URL(request.url ?? "/", callback);
102
+ if (requestUrl.pathname !== "/callback") {
103
+ response.writeHead(404).end("Not found");
104
+ return;
105
+ }
106
+ const token = requestUrl.searchParams.get("token");
107
+ const refreshToken = requestUrl.searchParams.get("refreshToken") ?? undefined;
108
+ response
109
+ .writeHead(token ? 200 : 400, {
110
+ "connection": "close",
111
+ "content-type": "text/plain; charset=utf-8",
112
+ })
113
+ .end(token ? "Login successful. Return to the terminal." : "Login failed.", () => {
114
+ server.close();
115
+ server.closeAllConnections();
116
+ });
117
+ clearTimeout(timer);
118
+ if (token)
119
+ resolve({ token, ...(refreshToken ? { refreshToken } : {}) });
120
+ else
121
+ reject(new Error("Identity callback did not include a token."));
122
+ });
123
+ server.on("error", (error) => {
124
+ clearTimeout(timer);
125
+ reject(error);
126
+ });
127
+ server.listen(port, "127.0.0.1", () => open(loginUrl));
128
+ });
129
+ return { loginUrl, result };
130
+ }
131
+ //# sourceMappingURL=identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../src/api/identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,YAAY,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAuB3C,MAAM,OAAO,cAAc;IACW;IAApC,YAAoC,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,0BAA0B,EAAE;YACnD,MAAM,EAAE,MAAM;YACd,aAAa,EAAE,KAAK;YACpB,IAAI,EAAE,EAAE,KAAK,EAAE;SAChB,CAAC,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,KAAa,EAAE,GAAW;QAClD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CACtC,sBAAsB,EACtB;YACE,MAAM,EAAE,MAAM;YACd,aAAa,EAAE,KAAK;YACpB,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE;SAC5C,CACF,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,YAAoB;QAIvC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAEtC,8BAA8B,EAAE;YAChC,MAAM,EAAE,MAAM;YACd,aAAa,EAAE,KAAK;YACpB,IAAI,EAAE,EAAE,YAAY,EAAE;SACvB,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAEM,KAAK,CAAC,MAAM;QACjB,MAAM,IAAI,CAAC,I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AG,CAAC,cAAc,CAAC,IAAI,SAAS,CAAC;YAC9E,QAAQ;iBACL,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE;gBAC5B,YAAY,EAAE,OAAO;gBACrB,cAAc,EAAE,2BAA2B;aAC5C,CAAC;iBACD,GAAG,CACF,KAAK,CAAC,CAAC,CAAC,2CAA2C,CAAC,CAAC,CAAC,eAAe,EACrE,GAAG,EAAE;gBACH,MAAM,CAAC,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,mBAAmB,EAAE,CAAC;YAC/B,CAAC,CACF,CAAC;YACJ,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,IAAI,KAAK;gBAAE,OAAO,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;;gBACpE,MAAM,CAAC,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAC3B,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,92 @@
1
+ import type { HttpClient, Page } from "./client-types.js";
2
+ export interface Project {
3
+ id: string;
4
+ name: string;
5
+ created_at: string;
6
+ updated_at: string;
7
+ }
8
+ export interface Agent {
9
+ id: string;
10
+ project_id: string;
11
+ name: string;
12
+ live_version_id?: string | null;
13
+ created_at: string;
14
+ updated_at: string;
15
+ }
16
+ export type VersionStatus = "draft" | "published" | "archived";
17
+ export interface AgentVersion {
18
+ id: string;
19
+ agent_id: string;
20
+ version_number: number;
21
+ version_revision_number: number;
22
+ version_tag: string;
23
+ status: VersionStatus;
24
+ parent_version_id?: string | null;
25
+ label?: string | null;
26
+ tags: string[];
27
+ notes?: string | null;
28
+ created_at: string;
29
+ published_at?: string | null;
30
+ }
31
+ export interface VersionPull {
32
+ return_type?: string | null;
33
+ agent_id: string;
34
+ version_id: string;
35
+ version_tag: string;
36
+ bundle: Record<string, unknown>;
37
+ expires_at: string;
38
+ }
39
+ export interface VersionPush {
40
+ agent_id: string;
41
+ version_id: string;
42
+ new_version_revision_number: number;
43
+ new_version_tag: string;
44
+ revision_id: string;
45
+ sha256: string;
46
+ size: number;
47
+ created_at: string;
48
+ commit_message?: string | null;
49
+ }
50
+ export type VersionSource = "version" | "agent-scope" | "template" | "empty";
51
+ export declare class ManagementClient {
52
+ private readonly http;
53
+ constructor(http: HttpClient);
54
+ listProjects(): Promise<Page<Project>>;
55
+ getProject(projectId: string): Promise<Project>;
56
+ createProject(name: string): Promise<Project>;
57
+ listAgents(projectId: string, name?: string): Promise<Page<Agent>>;
58
+ getAgent(agentId: string): Promise<Agent>;
59
+ createAgent(projectId: string, name: string): Promise<Agent>;
60
+ listVersions(agentId: string, filters?: {
61
+ status?: VersionStatus;
62
+ tag?: string;
63
+ versionNumber?: number;
64
+ excludeRevisions?: boolean;
65
+ }): Promise<Page<AgentVersion>>;
66
+ /**
67
+ * Resolve a local pin (`v{major}.{revision}`) to a version row.
68
+ *
69
+ * `version_id` is per major (`version_number`); each push bumps the revision and
70
+ * returns a new `version_tag` on the same id. Prefer an exact tag match, then fall
71
+ * back to the current tip of that major line so a stale pin like `v0.6` still finds
72
+ * `v0.11` on the same draft.
73
+ */
74
+ resolveVersion(agentId: string, tag: string): Promise<AgentVersion>;
75
+ createVersion(agentId: string, input: {
76
+ source: VersionSource;
77
+ fromVersion?: string;
78
+ fromTemplate?: string;
79
+ label?: string;
80
+ tags?: string[];
81
+ notes?: string;
82
+ }): Promise<AgentVersion>;
83
+ publishVersion(agentId: string, versionId: string): Promise<AgentVersion>;
84
+ archiveVersion(agentId: string, versionId: string): Promise<AgentVersion>;
85
+ pushVersion(agentId: string, versionId: string, bundle: Record<string, unknown>, commitMessage?: string): Promise<VersionPush>;
86
+ pullVersion(agentId: string, versionId: string, versionTag?: string): Promise<VersionPull>;
87
+ }
88
+ /** `v8.14` / `v8` → major (+ optional revision). */
89
+ export declare function parseVersionTag(tag: string): {
90
+ major: number;
91
+ revision?: number;
92
+ } | undefined;
@@ -0,0 +1,126 @@
1
+ export class ManagementClient {
2
+ http;
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ listProjects() {
7
+ return this.http.request("/management/v1/projects");
8
+ }
9
+ getProject(projectId) {
10
+ return this.http.request(`/management/v1/projects/${projectId}`);
11
+ }
12
+ createProject(name) {
13
+ return this.http.request("/management/v1/projects", {
14
+ method: "POST",
15
+ body: { name },
16
+ });
17
+ }
18
+ listAgents(projectId, name) {
19
+ return this.http.request(`/management/v1/projects/${projectId}/agents`, {
20
+ query: { name },
21
+ });
22
+ }
23
+ getAgent(agentId) {
24
+ return this.http.request(`/management/v1/agents/${agentId}`);
25
+ }
26
+ createAgent(projectId, name) {
27
+ return this.http.request(`/management/v1/projects/${projectId}/agents`, {
28
+ method: "POST",
29
+ body: { name },
30
+ });
31
+ }
32
+ listVersions(agentId, filters = {}) {
33
+ return this.http.request(`/management/v1/agents/${agentId}/versions`, {
34
+ query: {
35
+ status: filters.status,
36
+ tag: filters.tag,
37
+ version_number: filters.versionNumber,
38
+ exclude_revisions: filters.excludeRevisions,
39
+ },
40
+ });
41
+ }
42
+ /**
43
+ * Resolve a local pin (`v{major}.{revision}`) to a version row.
44
+ *
45
+ * `version_id` is per major (`version_number`); each push bumps the revision and
46
+ * returns a new `version_tag` on the same id. Prefer an exact tag match, then fall
47
+ * back to the current tip of that major line so a stale pin like `v0.6` still finds
48
+ * `v0.11` on the same draft.
49
+ */
50
+ async resolveVersion(agentId, tag) {
51
+ const normalized = tag.trim();
52
+ let page = await this.listVersions(agentId, { tag: normalized });
53
+ let match = page.results.find((version) => version.version_tag === normalized);
54
+ if (!match) {
55
+ page = await this.listVersions(agentId);
56
+ match = page.results.find((version) => version.version_tag === normalized);
57
+ }
58
+ if (match)
59
+ return match;
60
+ const parsed = parseVersionTag(normalized);
61
+ if (parsed !== undefined) {
62
+ const tip = tipOfMajor(page.results, parsed.major);
63
+ if (tip)
64
+ return tip;
65
+ page = await this.listVersions(agentId, { versionNumber: parsed.major });
66
+ const filteredTip = tipOfMajor(page.results, parsed.major);
67
+ if (filteredTip)
68
+ return filteredTip;
69
+ }
70
+ throw new Error(`No version with tag ${tag} exists for agent ${agentId}`);
71
+ }
72
+ createVersion(agentId, input) {
73
+ return this.http.request(`/management/v1/agents/${agentId}/versions`, {
74
+ method: "POST",
75
+ body: {
76
+ source: input.source,
77
+ from_version: input.fromVersion,
78
+ from_template: input.fromTemplate,
79
+ label: input.label,
80
+ tags: input.tags,
81
+ notes: input.notes,
82
+ },
83
+ });
84
+ }
85
+ publishVersion(agentId, versionId) {
86
+ return this.http.request(`/management/v1/agents/${agentId}/versions/${versionId}/publish`, { method: "POST" });
87
+ }
88
+ archiveVersion(agentId, versionId) {
89
+ return this.http.request(`/management/v1/agents/${agentId}/versions/${versionId}/archive`, { method: "POST" });
90
+ }
91
+ pushVersion(agentId, versionId, bundle, commitMessage) {
92
+ return this.http.request(`/management/v1/agents/${agentId}/versions/${versionId}/push`, {
93
+ method: "POST",
94
+ body: {
95
+ caller: "cli",
96
+ commit_message: commitMessage,
97
+ bundle,
98
+ },
99
+ });
100
+ }
101
+ pullVersion(agentId, versionId, versionTag) {
102
+ return this.http.request(`/management/v1/agents/${agentId}/versions/${versionId}/pull`, { query: { version_tag: versionTag } });
103
+ }
104
+ }
105
+ /** `v8.14` / `v8` → major (+ optional revision). */
106
+ export function parseVersionTag(tag) {
107
+ const match = /^v(\d+)(?:\.(\d+))?$/i.exec(tag.trim());
108
+ if (!match?.[1])
109
+ return undefined;
110
+ const major = Number(match[1]);
111
+ if (!Number.isSafeInteger(major))
112
+ return undefined;
113
+ if (match[2] === undefined)
114
+ return { major };
115
+ const revision = Number(match[2]);
116
+ if (!Number.isSafeInteger(revision))
117
+ return undefined;
118
+ return { major, revision };
119
+ }
120
+ function tipOfMajor(versions, major) {
121
+ const line = versions
122
+ .filter((version) => version.version_number === major)
123
+ .sort((left, right) => right.version_revision_number - left.version_revision_number);
124
+ return line[0];
125
+ }
126
+ //# sourceMappingURL=management.js.map