@relayplane/proxy 1.8.8 → 1.8.9
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/cli.js +0 -0
- package/dist/signup-nudge.d.ts +45 -0
- package/dist/signup-nudge.d.ts.map +1 -0
- package/dist/signup-nudge.js +155 -0
- package/dist/signup-nudge.js.map +1 -0
- package/dist/standalone-proxy.d.ts.map +1 -1
- package/dist/standalone-proxy.js +8 -0
- package/dist/standalone-proxy.js.map +1 -1
- package/package.json +1 -1
- package/dist/osmosis-store.d.ts +0 -33
- package/dist/osmosis-store.d.ts.map +0 -1
- package/dist/osmosis-store.js +0 -181
- package/dist/osmosis-store.js.map +0 -1
package/dist/cli.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RelayPlane Signup Nudge
|
|
3
|
+
*
|
|
4
|
+
* After the 100th cumulative proxied request, prints a one-time CLI nudge
|
|
5
|
+
* to stderr encouraging the user to connect a free cloud account.
|
|
6
|
+
*
|
|
7
|
+
* Guarantees:
|
|
8
|
+
* - Fires exactly once per install (flag written to ~/.relayplane/nudge-shown.json)
|
|
9
|
+
* - Prints to stderr — never pollutes proxy response stdout
|
|
10
|
+
* - Zero added latency — call checkAndShowNudge() *after* forwarding the response
|
|
11
|
+
* - Never throws — all errors are silently swallowed
|
|
12
|
+
*/
|
|
13
|
+
/** Path to the telemetry event log */
|
|
14
|
+
declare function getTelemetryFile(): string;
|
|
15
|
+
/** Path to the nudge-shown flag file */
|
|
16
|
+
declare function getNudgeFlagFile(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Call this once at proxy startup.
|
|
19
|
+
* Reads the flag file and caches the result so we never re-read it per-request.
|
|
20
|
+
*/
|
|
21
|
+
export declare function initNudge(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Count cumulative requests from the telemetry.jsonl file.
|
|
24
|
+
* Returns 0 on any read/parse error.
|
|
25
|
+
*/
|
|
26
|
+
export declare function countTelemetryRequests(): number;
|
|
27
|
+
/**
|
|
28
|
+
* Check whether the nudge should fire and, if so, show it.
|
|
29
|
+
*
|
|
30
|
+
* Call this AFTER the proxy response has been forwarded so there is
|
|
31
|
+
* zero added latency on the request path. This function is intentionally
|
|
32
|
+
* synchronous so it can be fire-and-forgotten without creating a dangling
|
|
33
|
+
* promise.
|
|
34
|
+
*
|
|
35
|
+
* @param requestCount Optional: pass the current cumulative count if you
|
|
36
|
+
* already have it (avoids re-reading the file). When
|
|
37
|
+
* omitted the file is read on every call until the nudge
|
|
38
|
+
* fires — fine because reads are O(lines) and infrequent.
|
|
39
|
+
*/
|
|
40
|
+
export declare function checkAndShowNudge(requestCount?: number): void;
|
|
41
|
+
/** Reset in-memory flag (used in tests only) */
|
|
42
|
+
export declare function _resetNudgeState(): void;
|
|
43
|
+
/** Expose the flag path for tests */
|
|
44
|
+
export { getNudgeFlagFile, getTelemetryFile };
|
|
45
|
+
//# sourceMappingURL=signup-nudge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signup-nudge.d.ts","sourceRoot":"","sources":["../src/signup-nudge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,sCAAsC;AACtC,iBAAS,gBAAgB,IAAI,MAAM,CAElC;AAED,wCAAwC;AACxC,iBAAS,gBAAgB,IAAI,MAAM,CAElC;AAKD;;;GAGG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAShC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAU/C;AA4BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAa7D;AAID,gDAAgD;AAChD,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAED,qCAAqC;AACrC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* RelayPlane Signup Nudge
|
|
4
|
+
*
|
|
5
|
+
* After the 100th cumulative proxied request, prints a one-time CLI nudge
|
|
6
|
+
* to stderr encouraging the user to connect a free cloud account.
|
|
7
|
+
*
|
|
8
|
+
* Guarantees:
|
|
9
|
+
* - Fires exactly once per install (flag written to ~/.relayplane/nudge-shown.json)
|
|
10
|
+
* - Prints to stderr — never pollutes proxy response stdout
|
|
11
|
+
* - Zero added latency — call checkAndShowNudge() *after* forwarding the response
|
|
12
|
+
* - Never throws — all errors are silently swallowed
|
|
13
|
+
*/
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.initNudge = initNudge;
|
|
49
|
+
exports.countTelemetryRequests = countTelemetryRequests;
|
|
50
|
+
exports.checkAndShowNudge = checkAndShowNudge;
|
|
51
|
+
exports._resetNudgeState = _resetNudgeState;
|
|
52
|
+
exports.getNudgeFlagFile = getNudgeFlagFile;
|
|
53
|
+
exports.getTelemetryFile = getTelemetryFile;
|
|
54
|
+
const fs = __importStar(require("fs"));
|
|
55
|
+
const path = __importStar(require("path"));
|
|
56
|
+
const config_js_1 = require("./config.js");
|
|
57
|
+
/** Path to the telemetry event log */
|
|
58
|
+
function getTelemetryFile() {
|
|
59
|
+
return path.join((0, config_js_1.getConfigDir)(), 'telemetry.jsonl');
|
|
60
|
+
}
|
|
61
|
+
/** Path to the nudge-shown flag file */
|
|
62
|
+
function getNudgeFlagFile() {
|
|
63
|
+
return path.join((0, config_js_1.getConfigDir)(), 'nudge-shown.json');
|
|
64
|
+
}
|
|
65
|
+
/** Whether the nudge has already been shown (checked once at startup) */
|
|
66
|
+
let nudgeAlreadyShown = false;
|
|
67
|
+
/**
|
|
68
|
+
* Call this once at proxy startup.
|
|
69
|
+
* Reads the flag file and caches the result so we never re-read it per-request.
|
|
70
|
+
*/
|
|
71
|
+
function initNudge() {
|
|
72
|
+
try {
|
|
73
|
+
const flagPath = getNudgeFlagFile();
|
|
74
|
+
if (fs.existsSync(flagPath)) {
|
|
75
|
+
nudgeAlreadyShown = true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
// Silently ignore — nudge is non-critical
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Count cumulative requests from the telemetry.jsonl file.
|
|
84
|
+
* Returns 0 on any read/parse error.
|
|
85
|
+
*/
|
|
86
|
+
function countTelemetryRequests() {
|
|
87
|
+
try {
|
|
88
|
+
const file = getTelemetryFile();
|
|
89
|
+
if (!fs.existsSync(file))
|
|
90
|
+
return 0;
|
|
91
|
+
const content = fs.readFileSync(file, 'utf-8');
|
|
92
|
+
// Each non-empty line is one request event
|
|
93
|
+
return content.split('\n').filter(l => l.trim().length > 0).length;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Write the nudge-shown flag so it never fires again.
|
|
101
|
+
*/
|
|
102
|
+
function markNudgeShown() {
|
|
103
|
+
try {
|
|
104
|
+
const flagPath = getNudgeFlagFile();
|
|
105
|
+
const configDir = (0, config_js_1.getConfigDir)();
|
|
106
|
+
if (!fs.existsSync(configDir)) {
|
|
107
|
+
fs.mkdirSync(configDir, { recursive: true });
|
|
108
|
+
}
|
|
109
|
+
fs.writeFileSync(flagPath, JSON.stringify({ shown: true, timestamp: new Date().toISOString() }), 'utf-8');
|
|
110
|
+
nudgeAlreadyShown = true;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
// Silently ignore
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Print the signup nudge to stderr.
|
|
118
|
+
*/
|
|
119
|
+
function printNudge(count) {
|
|
120
|
+
process.stderr.write(`\n💡 You've made ${count} requests through RelayPlane. Connect a free cloud account to sync savings history → relayplane.com/signup\n\n`);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Check whether the nudge should fire and, if so, show it.
|
|
124
|
+
*
|
|
125
|
+
* Call this AFTER the proxy response has been forwarded so there is
|
|
126
|
+
* zero added latency on the request path. This function is intentionally
|
|
127
|
+
* synchronous so it can be fire-and-forgotten without creating a dangling
|
|
128
|
+
* promise.
|
|
129
|
+
*
|
|
130
|
+
* @param requestCount Optional: pass the current cumulative count if you
|
|
131
|
+
* already have it (avoids re-reading the file). When
|
|
132
|
+
* omitted the file is read on every call until the nudge
|
|
133
|
+
* fires — fine because reads are O(lines) and infrequent.
|
|
134
|
+
*/
|
|
135
|
+
function checkAndShowNudge(requestCount) {
|
|
136
|
+
// Fast path — already shown, skip all I/O
|
|
137
|
+
if (nudgeAlreadyShown)
|
|
138
|
+
return;
|
|
139
|
+
try {
|
|
140
|
+
const count = requestCount ?? countTelemetryRequests();
|
|
141
|
+
if (count >= 100) {
|
|
142
|
+
printNudge(count);
|
|
143
|
+
markNudgeShown();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
// Nudge must never break the proxy
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// ── Test-seam exports (not part of public API) ────────────────────────────────
|
|
151
|
+
/** Reset in-memory flag (used in tests only) */
|
|
152
|
+
function _resetNudgeState() {
|
|
153
|
+
nudgeAlreadyShown = false;
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=signup-nudge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signup-nudge.js","sourceRoot":"","sources":["../src/signup-nudge.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBH,8BASC;AAMD,wDAUC;AAyCD,8CAaC;AAKD,4CAEC;AAGQ,4CAAgB;AAAE,4CAAgB;AA9G3C,uCAAyB;AACzB,2CAA6B;AAC7B,2CAA2C;AAE3C,sCAAsC;AACtC,SAAS,gBAAgB;IACvB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAA,wBAAY,GAAE,EAAE,iBAAiB,CAAC,CAAC;AACtD,CAAC;AAED,wCAAwC;AACxC,SAAS,gBAAgB;IACvB,OAAO,IAAI,CAAC,IAAI,CAA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,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CA2CjD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,CAavG;AAiJD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAe3D;AAuDD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,GAAG,UAAU,CAoDpG;AAED,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,GAAG,OAAO,CAIlG;AA6xDD;;GAEG;AACH,wBAAsB,UAAU,CAAC,MAAM,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAkuE/E"}
|
package/dist/standalone-proxy.js
CHANGED
|
@@ -83,6 +83,7 @@ const alerts_js_1 = require("./alerts.js");
|
|
|
83
83
|
const downgrade_js_1 = require("./downgrade.js");
|
|
84
84
|
const agent_tracker_js_1 = require("./agent-tracker.js");
|
|
85
85
|
const version_status_js_1 = require("./utils/version-status.js");
|
|
86
|
+
const signup_nudge_js_1 = require("./signup-nudge.js");
|
|
86
87
|
const PROXY_VERSION = (() => {
|
|
87
88
|
try {
|
|
88
89
|
const pkgPath = path.join(__dirname, '..', 'package.json');
|
|
@@ -317,6 +318,11 @@ function sendCloudTelemetry(taskType, model, tokensIn, tokensOut, latencyMs, suc
|
|
|
317
318
|
timestamp: new Date().toISOString(),
|
|
318
319
|
});
|
|
319
320
|
}
|
|
321
|
+
// Check whether we should show the signup nudge.
|
|
322
|
+
// Called *after* the event is written so the count includes this request.
|
|
323
|
+
// Uses setImmediate to guarantee zero added latency on the response path —
|
|
324
|
+
// the nudge prints to stderr only after the current I/O cycle completes.
|
|
325
|
+
setImmediate(() => (0, signup_nudge_js_1.checkAndShowNudge)());
|
|
320
326
|
}
|
|
321
327
|
catch {
|
|
322
328
|
// Telemetry should never break the proxy
|
|
@@ -2478,6 +2484,8 @@ async function startProxy(config = {}) {
|
|
|
2478
2484
|
// Load persistent history from disk
|
|
2479
2485
|
loadHistoryFromDisk();
|
|
2480
2486
|
(0, agent_tracker_js_1.loadAgentRegistry)();
|
|
2487
|
+
// Check once at startup whether the signup nudge has already been shown
|
|
2488
|
+
(0, signup_nudge_js_1.initNudge)();
|
|
2481
2489
|
// Flush history on shutdown
|
|
2482
2490
|
const handleShutdown = () => {
|
|
2483
2491
|
(0, agent_tracker_js_1.flushAgentRegistry)();
|