@arizeai/phoenix-cli 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/README.md +42 -0
  2. package/build/cli.d.ts.map +1 -1
  3. package/build/cli.js +2 -1
  4. package/build/cli.js.map +1 -1
  5. package/build/client.d.ts +5 -1
  6. package/build/client.d.ts.map +1 -1
  7. package/build/client.js +2 -1
  8. package/build/client.js.map +1 -1
  9. package/build/commands/annotationConfig.d.ts.map +1 -1
  10. package/build/commands/annotationConfig.js.map +1 -1
  11. package/build/commands/{annotationMutationUtils.d.ts → annotationMutations.d.ts} +1 -1
  12. package/build/commands/annotationMutations.d.ts.map +1 -0
  13. package/build/commands/{annotationMutationUtils.js → annotationMutations.js} +1 -1
  14. package/build/commands/annotationMutations.js.map +1 -0
  15. package/build/commands/api.d.ts.map +1 -1
  16. package/build/commands/api.js.map +1 -1
  17. package/build/commands/auth.d.ts +1 -1
  18. package/build/commands/auth.d.ts.map +1 -1
  19. package/build/commands/auth.js +6 -12
  20. package/build/commands/auth.js.map +1 -1
  21. package/build/commands/dataset.d.ts.map +1 -1
  22. package/build/commands/dataset.js.map +1 -1
  23. package/build/commands/docs.d.ts +51 -0
  24. package/build/commands/docs.d.ts.map +1 -1
  25. package/build/commands/docs.js +86 -37
  26. package/build/commands/docs.js.map +1 -1
  27. package/build/commands/experiment.d.ts.map +1 -1
  28. package/build/commands/experiment.js.map +1 -1
  29. package/build/commands/fetchSpanAnnotations.d.ts +14 -0
  30. package/build/commands/fetchSpanAnnotations.d.ts.map +1 -0
  31. package/build/commands/fetchSpanAnnotations.js +57 -0
  32. package/build/commands/fetchSpanAnnotations.js.map +1 -0
  33. package/build/commands/fetchTraceAnnotations.d.ts +14 -0
  34. package/build/commands/fetchTraceAnnotations.d.ts.map +1 -0
  35. package/build/commands/fetchTraceAnnotations.js +57 -0
  36. package/build/commands/fetchTraceAnnotations.js.map +1 -0
  37. package/build/commands/formatAnnotationMutation.d.ts +1 -1
  38. package/build/commands/formatAnnotationMutation.d.ts.map +1 -1
  39. package/build/commands/formatNoteMutation.d.ts +1 -1
  40. package/build/commands/formatNoteMutation.d.ts.map +1 -1
  41. package/build/commands/formatSetup.d.ts +50 -0
  42. package/build/commands/formatSetup.d.ts.map +1 -0
  43. package/build/commands/formatSetup.js +64 -0
  44. package/build/commands/formatSetup.js.map +1 -0
  45. package/build/commands/index.d.ts +4 -3
  46. package/build/commands/index.d.ts.map +1 -1
  47. package/build/commands/index.js +4 -3
  48. package/build/commands/index.js.map +1 -1
  49. package/build/commands/{noteMutationUtils.d.ts → noteMutations.d.ts} +1 -1
  50. package/build/commands/noteMutations.d.ts.map +1 -0
  51. package/build/commands/{noteMutationUtils.js → noteMutations.js} +1 -1
  52. package/build/commands/noteMutations.js.map +1 -0
  53. package/build/commands/options.d.ts +248 -0
  54. package/build/commands/options.d.ts.map +1 -0
  55. package/build/commands/options.js +16 -0
  56. package/build/commands/options.js.map +1 -0
  57. package/build/commands/profile.d.ts.map +1 -1
  58. package/build/commands/profile.js +3 -11
  59. package/build/commands/profile.js.map +1 -1
  60. package/build/commands/project.d.ts.map +1 -1
  61. package/build/commands/project.js +0 -1
  62. package/build/commands/project.js.map +1 -1
  63. package/build/commands/prompt.d.ts.map +1 -1
  64. package/build/commands/prompt.js.map +1 -1
  65. package/build/commands/self.d.ts.map +1 -1
  66. package/build/commands/self.js.map +1 -1
  67. package/build/commands/session.d.ts.map +1 -1
  68. package/build/commands/session.js +4 -4
  69. package/build/commands/session.js.map +1 -1
  70. package/build/commands/{sessionAnnotationsCommand.d.ts → sessionAnnotations.d.ts} +1 -1
  71. package/build/commands/sessionAnnotations.d.ts.map +1 -0
  72. package/build/commands/{sessionAnnotationsCommand.js → sessionAnnotations.js} +1 -1
  73. package/build/commands/sessionAnnotations.js.map +1 -0
  74. package/build/commands/setup.d.ts +19 -0
  75. package/build/commands/setup.d.ts.map +1 -0
  76. package/build/commands/setup.js +245 -0
  77. package/build/commands/setup.js.map +1 -0
  78. package/build/commands/span.d.ts.map +1 -1
  79. package/build/commands/span.js +5 -5
  80. package/build/commands/span.js.map +1 -1
  81. package/build/commands/spanAnnotations.d.ts +6 -13
  82. package/build/commands/spanAnnotations.d.ts.map +1 -1
  83. package/build/commands/spanAnnotations.js +154 -47
  84. package/build/commands/spanAnnotations.js.map +1 -1
  85. package/build/commands/trace.d.ts.map +1 -1
  86. package/build/commands/trace.js +6 -6
  87. package/build/commands/trace.js.map +1 -1
  88. package/build/commands/traceAnnotations.d.ts +6 -13
  89. package/build/commands/traceAnnotations.d.ts.map +1 -1
  90. package/build/commands/traceAnnotations.js +157 -47
  91. package/build/commands/traceAnnotations.js.map +1 -1
  92. package/build/config.d.ts +4 -1
  93. package/build/config.d.ts.map +1 -1
  94. package/build/config.js +67 -11
  95. package/build/config.js.map +1 -1
  96. package/build/curl.d.ts +17 -0
  97. package/build/curl.d.ts.map +1 -1
  98. package/build/curl.js.map +1 -1
  99. package/build/exitCodes.d.ts.map +1 -1
  100. package/build/optionParsers.d.ts +12 -0
  101. package/build/optionParsers.d.ts.map +1 -1
  102. package/build/optionParsers.js +15 -0
  103. package/build/optionParsers.js.map +1 -1
  104. package/build/pxi/App.d.ts.map +1 -1
  105. package/build/pxi/App.js +4 -0
  106. package/build/pxi/App.js.map +1 -1
  107. package/build/pxi/index.js.map +1 -1
  108. package/build/pxi/options.d.ts +98 -0
  109. package/build/pxi/options.d.ts.map +1 -1
  110. package/build/pxi/options.js.map +1 -1
  111. package/build/settings.d.ts.map +1 -1
  112. package/build/settings.js +4 -0
  113. package/build/settings.js.map +1 -1
  114. package/build/setup/agents/registry.d.ts +78 -0
  115. package/build/setup/agents/registry.d.ts.map +1 -0
  116. package/build/setup/agents/registry.js +129 -0
  117. package/build/setup/agents/registry.js.map +1 -0
  118. package/build/setup/copy.d.ts +167 -0
  119. package/build/setup/copy.d.ts.map +1 -0
  120. package/build/setup/copy.js +290 -0
  121. package/build/setup/copy.js.map +1 -0
  122. package/build/setup/deps/buildDefaultDeps.d.ts +13 -0
  123. package/build/setup/deps/buildDefaultDeps.d.ts.map +1 -0
  124. package/build/setup/deps/buildDefaultDeps.js +29 -0
  125. package/build/setup/deps/buildDefaultDeps.js.map +1 -0
  126. package/build/setup/deps/clipboard.d.ts +12 -0
  127. package/build/setup/deps/clipboard.d.ts.map +1 -0
  128. package/build/setup/deps/clipboard.js +30 -0
  129. package/build/setup/deps/clipboard.js.map +1 -0
  130. package/build/setup/deps/clock.d.ts +10 -0
  131. package/build/setup/deps/clock.d.ts.map +1 -0
  132. package/build/setup/deps/clock.js +11 -0
  133. package/build/setup/deps/clock.js.map +1 -0
  134. package/build/setup/deps/context.d.ts +28 -0
  135. package/build/setup/deps/context.d.ts.map +1 -0
  136. package/build/setup/deps/context.js +24 -0
  137. package/build/setup/deps/context.js.map +1 -0
  138. package/build/setup/deps/docs.d.ts +41 -0
  139. package/build/setup/deps/docs.d.ts.map +1 -0
  140. package/build/setup/deps/docs.js +33 -0
  141. package/build/setup/deps/docs.js.map +1 -0
  142. package/build/setup/deps/index.d.ts +42 -0
  143. package/build/setup/deps/index.d.ts.map +1 -0
  144. package/build/setup/deps/index.js +16 -0
  145. package/build/setup/deps/index.js.map +1 -0
  146. package/build/setup/deps/phoenixClient.d.ts +22 -0
  147. package/build/setup/deps/phoenixClient.d.ts.map +1 -0
  148. package/build/setup/deps/phoenixClient.js +17 -0
  149. package/build/setup/deps/phoenixClient.js.map +1 -0
  150. package/build/setup/deps/processes.d.ts +28 -0
  151. package/build/setup/deps/processes.d.ts.map +1 -0
  152. package/build/setup/deps/processes.js +58 -0
  153. package/build/setup/deps/processes.js.map +1 -0
  154. package/build/setup/deps/prompter.d.ts +42 -0
  155. package/build/setup/deps/prompter.d.ts.map +1 -0
  156. package/build/setup/deps/prompter.js +10 -0
  157. package/build/setup/deps/prompter.js.map +1 -0
  158. package/build/setup/errors.d.ts +27 -0
  159. package/build/setup/errors.d.ts.map +1 -0
  160. package/build/setup/errors.js +36 -0
  161. package/build/setup/errors.js.map +1 -0
  162. package/build/setup/options.d.ts +113 -0
  163. package/build/setup/options.d.ts.map +1 -0
  164. package/build/setup/options.js +63 -0
  165. package/build/setup/options.js.map +1 -0
  166. package/build/setup/prompts/instrumentationPrompt.d.ts +42 -0
  167. package/build/setup/prompts/instrumentationPrompt.d.ts.map +1 -0
  168. package/build/setup/prompts/instrumentationPrompt.js +64 -0
  169. package/build/setup/prompts/instrumentationPrompt.js.map +1 -0
  170. package/build/setup/runSetup.d.ts +45 -0
  171. package/build/setup/runSetup.d.ts.map +1 -0
  172. package/build/setup/runSetup.js +212 -0
  173. package/build/setup/runSetup.js.map +1 -0
  174. package/build/setup/steps/chooseEndpoint.d.ts +36 -0
  175. package/build/setup/steps/chooseEndpoint.d.ts.map +1 -0
  176. package/build/setup/steps/chooseEndpoint.js +125 -0
  177. package/build/setup/steps/chooseEndpoint.js.map +1 -0
  178. package/build/setup/steps/confirmGitSafety.d.ts +17 -0
  179. package/build/setup/steps/confirmGitSafety.d.ts.map +1 -0
  180. package/build/setup/steps/confirmGitSafety.js +73 -0
  181. package/build/setup/steps/confirmGitSafety.js.map +1 -0
  182. package/build/setup/steps/establishConnection.d.ts +29 -0
  183. package/build/setup/steps/establishConnection.d.ts.map +1 -0
  184. package/build/setup/steps/establishConnection.js +143 -0
  185. package/build/setup/steps/establishConnection.js.map +1 -0
  186. package/build/setup/steps/installTooling.d.ts +28 -0
  187. package/build/setup/steps/installTooling.d.ts.map +1 -0
  188. package/build/setup/steps/installTooling.js +79 -0
  189. package/build/setup/steps/installTooling.js.map +1 -0
  190. package/build/setup/steps/instrumentApp.d.ts +41 -0
  191. package/build/setup/steps/instrumentApp.d.ts.map +1 -0
  192. package/build/setup/steps/instrumentApp.js +131 -0
  193. package/build/setup/steps/instrumentApp.js.map +1 -0
  194. package/build/setup/steps/offerPxProfile.d.ts +20 -0
  195. package/build/setup/steps/offerPxProfile.d.ts.map +1 -0
  196. package/build/setup/steps/offerPxProfile.js +95 -0
  197. package/build/setup/steps/offerPxProfile.js.map +1 -0
  198. package/build/setup/steps/prefetchDocs.d.ts +24 -0
  199. package/build/setup/steps/prefetchDocs.d.ts.map +1 -0
  200. package/build/setup/steps/prefetchDocs.js +49 -0
  201. package/build/setup/steps/prefetchDocs.js.map +1 -0
  202. package/build/setup/steps/verifyTraces.d.ts +44 -0
  203. package/build/setup/steps/verifyTraces.d.ts.map +1 -0
  204. package/build/setup/steps/verifyTraces.js +119 -0
  205. package/build/setup/steps/verifyTraces.js.map +1 -0
  206. package/build/setup/steps/writeEnvFile.d.ts +19 -0
  207. package/build/setup/steps/writeEnvFile.d.ts.map +1 -0
  208. package/build/setup/steps/writeEnvFile.js +50 -0
  209. package/build/setup/steps/writeEnvFile.js.map +1 -0
  210. package/build/setup/ui/clackPrompter.d.ts +11 -0
  211. package/build/setup/ui/clackPrompter.d.ts.map +1 -0
  212. package/build/setup/ui/clackPrompter.js +107 -0
  213. package/build/setup/ui/clackPrompter.js.map +1 -0
  214. package/build/setup/ui/selectBoolean.d.ts +18 -0
  215. package/build/setup/ui/selectBoolean.d.ts.map +1 -0
  216. package/build/setup/ui/selectBoolean.js +14 -0
  217. package/build/setup/ui/selectBoolean.js.map +1 -0
  218. package/build/setup/util/gitignoreCoverage.d.ts +24 -0
  219. package/build/setup/util/gitignoreCoverage.d.ts.map +1 -0
  220. package/build/setup/util/gitignoreCoverage.js +43 -0
  221. package/build/setup/util/gitignoreCoverage.js.map +1 -0
  222. package/build/setup/util/paths.d.ts +6 -0
  223. package/build/setup/util/paths.d.ts.map +1 -0
  224. package/build/setup/util/paths.js +23 -0
  225. package/build/setup/util/paths.js.map +1 -0
  226. package/build/setup/util/redact.d.ts +12 -0
  227. package/build/setup/util/redact.d.ts.map +1 -0
  228. package/build/setup/util/redact.js +31 -0
  229. package/build/setup/util/redact.js.map +1 -0
  230. package/build/validation/endpoint.d.ts +19 -0
  231. package/build/validation/endpoint.d.ts.map +1 -0
  232. package/build/validation/endpoint.js +39 -0
  233. package/build/validation/endpoint.js.map +1 -0
  234. package/build/version.js.map +1 -1
  235. package/package.json +15 -12
  236. package/build/commands/annotationMutationUtils.d.ts.map +0 -1
  237. package/build/commands/annotationMutationUtils.js.map +0 -1
  238. package/build/commands/noteMutationUtils.d.ts.map +0 -1
  239. package/build/commands/noteMutationUtils.js.map +0 -1
  240. package/build/commands/sessionAnnotationsCommand.d.ts.map +0 -1
  241. package/build/commands/sessionAnnotationsCommand.js.map +0 -1
  242. package/build/commands/spanAnnotationsCommand.d.ts +0 -7
  243. package/build/commands/spanAnnotationsCommand.d.ts.map +0 -1
  244. package/build/commands/spanAnnotationsCommand.js +0 -164
  245. package/build/commands/spanAnnotationsCommand.js.map +0 -1
  246. package/build/commands/traceAnnotationsCommand.d.ts +0 -7
  247. package/build/commands/traceAnnotationsCommand.d.ts.map +0 -1
  248. package/build/commands/traceAnnotationsCommand.js +0 -167
  249. package/build/commands/traceAnnotationsCommand.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/setup/deps/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,WAAW,SAAS;IACxB,8DAA8D;IAC9D,OAAO,EAAE,UAAU,CAAC;IACpB,uEAAuE;IACvE,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,aAAa,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,cAAc,EAAE,eAAe,CAAC;IAChC,sEAAsE;IACtE,YAAY,EAAE,oBAAoB,CAAC;IACnC,SAAS,EAAE,WAAW,CAAC;CACxB;AAED,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAChD,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,QAAQ,CAAC;AAChB,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC/E,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC1E,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Dependency seam for setup.
