@datalyr/wizard 1.0.2 → 1.0.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.
package/dist/index.js CHANGED
@@ -2844,9 +2844,9 @@ async function runAgentWizard(_config, options = {}) {
2844
2844
  if (keyAttempts === 1) {
2845
2845
  p.note(
2846
2846
  `To get your API key:
2847
- 1. Go to ${import_chalk4.default.cyan("https://app.datalyr.com/settings/api")}
2848
- 2. Create a new API key (or copy existing)
2849
- 3. Paste it below`,
2847
+ 1. Go to ${import_chalk4.default.cyan("https://app.datalyr.com")}
2848
+ 2. Open your workspace settings
2849
+ 3. Copy your API key and paste it below`,
2850
2850
  "API Key Required"
2851
2851
  );
2852
2852
  }
@@ -2869,38 +2869,8 @@ async function runAgentWizard(_config, options = {}) {
2869
2869
  const validateSpinner = p.spinner();
2870
2870
  validateSpinner.start("Validating API key...");
2871
2871
  try {
2872
- const defaultWorkspace = await validateApiKey(apiKey);
2873
- const allWorkspaces = await fetchWorkspaces(apiKey);
2874
- if (allWorkspaces.length > 1) {
2875
- validateSpinner.stop("API key validated");
2876
- const workspaceChoice = await p.select({
2877
- message: "Select a workspace to configure:",
2878
- options: allWorkspaces.map((w) => ({
2879
- value: w.id,
2880
- label: w.name,
2881
- hint: w.domain || void 0
2882
- }))
2883
- });
2884
- if (p.isCancel(workspaceChoice)) {
2885
- p.cancel("Wizard cancelled");
2886
- return { success: false, error: "User cancelled" };
2887
- }
2888
- const selectedWorkspace = allWorkspaces.find((w) => w.id === workspaceChoice);
2889
- if (selectedWorkspace) {
2890
- workspace = {
2891
- id: selectedWorkspace.id,
2892
- name: selectedWorkspace.name,
2893
- timezone: null,
2894
- domain: selectedWorkspace.domain
2895
- };
2896
- } else {
2897
- workspace = defaultWorkspace;
2898
- }
2899
- p.log.info(`Selected workspace: ${import_chalk4.default.cyan(workspace.name)}`);
2900
- } else {
2901
- workspace = defaultWorkspace;
2902
- validateSpinner.stop(`Workspace: ${import_chalk4.default.cyan(workspace.name)}`);
2903
- }
2872
+ workspace = await validateApiKey(apiKey);
2873
+ validateSpinner.stop(`Workspace: ${import_chalk4.default.cyan(workspace.name)}`);
2904
2874
  } catch (error) {
2905
2875
  validateSpinner.stop(import_chalk4.default.red("Invalid API key"));
2906
2876
  const errorMessage = error instanceof Error ? error.message : "Failed to validate API key";
@@ -3475,27 +3445,6 @@ async function validateApiKey(apiKey) {
3475
3445
  }
3476
3446
  return result.workspace;
3477
3447
  }
3478
- async function fetchWorkspaces(apiKey) {
3479
- const controller = new AbortController();
3480
- const timeoutId = setTimeout(() => controller.abort(), 3e4);
3481
- const response = await fetch(`${LLM_GATEWAY_URL}/workspaces`, {
3482
- method: "POST",
3483
- headers: {
3484
- "Content-Type": "application/json"
3485
- },
3486
- body: JSON.stringify({ apiKey }),
3487
- signal: controller.signal
3488
- });
3489
- clearTimeout(timeoutId);
3490
- if (!response.ok) {
3491
- return [];
3492
- }
3493
- const result = await response.json();
3494
- if (!result.success || !result.workspaces) {
3495
- return [];
3496
- }
3497
- return result.workspaces;
3498
- }
3499
3448
  async function verifyInstallation(apiKey, workspaceId) {
3500
3449
  try {
3501
3450
  const controller = new AbortController();