@aivin-labs/cli 1.0.47 → 1.0.51

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 (34) hide show
  1. package/README.md +1 -1
  2. package/bin/cli.mjs +1 -1
  3. package/bin/lib/auth.mjs +1 -1
  4. package/bin/lib/context.mjs +3 -3
  5. package/bin/lib/openFile.mjs +3 -2
  6. package/bin/lib/remote/client.mjs +1418 -1221
  7. package/bin/lib/remote/confirmBarrier.mjs +45 -0
  8. package/bin/lib/remote/constants.mjs +3 -1
  9. package/bin/lib/remote/desktop/aivinIco.mjs +696 -0
  10. package/bin/lib/remote/desktop/castAuth.mjs +23 -9
  11. package/bin/lib/remote/desktop/castConsent.mjs +37 -6
  12. package/bin/lib/remote/desktop/castFileDrop.mjs +24 -0
  13. package/bin/lib/remote/desktop/castInput.mjs +63 -19
  14. package/bin/lib/remote/desktop/castTouchViewers.mjs +26 -0
  15. package/bin/lib/remote/desktop/desktopCast.mjs +25 -2
  16. package/bin/lib/remote/desktop/desktopCastSource.mjs +298 -101
  17. package/bin/lib/remote/desktop/index.mjs +5 -3
  18. package/bin/lib/remote/desktop/traySource.mjs +1385 -1343
  19. package/bin/lib/remote/desktop/webrtcWorker.mjs +3 -0
  20. package/bin/lib/remote/deviceProfile.mjs +2 -0
  21. package/bin/lib/remote/gui/index.mjs +485 -480
  22. package/bin/lib/remote/humanInput.mjs +117 -0
  23. package/bin/lib/remote/idempotency.mjs +19 -2
  24. package/bin/lib/remote/keepAwake.mjs +15 -9
  25. package/bin/lib/remote/localConfirm.mjs +26 -7
  26. package/bin/lib/remote/mascot/ask.mjs +23 -4
  27. package/bin/lib/remote/mascot/askHostSource.mjs +10 -4
  28. package/bin/lib/remote/processes.mjs +231 -230
  29. package/bin/lib/remote/scheduler.mjs +164 -124
  30. package/bin/lib/remote/toolHandlers.mjs +3 -2
  31. package/bin/lib/remote/winTree.mjs +29 -0
  32. package/bin/lib/servers.mjs +31 -1
  33. package/docs/CLI.md +2 -2
  34. package/package.json +1 -1
package/README.md CHANGED
@@ -243,7 +243,7 @@ my-plugin/
243
243
  | :--- | :--- | :--- |
244
244
  | `SDK_ENDPOINT` | SDK gRPC connection | `sdk.aivin.cloud:443` |
245
245
  | `AIVIN_BASE_URL` | API endpoints (`deploy`, `test`, `login`) | `https://api.aivin.cloud` |
246
- | `AIVIN_WEB_URL` | Web dashboard & browser login | `https://brain.aivin.cloud` |
246
+ | `AIVIN_WEB_URL` | Web dashboard & browser login | `https://app.aivin.cloud` |
247
247
  | `LOCAL_TEST_PORT` | Local test HTTP port (`aivin start`) | `4001` |
248
248
  | `LOCAL_TEST_HOST` | Local test bind host | `127.0.0.1` |
249
249
  | `AIVIN_SANDBOX_WORKER` | Isolated thread execution | `false` |
package/bin/cli.mjs CHANGED
@@ -910,7 +910,7 @@ program
910
910
  // returns null - warn instead of silently opening the PRODUCTION web app's login page,
911
911
  // which would mint a key for the wrong server without any indication why.
912
912
  console.log(chalk.yellow(`⚠️ Couldn't reach ${resolvedBaseUrl} to resolve its web app URL - check the host is correct.`));
913
- console.log(chalk.yellow(` Falling back to the production web app (https://brain.aivin.cloud) - the key it mints will still be saved against ${resolvedBaseUrl}, likely NOT what you want.`));
913
+ console.log(chalk.yellow(` Falling back to the production web app (https://app.aivin.cloud) - the key it mints will still be saved against ${resolvedBaseUrl}, likely NOT what you want.`));
914
914
  }