3
+ *
4
+ * Every side effect setup performs — env access, network, subprocesses,
5
+ * clipboard, time — goes through `SetupDeps`. No other module under `setup/`
6
+ * may touch `process.env`, `fetch`, `child_process`, or the clipboard
7
+ * directly. This is what makes setup unit-testable with fakes.
8
+ *
9
+ * Each capability's contract (and, where it is a few lines of system glue,
10
+ * its real implementation) lives in its own module in this directory. This
11
+ * barrel re-exports the contracts so consumers address the seam as one
12
+ * module; it exports types only, so importing it can never form a runtime
13
+ * cycle. The wiring lives in `buildDefaultDeps.ts`.
14
+ */
15
+ export { unknownWorkflowWarning } from "./docs.js";
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/setup/deps/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA0BH,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The Phoenix API capability: a factory for typed clients, so steps never
3
+ * construct one from ambient config. Tests inject a fake transport beneath
4
+ * the same real client.
5
+ */
6
+ import type { PhoenixClient } from "@arizeai/phoenix-client";
7
+ export interface PhoenixClientArgs {
8
+ /** Normalized origin, no trailing slash. */
9
+ endpoint: string;
10
+ /** Omitted for the unauthenticated auth probe. */
11
+ apiKey?: string;
12
+ }
13
+ export type PhoenixClientFactory = (args: PhoenixClientArgs) => PhoenixClient;
14
+ /**
15
+ * `apiUrl` is the hidden `--api-url` dev override: it reroutes setup's own
16
+ * API traffic while user-facing values — hand-off files, px profile, traces
17
+ * URLs — keep the endpoint the user chose.
18
+ */
19
+ export declare function createPhoenixClientFactory({ apiUrl, }?: {
20
+ apiUrl?: string;
21
+ }): PhoenixClientFactory;
22
+ //# sourceMappingURL=phoenixClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phoenixClient.d.ts","sourceRoot":"","sources":["../../../src/setup/deps/phoenixClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAI7D,MAAM,WAAW,iBAAiB;IAChC,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,IAAI,EAAE,iBAAiB,KAAK,aAAa,CAAC;AAE9E;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,MAAM,GACP,GAAE;IACD,MAAM,CAAC,EAAE,MAAM,CAAC;CACZ,GAAG,oBAAoB,CAK5B"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The Phoenix API capability: a factory for typed clients, so steps never
3
+ * construct one from ambient config. Tests inject a fake transport beneath
4
+ * the same real client.
5
+ */
6
+ import { createPhoenixClient } from "../../client.js";
7
+ /**
8
+ * `apiUrl` is the hidden `--api-url` dev override: it reroutes setup's own
9
+ * API traffic while user-facing values — hand-off files, px profile, traces
10
+ * URLs — keep the endpoint the user chose.
11
+ */
12
+ export function createPhoenixClientFactory({ apiUrl, } = {}) {
13
+ return ({ endpoint, apiKey }) => createPhoenixClient({
14
+ config: { endpoint: apiUrl ?? endpoint, apiKey },
15
+ });
16
+ }
17
+ //# sourceMappingURL=phoenixClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phoenixClient.js","sourceRoot":"","sources":["../../../src/setup/deps/phoenixClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAWnD;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,EACzC,MAAM,GACP,GAEG,EAAE;IACJ,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,CAC9B,mBAAmB,CAAC;QAClB,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,EAAE;KACjD,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The subprocess capability: one-shot probes (git checks, agent detection)
3
+ * and the interactive agent hand-off share these contracts and this runner.
4
+ */
5
+ export interface CommandSpec {
6
+ command: string;
7
+ args: string[];
8
+ stdin?: string;
9
+ env?: Record<string, string>;
10
+ cwd?: string;
11
+ /** Kill the child and resolve non-zero once this many ms elapse. */
12
+ timeoutMs?: number;
13
+ }
14
+ export interface ExecResult {
15
+ exitCode: number;
16
+ stdout: string;
17
+ stderr: string;
18
+ }
19
+ export interface ProcessRunner {
20
+ /** One-shot subprocess (git, probes). Never throws on non-zero exit. */
21
+ exec(spec: CommandSpec): Promise<ExecResult>;
22
+ /** Interactive subprocess with inherited stdio (agent hand-off). */
23
+ spawnInteractive(spec: CommandSpec): Promise<{
24
+ exitCode: number;
25
+ }>;
26
+ }
27
+ export declare function createSystemProcessRunner(): ProcessRunner;
28
+ //# sourceMappingURL=processes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processes.d.ts","sourceRoot":"","sources":["../../../src/setup/deps/processes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,IAAI,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7C,oEAAoE;IACpE,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpE;AAiDD,wBAAgB,yBAAyB,IAAI,aAAa,CAKzD"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * The subprocess capability: one-shot probes (git checks, agent detection)
3
+ * and the interactive agent hand-off share these contracts and this runner.
4
+ */
5
+ import * as process from "node:process";
6
+ // cross-spawn resolves .cmd/.bat shims on Windows (npm, npx, agent CLIs),
7
+ // where node's bare spawn fails with ENOENT unless given a shell.
8
+ import spawn from "cross-spawn";
9
+ function execOnce(spec) {
10
+ return new Promise((resolve) => {
11
+ const child = spawn(spec.command, spec.args, {
12
+ cwd: spec.cwd,
13
+ env: spec.env ? { ...process.env, ...spec.env } : process.env,
14
+ stdio: ["pipe", "pipe", "pipe"],
15
+ // Kills the child on expiry — a hung probe must not leave an orphaned
16
+ // subprocess behind. Surfaces as a non-zero exit via `close`.
17
+ timeout: spec.timeoutMs,
18
+ });
19
+ let stdout = "";
20
+ let stderr = "";
21
+ child.stdout?.on("data", (chunk) => {
22
+ stdout += chunk.toString("utf-8");
23
+ });
24
+ child.stderr?.on("data", (chunk) => {
25
+ stderr += chunk.toString("utf-8");
26
+ });
27
+ child.on("error", (error) => {
28
+ // Command not found and similar spawn failures surface as a non-zero
29
+ // exit with the message on stderr rather than a throw.
30
+ resolve({ exitCode: 127, stdout, stderr: String(error) });
31
+ });
32
+ child.on("close", (code) => {
33
+ resolve({ exitCode: code ?? 1, stdout, stderr });
34
+ });
35
+ if (spec.stdin !== undefined) {
36
+ child.stdin?.write(spec.stdin);
37
+ }
38
+ child.stdin?.end();
39
+ });
40
+ }
41
+ function spawnInteractiveChild(spec) {
42
+ return new Promise((resolve) => {
43
+ const child = spawn(spec.command, spec.args, {
44
+ cwd: spec.cwd,
45
+ env: spec.env ? { ...process.env, ...spec.env } : process.env,
46
+ stdio: "inherit",
47
+ });
48
+ child.on("error", () => resolve({ exitCode: 127 }));
49
+ child.on("close", (code) => resolve({ exitCode: code ?? 1 }));
50
+ });
51
+ }
52
+ export function createSystemProcessRunner() {
53
+ return {
54
+ exec: execOnce,
55
+ spawnInteractive: spawnInteractiveChild,
56
+ };
57
+ }
58
+ //# sourceMappingURL=processes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processes.js","sourceRoot":"","sources":["../../../src/setup/deps/processes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,0EAA0E;AAC1E,kEAAkE;AAClE,OAAO,KAAK,MAAM,aAAa,CAAC;AAyBhC,SAAS,QAAQ,CAAC,IAAiB;IACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,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AAC;QACH,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC7B,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;QACD,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,qBAAqB,CAAC,IAAiB;IAG9C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE;YAC3C,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG;YAC7D,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QACpD,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,gBAAgB,EAAE,qBAAqB;KACxC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The prompting capability: every question setup asks — selects, text,
3
+ * masked secrets — and every line it narrates between them.
4
+ *
5
+ * Contract only. The real terminal implementation is `ui/clackPrompter.ts`
6
+ * (kept with the rest of the UI, since rendering rules live there); tests
7
+ * script answers through `scriptedPrompter`.
8
+ */
9
+ export interface SelectOption<T> {
10
+ value: T;
11
+ label: string;
12
+ hint?: string;
13
+ /** Rendered unselectable with the reason appended to the label. */
14
+ disabled?: boolean;
15
+ }
16
+ export interface Prompter {
17
+ /** Throws SetupCancelledError on Ctrl-C / Escape. */
18
+ select<T>(args: {
19
+ message: string;
20
+ options: Array<SelectOption<T>>;
21
+ }): Promise<T>;
22
+ /** Throws SetupCancelledError on Ctrl-C / Escape. */
23
+ textInput(args: {
24
+ message: string;
25
+ defaultValue?: string;
26
+ validate?: (value: string) => string | undefined;
27
+ }): Promise<string>;
28
+ /** Masked input for secrets. Throws SetupCancelledError on Ctrl-C / Escape. */
29
+ passwordInput(args: {
30
+ message: string;
31
+ validate?: (value: string) => string | undefined;
32
+ }): Promise<string>;
33
+ /** Non-interactive display of a block of text between prompts. */
34
+ note(message: string, title?: string): void;
35
+ /** One-line status/warning between prompts (stderr). */
36
+ line(message: string): void;
37
+ /** Open the setup session frame. */
38
+ intro(message: string): void;
39
+ /** Close the setup session frame. */
40
+ outro(message: string): void;
41
+ }
42
+ //# sourceMappingURL=prompter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompter.d.ts","sourceRoot":"","sources":["../../../src/setup/deps/prompter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,qDAAqD;IACrD,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;KACjC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACf,qDAAqD;IACrD,SAAS,CAAC,IAAI,EAAE;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;KAClD,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpB,+EAA+E;IAC/E,aAAa,CAAC,IAAI,EAAE;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;KAClD,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpB,kEAAkE;IAClE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,wDAAwD;IACxD,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,oCAAoC;IACpC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,qCAAqC;IACrC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The prompting capability: every question setup asks — selects, text,
3
+ * masked secrets — and every line it narrates between them.
4
+ *
5
+ * Contract only. The real terminal implementation is `ui/clackPrompter.ts`
6
+ * (kept with the rest of the UI, since rendering rules live there); tests
7
+ * script answers through `scriptedPrompter`.
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=prompter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompter.js","sourceRoot":"","sources":["../../../src/setup/deps/prompter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Typed errors for setup.
3
+ *
4
+ * `SetupCancelledError` is thrown by the prompter whenever the user cancels
5
+ * (Ctrl-C / Escape on any prompt) and unwinds the whole of setup to a single
6
+ * catch site in the command handler, which prints the support outro and
7
+ * exits with `ExitCode.CANCELLED`.
8
+ */
9
+ export declare class SetupCancelledError extends Error {
10
+ constructor();
11
+ }
12
+ /**
13
+ * Thrown when input supplied via flags or environment variables is missing
14
+ * (headless mode) or invalid (any mode). Carries the exact remediation text
15
+ * so the command handler can print it and exit `INVALID_ARGUMENT`.
16
+ */
17
+ export declare class HeadlessInputError extends Error {
18
+ constructor(message: string);
19
+ }
20
+ /**
21
+ * Thrown when a step fails in a way setup cannot recover from
22
+ * (e.g. headless dirty git tree). Exits `FAILURE`.
23
+ */
24
+ export declare class SetupFatalError extends Error {
25
+ constructor(message: string);
26
+ }
27
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/setup/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,cAGC;CACF;AAED;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Typed errors for setup.
3
+ *
4
+ * `SetupCancelledError` is thrown by the prompter whenever the user cancels
5
+ * (Ctrl-C / Escape on any prompt) and unwinds the whole of setup to a single
6
+ * catch site in the command handler, which prints the support outro and
7
+ * exits with `ExitCode.CANCELLED`.
8
+ */
9
+ export class SetupCancelledError extends Error {
10
+ constructor() {
11
+ super("Setup cancelled by user");
12
+ this.name = "SetupCancelledError";
13
+ }
14
+ }
15
+ /**
16
+ * Thrown when input supplied via flags or environment variables is missing
17
+ * (headless mode) or invalid (any mode). Carries the exact remediation text
18
+ * so the command handler can print it and exit `INVALID_ARGUMENT`.
19
+ */
20
+ export class HeadlessInputError extends Error {
21
+ constructor(message) {
22
+ super(message);
23
+ this.name = "HeadlessInputError";
24
+ }
25
+ }
26
+ /**
27
+ * Thrown when a step fails in a way setup cannot recover from
28
+ * (e.g. headless dirty git tree). Exits `FAILURE`.
29
+ */
30
+ export class SetupFatalError extends Error {
31
+ constructor(message) {
32
+ super(message);
33
+ this.name = "SetupFatalError";
34
+ }
35
+ }
36
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/setup/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C;QACE,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Input resolution for setup.
3
+ *
4
+ * Follows px's `resolveConfig()` precedence — flags, then env, then
5
+ * defaults — additionally accepting `PHOENIX_COLLECTOR_ENDPOINT` and
6
+ * `PHOENIX_PROJECT_NAME` as endpoint/project aliases (#14131). There are no
7
+ * setup-specific env vars. Reads env only through `RunContext.env`.
8
+ *
9
+ * Note the `--no-input` flag (or a non-TTY stdin) — not the presence of env
10
+ * vars — is what opts into headless behavior: an ambient `PHOENIX_API_KEY`
11
+ * in a dev shell never silently short-circuits the interactive flow.
12
+ */
13
+ import { type CodingAgentId } from "./agents/registry.js";
14
+ import type { DocsPrefetchOptions, RunContext } from "./deps/index.js";
15
+ /**
16
+ * The parsed `px setup` flags, as the command layer hands them over. Every
17
+ * choice setup would prompt for has a field here, which is what lets an
18
+ * unattended caller — CI, or a coding agent — run the same flow a human
19
+ * clicks through. Raw material for {@link resolveSetupInputs}; steps only
20
+ * ever see the resolved {@link SetupInputs}.
21
+ */
22
+ export interface SetupOptions {
23
+ /** --endpoint: pre-answer the endpoint question */
24
+ endpoint?: string;
25
+ /** --project: name or Relay Global ID */
26
+ project?: string;
27
+ /** --no-input: headless mode (also auto-on when !stdin.isTTY, per px convention) */
28
+ noInput?: boolean;
29
+ /**
30
+ * Hidden --api-url: base URL for setup's own API calls (dev).
31
+ * User-facing values — hand-off files, px profile, traces URLs — keep the
32
+ * endpoint the user chose.
33
+ */
34
+ apiUrl?: string;
35
+ /**
36
+ * --agent: pre-answer the instrumentation lane with a coding agent id.
37
+ * Validated against the registry at the command layer. Headless
38
+ * instrumentation requires it — there is no prompt to fall back to.
39
+ */
40
+ agent?: CodingAgentId;
41
+ /**
42
+ * --language: languages to instrument. Passed to the agent so it skips its
43
+ * own detection; empty means "detect it yourself".
44
+ */
45
+ languages?: string[];
46
+ /**
47
+ * --instrument / --no-instrument: run the instrumentation hand-off.
48
+ * Undefined means "decide by lane" — interactive asks, headless skips
49
+ * (registration-only stays the default for an unattended run, so `px setup
50
+ * --no-input` in CI never edits source that nobody asked it to touch).
51
+ */
52
+ instrument?: boolean;
53
+ /** --skills / --no-skills: offer the coding-agent skills install. */
54
+ skills?: boolean;
55
+ /**
56
+ * --yolo: let the agent run without its own permission prompts. Required in
57
+ * practice for a background run, which has no terminal to approve on.
58
+ */
59
+ bypassPermissions?: boolean;
60
+ /**
61
+ * --background: run the agent to completion without its TUI. Implied when
62
+ * setup itself is headless — there is no terminal to hand over.
63
+ */
64
+ background?: boolean;
65
+ /** Docs prefetch, so the agent instruments against local docs. */
66
+ docs?: DocsPrefetchOptions;
67
+ }
68
+ export interface SetupInputs {
69
+ /** Pre-answered endpoint (flag, else env), if any. */
70
+ endpoint?: string;
71
+ /** Pre-answered project name or Relay Global ID (flag, else env), if any. */
72
+ project?: string;
73
+ /** API key from env — used by the headless auth-on lane only. */
74
+ apiKey?: string;
75
+ /** True when --no-input was passed or stdin is not a TTY. */
76
+ headless: boolean;
77
+ /** Pre-answered instrumentation lane, if `--agent` named one. */
78
+ agent?: CodingAgentId;
79
+ /** Languages to instrument; empty means the agent detects them itself. */
80
+ languages: string[];
81
+ /**
82
+ * Whether to run the instrumentation hand-off. Interactive defaults to
83
+ * true (it is the point of setup); headless defaults to false, so an
84
+ * unattended run registers without ever editing source unless asked.
85
+ */
86
+ instrument: boolean;
87
+ /** Whether to offer/install the coding-agent skills; undefined means ask. */
88
+ skills?: boolean;
89
+ /** Run the agent without its TUI. Always true when setup is headless. */
90
+ background: boolean;
91
+ /** Run the agent without its own permission prompts (`--yolo`). */
92
+ bypassPermissions: boolean;
93
+ /** Docs prefetch; only consulted when `instrument` is true. */
94
+ docs: DocsPrefetchOptions;
95
+ }
96
+ /**
97
+ * A headless run that instruments must name its agent: there is no prompt to
98
+ * pick a lane from, and silently falling back to one would be a coin flip over
99
+ * which agent edits the caller's source.
100
+ *
101
+ * `px setup instrument` calls this directly — its lane is instrumentation by
102
+ * definition, so it never passes `--instrument` for `resolveSetupInputs` to
103
+ * catch.
104
+ */
105
+ export declare function assertAgentForHeadlessInstrument({ headless, agent, }: {
106
+ headless: boolean;
107
+ agent?: CodingAgentId;
108
+ }): void;
109
+ export declare function resolveSetupInputs({ options, context, }: {
110
+ options: SetupOptions;
111
+ context: Pick<RunContext, "env" | "stdinIsTTY">;
112
+ }): SetupInputs;
113
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/setup/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,mBAAmB,C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AAI,EAAE,mBAAmB,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,gCAAgC,CAAC,EAC/C,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,GAAG,IAAI,CAIP;AAED,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,OAAO,GACR,EAAE;IACD,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,GAAG,YAAY,CAAC,CAAC;CACjD,GAAG,WAAW,CAqCd"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Input resolution for setup.
3
+ *
4
+ * Follows px's `resolveConfig()` precedence — flags, then env, then
5
+ * defaults — additionally accepting `PHOENIX_COLLECTOR_ENDPOINT` and
6
+ * `PHOENIX_PROJECT_NAME` as endpoint/project aliases (#14131). There are no
7
+ * setup-specific env vars. Reads env only through `RunContext.env`.
8
+ *
9
+ * Note the `--no-input` flag (or a non-TTY stdin) — not the presence of env
10
+ * vars — is what opts into headless behavior: an ambient `PHOENIX_API_KEY`
11
+ * in a dev shell never silently short-circuits the interactive flow.
12
+ */
13
+ import { CODING_AGENT_IDS } from "./agents/registry.js";
14
+ import * as COPY from "./copy.js";
15
+ import { HeadlessInputError } from "./errors.js";
16
+ /**
17
+ * A headless run that instruments must name its agent: there is no prompt to
18
+ * pick a lane from, and silently falling back to one would be a coin flip over
19
+ * which agent edits the caller's source.
20
+ *
21
+ * `px setup instrument` calls this directly — its lane is instrumentation by
22
+ * definition, so it never passes `--instrument` for `resolveSetupInputs` to
23
+ * catch.
24
+ */
25
+ export function assertAgentForHeadlessInstrument({ headless, agent, }) {
26
+ if (headless && agent === undefined) {
27
+ throw new HeadlessInputError(COPY.HEADLESS.agentRequired(CODING_AGENT_IDS));
28
+ }
29
+ }
30
+ export function resolveSetupInputs({ options, context, }) {
31
+ const { env } = context;
32
+ const endpoint = options.endpoint ??
33
+ env.PHOENIX_HOST ??
34
+ env.PHOENIX_COLLECTOR_ENDPOINT ??
35
+ undefined;
36
+ const project = options.project ??
37
+ env.PHOENIX_PROJECT ??
38
+ env.PHOENIX_PROJECT_NAME ??
39
+ undefined;
40
+ const apiKey = env.PHOENIX_API_KEY ?? undefined;
41
+ const headless = Boolean(options.noInput) || !context.stdinIsTTY;
42
+ // Interactive setup exists to instrument; an unattended run does not
43
+ // touch source unless the caller asked for it by name.
44
+ const instrument = options.instrument ?? !headless;
45
+ if (instrument) {
46
+ assertAgentForHeadlessInstrument({ headless, agent: options.agent });
47
+ }
48
+ return {
49
+ endpoint: endpoint?.trim() || undefined,
50
+ project: project?.trim() || undefined,
51
+ apiKey: apiKey?.trim() || undefined,
52
+ headless,
53
+ agent: options.agent,
54
+ languages: options.languages ?? [],
55
+ instrument,
56
+ skills: options.skills,
57
+ // A headless run has no terminal to hand to the agent's TUI.
58
+ background: options.background ?? headless,
59
+ bypassPermissions: Boolean(options.bypassPermissions),
60
+ docs: options.docs ?? { enabled: true },
61
+ };
62
+ }
63
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/setup/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,gBAAgB,EAAsB,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAqF9C;;;;;;;;GAQG;AACH,MAAM,UAAU,gCAAgC,CAAC,EAC/C,QAAQ,EACR,KAAK,GAIN;IACC,IAAI,QAAQ,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACpC,MAAM,IAAI,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC;AAED,MAAM,UAAU,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AAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The instrumentation prompt handed to a coding agent.
3
+ *
4
+ * One shared template serves the launched-agent and copy-to-clipboard lanes.
5
+ * Every rule is load-bearing — do not trim a rule without replacing the
6
+ * protection it provides. The prompt leans
7
+ * on the docs for package names and APIs (language-scoped quickstarts plus
8
+ * the integrations index) rather than inlining instructions that go stale.
9
+ * Setup independently verifies traces against the Phoenix API after the
10
+ * agent finishes, so the agent's job ends with an emitted trace, not a
11
+ * self-report.
12
+ */
13
+ export interface InstrumentationPromptDocs {
14
+ /** Python quickstart (arize-phoenix-otel). */
15
+ quickstartPython: string;
16
+ /** TypeScript quickstart (@arizeai/phoenix-otel). */
17
+ quickstartTypeScript: string;
18
+ /** phoenix.otel register() reference. */
19
+ phoenixOtelSetup: string;
20
+ /** Per-framework/provider auto-instrumentation guides. */
21
+ integrationsIndex: string;
22
+ }
23
+ export interface InstrumentationPromptArgs {
24
+ projectName: string;
25
+ endpoint: string;
26
+ isDefaultEndpoint: boolean;
27
+ docs: InstrumentationPromptDocs;
28
+ tracesUrl: string;
29
+ authEnabled: boolean;
30
+ /**
31
+ * `--language` values. Non-empty replaces the agent's own language
32
+ * detection, which is the slowest and least reliable thing it does.
33
+ */
34
+ languages?: string[];
35
+ /**
36
+ * Directory the docs prefetch wrote, when it ran. The agent reads those
37
+ * pages from disk instead of fetching the URLs mid-run.
38
+ */
39
+ localDocsDir?: string;
40
+ }
41
+ export declare function buildInstrumentationPrompt({ projectName, endpoint, isDefaultEndpoint, docs, tracesUrl, authEnabled, languages, localDocsDir, }: InstrumentationPromptArgs): string;
42
+ //# sourceMappingURL=instrumentationPrompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentationPrompt.d.ts","sourceRoot":"","sources":["../../../src/setup/prompts/instrumentationPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,yBAAyB;IACxC,8CAA8C;IAC9C,gBAAgB,EAAE,MAAM,CAAC;IACzB,qDAAqD;IACrD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,yCAAyC;IACzC,gBAAgB,EAAE,MAAM,CAAC;IACzB,0DAA0D;IAC1D,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,IAAI,EAAE,yBAAyB,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,0BAA0B,CAAC,EACzC,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,IAAI,EACJ,SAAS,EACT,WAAW,EACX,SAAc,EACd,YAAY,GACb,EAAE,yBAAyB,GAAG,MAAM,CAoDpC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * The instrumentation prompt handed to a coding agent.
3
+ *
4
+ * One shared template serves the launched-agent and copy-to-clipboard lanes.
5
+ * Every rule is load-bearing — do not trim a rule without replacing the
6
+ * protection it provides. The prompt leans
7
+ * on the docs for package names and APIs (language-scoped quickstarts plus
8
+ * the integrations index) rather than inlining instructions that go stale.
9
+ * Setup independently verifies traces against the Phoenix API after the
10
+ * agent finishes, so the agent's job ends with an emitted trace, not a
11
+ * self-report.
12
+ */
13
+ export function buildInstrumentationPrompt({ projectName, endpoint, isDefaultEndpoint, docs, tracesUrl, authEnabled, languages = [], localDocsDir, }) {
14
+ const credentialVars = authEnabled
15
+ ? "PHOENIX_COLLECTOR_ENDPOINT and PHOENIX_API_KEY"
16
+ : "PHOENIX_COLLECTOR_ENDPOINT";
17
+ const endpointRule = isDefaultEndpoint
18
+ ? ""
19
+ : `\n Also set the collector endpoint in code only if the quickstart says to; it is ${endpoint}.`;
20
+ const languageRule = languages.length > 0
21
+ ? `The app's language is ${languages.join(" and ")} — do not spend time detecting it.`
22
+ : "Detect the app's language, follow the matching quickstart, and use the integration guide\nfor the app's LLM framework or provider.";
23
+ const localDocsRule = localDocsDir
24
+ ? `\nThese pages are already downloaded to ${localDocsDir} — read them from disk first, and only\nfetch a URL if the page you need is missing there.`
25
+ : "";
26
+ return `You are running as part of the Phoenix setup script. Your ONLY task is to add Phoenix
27
+ tracing to the application in the current working directory and emit one verification
28
+ trace. Do not run setup tools, onboarding scripts, or "px setup" again.
29
+
30
+ Work from the official docs — do not guess package names or APIs from memory:
31
+ - Python quickstart (arize-phoenix-otel): ${docs.quickstartPython}
32
+ - TypeScript quickstart (@arizeai/phoenix-otel): ${docs.quickstartTypeScript}
33
+ - register() reference: ${docs.phoenixOtelSetup}
34
+ - Auto-instrumentation guides by framework/provider: ${docs.integrationsIndex}${localDocsRule}
35
+ ${languageRule}
36
+
37
+ Rules:
38
+ 1. Tracing only. Do not add evals, datasets, prompts, dashboards, or any other feature.
39
+ 2. Credentials are provided via environment variables (${credentialVars}), which Phoenix SDKs read
40
+ automatically. If they are not set in your shell, apply them with
41
+ \`set -a; source .env.phoenix; set +a\` before the verification run. NEVER print the
42
+ contents of \`.env.phoenix\`, never print the API key, and never
43
+ write the API key or any secret into source code, config files, or command arguments.
44
+ 3. Configure the Phoenix project name in code: use the SDK's register call with the
45
+ project name "${projectName}".${endpointRule}
46
+ 4. Prefer auto-instrumentation packages over hand-written span wrappers. Make the smallest
47
+ correct change.
48
+ 5. Verify your work by emitting exactly one trace: run the app briefly, or a minimal
49
+ throwaway script that makes one real LLM call through the instrumented path, then
50
+ delete any throwaway script. Do not run the full test suite or the build.
51
+ 6. Install SDK packages with the project's existing package manager, pinned to the latest
52
+ stable version you can verify. If this is a monorepo, note the root but only modify
53
+ files at or below the current working directory.
54
+ 7. Keep changes concise and readable. Do not restructure, reformat, or meaningfully modify
55
+ existing application code.
56
+ 8. Do not use the \`px\` CLI.
57
+
58
+ When finished, end your final message with a one-line summary of the changes you made and
59
+ this link to the project's traces: ${tracesUrl}
60
+ If you could not complete the task or could not emit a verification trace, say so plainly
61
+ with a one-paragraph reason instead.
62
+ `;
63
+ }
64
+ //# sourceMappingURL=instrumentationPrompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentationPrompt.js","sourceRoot":"","sources":["../../../src/setup/prompts/instrumentationPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAgCH,MAAM,UAAU,0BAA0B,CAAC,EACzC,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,IAAI,EACJ,SAAS,EACT,WAAW,EACX,SAAS,GAAG,EAAE,EACd,YAAY,GACc;IAC1B,MAAM,cAAc,GAAG,WAAW;QAChC,CAAC,CAAC,gDAAgD;QAClD,CAAC,CAAC,4BAA4B,CAAC;IACjC,MAAM,YAAY,GAAG,iBAAiB;QACpC,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,sFAAsF,QAAQ,GAAG,CAAC;IACtG,MAAM,YAAY,GAChB,SAAS,CAAC,MAAM,GAAG,CAAC;QAClB,CAAC,CAAC,yBAAyB,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,oCAAoC;QACtF,CAAC,CAAC,oIAAoI,CAAC;IAC3I,MAAM,aAAa,GAAG,YAAY;QAChC,CAAC,CAAC,2CAA2C,YAAY,4FAA4F;QACrJ,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO;;;;;4CAKmC,IAAI,CAAC,gBAAgB;mDACd,IAAI,CAAC,oBAAoB;0BAClD,IAAI,CAAC,gBAAgB;uDACQ,IAAI,CAAC,iBAAiB,GAAG,aAAa;EAC3F,YAAY;;;;yDAI2C,cAAc;;;;;;mBAMpD,WAAW,KAAK,YAAY;;;;;;;;;;;;;;qCAcV,SAAS;;;CAG7C,CAAC;AACF,CAAC"}