@layr-labs/ecloud-sdk 0.1.0-rc.1 → 0.1.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.
package/dist/index.cjs CHANGED
@@ -30,17 +30,26 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ NoopClient: () => NoopClient,
33
34
  PRIMARY_LANGUAGES: () => PRIMARY_LANGUAGES,
35
+ PostHogClient: () => PostHogClient,
34
36
  UserApiClient: () => UserApiClient,
37
+ addMetric: () => addMetric,
38
+ addMetricWithDimensions: () => addMetricWithDimensions,
35
39
  assertValidFilePath: () => assertValidFilePath,
36
40
  assertValidImageReference: () => assertValidImageReference,
37
41
  assertValidPrivateKey: () => assertValidPrivateKey,
42
+ checkERC7702Delegation: () => checkERC7702Delegation,
38
43
  createApp: () => createApp,
39
- createAppModule: () => createAppModule,
44
+ createAppEnvironment: () => createAppEnvironment,
40
45
  createBillingModule: () => createBillingModule,
46
+ createComputeModule: () => createComputeModule,
41
47
  createECloudClient: () => createECloudClient,
48
+ createMetricsContext: () => createMetricsContext,
49
+ createTelemetryClient: () => createTelemetryClient,
42
50
  deleteLegacyPrivateKey: () => deleteLegacyPrivateKey,
43
51
  deletePrivateKey: () => deletePrivateKey,
52
+ emitMetrics: () => emitMetrics,
44
53
  encodeStartAppData: () => encodeStartAppData,
45
54
  encodeStopAppData: () => encodeStopAppData,
46
55
  encodeTerminateAppData: () => encodeTerminateAppData,
