glass-connect 0.1.0 → 0.2.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 (2) hide show
  1. package/dist/cli.js +32 -44
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -16592,7 +16592,7 @@ var init_execution_handler = __esm({
16592
16592
  });
16593
16593
 
16594
16594
  // ../../packages/contracts/src/environments.ts
16595
- var environmentCredentialScope, environmentPairingApprovalPath, environmentRotationApprovalPath, maxEnvironmentDisplayNameLength, base64UrlPattern, rejectUnknown2, decodePublicKey, decodePlatform, decodeEnvironmentIdentityChallenge, decodeExecutionEnvironment, decodeApprovalResponse, decodeBeginEnvironmentPairingResponse, decodeEnvironmentPairingStatus, decodeEnvironmentCredential;
16595
+ var environmentCredentialScope, environmentPairingApprovalPath, maxEnvironmentDisplayNameLength, base64UrlPattern, rejectUnknown2, decodePublicKey, decodePlatform, decodeEnvironmentIdentityChallenge, decodeExecutionEnvironment, decodeBeginEnvironmentPairingResponse, decodeEnvironmentPairingStatus, decodeEnvironmentCredential;
16596
16596
  var init_environments = __esm({
16597
16597
  "../../packages/contracts/src/environments.ts"() {
16598
16598
  "use strict";
@@ -16600,7 +16600,6 @@ var init_environments = __esm({
16600
16600
  init_validation();
16601
16601
  environmentCredentialScope = "glass-connect";
16602
16602
  environmentPairingApprovalPath = "/#glass-connect-pair";
16603
- environmentRotationApprovalPath = "/#glass-connect-rotate";
16604
16603
  maxEnvironmentDisplayNameLength = 120;
16605
16604
  base64UrlPattern = /^[A-Za-z0-9_-]+$/u;
16606
16605
  rejectUnknown2 = (value2, keys, path) => {
@@ -16711,12 +16710,12 @@ var init_environments = __esm({
16711
16710
  revokedAt: revokedAt.value
16712
16711
  });
16713
16712
  };
16714
- decodeApprovalResponse = (input, kind) => {
16715
- const path = kind === "pairing" ? "$pairingResponse" : "$rotationResponse";
16713
+ decodeBeginEnvironmentPairingResponse = (input) => {
16714
+ const path = "$pairingResponse";
16716
16715
  const record2 = decodeRecord(input, path);
16717
16716
  if (!record2.ok) return record2;
16718
- const idKey = kind === "pairing" ? "pairingId" : "rotationId";
16719
- const codeKey = kind === "pairing" ? "pairingCode" : "rotationCode";
16717
+ const idKey = "pairingId";
16718
+ const codeKey = "pairingCode";
16720
16719
  const keys = rejectUnknown2(
16721
16720
  record2.value,
16722
16721
  [idKey, codeKey, "pollingToken", "approvalPath", "expiresAt"],
@@ -16732,8 +16731,7 @@ var init_environments = __esm({
16732
16731
  minLength: 43,
16733
16732
  maxLength: 128
16734
16733
  });
16735
- const expectedPath = kind === "pairing" ? environmentPairingApprovalPath : environmentRotationApprovalPath;
16736
- const approvalPath = record2.value.approvalPath === expectedPath ? decodeSuccess(expectedPath) : decodeFailure(`${path}.approvalPath`, "invalid_format", "Unexpected approval path.");
16734
+ const approvalPath = record2.value.approvalPath === environmentPairingApprovalPath ? decodeSuccess(environmentPairingApprovalPath) : decodeFailure(`${path}.approvalPath`, "invalid_format", "Unexpected approval path.");
16737
16735
  const expiresAt = decodeIsoDateTime(record2.value.expiresAt, `${path}.expiresAt`);
16738
16736
  const issues = [id, code, pollingToken, approvalPath, expiresAt].flatMap(
16739
16737
  (result3) => result3.ok ? [] : result3.issues
@@ -16741,23 +16739,14 @@ var init_environments = __esm({
16741
16739
  if (issues.length > 0) return { ok: false, issues };
16742
16740
  if (!id.ok || !code.ok || !pollingToken.ok || !approvalPath.ok || !expiresAt.ok)
16743
16741
  return decodeFailure(path, "invalid_type", "Invalid approval response.");
16744
- return decodeSuccess(
16745
- kind === "pairing" ? {
16746
- pairingId: id.value,
16747
- pairingCode: code.value,
16748
- pollingToken: pollingToken.value,
16749
- approvalPath: approvalPath.value,
16750
- expiresAt: expiresAt.value
16751
- } : {
16752
- rotationId: id.value,
16753
- rotationCode: code.value,
16754
- pollingToken: pollingToken.value,
16755
- approvalPath: approvalPath.value,
16756
- expiresAt: expiresAt.value
16757
- }
16758
- );
16742
+ return decodeSuccess({
16743
+ pairingId: id.value,
16744
+ pairingCode: code.value,
16745
+ pollingToken: pollingToken.value,
16746
+ approvalPath: approvalPath.value,
16747
+ expiresAt: expiresAt.value
16748
+ });
16759
16749
  };
16760
- decodeBeginEnvironmentPairingResponse = (input) => decodeApprovalResponse(input, "pairing");
16761
16750
  decodeEnvironmentPairingStatus = (input) => {
16762
16751
  const record2 = decodeRecord(input, "$pairingStatusResponse");
16763
16752
  if (!record2.ok) return record2;
@@ -21176,8 +21165,8 @@ var init_main = __esm({
21176
21165
  const index = args2.indexOf(name);
21177
21166
  return index < 0 ? void 0 : args2[index + 1];
21178
21167
  };
21179
- identityPath2 = option3("--identity") ?? defaultIdentityPath();
21180
- workspaceRegistryPath = option3("--workspaces") ?? defaultWorkspaceRegistryPath(identityPath2);
21168
+ identityPath2 = defaultIdentityPath();
21169
+ workspaceRegistryPath = defaultWorkspaceRegistryPath(identityPath2);
21181
21170
  publishIdentity = async (origin) => {
21182
21171
  let identity2 = createNodeIdentity(origin);
21183
21172
  const nodePlatform = platform() === "darwin" ? "macos" : platform() === "win32" ? "windows" : "linux";
@@ -21198,15 +21187,7 @@ Waiting for approval\u2026
21198
21187
  return identity2;
21199
21188
  };
21200
21189
  runConnectCommand = async () => {
21201
- const commandArguments = [
21202
- ...process.execArgv,
21203
- process.argv[1] ?? "",
21204
- "connect",
21205
- "--identity",
21206
- identityPath2,
21207
- "--workspaces",
21208
- workspaceRegistryPath
21209
- ];
21190
+ const commandArguments = [...process.execArgv, process.argv[1] ?? "", "connect"];
21210
21191
  const child = spawn2(process.execPath, commandArguments, { stdio: "inherit" });
21211
21192
  const result3 = await new Promise((complete, reject) => {
21212
21193
  child.once("error", reject);
@@ -21216,11 +21197,11 @@ Waiting for approval\u2026
21216
21197
  if (result3.code !== 0) process.exitCode = result3.code ?? 1;
21217
21198
  };
21218
21199
  if (command === "start") {
21219
- const configuredOrigin = option3("--api") ?? process.env.GLASS_CLOUD_ORIGIN;
21200
+ const configuredOrigin = process.env.GLASS_CLOUD_ORIGIN;
21220
21201
  let identity2 = await loadNodeIdentity(identityPath2);
21221
21202
  if (identity2 !== null && configuredOrigin !== void 0 && new URL(identity2.apiOrigin).origin !== new URL(configuredOrigin).origin) {
21222
21203
  throw new Error(
21223
- `This Glass Connect identity belongs to ${identity2.apiOrigin}. Use a different --identity path for ${configuredOrigin}.`
21204
+ `This Glass Connect identity belongs to ${identity2.apiOrigin}. Use stage-specific Glass Connect state for ${configuredOrigin}.`
21224
21205
  );
21225
21206
  }
21226
21207
  if (identity2 !== null && identity2.environment !== null) {
@@ -21237,7 +21218,8 @@ Waiting for approval\u2026
21237
21218
  }
21238
21219
  } else {
21239
21220
  const origin = configuredOrigin ?? identity2?.apiOrigin;
21240
- if (origin === void 0) throw new Error("Set GLASS_CLOUD_ORIGIN or pass --api.");
21221
+ if (origin === void 0)
21222
+ throw new Error("Glass Connect has no configured Glass Cloud origin.");
21241
21223
  identity2 = await publishIdentity(origin);
21242
21224
  }
21243
21225
  const registeredWorkspaces = await loadWorkspaceRegistry(workspaceRegistryPath, {
@@ -21256,9 +21238,7 @@ Waiting for approval\u2026
21256
21238
  }
21257
21239
  await runConnectCommand();
21258
21240
  } else if (command === "help") {
21259
- process.stdout.write(
21260
- "Usage: glass-connect [--api URL] [--name NAME] [--identity PATH] [--workspaces PATH]\n"
21261
- );
21241
+ process.stdout.write("Usage: glass-connect [--name NAME]\n");
21262
21242
  } else if (command === "descriptor") {
21263
21243
  process.stdout.write(`${JSON.stringify(await Effect_exports.runPromise(readExecutionDescriptor))}
21264
21244
  `);
@@ -21408,7 +21388,7 @@ Waiting for approval\u2026
21408
21388
  });
21409
21389
  } else {
21410
21390
  throw new Error(
21411
- "Usage: glass-connect [--api URL] [--name NAME] | descriptor | workspace-add --id UUID --name NAME --root PATH | workspace-list | workspace-remove --id UUID"
21391
+ "Usage: glass-connect [--name NAME] | descriptor | workspace-add --id UUID --name NAME --root PATH | workspace-list | workspace-remove --id UUID"
21412
21392
  );
21413
21393
  }
21414
21394
  }
@@ -21417,18 +21397,26 @@ Waiting for approval\u2026
21417
21397
  // ../../config/glass-cloud.json
21418
21398
  var glass_cloud_default = {
21419
21399
  origins: {
21420
- development: "https://glasscloud-api-dev-iqwgnfdineqiceki.naaiyyyy.workers.dev",
21421
21400
  production: "https://glasscloud-api-prod-lcuxsmngpdigrgum.naaiyyyy.workers.dev",
21422
21401
  staging: "https://glasscloud-api-staging-rmhiqpuua7m4g6a3.naaiyyyy.workers.dev"
21402
+ },
21403
+ services: {
21404
+ stagingTunnelControl: "glasscloud-tunnelcontrol-staging-uyzu7wweagwmmwd2"
21423
21405
  }
21424
21406
  };
21425
21407
 
21426
21408
  // npm/cli.ts
21427
21409
  import { chmod as chmod5 } from "node:fs/promises";
21428
21410
  import { createRequire as createRequire2 } from "node:module";
21429
- import { arch, platform as platform2 } from "node:os";
21411
+ import { arch, homedir as homedir2, platform as platform2 } from "node:os";
21430
21412
  import { dirname as dirname5, join as join7 } from "node:path";
21413
+ var productionStateRoot = join7(homedir2(), ".glass", "production");
21431
21414
  process.env.GLASS_CLOUD_ORIGIN ??= glass_cloud_default.origins.production;
21415
+ process.env.GLASS_NODE_IDENTITY_PATH ??= join7(productionStateRoot, "execution-node.json");
21416
+ process.env.GLASS_EXECUTION_WORKSPACES_PATH ??= join7(
21417
+ productionStateRoot,
21418
+ "execution-workspaces.json"
21419
+ );
21432
21420
  if (platform2() !== "win32") {
21433
21421
  const require3 = createRequire2(import.meta.url);
21434
21422
  const nodePtyRoot = dirname5(require3.resolve("node-pty/package.json"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glass-connect",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Publish a computer to Glass with one command.",
5
5
  "license": "UNLICENSED",
6
6
  "bin": {
@@ -20,4 +20,4 @@
20
20
  "engines": {
21
21
  "node": ">=24.13.1"
22
22
  }
23
- }
23
+ }