From 91a603ce9676a191dba0ad0cc9ce2b300cf9ee66 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Sun, 12 Jul 2026 18:39:18 -0700 Subject: [PATCH] [eric] conventions: strip em-dashes from app runtime contract; de-prefix cross-file affiliate exports --- .../agents/manager/prompt/prompt_context.py | 4 ++-- electron/affiliateTracking.js | 8 ++++---- electron/affiliateTracking.test.js | 18 +++++++++--------- electron/main.js | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/backend/apps/agents/manager/prompt/prompt_context.py b/backend/apps/agents/manager/prompt/prompt_context.py index 06740839..b9ae5bb3 100644 --- a/backend/apps/agents/manager/prompt/prompt_context.py +++ b/backend/apps/agents/manager/prompt/prompt_context.py @@ -208,8 +208,8 @@ def build_app_runtime_contract(workspace_path: Optional[str]) -> str: log = os.path.join(root, ".openswarm", "terminal.log") return ( "\n" - "Your app is already running. Its terminal — backend stdout/stderr, runtime events, and the\n" - "browser console — is tee'd to a file you can read directly. This is the ONLY way you can see\n" + "Your app is already running. Its terminal (backend stdout/stderr, runtime events, and the\n" + "browser console) is tee'd to a file you can read directly. This is the ONLY way you can see\n" "what the app actually does; editing files tells you nothing about whether it runs.\n\n" "Read it with exactly this, every time:\n\n" f' tail -50 {log} 2>/dev/null || echo "Terminal log not yet available"\n\n' diff --git a/electron/affiliateTracking.js b/electron/affiliateTracking.js index 650e6736..fae4d54f 100644 --- a/electron/affiliateTracking.js +++ b/electron/affiliateTracking.js @@ -312,8 +312,8 @@ async function maybeRunFirstLaunchHandshake({ module.exports = { maybeRunFirstLaunchHandshake, resolveInstallId, - p_readState: readState, - p_writeState: writeState, - p_hashFromInstallerBasename: hashFromInstallerBasename, - p_findAffiliateHashFromInstaller: findAffiliateHashFromInstaller, + readState, + writeState, + hashFromInstallerBasename, + findAffiliateHashFromInstaller, }; diff --git a/electron/affiliateTracking.test.js b/electron/affiliateTracking.test.js index 3a6fb6b6..dfc286be 100644 --- a/electron/affiliateTracking.test.js +++ b/electron/affiliateTracking.test.js @@ -285,14 +285,14 @@ test("first launch: stamped AppImage hash binds before opening welcome URL", asy test("filename parser accepts browser duplicate suffix", () => { assert.equal( - affiliateTracking.p_hashFromInstallerBasename("OpenSwarm-arm64-abcDEF1234567890_hash (1).dmg"), + affiliateTracking.hashFromInstallerBasename("OpenSwarm-arm64-abcDEF1234567890_hash (1).dmg"), "abcDEF1234567890_hash", ); }); test("filename parser keeps hyphens inside base64url affiliate hash", () => { assert.equal( - affiliateTracking.p_hashFromInstallerBasename("OpenSwarm-arm64-abcDEF1234567890-hash.dmg"), + affiliateTracking.hashFromInstallerBasename("OpenSwarm-arm64-abcDEF1234567890-hash.dmg"), "abcDEF1234567890-hash", ); }); @@ -306,10 +306,10 @@ test("filename parser covers every stamped artifact shape (mac/win/linux)", () = `OpenSwarm-x64-${h}.AppImage`, `OpenSwarm-arm64-${h}.AppImage`, ]) { - assert.equal(affiliateTracking.p_hashFromInstallerBasename(name), h, name); + assert.equal(affiliateTracking.hashFromInstallerBasename(name), h, name); } for (const name of ["OpenSwarm-arm64.dmg", "OpenSwarm-Setup-x64.exe", "OpenSwarm-x64.AppImage"]) { - assert.equal(affiliateTracking.p_hashFromInstallerBasename(name), null, name); + assert.equal(affiliateTracking.hashFromInstallerBasename(name), null, name); } }); @@ -353,7 +353,7 @@ test("download scan refuses ambiguous stamped installers", () => { fs.writeFileSync(path.join(downloads, "OpenSwarm-arm64-abcDEF1234567890_a.dmg"), ""); fs.writeFileSync(path.join(downloads, "OpenSwarm-arm64-abcDEF1234567890_b.dmg"), ""); - const hash = affiliateTracking.p_findAffiliateHashFromInstaller({ + const hash = affiliateTracking.findAffiliateHashFromInstaller({ platform: "darwin", homeDir: userDataDir, nowMs: Date.now(), @@ -363,7 +363,7 @@ test("download scan refuses ambiguous stamped installers", () => { test("resolveInstallId: reuses install.json app_install_id", () => { const userDataDir = makeTempUserDataDir(); - affiliateTracking.p_writeState(userDataDir, { app_install_id: "existing-id-12345" }); + affiliateTracking.writeState(userDataDir, { app_install_id: "existing-id-12345" }); const id = affiliateTracking.resolveInstallId({ userDataDir, isPackaged: true, projectRoot: userDataDir, homeDir: userDataDir, }); @@ -595,7 +595,7 @@ test("dev mode: skipped unless OPENSWARM_AFFILIATE_FORCE=1", async () => { test("install.json write is atomic-ish (temp + rename)", async () => { const userDataDir = makeTempUserDataDir(); - affiliateTracking.p_writeState(userDataDir, { app_install_id: "atomic-test-1234567890", ref: "x" }); + affiliateTracking.writeState(userDataDir, { app_install_id: "atomic-test-1234567890", ref: "x" }); // After write, the temp file shouldn't be left behind. const files = fs.readdirSync(userDataDir); assert.ok(files.includes("install.json")); @@ -604,14 +604,14 @@ test("install.json write is atomic-ish (temp + rename)", async () => { test("readState returns {} when no install.json exists", () => { const userDataDir = makeTempUserDataDir(); - const state = affiliateTracking.p_readState(userDataDir); + const state = affiliateTracking.readState(userDataDir); assert.deepEqual(state, {}); }); test("readState returns {} when install.json is corrupt", () => { const userDataDir = makeTempUserDataDir(); fs.writeFileSync(path.join(userDataDir, "install.json"), "{ not json"); - const state = affiliateTracking.p_readState(userDataDir); + const state = affiliateTracking.readState(userDataDir); assert.deepEqual(state, {}); }); diff --git a/electron/main.js b/electron/main.js index 1bab4f1f..f6debeac 100644 --- a/electron/main.js +++ b/electron/main.js @@ -3020,7 +3020,7 @@ ipcMain.handle('open-external', (_event, url) => { // (Stripe checkout, sign-in events) for downstream attribution. ipcMain.handle('get-install-state', () => { try { - return affiliateTracking.p_readState(app.getPath('userData')); + return affiliateTracking.readState(app.getPath('userData')); } catch (_) { return {}; }