@@ -64,11 +73,14 @@ __export(index_exports, {
64
73
  getEnvironmentConfig: () => getEnvironmentConfig,
65
74
  getLegacyKeys: () => getLegacyKeys,
66
75
  getLegacyPrivateKey: () => getLegacyPrivateKey,
76
+ getPostHogAPIKey: () => getPostHogAPIKey,
77
+ getPostHogEndpoint: () => getPostHogEndpoint,
67
78
  getPrivateKey: () => getPrivateKey,
68
79
  getPrivateKeyWithSource: () => getPrivateKeyWithSource,
69
80
  getTemplate: () => getTemplate,
70
81
  isEnvironmentAvailable: () => isEnvironmentAvailable,
71
82
  isMainnet: () => isMainnet,
83
+ isNoopClient: () => isNoopClient,
72
84
  isSubscriptionActive: () => isSubscriptionActive,
73
85
  keyExists: () => keyExists,
74
86
  listStoredKeys: () => listStoredKeys,
@@ -98,11 +110,12 @@ __export(index_exports, {
98
110
  validateUpgradeParams: () => validateUpgradeParams,
99
111
  validateXURL: () => validateXURL,
100
112
  watchDeployment: () => watchDeployment,
101
- watchUpgrade: () => watchUpgrade
113
+ watchUpgrade: () => watchUpgrade,
114
+ withSDKTelemetry: () => withSDKTelemetry
102
115
  });
103
116
  module.exports = __toCommonJS(index_exports);
104
117
 
105
- // src/client/modules/app/index.ts
118
+ // src/client/modules/compute/app/index.ts
106
119
  var import_viem9 = require("viem");
107
120
 
108
121
  // src/client/common/config/environment.ts
@@ -337,10 +350,10 @@ async function checkIfImageAlreadyLayeredForECloud(docker, imageTag) {
337
350
  return false;
338
351
  }
339
352
  }
340
- async function pullDockerImage(docker, imageTag, platform = "linux/amd64", logger) {
353
+ async function pullDockerImage(docker, imageTag, platform2 = "linux/amd64", logger) {
341
354
  logger?.info?.(`Pulling image ${imageTag}...`);
342
355
  return new Promise((resolve2, reject) => {
343
- docker.pull(imageTag, { platform }, (err, stream) => {
356
+ docker.pull(imageTag, { platform: platform2 }, (err, stream) => {
344
357
  if (err) {
345
358
  reject(new Error(`Failed to pull image ${imageTag}: ${err.message}`));
346
359
  return;
@@ -936,9 +949,9 @@ function extractDigestFromMultiPlatform(manifest, imageRef) {
936
949
  const platforms = [];
937
950
  for (const m of manifest.manifests) {
938
951
  if (m.platform) {
939
- const platform = `${m.platform.os}/${m.platform.architecture}`;
940
- platforms.push(platform);
941
- if (platform === DOCKER_PLATFORM) {
952
+ const platform2 = `${m.platform.os}/${m.platform.architecture}`;
953
+ platforms.push(platform2);
954
+ if (platform2 === DOCKER_PLATFORM) {
942
955
  const digest = hexStringToBytes32(m.digest);
943
956
  const registry = extractRegistryName(imageRef);
944
957
  return {
@@ -953,7 +966,7 @@ function extractDigestFromMultiPlatform(manifest, imageRef) {
953
966
  }
954
967
  async function extractDigestFromSinglePlatform(manifest, imageRef) {
955
968
  try {
956
- const { stdout } = await execFile("docker", ["inspect", imageRef], {
969
+ const { stdout } = await execFileAsync("docker", ["inspect", imageRef], {
957
970
  maxBuffer: 10 * 1024 * 1024
958
971
  });
959
972
  const inspectData = JSON.parse(stdout);
@@ -976,8 +989,8 @@ async function extractDigestFromSinglePlatform(manifest, imageRef) {
976
989
  }
977
990
  throw new Error(`Could not determine platform for ${imageRef}`);
978
991
  }
979
- const platform = `${config.os}/${config.architecture}`;
980
- if (platform === DOCKER_PLATFORM) {
992
+ const platform2 = `${config.os}/${config.architecture}`;
993
+ if (platform2 === DOCKER_PLATFORM) {
981
994
  let digest;
982
995
  if (inspectData[0].RepoDigests && inspectData[0].RepoDigests.length > 0) {
983
996
  const repoDigest = inspectData[0].RepoDigests[0];
@@ -994,7 +1007,7 @@ async function extractDigestFromSinglePlatform(manifest, imageRef) {
994
1007
  platform: DOCKER_PLATFORM
995
1008
  };
996
1009
  }
997
- throw createPlatformErrorMessage(imageRef, [platform]);
1010
+ throw createPlatformErrorMessage(imageRef, [platform2]);
998
1011
  } catch (error) {
999
1012
  if (error.message.includes("platform")) {
1000
1013
  throw error;
@@ -1217,7 +1230,7 @@ Please verify the image exists: docker manifest inspect ${finalImageRef}`
1217
1230
  } else {
1218
1231
  logger.info("Continuing without environment file");
1219
1232
  }
1220
- publicEnv["EIGEN_MACHINE_TYPE"] = instanceType;
1233
+ publicEnv["EIGEN_MACHINE_TYPE_PUBLIC"] = instanceType;
1221
1234
  logger.info(`Instance type: ${instanceType}`);
1222
1235
  logger.info("Encrypting environment variables...");
1223
1236
  const { encryptionKey } = getKMSKeysForEnvironment(
@@ -2354,13 +2367,13 @@ async function executeBatch(options, logger) {
2354
2367
  );
2355
2368
  executeBatchData = (0, import_viem.concat)([selector, encodedParams]);
2356
2369
  }
2357
- const isDelegated = await checkERC7702Delegation(
2370
+ const isDelegated2 = await checkERC7702Delegation(
2358
2371
  publicClient,
2359
2372
  account.address,
2360
2373
  environmentConfig.erc7702DelegatorAddress
2361
2374
  );
2362
2375
  let authorizationList = [];
2363
- if (!isDelegated) {
2376
+ if (!isDelegated2) {
2364
2377
  const transactionNonce = await publicClient.getTransactionCount({
2365
2378
  address: account.address,
2366
2379
  blockTag: "pending"
@@ -2512,7 +2525,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
2512
2525
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
2513
2526
  var CanUpdateAppProfilePermission = "0x036fef61";
2514
2527
  function getDefaultClientId() {
2515
- const version = true ? "0.1.0-rc.1" : "0.0.0";
2528
+ const version = true ? "0.1.0" : "0.0.0";
2516
2529
  return `ecloud-sdk/v${version}`;
2517
2530
  }
2518
2531
  var UserApiClient = class {
@@ -4768,6 +4781,21 @@ async function getBlockTimestamps(rpcUrl, environmentConfig, blockNumbers) {
4768
4781
  }
4769
4782
  return timestamps;
4770
4783
  }
4784
+ async function isDelegated(options) {
4785
+ const { privateKey, rpcUrl, environmentConfig } = options;
4786
+ const privateKeyHex = addHexPrefix(privateKey);
4787
+ const account = (0, import_accounts2.privateKeyToAccount)(privateKeyHex);
4788
+ const chain = getChainFromID(environmentConfig.chainID);
4789
+ const publicClient = (0, import_viem5.createPublicClient)({
4790
+ chain,
4791
+ transport: (0, import_viem5.http)(rpcUrl)
4792
+ });
4793
+ return checkERC7702Delegation(
4794
+ publicClient,
4795
+ account.address,
4796
+ environmentConfig.erc7702DelegatorAddress
4797
+ );
4798
+ }
4771
4799
  async function undelegate(options, logger) {
4772
4800
  const { privateKey, rpcUrl, environmentConfig } = options;
4773
4801
  const privateKeyHex = addHexPrefix(privateKey);
@@ -4900,7 +4928,7 @@ async function watchUntilUpgradeComplete(options, logger) {
4900
4928
  if (status === APP_STATUS_STOPPED && ip) {
4901
4929
  logger.info("App upgrade complete.");
4902
4930
  logger.info(`Status: ${status}`);
4903
- logger.info(`To start the app, run: eigenx app start ${appId}`);
4931
+ logger.info(`To start the app, run: ecloud compute app start ${appId}`);
4904
4932
  return true;
4905
4933
  }
4906
4934
  }
@@ -4910,7 +4938,7 @@ async function watchUntilUpgradeComplete(options, logger) {
4910
4938
  if (status === APP_STATUS_STOPPED && ip && hasChanged) {
4911
4939
  logger.info("App upgrade complete.");
4912
4940
  logger.info(`Status: ${status}`);
4913
- logger.info(`To start the app, run: eigenx app start ${appId}`);
4941
+ logger.info(`To start the app, run: ecloud compute app start ${appId}`);
4914
4942
  return true;
4915
4943
  }
4916
4944
  if (status === APP_STATUS_RUNNING && ip && hasChanged) {
@@ -5309,7 +5337,202 @@ function validatePrivateKey(key) {
5309
5337
  }
5310
5338
  }
5311
5339
 
5312
- // src/client/modules/app/deploy.ts
5340
+ // src/client/common/telemetry/noop.ts
5341
+ var NoopClient = class {
5342
+ /**
5343
+ * AddMetric implements the TelemetryClient interface
5344
+ */
5345
+ async addMetric(_metric) {
5346
+ }
5347
+ /**
5348
+ * Close implements the TelemetryClient interface
5349
+ */
5350
+ async close() {
5351
+ }
5352
+ };
5353
+ function isNoopClient(client) {
5354
+ return client instanceof NoopClient;
5355
+ }
5356
+
5357
+ // src/client/common/telemetry/posthog.ts
5358
+ var import_posthog_node = require("posthog-node");
5359
+ var PostHogClient = class {
5360
+ constructor(environment, namespace, apiKey, endpoint) {
5361
+ this.namespace = namespace;
5362
+ this.appEnvironment = environment;
5363
+ const host = endpoint || "https://us.i.posthog.com";
5364
+ this.client = new import_posthog_node.PostHog(apiKey, {
5365
+ host,
5366
+ flushAt: 1,
5367
+ // Flush immediately for CLI/SDK usage
5368
+ flushInterval: 0
5369
+ // Disable interval flushing
5370
+ });
5371
+ this.client.identify({
5372
+ distinctId: environment.userUUID,
5373
+ properties: {
5374
+ os: environment.os,
5375
+ arch: environment.arch,
5376
+ ...environment.cliVersion ? { cliVersion: environment.cliVersion } : {}
5377
+ }
5378
+ });
5379
+ }
5380
+ /**
5381
+ * AddMetric implements the TelemetryClient interface
5382
+ */
5383
+ async addMetric(metric) {
5384
+ try {
5385
+ const props = {
5386
+ name: metric.name,
5387
+ value: metric.value
5388
+ };
5389
+ for (const [k, v] of Object.entries(metric.dimensions)) {
5390
+ props[k] = v;
5391
+ }
5392
+ this.client.capture({
5393
+ distinctId: this.appEnvironment.userUUID,
5394
+ event: this.namespace,
5395
+ properties: props
5396
+ });
5397
+ } catch {
5398
+ }
5399
+ }
5400
+ /**
5401
+ * Close implements the TelemetryClient interface
5402
+ */
5403
+ async close() {
5404
+ try {
5405
+ this.client.shutdown();
5406
+ } catch {
5407
+ }
5408
+ }
5409
+ };
5410
+ function getPostHogAPIKey() {
5411
+ if (process.env.ECLOUD_POSTHOG_KEY) {
5412
+ return process.env.ECLOUD_POSTHOG_KEY;
5413
+ }
5414
+ return true ? "phc_BiKfywNft5iBI8N7MxmuVCkb4GGZj4mDFXYPmOPUAI8" : void 0;
5415
+ }
5416
+ function getPostHogEndpoint() {
5417
+ return process.env.ECLOUD_POSTHOG_ENDPOINT || "https://us.i.posthog.com";
5418
+ }
5419
+
5420
+ // src/client/common/telemetry/index.ts
5421
+ var os2 = __toESM(require("os"), 1);
5422
+
5423
+ // src/client/common/telemetry/metricsContext.ts
5424
+ function createMetricsContext() {
5425
+ return {
5426
+ startTime: /* @__PURE__ */ new Date(),
5427
+ metrics: [],
5428
+ properties: {}
5429
+ };
5430
+ }
5431
+ function addMetric(context, name, value) {
5432
+ addMetricWithDimensions(context, name, value, {});
5433
+ }
5434
+ function addMetricWithDimensions(context, name, value, dimensions) {
5435
+ context.metrics.push({
5436
+ name,
5437
+ value,
5438
+ dimensions
5439
+ });
5440
+ }
5441
+
5442
+ // src/client/common/telemetry/index.ts
5443
+ function createTelemetryClient(environment, namespace, options) {
5444
+ const telemetryEnabled = options?.telemetryEnabled === true;
5445
+ if (!telemetryEnabled) {
5446
+ return new NoopClient();
5447
+ }
5448
+ const resolvedApiKey = options?.apiKey || getPostHogAPIKey();
5449
+ if (!resolvedApiKey) {
5450
+ return new NoopClient();
5451
+ }
5452
+ const endpoint = options?.endpoint || getPostHogEndpoint();
5453
+ try {
5454
+ return new PostHogClient(environment, namespace, resolvedApiKey, endpoint);
5455
+ } catch {
5456
+ return new NoopClient();
5457
+ }
5458
+ }
5459
+ function createAppEnvironment(userUUID, cliVersion, osOverride, archOverride) {
5460
+ return {
5461
+ userUUID,
5462
+ cliVersion,
5463
+ os: osOverride || os2.platform(),
5464
+ arch: archOverride || os2.arch()
5465
+ };
5466
+ }
5467
+ async function emitMetrics(client, context) {
5468
+ if (isNoopClient(client)) {
5469
+ return;
5470
+ }
5471
+ for (const metric of context.metrics) {
5472
+ const dimensions = {
5473
+ ...metric.dimensions,
5474
+ ...context.properties
5475
+ };
5476
+ const metricWithProperties = {
5477
+ ...metric,
5478
+ dimensions
5479
+ };
5480
+ try {
5481
+ await client.addMetric(metricWithProperties);
5482
+ } catch {
5483
+ }
5484
+ }
5485
+ }
5486
+
5487
+ // src/client/common/telemetry/wrapper.ts
5488
+ var import_crypto = require("crypto");
5489
+ function generateRandomUUID() {
5490
+ return (0, import_crypto.randomUUID)();
5491
+ }
5492
+ async function withSDKTelemetry(options, action) {
5493
+ if (options.skipTelemetry) {
5494
+ return action();
5495
+ }
5496
+ const userUUID = options.userUUID || generateRandomUUID();
5497
+ const environment = createAppEnvironment(userUUID);
5498
+ const client = createTelemetryClient(environment, "ecloud-sdk", {
5499
+ telemetryEnabled: options.telemetryEnabled,
5500
+ apiKey: options.apiKey,
5501
+ endpoint: options.endpoint
5502
+ });
5503
+ const metrics = createMetricsContext();
5504
+ metrics.properties["source"] = "ecloud-sdk";
5505
+ metrics.properties["function"] = options.functionName;
5506
+ if (options.properties) {
5507
+ Object.assign(metrics.properties, options.properties);
5508
+ }
5509
+ addMetric(metrics, "Count", 1);
5510
+ let actionError;
5511
+ let result;
5512
+ try {
5513
+ result = await action();
5514
+ return result;
5515
+ } catch (err) {
5516
+ actionError = err instanceof Error ? err : new Error(String(err));
5517
+ throw err;
5518
+ } finally {
5519
+ const resultValue = actionError ? "Failure" : "Success";
5520
+ const dimensions = {};
5521
+ if (actionError) {
5522
+ dimensions["error"] = actionError.message;
5523
+ }
5524
+ addMetricWithDimensions(metrics, resultValue, 1, dimensions);
5525
+ const duration = Date.now() - metrics.startTime.getTime();
5526
+ addMetric(metrics, "DurationMilliseconds", duration);
5527
+ try {
5528
+ await emitMetrics(client, metrics);
5529
+ await client.close();
5530
+ } catch {
5531
+ }
5532
+ }
5533
+ }
5534
+
5535
+ // src/client/modules/compute/app/deploy.ts
5313
5536
  function validateDeployOptions(options) {
5314
5537
  if (!options.privateKey) {
5315
5538
  throw new Error("privateKey is required for deployment");
@@ -5336,84 +5559,95 @@ function validateDeployOptions(options) {
5336
5559
  validateLogVisibility(options.logVisibility);
5337
5560
  }
5338
5561
  async function deploy(options, logger = defaultLogger) {
5339
- validateDeployOptions(options);
5340
- const { logRedirect, publicLogs } = validateLogVisibility(options.logVisibility);
5341
- const resourceUsageAllow = validateResourceUsageMonitoring(options.resourceUsageMonitoring);
5342
- logger.debug("Performing preflight checks...");
5343
- const preflightCtx = await doPreflightChecks(
5344
- {
5345
- privateKey: options.privateKey,
5346
- rpcUrl: options.rpcUrl,
5347
- environment: options.environment
5348
- },
5349
- logger
5350
- );
5351
- logger.debug("Checking quota availability...");
5352
- await checkQuotaAvailable(preflightCtx);
5353
- logger.debug("Checking Docker...");
5354
- await ensureDockerIsRunning();
5355
- const dockerfilePath = options.dockerfilePath || "";
5356
- const imageRef = options.imageRef || "";
5357
- const appName = options.appName;
5358
- const envFilePath = options.envFilePath || "";
5359
- const instanceType = options.instanceType;
5360
- const salt = generateRandomSalt();
5361
- logger.debug(`Generated salt: ${Buffer.from(salt).toString("hex")}`);
5362
- logger.debug("Calculating app ID...");
5363
- const appIDToBeDeployed = await calculateAppID(
5364
- preflightCtx.privateKey,
5365
- options.rpcUrl || preflightCtx.rpcUrl,
5366
- preflightCtx.environmentConfig,
5367
- salt
5368
- );
5369
- logger.info(``);
5370
- logger.info(`App ID: ${appIDToBeDeployed}`);
5371
- logger.info(``);
5372
- logger.info("Preparing release...");
5373
- const { release, finalImageRef } = await prepareRelease(
5374
- {
5375
- dockerfilePath,
5376
- imageRef,
5377
- envFilePath,
5378
- logRedirect,
5379
- resourceUsageAllow,
5380
- instanceType,
5381
- environmentConfig: preflightCtx.environmentConfig,
5382
- appId: appIDToBeDeployed
5383
- },
5384
- logger
5385
- );
5386
- logger.info("Deploying on-chain...");
5387
- const deployResult = await deployApp(
5562
+ return withSDKTelemetry(
5388
5563
  {
5389
- privateKey: preflightCtx.privateKey,
5390
- rpcUrl: options.rpcUrl || preflightCtx.rpcUrl,
5391
- environmentConfig: preflightCtx.environmentConfig,
5392
- salt,
5393
- release,
5394
- publicLogs,
5395
- imageRef: finalImageRef,
5396
- gas: options.gas
5397
- },
5398
- logger
5399
- );
5400
- logger.info("Waiting for app to start...");
5401
- const ipAddress = await watchUntilRunning(
5402
- {
5403
- privateKey: preflightCtx.privateKey,
5404
- rpcUrl: options.rpcUrl || preflightCtx.rpcUrl,
5405
- environmentConfig: preflightCtx.environmentConfig,
5406
- appId: deployResult.appId
5564
+ functionName: "deploy",
5565
+ skipTelemetry: options.skipTelemetry,
5566
+ properties: {
5567
+ environment: options.environment || "sepolia"
5568
+ }
5407
5569
  },
5408
- logger
5570
+ async () => {
5571
+ validateDeployOptions(options);
5572
+ const { logRedirect, publicLogs } = validateLogVisibility(options.logVisibility);
5573
+ const resourceUsageAllow = validateResourceUsageMonitoring(options.resourceUsageMonitoring);
5574
+ logger.debug("Performing preflight checks...");
5575
+ const preflightCtx = await doPreflightChecks(
5576
+ {
5577
+ privateKey: options.privateKey,
5578
+ rpcUrl: options.rpcUrl,
5579
+ environment: options.environment
5580
+ },
5581
+ logger
5582
+ );
5583
+ logger.debug("Checking quota availability...");
5584
+ await checkQuotaAvailable(preflightCtx);
5585
+ logger.debug("Checking Docker...");
5586
+ await ensureDockerIsRunning();
5587
+ const dockerfilePath = options.dockerfilePath || "";
5588
+ const imageRef = options.imageRef || "";
5589
+ const appName = options.appName;
5590
+ const envFilePath = options.envFilePath || "";
5591
+ const instanceType = options.instanceType;
5592
+ const salt = generateRandomSalt();
5593
+ logger.debug(`Generated salt: ${Buffer.from(salt).toString("hex")}`);
5594
+ logger.debug("Calculating app ID...");
5595
+ const appIDToBeDeployed = await calculateAppID(
5596
+ preflightCtx.privateKey,
5597
+ options.rpcUrl || preflightCtx.rpcUrl,
5598
+ preflightCtx.environmentConfig,
5599
+ salt
5600
+ );
5601
+ logger.info(``);
5602
+ logger.info(`App ID: ${appIDToBeDeployed}`);
5603
+ logger.info(``);
5604
+ logger.info("Preparing release...");
5605
+ const { release, finalImageRef } = await prepareRelease(
5606
+ {
5607
+ dockerfilePath,
5608
+ imageRef,
5609
+ envFilePath,
5610
+ logRedirect,
5611
+ resourceUsageAllow,
5612
+ instanceType,
5613
+ environmentConfig: preflightCtx.environmentConfig,
5614
+ appId: appIDToBeDeployed
5615
+ },
5616
+ logger
5617
+ );
5618
+ logger.info("Deploying on-chain...");
5619
+ const deployResult = await deployApp(
5620
+ {
5621
+ privateKey: preflightCtx.privateKey,
5622
+ rpcUrl: options.rpcUrl || preflightCtx.rpcUrl,
5623
+ environmentConfig: preflightCtx.environmentConfig,
5624
+ salt,
5625
+ release,
5626
+ publicLogs,
5627
+ imageRef: finalImageRef,
5628
+ gas: options.gas
5629
+ },
5630
+ logger
5631
+ );
5632
+ logger.info("Waiting for app to start...");
5633
+ const ipAddress = await watchUntilRunning(
5634
+ {
5635
+ privateKey: preflightCtx.privateKey,
5636
+ rpcUrl: options.rpcUrl || preflightCtx.rpcUrl,
5637
+ environmentConfig: preflightCtx.environmentConfig,
5638
+ appId: deployResult.appId
5639
+ },
5640
+ logger
5641
+ );
5642
+ return {
5643
+ appId: deployResult.appId,
5644
+ txHash: deployResult.txHash,
5645
+ appName,
5646
+ imageRef: finalImageRef,
5647
+ ipAddress
5648
+ };
5649
+ }
5409
5650
  );
5410
- return {
5411
- appId: deployResult.appId,
5412
- txHash: deployResult.txHash,
5413
- appName,
5414
- imageRef: finalImageRef,
5415
- ipAddress
5416
- };
5417
5651
  }
5418
5652
  async function checkQuotaAvailable(preflightCtx) {
5419
5653
  const rpcUrl = preflightCtx.rpcUrl;
@@ -5427,7 +5661,7 @@ async function checkQuotaAvailable(preflightCtx) {
5427
5661
  }
5428
5662
  if (maxQuota === 0) {
5429
5663
  throw new Error(
5430
- "no app quota available. Run 'npx ecloud billing subscribe' to enable app deployment"
5664
+ "no app quota available. Run 'ecloud billing subscribe' to enable app deployment"
5431
5665
  );
5432
5666
  }
5433
5667
  let activeCount;
@@ -5448,107 +5682,137 @@ function generateRandomSalt() {
5448
5682
  return salt;
5449
5683
  }
5450
5684
  async function prepareDeploy(options, logger = defaultLogger) {
5451
- validateDeployOptions(options);
5452
- const { logRedirect, publicLogs } = validateLogVisibility(options.logVisibility);
5453
- const resourceUsageAllow = validateResourceUsageMonitoring(options.resourceUsageMonitoring);
5454
- logger.debug("Performing preflight checks...");
5455
- const preflightCtx = await doPreflightChecks(
5685
+ return withSDKTelemetry(
5456
5686
  {
5457
- privateKey: options.privateKey,
5458
- rpcUrl: options.rpcUrl,
5459
- environment: options.environment
5460
- },
5461
- logger
5462
- );
5463
- logger.debug("Checking quota availability...");
5464
- await checkQuotaAvailable(preflightCtx);
5465
- logger.debug("Checking Docker...");
5466
- await ensureDockerIsRunning();
5467
- const dockerfilePath = options.dockerfilePath || "";
5468
- const imageRef = options.imageRef || "";
5469
- const appName = options.appName;
5470
- const envFilePath = options.envFilePath || "";
5471
- const instanceType = options.instanceType;
5472
- const salt = generateRandomSalt();
5473
- logger.debug(`Generated salt: ${Buffer.from(salt).toString("hex")}`);
5474
- logger.debug("Calculating app ID...");
5475
- const appIDToBeDeployed = await calculateAppID(
5476
- preflightCtx.privateKey,
5477
- options.rpcUrl || preflightCtx.rpcUrl,
5478
- preflightCtx.environmentConfig,
5479
- salt
5480
- );
5481
- logger.info(``);
5482
- logger.info(`App ID: ${appIDToBeDeployed}`);
5483
- logger.info(``);
5484
- logger.info("Preparing release...");
5485
- const { release, finalImageRef } = await prepareRelease(
5486
- {
5487
- dockerfilePath,
5488
- imageRef,
5489
- envFilePath,
5490
- logRedirect,
5491
- resourceUsageAllow,
5492
- instanceType,
5493
- environmentConfig: preflightCtx.environmentConfig,
5494
- appId: appIDToBeDeployed
5687
+ functionName: "prepareDeploy",
5688
+ skipTelemetry: options.skipTelemetry,
5689
+ properties: {
5690
+ environment: options.environment || "sepolia"
5691
+ }
5495
5692
  },
5496
- logger
5693
+ async () => {
5694
+ validateDeployOptions(options);
5695
+ const { logRedirect, publicLogs } = validateLogVisibility(options.logVisibility);
5696
+ const resourceUsageAllow = validateResourceUsageMonitoring(options.resourceUsageMonitoring);
5697
+ logger.debug("Performing preflight checks...");
5698
+ const preflightCtx = await doPreflightChecks(
5699
+ {
5700
+ privateKey: options.privateKey,
5701
+ rpcUrl: options.rpcUrl,
5702
+ environment: options.environment
5703
+ },
5704
+ logger
5705
+ );
5706
+ logger.debug("Checking quota availability...");
5707
+ await checkQuotaAvailable(preflightCtx);
5708
+ logger.debug("Checking Docker...");
5709
+ await ensureDockerIsRunning();
5710
+ const dockerfilePath = options.dockerfilePath || "";
5711
+ const imageRef = options.imageRef || "";
5712
+ const appName = options.appName;
5713
+ const envFilePath = options.envFilePath || "";
5714
+ const instanceType = options.instanceType;
5715
+ const salt = generateRandomSalt();
5716
+ logger.debug(`Generated salt: ${Buffer.from(salt).toString("hex")}`);
5717
+ logger.debug("Calculating app ID...");
5718
+ const appIDToBeDeployed = await calculateAppID(
5719
+ preflightCtx.privateKey,
5720
+ options.rpcUrl || preflightCtx.rpcUrl,
5721
+ preflightCtx.environmentConfig,
5722
+ salt
5723
+ );
5724
+ logger.info(``);
5725
+ logger.info(`App ID: ${appIDToBeDeployed}`);
5726
+ logger.info(``);
5727
+ logger.info("Preparing release...");
5728
+ const { release, finalImageRef } = await prepareRelease(
5729
+ {
5730
+ dockerfilePath,
5731
+ imageRef,
5732
+ envFilePath,
5733
+ logRedirect,
5734
+ resourceUsageAllow,
5735
+ instanceType,
5736
+ environmentConfig: preflightCtx.environmentConfig,
5737
+ appId: appIDToBeDeployed
5738
+ },
5739
+ logger
5740
+ );
5741
+ logger.debug("Preparing deploy batch...");
5742
+ const batch = await prepareDeployBatch(
5743
+ {
5744
+ privateKey: preflightCtx.privateKey,
5745
+ rpcUrl: options.rpcUrl || preflightCtx.rpcUrl,
5746
+ environmentConfig: preflightCtx.environmentConfig,
5747
+ salt,
5748
+ release,
5749
+ publicLogs
5750
+ },
5751
+ logger
5752
+ );
5753
+ logger.debug("Estimating gas...");
5754
+ const gasEstimate = await estimateBatchGas({
5755
+ publicClient: batch.publicClient,
5756
+ environmentConfig: batch.environmentConfig,
5757
+ executions: batch.executions
5758
+ });
5759
+ return {
5760
+ prepared: {
5761
+ batch,
5762
+ appName,
5763
+ imageRef: finalImageRef,
5764
+ preflightCtx: {
5765
+ privateKey: preflightCtx.privateKey,
5766
+ rpcUrl: preflightCtx.rpcUrl,
5767
+ environmentConfig: preflightCtx.environmentConfig
5768
+ }
5769
+ },
5770
+ gasEstimate
5771
+ };
5772
+ }
5497
5773
  );
5498
- logger.debug("Preparing deploy batch...");
5499
- const batch = await prepareDeployBatch(
5774
+ }
5775
+ async function executeDeploy(prepared, gas, logger = defaultLogger, skipTelemetry) {
5776
+ return withSDKTelemetry(
5500
5777
  {
5501
- privateKey: preflightCtx.privateKey,
5502
- rpcUrl: options.rpcUrl || preflightCtx.rpcUrl,
5503
- environmentConfig: preflightCtx.environmentConfig,
5504
- salt,
5505
- release,
5506
- publicLogs
5778
+ functionName: "executeDeploy",
5779
+ skipTelemetry
5507
5780
  },
5508
- logger
5781
+ async () => {
5782
+ logger.info("Deploying on-chain...");
5783
+ const { appId, txHash } = await executeDeployBatch(prepared.batch, gas, logger);
5784
+ return {
5785
+ appId,
5786
+ txHash,
5787
+ appName: prepared.appName,
5788
+ imageRef: prepared.imageRef
5789
+ };
5790
+ }
5509
5791
  );
5510
- logger.debug("Estimating gas...");
5511
- const gasEstimate = await estimateBatchGas({
5512
- publicClient: batch.publicClient,
5513
- environmentConfig: batch.environmentConfig,
5514
- executions: batch.executions
5515
- });
5516
- return {
5517
- prepared: {
5518
- batch,
5519
- appName,
5520
- imageRef: finalImageRef,
5521
- preflightCtx: {
5522
- privateKey: preflightCtx.privateKey,
5523
- rpcUrl: preflightCtx.rpcUrl,
5524
- environmentConfig: preflightCtx.environmentConfig
5525
- }
5526
- },
5527
- gasEstimate
5528
- };
5529
- }
5530
- async function executeDeploy(prepared, gas, logger = defaultLogger) {
5531
- logger.info("Deploying on-chain...");
5532
- const { appId, txHash } = await executeDeployBatch(prepared.batch, gas, logger);
5533
- return {
5534
- appId,
5535
- txHash,
5536
- appName: prepared.appName,
5537
- imageRef: prepared.imageRef
5538
- };
5539
5792
  }
5540
- async function watchDeployment(appId, privateKey, rpcUrl, environment, logger = defaultLogger, clientId) {
5541
- const environmentConfig = getEnvironmentConfig(environment);
5542
- logger.info("Waiting for app to start...");
5543
- return watchUntilRunning(
5793
+ async function watchDeployment(appId, privateKey, rpcUrl, environment, logger = defaultLogger, clientId, skipTelemetry) {
5794
+ return withSDKTelemetry(
5544
5795
  {
5545
- privateKey,
5546
- rpcUrl,
5547
- environmentConfig,
5548
- appId,
5549
- clientId
5796
+ functionName: "watchDeployment",
5797
+ skipTelemetry,
5798
+ properties: {
5799
+ environment
5800
+ }
5550
5801
  },
5551
- logger
5802
+ async () => {
5803
+ const environmentConfig = getEnvironmentConfig(environment);
5804
+ logger.info("Waiting for app to start...");
5805
+ return watchUntilRunning(
5806
+ {
5807
+ privateKey,
5808
+ rpcUrl,
5809
+ environmentConfig,
5810
+ appId,
5811
+ clientId
5812
+ },
5813
+ logger
5814
+ );
5815
+ }
5552
5816
  );
5553
5817
  }
5554
5818
 
@@ -5577,7 +5841,7 @@ async function checkAppLogPermission(preflightCtx, appAddress, logger) {
5577
5841
  }
5578
5842
  }
5579
5843
 
5580
- // src/client/modules/app/upgrade.ts
5844
+ // src/client/modules/compute/app/upgrade.ts
5581
5845
  function validateUpgradeOptions(options) {
5582
5846
  if (!options.privateKey) {
5583
5847
  throw new Error("privateKey is required for upgrade");
@@ -5605,163 +5869,204 @@ function validateUpgradeOptions(options) {
5605
5869
  return resolvedAppID;
5606
5870
  }
5607
5871
  async function upgrade(options, logger = defaultLogger) {
5608
- logger.debug("Performing preflight checks...");
5609
- const preflightCtx = await doPreflightChecks(
5610
- {
5611
- privateKey: options.privateKey,
5612
- rpcUrl: options.rpcUrl,
5613
- environment: options.environment
5614
- },
5615
- logger
5616
- );
5617
- const appID = validateUpgradeOptions(options);
5618
- const { logRedirect, publicLogs } = validateLogVisibility(options.logVisibility);
5619
- const resourceUsageAllow = validateResourceUsageMonitoring(options.resourceUsageMonitoring);
5620
- logger.debug("Checking Docker...");
5621
- await ensureDockerIsRunning();
5622
- const dockerfilePath = options.dockerfilePath || "";
5623
- const imageRef = options.imageRef || "";
5624
- const envFilePath = options.envFilePath || "";
5625
- const instanceType = options.instanceType;
5626
- logger.info("Preparing release...");
5627
- const { release, finalImageRef } = await prepareRelease(
5628
- {
5629
- dockerfilePath,
5630
- imageRef,
5631
- envFilePath,
5632
- logRedirect,
5633
- resourceUsageAllow,
5634
- instanceType,
5635
- environmentConfig: preflightCtx.environmentConfig,
5636
- appId: appID
5637
- },
5638
- logger
5639
- );
5640
- logger.debug("Checking current log permission state...");
5641
- const currentlyPublic = await checkAppLogPermission(preflightCtx, appID, logger);
5642
- const needsPermissionChange = currentlyPublic !== publicLogs;
5643
- logger.info("Upgrading on-chain...");
5644
- const txHash = await upgradeApp(
5872
+ return withSDKTelemetry(
5645
5873
  {
5646
- privateKey: preflightCtx.privateKey,
5647
- rpcUrl: options.rpcUrl || preflightCtx.rpcUrl,
5648
- environmentConfig: preflightCtx.environmentConfig,
5649
- appId: appID,
5650
- release,
5651
- publicLogs,
5652
- needsPermissionChange,
5653
- imageRef: finalImageRef,
5654
- gas: options.gas
5655
- },
5656
- logger
5657
- );
5658
- logger.info("Waiting for upgrade to complete...");
5659
- await watchUntilUpgradeComplete(
5660
- {
5661
- privateKey: preflightCtx.privateKey,
5662
- rpcUrl: options.rpcUrl || preflightCtx.rpcUrl,
5663
- environmentConfig: preflightCtx.environmentConfig,
5664
- appId: appID
5874
+ functionName: "upgrade",
5875
+ skipTelemetry: options.skipTelemetry,
5876
+ properties: {
5877
+ environment: options.environment || "sepolia"
5878
+ }
5665
5879
  },
5666
- logger
5880
+ async () => {
5881
+ logger.debug("Performing preflight checks...");
5882
+ const preflightCtx = await doPreflightChecks(
5883
+ {
5884
+ privateKey: options.privateKey,
5885
+ rpcUrl: options.rpcUrl,
5886
+ environment: options.environment
5887
+ },
5888
+ logger
5889
+ );
5890
+ const appID = validateUpgradeOptions(options);
5891
+ const { logRedirect, publicLogs } = validateLogVisibility(options.logVisibility);
5892
+ const resourceUsageAllow = validateResourceUsageMonitoring(options.resourceUsageMonitoring);
5893
+ logger.debug("Checking Docker...");
5894
+ await ensureDockerIsRunning();
5895
+ const dockerfilePath = options.dockerfilePath || "";
5896
+ const imageRef = options.imageRef || "";
5897
+ const envFilePath = options.envFilePath || "";
5898
+ const instanceType = options.instanceType;
5899
+ logger.info("Preparing release...");
5900
+ const { release, finalImageRef } = await prepareRelease(
5901
+ {
5902
+ dockerfilePath,
5903
+ imageRef,
5904
+ envFilePath,
5905
+ logRedirect,
5906
+ resourceUsageAllow,
5907
+ instanceType,
5908
+ environmentConfig: preflightCtx.environmentConfig,
5909
+ appId: appID
5910
+ },
5911
+ logger
5912
+ );
5913
+ logger.debug("Checking current log permission state...");
5914
+ const currentlyPublic = await checkAppLogPermission(preflightCtx, appID, logger);
5915
+ const needsPermissionChange = currentlyPublic !== publicLogs;
5916
+ logger.info("Upgrading on-chain...");
5917
+ const txHash = await upgradeApp(
5918
+ {
5919
+ privateKey: preflightCtx.privateKey,
5920
+ rpcUrl: options.rpcUrl || preflightCtx.rpcUrl,
5921
+ environmentConfig: preflightCtx.environmentConfig,
5922
+ appId: appID,
5923
+ release,
5924
+ publicLogs,
5925
+ needsPermissionChange,
5926
+ imageRef: finalImageRef,
5927
+ gas: options.gas
5928
+ },
5929
+ logger
5930
+ );
5931
+ logger.info("Waiting for upgrade to complete...");
5932
+ await watchUntilUpgradeComplete(
5933
+ {
5934
+ privateKey: preflightCtx.privateKey,
5935
+ rpcUrl: options.rpcUrl || preflightCtx.rpcUrl,
5936
+ environmentConfig: preflightCtx.environmentConfig,
5937
+ appId: appID
5938
+ },
5939
+ logger
5940
+ );
5941
+ return {
5942
+ appId: appID,
5943
+ imageRef: finalImageRef,
5944
+ txHash
5945
+ };
5946
+ }
5667
5947
  );
5668
- return {
5669
- appId: appID,
5670
- imageRef: finalImageRef,
5671
- txHash
5672
- };
5673
5948
  }
5674
5949
  async function prepareUpgrade(options, logger = defaultLogger) {
5675
- logger.debug("Performing preflight checks...");
5676
- const preflightCtx = await doPreflightChecks(
5950
+ return withSDKTelemetry(
5677
5951
  {
5678
- privateKey: options.privateKey,
5679
- rpcUrl: options.rpcUrl,
5680
- environment: options.environment
5952
+ functionName: "prepareUpgrade",
5953
+ skipTelemetry: options.skipTelemetry,
5954
+ properties: {
5955
+ environment: options.environment || "sepolia"
5956
+ }
5681
5957
  },
5682
- logger
5958
+ async () => {
5959
+ logger.debug("Performing preflight checks...");
5960
+ const preflightCtx = await doPreflightChecks(
5961
+ {
5962
+ privateKey: options.privateKey,
5963
+ rpcUrl: options.rpcUrl,
5964
+ environment: options.environment
5965
+ },
5966
+ logger
5967
+ );
5968
+ const appID = validateUpgradeOptions(options);
5969
+ const { logRedirect, publicLogs } = validateLogVisibility(options.logVisibility);
5970
+ const resourceUsageAllow = validateResourceUsageMonitoring(options.resourceUsageMonitoring);
5971
+ logger.debug("Checking Docker...");
5972
+ await ensureDockerIsRunning();
5973
+ const dockerfilePath = options.dockerfilePath || "";
5974
+ const imageRef = options.imageRef || "";
5975
+ const envFilePath = options.envFilePath || "";
5976
+ const instanceType = options.instanceType;
5977
+ logger.info("Preparing release...");
5978
+ const { release, finalImageRef } = await prepareRelease(
5979
+ {
5980
+ dockerfilePath,
5981
+ imageRef,
5982
+ envFilePath,
5983
+ logRedirect,
5984
+ resourceUsageAllow,
5985
+ instanceType,
5986
+ environmentConfig: preflightCtx.environmentConfig,
5987
+ appId: appID
5988
+ },
5989
+ logger
5990
+ );
5991
+ logger.debug("Checking current log permission state...");
5992
+ const currentlyPublic = await checkAppLogPermission(preflightCtx, appID, logger);
5993
+ const needsPermissionChange = currentlyPublic !== publicLogs;
5994
+ logger.debug("Preparing upgrade batch...");
5995
+ const batch = await prepareUpgradeBatch({
5996
+ privateKey: preflightCtx.privateKey,
5997
+ rpcUrl: options.rpcUrl || preflightCtx.rpcUrl,
5998
+ environmentConfig: preflightCtx.environmentConfig,
5999
+ appId: appID,
6000
+ release,
6001
+ publicLogs,
6002
+ needsPermissionChange
6003
+ });
6004
+ logger.debug("Estimating gas...");
6005
+ const gasEstimate = await estimateBatchGas({
6006
+ publicClient: batch.publicClient,
6007
+ environmentConfig: batch.environmentConfig,
6008
+ executions: batch.executions
6009
+ });
6010
+ return {
6011
+ prepared: {
6012
+ batch,
6013
+ appId: appID,
6014
+ imageRef: finalImageRef,
6015
+ preflightCtx: {
6016
+ privateKey: preflightCtx.privateKey,
6017
+ rpcUrl: preflightCtx.rpcUrl,
6018
+ environmentConfig: preflightCtx.environmentConfig
6019
+ }
6020
+ },
6021
+ gasEstimate
6022
+ };
6023
+ }
5683
6024
  );
5684
- const appID = validateUpgradeOptions(options);
5685
- const { logRedirect, publicLogs } = validateLogVisibility(options.logVisibility);
5686
- const resourceUsageAllow = validateResourceUsageMonitoring(options.resourceUsageMonitoring);
5687
- logger.debug("Checking Docker...");
5688
- await ensureDockerIsRunning();
5689
- const dockerfilePath = options.dockerfilePath || "";
5690
- const imageRef = options.imageRef || "";
5691
- const envFilePath = options.envFilePath || "";
5692
- const instanceType = options.instanceType;
5693
- logger.info("Preparing release...");
5694
- const { release, finalImageRef } = await prepareRelease(
6025
+ }
6026
+ async function executeUpgrade(prepared, gas, logger = defaultLogger, skipTelemetry) {
6027
+ return withSDKTelemetry(
5695
6028
  {
5696
- dockerfilePath,
5697
- imageRef,
5698
- envFilePath,
5699
- logRedirect,
5700
- resourceUsageAllow,
5701
- instanceType,
5702
- environmentConfig: preflightCtx.environmentConfig,
5703
- appId: appID
6029
+ functionName: "executeUpgrade",
6030
+ skipTelemetry
5704
6031
  },
5705
- logger
6032
+ async () => {
6033
+ logger.info("Upgrading on-chain...");
6034
+ const txHash = await executeUpgradeBatch(prepared.batch, gas, logger);
6035
+ return {
6036
+ appId: prepared.appId,
6037
+ imageRef: prepared.imageRef,
6038
+ txHash
6039
+ };
6040
+ }
5706
6041
  );
5707
- logger.debug("Checking current log permission state...");
5708
- const currentlyPublic = await checkAppLogPermission(preflightCtx, appID, logger);
5709
- const needsPermissionChange = currentlyPublic !== publicLogs;
5710
- logger.debug("Preparing upgrade batch...");
5711
- const batch = await prepareUpgradeBatch({
5712
- privateKey: preflightCtx.privateKey,
5713
- rpcUrl: options.rpcUrl || preflightCtx.rpcUrl,
5714
- environmentConfig: preflightCtx.environmentConfig,
5715
- appId: appID,
5716
- release,
5717
- publicLogs,
5718
- needsPermissionChange
5719
- });
5720
- logger.debug("Estimating gas...");
5721
- const gasEstimate = await estimateBatchGas({
5722
- publicClient: batch.publicClient,
5723
- environmentConfig: batch.environmentConfig,
5724
- executions: batch.executions
5725
- });
5726
- return {
5727
- prepared: {
5728
- batch,
5729
- appId: appID,
5730
- imageRef: finalImageRef,
5731
- preflightCtx: {
5732
- privateKey: preflightCtx.privateKey,
5733
- rpcUrl: preflightCtx.rpcUrl,
5734
- environmentConfig: preflightCtx.environmentConfig
5735
- }
5736
- },
5737
- gasEstimate
5738
- };
5739
- }
5740
- async function executeUpgrade(prepared, gas, logger = defaultLogger) {
5741
- logger.info("Upgrading on-chain...");
5742
- const txHash = await executeUpgradeBatch(prepared.batch, gas, logger);
5743
- return {
5744
- appId: prepared.appId,
5745
- imageRef: prepared.imageRef,
5746
- txHash
5747
- };
5748
6042
  }
5749
- async function watchUpgrade(appId, privateKey, rpcUrl, environment, logger = defaultLogger, clientId) {
5750
- const environmentConfig = getEnvironmentConfig(environment);
5751
- logger.info("Waiting for upgrade to complete...");
5752
- await watchUntilUpgradeComplete(
6043
+ async function watchUpgrade(appId, privateKey, rpcUrl, environment, logger = defaultLogger, clientId, skipTelemetry) {
6044
+ return withSDKTelemetry(
5753
6045
  {
5754
- privateKey,
5755
- rpcUrl,
5756
- environmentConfig,
5757
- appId,
5758
- clientId
6046
+ functionName: "watchUpgrade",
6047
+ skipTelemetry,
6048
+ properties: {
6049
+ environment
6050
+ }
5759
6051
  },
5760
- logger
6052
+ async () => {
6053
+ const environmentConfig = getEnvironmentConfig(environment);
6054
+ logger.info("Waiting for upgrade to complete...");
6055
+ await watchUntilUpgradeComplete(
6056
+ {
6057
+ privateKey,
6058
+ rpcUrl,
6059
+ environmentConfig,
6060
+ appId,
6061
+ clientId
6062
+ },
6063
+ logger
6064
+ );
6065
+ }
5761
6066
  );
5762
6067
  }
5763
6068
 
5764
- // src/client/modules/app/create.ts
6069
+ // src/client/modules/compute/app/create.ts
5765
6070
  var fs7 = __toESM(require("fs"), 1);
5766
6071
  var path7 = __toESM(require("path"), 1);
5767
6072
 
@@ -5854,7 +6159,7 @@ function getCategoryDescriptions(catalog, language) {
5854
6159
  // src/client/common/templates/git.ts
5855
6160
  var fs5 = __toESM(require("fs"), 1);
5856
6161
  var path5 = __toESM(require("path"), 1);
5857
- var os2 = __toESM(require("os"), 1);
6162
+ var os3 = __toESM(require("os"), 1);
5858
6163
  var import_child_process2 = require("child_process");
5859
6164
  var import_util4 = require("util");
5860
6165
  var execAsync2 = (0, import_util4.promisify)(import_child_process2.exec);
@@ -5893,9 +6198,9 @@ async function fetchTemplateSubdirectory(repoURL, ref, subPath, targetDir, logge
5893
6198
  }
5894
6199
  let tempDir;
5895
6200
  try {
5896
- tempDir = fs5.mkdtempSync(path5.join(os2.tmpdir(), "eigenx-template-"));
6201
+ tempDir = fs5.mkdtempSync(path5.join(os3.tmpdir(), "eigenx-template-"));
5897
6202
  } catch {
5898
- const homeDir = os2.homedir();
6203
+ const homeDir = os3.homedir();
5899
6204
  const fallbackBase = path5.join(homeDir, ".eigenx", "tmp");
5900
6205
  fs5.mkdirSync(fallbackBase, { recursive: true });
5901
6206
  tempDir = fs5.mkdtempSync(path5.join(fallbackBase, "eigenx-template-"));
@@ -6043,7 +6348,7 @@ Before deploying, you'll need:
6043
6348
  ## Deployment
6044
6349
 
6045
6350
  \`\`\`bash
6046
- eigenx app deploy username/image-name
6351
+ ecloud compute app deploy username/image-name
6047
6352
  \`\`\`
6048
6353
 
6049
6354
  The CLI will automatically detect the \`Dockerfile\` and build your app before deploying.
@@ -6051,13 +6356,13 @@ The CLI will automatically detect the \`Dockerfile\` and build your app before d
6051
6356
  ## Management & Monitoring
6052
6357
 
6053
6358
  \`\`\`bash
6054
- npx ecloud app list # List all apps
6055
- npx ecloud app info [app-name] # Get app details
6056
- npx ecloud app logs [app-name] # View logs
6057
- npx ecloud app start [app-name] # Start stopped app
6058
- npx ecloud app stop [app-name] # Stop running app
6059
- npx ecloud app terminate [app-name] # Terminate app
6060
- npx ecloud app upgrade [app-name] [image] # Update deployment
6359
+ ecloud compute app list # List all apps
6360
+ ecloud compute app info [app-name] # Get app details
6361
+ ecloud compute app logs [app-name] # View logs
6362
+ ecloud compute app start [app-name] # Start stopped app
6363
+ ecloud compute app stop [app-name] # Stop running app
6364
+ ecloud compute app terminate [app-name] # Terminate app
6365
+ ecloud compute app upgrade [app-name] [image] # Update deployment
6061
6366
  \`\`\`
6062
6367
  `;
6063
6368
  }
@@ -6072,7 +6377,7 @@ async function updateProjectFile(projectDir, filename, oldString, newString, log
6072
6377
  fs6.writeFileSync(filePath, newContent, { mode: 420 });
6073
6378
  }
6074
6379
 
6075
- // src/client/modules/app/create.ts
6380
+ // src/client/modules/compute/app/create.ts
6076
6381
  var PRIMARY_LANGUAGES = ["typescript", "golang", "rust", "python"];
6077
6382
  function validateProjectName(name) {
6078
6383
  if (!name) {
@@ -6113,30 +6418,41 @@ async function getAvailableTemplates(language) {
6113
6418
  }));
6114
6419
  }
6115
6420
  async function createApp(options, logger = defaultLogger) {
6116
- validateProjectName(options.name || "");
6117
- validateLanguage(options.language || "");
6118
- const cfg = await gatherProjectConfig(
6421
+ return withSDKTelemetry(
6119
6422
  {
6120
- ...options,
6121
- name: options.name,
6122
- language: options.language
6423
+ functionName: "createApp",
6424
+ skipTelemetry: options.skipTelemetry,
6425
+ properties: {
6426
+ language: options.language || ""
6427
+ }
6123
6428
  },
6124
- logger
6125
- );
6126
- if (fs7.existsSync(cfg.name)) {
6127
- throw new Error(`Directory ${cfg.name} already exists`);
6128
- }
6129
- fs7.mkdirSync(cfg.name, { mode: 493 });
6130
- try {
6131
- await populateProjectFromTemplate(cfg, options, logger);
6132
- if (cfg.subPath && cfg.language && cfg.templateEntry) {
6133
- await postProcessTemplate(cfg.name, cfg.language, cfg.templateEntry, logger);
6429
+ async () => {
6430
+ validateProjectName(options.name || "");
6431
+ validateLanguage(options.language || "");
6432
+ const cfg = await gatherProjectConfig(
6433
+ {
6434
+ ...options,
6435
+ name: options.name,
6436
+ language: options.language
6437
+ },
6438
+ logger
6439
+ );
6440
+ if (fs7.existsSync(cfg.name)) {
6441
+ throw new Error(`Directory ${cfg.name} already exists`);
6442
+ }
6443
+ fs7.mkdirSync(cfg.name, { mode: 493 });
6444
+ try {
6445
+ await populateProjectFromTemplate(cfg, options, logger);
6446
+ if (cfg.subPath && cfg.language && cfg.templateEntry) {
6447
+ await postProcessTemplate(cfg.name, cfg.language, cfg.templateEntry, logger);
6448
+ }
6449
+ logger.info(`Successfully created ${cfg.language || "project"} project: ${cfg.name}`);
6450
+ } catch (error) {
6451
+ fs7.rmSync(cfg.name, { recursive: true, force: true });
6452
+ throw error;
6453
+ }
6134
6454
  }
6135
- logger.info(`Successfully created ${cfg.language || "project"} project: ${cfg.name}`);
6136
- } catch (error) {
6137
- fs7.rmSync(cfg.name, { recursive: true, force: true });
6138
- throw error;
6139
- }
6455
+ );
6140
6456
  }
6141
6457
  async function gatherProjectConfig(options, logger) {
6142
6458
  const cfg = {
@@ -6224,7 +6540,7 @@ async function copyDirectory2(src, dst) {
6224
6540
  }
6225
6541
  }
6226
6542
 
6227
- // src/client/modules/app/logs.ts
6543
+ // src/client/modules/compute/app/logs.ts
6228
6544
  var import_chalk = __toESM(require("chalk"), 1);
6229
6545
  var AppStatusCreated = "Created";
6230
6546
  var AppStatusDeploying = "Deploying";
@@ -6306,93 +6622,107 @@ async function watchLogs(appID, userApiClient, initialLogs) {
6306
6622
  }
6307
6623
  console.log("\nStopped watching");
6308
6624
  }
6309
- async function logs(options, logger = defaultLogger) {
6310
- console.log();
6311
- if (!options.appID) {
6312
- throw new Error("appID is required for viewing logs");
6313
- }
6314
- const environment = options.environment || "sepolia";
6315
- const environmentConfig = getEnvironmentConfig(environment);
6316
- const rpcUrl = options.rpcUrl || environmentConfig.defaultRPCURL;
6317
- if (!rpcUrl) {
6318
- throw new Error("RPC URL is required for authenticated requests");
6319
- }
6320
- const appID = validateAppID(options.appID);
6321
- const formattedApp = formatAppDisplay(environmentConfig.name, appID, "");
6322
- const userApiClient = new UserApiClient(
6323
- environmentConfig,
6324
- options.privateKey,
6325
- rpcUrl,
6326
- options.clientId
6327
- );
6328
- let logsText;
6329
- let logsError = null;
6330
- try {
6331
- logsText = await userApiClient.getLogs(appID);
6332
- } catch (err) {
6333
- logsError = err;
6334
- logsText = "";
6335
- }
6336
- const watchMode = options.watch || false;
6337
- if (logsError || logsText.trim() === "") {
6338
- if (watchMode) {
6339
- logger.info("\nWaiting for logs to become available...");
6625
+ async function logs(options, logger = defaultLogger, skipTelemetry = false) {
6626
+ const skipTelemetryFlag = skipTelemetry || options.skipTelemetry || false;
6627
+ return withSDKTelemetry(
6628
+ {
6629
+ functionName: "logs",
6630
+ skipTelemetry: skipTelemetryFlag,
6631
+ properties: { environment: options.environment || "sepolia" }
6632
+ },
6633
+ async () => {
6340
6634
  console.log();
6341
- await watchLogs(appID, userApiClient, "");
6342
- return;
6343
- }
6344
- try {
6345
- const statuses = await userApiClient.getStatuses([appID]);
6346
- if (statuses.length > 0) {
6347
- const status = statuses[0].status;
6348
- switch (status) {
6349
- case AppStatusCreated:
6350
- case AppStatusDeploying:
6351
- logger.info(
6352
- `${formattedApp} is currently being provisioned. Logs will be available once deployment is complete.`
6353
- );
6354
- return;
6355
- case AppStatusUpgrading:
6356
- logger.info(
6357
- `${formattedApp} is currently upgrading. Logs will be available once upgrade is complete.`
6358
- );
6359
- return;
6360
- case AppStatusResuming:
6361
- logger.info(`${formattedApp} is currently resuming. Logs will be available shortly.`);
6362
- return;
6363
- case AppStatusStopping:
6364
- logger.info(`${formattedApp} is currently stopping. Logs may be limited.`);
6365
- return;
6366
- case AppStatusStopped:
6367
- case AppStatusTerminating:
6368
- case AppStatusTerminated:
6369
- case AppStatusSuspended:
6370
- logger.info(`${formattedApp} is ${status.toLowerCase()}. Logs are not available.`);
6371
- return;
6372
- case AppStatusFailed:
6373
- logger.info(`${formattedApp} has failed. Check the app status for more information.`);
6374
- return;
6635
+ if (!options.appID) {
6636
+ throw new Error("appID is required for viewing logs");
6637
+ }
6638
+ const environment = options.environment || "sepolia";
6639
+ const environmentConfig = getEnvironmentConfig(environment);
6640
+ const rpcUrl = options.rpcUrl || environmentConfig.defaultRPCURL;
6641
+ if (!rpcUrl) {
6642
+ throw new Error("RPC URL is required for authenticated requests");
6643
+ }
6644
+ const appID = validateAppID(options.appID);
6645
+ const formattedApp = formatAppDisplay(environmentConfig.name, appID, "");
6646
+ const userApiClient = new UserApiClient(
6647
+ environmentConfig,
6648
+ options.privateKey,
6649
+ rpcUrl,
6650
+ options.clientId
6651
+ );
6652
+ let logsText;
6653
+ let logsError = null;
6654
+ try {
6655
+ logsText = await userApiClient.getLogs(appID);
6656
+ } catch (err) {
6657
+ logsError = err;
6658
+ logsText = "";
6659
+ }
6660
+ const watchMode = options.watch || false;
6661
+ if (logsError || logsText.trim() === "") {
6662
+ if (watchMode) {
6663
+ logger.info("\nWaiting for logs to become available...");
6664
+ console.log();
6665
+ await watchLogs(appID, userApiClient, "");
6666
+ return;
6667
+ }
6668
+ try {
6669
+ const statuses = await userApiClient.getStatuses([appID]);
6670
+ if (statuses.length > 0) {
6671
+ const status = statuses[0].status;
6672
+ switch (status) {
6673
+ case AppStatusCreated:
6674
+ case AppStatusDeploying:
6675
+ logger.info(
6676
+ `${formattedApp} is currently being provisioned. Logs will be available once deployment is complete.`
6677
+ );
6678
+ return;
6679
+ case AppStatusUpgrading:
6680
+ logger.info(
6681
+ `${formattedApp} is currently upgrading. Logs will be available once upgrade is complete.`
6682
+ );
6683
+ return;
6684
+ case AppStatusResuming:
6685
+ logger.info(
6686
+ `${formattedApp} is currently resuming. Logs will be available shortly.`
6687
+ );
6688
+ return;
6689
+ case AppStatusStopping:
6690
+ logger.info(`${formattedApp} is currently stopping. Logs may be limited.`);
6691
+ return;
6692
+ case AppStatusStopped:
6693
+ case AppStatusTerminating:
6694
+ case AppStatusTerminated:
6695
+ case AppStatusSuspended:
6696
+ logger.info(`${formattedApp} is ${status.toLowerCase()}. Logs are not available.`);
6697
+ return;
6698
+ case AppStatusFailed:
6699
+ logger.info(
6700
+ `${formattedApp} has failed. Check the app status for more information.`
6701
+ );
6702
+ return;
6703
+ }
6704
+ }
6705
+ } catch {
6706
+ }
6707
+ if (logsError) {
6708
+ throw new Error(
6709
+ `Failed to get logs, you can watch for logs by calling this command with the --watch flag (or --w): ${logsError.message}`
6710
+ );
6375
6711
  }
6712
+ throw new Error(
6713
+ "Failed to get logs, you can watch for logs by calling this command with the --watch flag (or --w): empty logs"
6714
+ );
6376
6715
  }
6377
- } catch {
6378
- }
6379
- if (logsError) {
6380
- throw new Error(
6381
- `Failed to get logs, you can watch for logs by calling this command with the --watch flag (or --w): ${logsError.message}`
6382
- );
6716
+ console.log(logsText);
6717
+ if (!watchMode) {
6718
+ return;
6719
+ }
6720
+ await watchLogs(appID, userApiClient, logsText);
6383
6721
  }
6384
- throw new Error(
6385
- "Failed to get logs, you can watch for logs by calling this command with the --watch flag (or --w): empty logs"
6386
- );
6387
- }
6388
- console.log(logsText);
6389
- if (!watchMode) {
6390
- return;
6391
- }
6392
- await watchLogs(appID, userApiClient, logsText);
6722
+ );
6393
6723
  }
6394
6724
 
6395
- // src/client/modules/app/index.ts
6725
+ // src/client/modules/compute/app/index.ts
6396
6726
  var CONTROLLER_ABI = (0, import_viem9.parseAbi)([
6397
6727
  "function startApp(address appId)",
6398
6728
  "function stopApp(address appId)",
@@ -6421,6 +6751,7 @@ function encodeTerminateAppData(appId) {
6421
6751
  }
6422
6752
  function createAppModule(ctx) {
6423
6753
  const privateKey = addHexPrefix(ctx.privateKey);
6754
+ const skipTelemetry = ctx.skipTelemetry || false;
6424
6755
  const environment = getEnvironmentConfig(ctx.environment);
6425
6756
  const logger = getLogger(ctx.verbose);
6426
6757
  return {
@@ -6483,89 +6814,145 @@ function createAppModule(ctx) {
6483
6814
  environment: ctx.environment,
6484
6815
  clientId: ctx.clientId
6485
6816
  },
6486
- logger
6817
+ logger,
6818
+ skipTelemetry
6819
+ // Skip if called from CLI
6487
6820
  );
6488
6821
  },
6489
6822
  async start(appId, opts) {
6490
- const pendingMessage = `Starting app ${appId}...`;
6491
- const data = (0, import_viem9.encodeFunctionData)({
6492
- abi: CONTROLLER_ABI,
6493
- functionName: "startApp",
6494
- args: [appId]
6495
- });
6496
- const tx = await sendAndWaitForTransaction(
6823
+ return withSDKTelemetry(
6497
6824
  {
6498
- privateKey,
6499
- rpcUrl: ctx.rpcUrl,
6500
- environmentConfig: environment,
6501
- to: environment.appControllerAddress,
6502
- data,
6503
- pendingMessage,
6504
- txDescription: "StartApp",
6505
- gas: opts?.gas
6825
+ functionName: "start",
6826
+ skipTelemetry,
6827
+ // Skip if called from CLI
6828
+ properties: { environment: ctx.environment }
6506
6829
  },
6507
- logger
6830
+ async () => {
6831
+ const pendingMessage = `Starting app ${appId}...`;
6832
+ const data = (0, import_viem9.encodeFunctionData)({
6833
+ abi: CONTROLLER_ABI,
6834
+ functionName: "startApp",
6835
+ args: [appId]
6836
+ });
6837
+ const tx = await sendAndWaitForTransaction(
6838
+ {
6839
+ privateKey,
6840
+ rpcUrl: ctx.rpcUrl,
6841
+ environmentConfig: environment,
6842
+ to: environment.appControllerAddress,
6843
+ data,
6844
+ pendingMessage,
6845
+ txDescription: "StartApp",
6846
+ gas: opts?.gas
6847
+ },
6848
+ logger
6849
+ );
6850
+ return { tx };
6851
+ }
6508
6852
  );
6509
- return { tx };
6510
6853
  },
6511
6854
  async stop(appId, opts) {
6512
- const pendingMessage = `Stopping app ${appId}...`;
6513
- const data = (0, import_viem9.encodeFunctionData)({
6514
- abi: CONTROLLER_ABI,
6515
- functionName: "stopApp",
6516
- args: [appId]
6517
- });
6518
- const tx = await sendAndWaitForTransaction(
6855
+ return withSDKTelemetry(
6519
6856
  {
6520
- privateKey,
6521
- rpcUrl: ctx.rpcUrl,
6522
- environmentConfig: environment,
6523
- to: environment.appControllerAddress,
6524
- data,
6525
- pendingMessage,
6526
- txDescription: "StopApp",
6527
- gas: opts?.gas
6857
+ functionName: "stop",
6858
+ skipTelemetry,
6859
+ // Skip if called from CLI
6860
+ properties: { environment: ctx.environment }
6528
6861
  },
6529
- logger
6862
+ async () => {
6863
+ const pendingMessage = `Stopping app ${appId}...`;
6864
+ const data = (0, import_viem9.encodeFunctionData)({
6865
+ abi: CONTROLLER_ABI,
6866
+ functionName: "stopApp",
6867
+ args: [appId]
6868
+ });
6869
+ const tx = await sendAndWaitForTransaction(
6870
+ {
6871
+ privateKey,
6872
+ rpcUrl: ctx.rpcUrl,
6873
+ environmentConfig: environment,
6874
+ to: environment.appControllerAddress,
6875
+ data,
6876
+ pendingMessage,
6877
+ txDescription: "StopApp",
6878
+ gas: opts?.gas
6879
+ },
6880
+ logger
6881
+ );
6882
+ return { tx };
6883
+ }
6530
6884
  );
6531
- return { tx };
6532
6885
  },
6533
6886
  async terminate(appId, opts) {
6534
- const pendingMessage = `Terminating app ${appId}...`;
6535
- const data = (0, import_viem9.encodeFunctionData)({
6536
- abi: CONTROLLER_ABI,
6537
- functionName: "terminateApp",
6538
- args: [appId]
6539
- });
6540
- const tx = await sendAndWaitForTransaction(
6887
+ return withSDKTelemetry(
6541
6888
  {
6542
- privateKey,
6543
- rpcUrl: ctx.rpcUrl,
6544
- environmentConfig: environment,
6545
- to: environment.appControllerAddress,
6546
- data,
6547
- pendingMessage,
6548
- txDescription: "TerminateApp",
6549
- gas: opts?.gas
6889
+ functionName: "terminate",
6890
+ skipTelemetry,
6891
+ // Skip if called from CLI
6892
+ properties: { environment: ctx.environment }
6550
6893
  },
6551
- logger
6894
+ async () => {
6895
+ const pendingMessage = `Terminating app ${appId}...`;
6896
+ const data = (0, import_viem9.encodeFunctionData)({
6897
+ abi: CONTROLLER_ABI,
6898
+ functionName: "terminateApp",
6899
+ args: [appId]
6900
+ });
6901
+ const tx = await sendAndWaitForTransaction(
6902
+ {
6903
+ privateKey,
6904
+ rpcUrl: ctx.rpcUrl,
6905
+ environmentConfig: environment,
6906
+ to: environment.appControllerAddress,
6907
+ data,
6908
+ pendingMessage,
6909
+ txDescription: "TerminateApp",
6910
+ gas: opts?.gas
6911
+ },
6912
+ logger
6913
+ );
6914
+ return { tx };
6915
+ }
6552
6916
  );
6553
- return { tx };
6917
+ },
6918
+ async isDelegated() {
6919
+ return isDelegated({
6920
+ privateKey,
6921
+ rpcUrl: ctx.rpcUrl,
6922
+ environmentConfig: environment
6923
+ });
6554
6924
  },
6555
6925
  async undelegate() {
6556
- const tx = await undelegate(
6926
+ return withSDKTelemetry(
6557
6927
  {
6558
- privateKey,
6559
- rpcUrl: ctx.rpcUrl,
6560
- environmentConfig: environment
6928
+ functionName: "undelegate",
6929
+ skipTelemetry,
6930
+ // Skip if called from CLI
6931
+ properties: { environment: ctx.environment }
6561
6932
  },
6562
- logger
6933
+ async () => {
6934
+ const tx = await undelegate(
6935
+ {
6936
+ privateKey,
6937
+ rpcUrl: ctx.rpcUrl,
6938
+ environmentConfig: environment
6939
+ },
6940
+ logger
6941
+ );
6942
+ return { tx };
6943
+ }
6563
6944
  );
6564
- return { tx };
6565
6945
  }
6566
6946
  };
6567
6947
  }
6568
6948
 
6949
+ // src/client/modules/compute/index.ts
6950
+ function createComputeModule(config) {
6951
+ return {
6952
+ app: createAppModule(config)
6953
+ };
6954
+ }
6955
+
6569
6956
  // src/client/common/utils/billingapi.ts
6570
6957
  var import_axios2 = __toESM(require("axios"), 1);
6571
6958
  var import_accounts5 = require("viem/accounts");
@@ -6641,63 +7028,93 @@ Please check:
6641
7028
 
6642
7029
  // src/client/modules/billing/index.ts
6643
7030
  function createBillingModule(config) {
6644
- const { verbose = false } = config;
7031
+ const { verbose = false, skipTelemetry = false } = config;
6645
7032
  const privateKey = addHexPrefix(config.privateKey);
6646
7033
  const logger = getLogger(verbose);
6647
7034
  const billingEnvConfig = getBillingEnvironmentConfig(getBuildType());
6648
7035
  const billingApi = new BillingApiClient(billingEnvConfig, privateKey);
6649
7036
  return {
6650
7037
  async subscribe(opts) {
6651
- const productId = opts?.productId || "compute";
6652
- logger.debug(`Checking existing subscription for ${productId}...`);
6653
- const currentStatus = await billingApi.getSubscription(productId);
6654
- if (isSubscriptionActive(currentStatus.subscriptionStatus)) {
6655
- logger.debug(`Subscription already active: ${currentStatus.subscriptionStatus}`);
6656
- return {
6657
- type: "already_active",
6658
- status: currentStatus.subscriptionStatus
6659
- };
6660
- }
6661
- if (currentStatus.subscriptionStatus === "past_due" || currentStatus.subscriptionStatus === "unpaid") {
6662
- logger.debug(`Subscription has payment issue: ${currentStatus.subscriptionStatus}`);
6663
- return {
6664
- type: "payment_issue",
6665
- status: currentStatus.subscriptionStatus,
6666
- portalUrl: currentStatus.portalUrl
6667
- };
6668
- }
6669
- logger.debug(`Creating subscription for ${productId}...`);
6670
- const result = await billingApi.createSubscription(productId);
6671
- logger.debug(`Checkout URL: ${result.checkoutUrl}`);
6672
- return {
6673
- type: "checkout_created",
6674
- checkoutUrl: result.checkoutUrl
6675
- };
7038
+ return withSDKTelemetry(
7039
+ {
7040
+ functionName: "subscribe",
7041
+ skipTelemetry,
7042
+ // Skip if called from CLI
7043
+ properties: { productId: opts?.productId || "compute" }
7044
+ },
7045
+ async () => {
7046
+ const productId = opts?.productId || "compute";
7047
+ logger.debug(`Checking existing subscription for ${productId}...`);
7048
+ const currentStatus = await billingApi.getSubscription(productId);
7049
+ if (isSubscriptionActive(currentStatus.subscriptionStatus)) {
7050
+ logger.debug(`Subscription already active: ${currentStatus.subscriptionStatus}`);
7051
+ return {
7052
+ type: "already_active",
7053
+ status: currentStatus.subscriptionStatus
7054
+ };
7055
+ }
7056
+ if (currentStatus.subscriptionStatus === "past_due" || currentStatus.subscriptionStatus === "unpaid") {
7057
+ logger.debug(`Subscription has payment issue: ${currentStatus.subscriptionStatus}`);
7058
+ return {
7059
+ type: "payment_issue",
7060
+ status: currentStatus.subscriptionStatus,
7061
+ portalUrl: currentStatus.portalUrl
7062
+ };
7063
+ }
7064
+ logger.debug(`Creating subscription for ${productId}...`);
7065
+ const result = await billingApi.createSubscription(productId);
7066
+ logger.debug(`Checkout URL: ${result.checkoutUrl}`);
7067
+ return {
7068
+ type: "checkout_created",
7069
+ checkoutUrl: result.checkoutUrl
7070
+ };
7071
+ }
7072
+ );
6676
7073
  },
6677
7074
  async getStatus(opts) {
6678
- const productId = opts?.productId || "compute";
6679
- logger.debug(`Fetching subscription status for ${productId}...`);
6680
- const result = await billingApi.getSubscription(productId);
6681
- logger.debug(`Subscription status: ${result.subscriptionStatus}`);
6682
- return result;
7075
+ return withSDKTelemetry(
7076
+ {
7077
+ functionName: "getStatus",
7078
+ skipTelemetry,
7079
+ // Skip if called from CLI
7080
+ properties: { productId: opts?.productId || "compute" }
7081
+ },
7082
+ async () => {
7083
+ const productId = opts?.productId || "compute";
7084
+ logger.debug(`Fetching subscription status for ${productId}...`);
7085
+ const result = await billingApi.getSubscription(productId);
7086
+ logger.debug(`Subscription status: ${result.subscriptionStatus}`);
7087
+ return result;
7088
+ }
7089
+ );
6683
7090
  },
6684
7091
  async cancel(opts) {
6685
- const productId = opts?.productId || "compute";
6686
- logger.debug(`Checking subscription status for ${productId}...`);
6687
- const currentStatus = await billingApi.getSubscription(productId);
6688
- if (!isSubscriptionActive(currentStatus.subscriptionStatus)) {
6689
- logger.debug(`No active subscription to cancel: ${currentStatus.subscriptionStatus}`);
6690
- return {
6691
- type: "no_active_subscription",
6692
- status: currentStatus.subscriptionStatus
6693
- };
6694
- }
6695
- logger.debug(`Canceling subscription for ${productId}...`);
6696
- await billingApi.cancelSubscription(productId);
6697
- logger.debug(`Subscription canceled successfully`);
6698
- return {
6699
- type: "canceled"
6700
- };
7092
+ return withSDKTelemetry(
7093
+ {
7094
+ functionName: "cancel",
7095
+ skipTelemetry,
7096
+ // Skip if called from CLI
7097
+ properties: { productId: opts?.productId || "compute" }
7098
+ },
7099
+ async () => {
7100
+ const productId = opts?.productId || "compute";
7101
+ logger.debug(`Checking subscription status for ${productId}...`);
7102
+ const currentStatus = await billingApi.getSubscription(productId);
7103
+ if (!isSubscriptionActive(currentStatus.subscriptionStatus)) {
7104
+ logger.debug(`No active subscription to cancel: ${currentStatus.subscriptionStatus}`);
7105
+ return {
7106
+ type: "no_active_subscription",
7107
+ status: currentStatus.subscriptionStatus
7108
+ };
7109
+ }
7110
+ logger.debug(`Canceling subscription for ${productId}...`);
7111
+ await billingApi.cancelSubscription(productId);
7112
+ logger.debug(`Subscription canceled successfully`);
7113
+ return {
7114
+ type: "canceled"
7115
+ };
7116
+ }
7117
+ );
6701
7118
  }
6702
7119
  };
6703
7120
  }
@@ -6981,7 +7398,7 @@ function createECloudClient(cfg) {
6981
7398
  );
6982
7399
  }
6983
7400
  return {
6984
- app: createAppModule({
7401
+ compute: createComputeModule({
6985
7402
  rpcUrl,
6986
7403
  verbose: cfg.verbose,
6987
7404
  privateKey: cfg.privateKey,
@@ -6995,17 +7412,26 @@ function createECloudClient(cfg) {
6995
7412
  }
6996
7413
  // Annotate the CommonJS export names for ESM import in node:
6997
7414
  0 && (module.exports = {
7415
+ NoopClient,
6998
7416
  PRIMARY_LANGUAGES,
7417
+ PostHogClient,
6999
7418
  UserApiClient,
7419
+ addMetric,
7420
+ addMetricWithDimensions,
7000
7421
  assertValidFilePath,
7001
7422
  assertValidImageReference,
7002
7423
  assertValidPrivateKey,
7424
+ checkERC7702Delegation,
7003
7425
  createApp,
7004
- createAppModule,
7426
+ createAppEnvironment,
7005
7427
  createBillingModule,
7428
+ createComputeModule,
7006
7429
  createECloudClient,
7430
+ createMetricsContext,
7431
+ createTelemetryClient,
7007
7432
  deleteLegacyPrivateKey,
7008
7433
  deletePrivateKey,
7434
+ emitMetrics,
7009
7435
  encodeStartAppData,
7010
7436
  encodeStopAppData,
7011
7437
  encodeTerminateAppData,
@@ -7029,11 +7455,14 @@ function createECloudClient(cfg) {
7029
7455
  getEnvironmentConfig,
7030
7456
  getLegacyKeys,
7031
7457
  getLegacyPrivateKey,
7458
+ getPostHogAPIKey,
7459
+ getPostHogEndpoint,
7032
7460
  getPrivateKey,
7033
7461
  getPrivateKeyWithSource,
7034
7462
  getTemplate,
7035
7463
  isEnvironmentAvailable,
7036
7464
  isMainnet,
7465
+ isNoopClient,
7037
7466
  isSubscriptionActive,
7038
7467
  keyExists,
7039
7468
  listStoredKeys,
@@ -7063,6 +7492,7 @@ function createECloudClient(cfg) {
7063
7492
  validateUpgradeParams,
7064
7493
  validateXURL,
7065
7494
  watchDeployment,
7066
- watchUpgrade
7495
+ watchUpgrade,
7496
+ withSDKTelemetry
7067
7497
  });
7068
7498
  //# sourceMappingURL=index.cjs.map