relay-companion 0.1.511 → 0.1.512

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.
@@ -1051,6 +1051,19 @@ async function activateRuntime(layout, runtime, version, {
1051
1051
  return { candidate, cliLauncher };
1052
1052
  }
1053
1053
 
1054
+ // The setup-intent marker, read by the pill (overlay/main.cjs readSetupIntent).
1055
+ // Plain setup opens the pill signed out for a person who will sign in there
1056
+ // (sendrelays.com's Get started); the marker is what lets the pill start that
1057
+ // sign-in without a click. The --code and --agent-protocol paths pair without
1058
+ // a pill sign-in, so they must not leave one behind. Only the fact, the time
1059
+ // and the version are recorded: never a credential.
1060
+ const SETUP_INTENT_FILE = "setup-intent.json";
1061
+ function writeSetupIntent(configDir, version, setupCompatibilityArgs = [], { now = new Date(), write = atomicWriteJson } = {}) {
1062
+ if (setupCompatibilityArgs.includes("--code") || setupCompatibilityArgs.includes("--agent-protocol")) return false;
1063
+ write(path.join(configDir, SETUP_INTENT_FILE), { agentInstalled: true, at: now.toISOString(), version });
1064
+ return true;
1065
+ }
1066
+
1054
1067
  async function setup(argv = []) {
1055
1068
  assertCompatibleNode();
1056
1069
  const setupCompatibilityArgs = validateSetupCompatibilityArgs(argv);
@@ -1068,6 +1081,12 @@ async function setup(argv = []) {
1068
1081
  if (setupCompatibilityArgs.includes("--agent-protocol") && process.env.RELAY_BACKGROUND_INSTALL_WORKER === "1") {
1069
1082
  await require("./relay-background-install.cjs").waitForAgentAuthorization();
1070
1083
  }
1084
+ // Before activation, so the pill it opens reads the marker on first paint.
1085
+ // A marker that cannot be written costs the person one click, not the
1086
+ // install, so it never fails setup.
1087
+ try {
1088
+ writeSetupIntent(process.env.RELAY_CONFIG_DIR || path.join(os.homedir(), ".relay"), version, setupCompatibilityArgs);
1089
+ } catch {}
1071
1090
  const activated = await activateRuntime(layout, runtime, version, { setupCompatibilityArgs });
1072
1091
  if (setupCompatibilityArgs.includes("--code")) {
1073
1092
  console.log(`Relay ${version} is installed and paired. The Relay pill is open.`);
@@ -1203,6 +1222,7 @@ module.exports = {
1203
1222
  validateArchiveEntries,
1204
1223
  verifyExtractedRuntime,
1205
1224
  waitForRuntimeHealth,
1225
+ writeSetupIntent,
1206
1226
  };
1207
1227
 
1208
1228
  if (require.main === module) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relay-companion",
3
- "version": "0.1.511",
3
+ "version": "0.1.512",
4
4
  "description": "Install Relay for Claude Code, Cowork, and Codex, then sign in from the Relay pill.",
5
5
  "homepage": "https://sendrelays.com/get-started",
6
6
  "repository": {