@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.
@@ -1863,9 +1863,9 @@ async function runAgentWizard(_config, options = {}) {
1863
1863
  if (keyAttempts === 1) {
1864
1864
  p.note(
1865
1865
  `To get your API key:
1866
- 1. Go to ${import_chalk.default.cyan("https://app.datalyr.com/settings/api")}
1867
- 2. Create a new API key (or copy existing)
1868
- 3. Paste it below`,
1866
+ 1. Go to ${import_chalk.default.cyan("https://app.datalyr.com")}
1867
+ 2. Open your workspace settings
1868
+ 3. Copy your API key and paste it below`,
1869
1869
  "API Key Required"
1870
1870
  );
1871
1871
  }
@@ -1888,38 +1888,8 @@ async function runAgentWizard(_config, options = {}) {
1888
1888
  const validateSpinner = p.spinner();
1889
1889
  validateSpinner.start("Validating API key...");
1890
1890
  try {
1891
- const defaultWorkspace = await validateApiKey(apiKey);
1892
- const allWorkspaces = await fetchWorkspaces(apiKey);
1893
- if (allWorkspaces.length > 1) {
1894
- validateSpinner.stop("API key validated");
1895
- const workspaceChoice = await p.select({
1896
- message: "Select a workspace to configure:",
1897
- options: allWorkspaces.map((w) => ({
1898
- value: w.id,
1899
- label: w.name,
1900
- hint: w.domain || void 0
1901
- }))
1902
- });
1903
- if (p.isCancel(workspaceChoice)) {
1904
- p.cancel("Wizard cancelled");
1905
- return { success: false, error: "User cancelled" };
1906
- }
1907
- const selectedWorkspace = allWorkspaces.find((w) => w.id === workspaceChoice);
1908
- if (selectedWorkspace) {
1909
- workspace = {
1910
- id: selectedWorkspace.id,
1911
- name: selectedWorkspace.name,
1912
- timezone: null,
1913
- domain: selectedWorkspace.domain
1914
- };
1915
- } else {
1916
- workspace = defaultWorkspace;
1917
- }
1918
- p.log.info(`Selected workspace: ${import_chalk.default.cyan(workspace.name)}`);
1919
- } else {
1920
- workspace = defaultWorkspace;
1921
- validateSpinner.stop(`Workspace: ${import_chalk.default.cyan(workspace.name)}`);
1922
- }
1891
+ workspace = await validateApiKey(apiKey);
1892
+ validateSpinner.stop(`Workspace: ${import_chalk.default.cyan(workspace.name)}`);
1923
1893
  } catch (error) {
1924
1894
  validateSpinner.stop(import_chalk.default.red("Invalid API key"));
1925
1895
  const errorMessage = error instanceof Error ? error.message : "Failed to validate API key";
@@ -2494,27 +2464,6 @@ async function validateApiKey(apiKey) {
2494
2464
  }
2495
2465
  return result.workspace;
2496
2466
  }
2497
- async function fetchWorkspaces(apiKey) {
2498
- const controller = new AbortController();
2499
- const timeoutId = setTimeout(() => controller.abort(), 3e4);
2500
- const response = await fetch(`${LLM_GATEWAY_URL}/workspaces`, {
2501
- method: "POST",
2502
- headers: {
2503
- "Content-Type": "application/json"
2504
- },
2505
- body: JSON.stringify({ apiKey }),
2506
- signal: controller.signal
2507
- });
2508
- clearTimeout(timeoutId);
2509
- if (!response.ok) {
2510
- return [];
2511
- }
2512
- const result = await response.json();
2513
- if (!result.success || !result.workspaces) {
2514
- return [];
2515
- }
2516
- return result.workspaces;
2517
- }
2518
2467
  async function verifyInstallation(apiKey, workspaceId) {
2519
2468
  try {
2520
2469
  const controller = new AbortController();