915
915
  }
916
916
 
package/bin/lib/auth.mjs CHANGED
@@ -58,7 +58,7 @@ export function openBrowser(url) {
58
58
  export async function browserLogin() {
59
59
  // Defaults to the production web app - override with AIVIN_WEB_URL only if you're pointing at a
60
60
  // local/dev/staging frontend instead.
61
- const webBaseUrl = process.env.AIVIN_WEB_URL || 'https://brain.aivin.cloud';
61
+ const webBaseUrl = process.env.AIVIN_WEB_URL || 'https://app.aivin.cloud';
62
62
 
63
63
  const state = randomBytes(16).toString('hex');
64
64
  let resolveKey, rejectKey;
@@ -3,7 +3,7 @@ import path from 'path';
3
3
  import os from 'os';
4
4
  import axios from 'axios';
5
5
  import { execFileSync } from 'child_process';
6
- import { readActiveServer, resolveServerUrl, serverKey, setActiveServer } from './servers.mjs';
6
+ import { readActiveServer, resolveServerUrl, serverKey, setActiveServer, webUrlForServer } from './servers.mjs';
7
7
 
8
8
  export const GLOBAL_CREDENTIALS_PATH = path.join(os.homedir(), '.aivin', 'credentials');
9
9
  export const DEFAULT_AIVIN_BASE_URL = 'https://api.aivin.cloud';
@@ -19,7 +19,7 @@ export function deriveSdkEndpoint(baseUrl) {
19
19
  export async function fetchWebUrl(baseUrl) {
20
20
  try {
21
21
  const res = await axios.get(`${resolveServerUrl(baseUrl)}/setting/lang/default`, { timeout: 5000 });
22
- return typeof res.data?.app_url === 'string' && res.data.app_url ? res.data.app_url : null;
22
+ return typeof res.data?.app_url === 'string' && res.data.app_url ? webUrlForServer(baseUrl, res.data.app_url) : null;
23
23
  } catch { return null; }
24
24
  }
25
25
 
@@ -94,4 +94,4 @@ export function saveActiveContext(baseUrl, apiKey, identity = {}) {
94
94
  writeCredentialStore(store);
95
95
  setActiveServer(normalized);
96
96
  return store.contexts[serverKey(normalized)].sdk_endpoint;
97
- }
97
+ }
@@ -4,6 +4,7 @@ import path from 'path';
4
4
  import axios from 'axios';
5
5
  import { createHash } from 'crypto';
6
6
  import { fetchWebUrl } from './context.mjs';
7
+ import { defaultWebUrl } from './servers.mjs';
7
8
  import { startPreviewServer } from './localPreview.mjs';
8
9
  import { missionAuthHeaders, missionServerUrl, resolveWorkspace } from './workspace.mjs';
9
10
  import { spawn } from 'child_process';
@@ -21,7 +22,7 @@ import { mascotLang } from './remote/mascot/strings.mjs';
21
22
 
22
23
  export const OPEN_INDEX_FILE = path.join(os.homedir(), '.aivin', 'opened-files.json');
23
24
  const MAX_INDEX_ENTRIES = 500;
24
- const DEFAULT_WEB_URL = 'https://brain.aivin.cloud';
25
+ const DEFAULT_WEB_URL = 'https://app.aivin.cloud';
25
26
 
26
27
  export const OpenDisplay = Object.freeze({ WINDOW: 'window', TAB: 'tab', NONE: 'none' });
27
28
 
@@ -175,7 +176,7 @@ function showUrl(url, mode) {
175
176
  }
176
177
 
177
178
  async function resolveWebUrl(serverUrl) {
178
- return process.env.AIVIN_WEB_URL || (await fetchWebUrl(serverUrl)) || DEFAULT_WEB_URL;
179
+ return process.env.AIVIN_WEB_URL || (await fetchWebUrl(serverUrl)) || defaultWebUrl(serverUrl) || DEFAULT_WEB_URL;
179
180
  }
180
181
 
181
182
  /**