openzoo 0.30.4 → 0.30.6

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.
@@ -97,8 +97,15 @@ const CORS = {
97
97
  * active, unlimited membership so nothing is gated.
98
98
  */
99
99
  function stripeProfile() {
100
+ // MUST MATCH the membershipType written into the applicationUser blob — Cursor
101
+ // refreshes the blob FROM this profile on launch, so a hardcoded 'pro' here
102
+ // overwrote our 'ultra' and the free-plan gate ("free plans can only use Auto")
103
+ // fired anyway. Same env var, one source of truth.
104
+ const m = process.env.OPENZOO_MEMBERSHIP || 'pro';
100
105
  return JSON.stringify({
101
- membershipType: 'pro',
106
+ membershipType: m,
107
+ individualMembershipType: m,
108
+ teamMembershipType: null,
102
109
  subscriptionStatus: 'active',
103
110
  verifiedStudent: false,
104
111
  trialEligible: false,
@@ -108,8 +115,6 @@ function stripeProfile() {
108
115
  hardLimitPerUser: null,
109
116
  usageBasedPricingEnabled: true,
110
117
  monthlyUsageBasedLimit: 1000000,
111
- individualMembershipType: 'pro',
112
- teamMembershipType: null,
113
118
  });
114
119
  }
115
120
 
package/lib/cursorcfg.js CHANGED
@@ -144,6 +144,14 @@ export function writeEditorProviderConfig(which, { baseUrl, models }) {
144
144
  const before = { openAIBaseUrl: doc.openAIBaseUrl, models: (doc.availableAPIKeyModels || []).length };
145
145
  doc.openAIBaseUrl = baseUrl;
146
146
  doc.useOpenAIKey = true;
147
+ // THE MODEL-SELECTION GATE READS MEMBERSHIP FROM RIGHT HERE. Traced in the
148
+ // bundle: membershipType(){ return this.reactiveStorageService
149
+ // .applicationUserPersistentStorage.membershipType } — i.e. THIS blob, not
150
+ // cursorAuth/stripeMembershipType. Setting it entitles model selection; the
151
+ // api2 impersonation keeps the editor from re-syncing it back to free.
152
+ // OPENZOO_MEMBERSHIP overrides (pro | pro_plus | enterprise | ultra).
153
+ doc.membershipType = process.env.OPENZOO_MEMBERSHIP || 'pro';
154
+ doc.subscriptionStatus = 'active';
147
155
  // Merge, don't clobber: a user may have their own custom models listed.
148
156
  const existing = Array.isArray(doc.availableAPIKeyModels) ? doc.availableAPIKeyModels : [];
149
157
  const names = new Set(existing.map((m) => (typeof m === 'string' ? m : m?.name)).filter(Boolean));
@@ -257,6 +265,7 @@ export function writeEditorProviderConfig(which, { baseUrl, models }) {
257
265
  * that clobbers them. Removable with unpinEditorProviderConfig.
258
266
  */
259
267
  export function pinEditorProviderConfig(which, { baseUrl, models }) {
268
+ const mem = process.env.OPENZOO_MEMBERSHIP || 'pro';
260
269
  const db = storagePath(which);
261
270
  if (!fs.existsSync(db)) return null;
262
271
  const esc = (v) => String(v).replace(/'/g, "''");
@@ -283,7 +292,8 @@ CREATE TRIGGER openzoo_pin AFTER UPDATE ON ItemTable
283
292
  WHEN NEW.key = '${KEY}'
284
293
  AND (json_extract(NEW.value,'$.openAIBaseUrl') IS NOT '${base}'
285
294
  OR json_extract(NEW.value,'$.featureModelConfigs.composer.defaultModel') IS NOT '${primary}'
286
- OR json_array_length(json_extract(NEW.value,'$.availableDefaultModels2')) IS NOT ${models.length})
295
+ OR json_array_length(json_extract(NEW.value,'$.availableDefaultModels2')) IS NOT ${models.length}
296
+ OR json_extract(NEW.value,'$.membershipType') IS NOT '${mem}')
287
297
  BEGIN
288
298
  UPDATE ItemTable SET value = json_set(
289
299
  NEW.value,
@@ -292,7 +302,9 @@ BEGIN
292
302
  '$.availableAPIKeyModels', json('${modelJson}'),
293
303
  '$.availableDefaultModels2', json('${uiJson}'),
294
304
  '$.featureModelConfigs.composer.defaultModel', '${primary}',
295
- '$.featureModelConfigs.cmdK.defaultModel', '${primary}'
305
+ '$.featureModelConfigs.cmdK.defaultModel', '${primary}',
306
+ '$.membershipType', '${mem}',
307
+ '$.subscriptionStatus', 'active'
296
308
  ) WHERE key = NEW.key;
297
309
  END;`;
298
310
  try { sqlite(db, sql); } catch (e) { return { error: e.message }; }
package/lib/hosts.js CHANGED
@@ -147,6 +147,9 @@ export function unredirect443() {
147
147
  * runs privileged, never the wallet-holding proxy. unbindBackend443 kills it.
148
148
  */
149
149
  export function bindBackend443(modelsPath, logPath, log = console.log) {
150
+ // sudo strips the environment, so forward the one var the backend needs to
151
+ // report the right membership in the stripe profile it serves.
152
+ const memEnv = `OPENZOO_MEMBERSHIP='${(process.env.OPENZOO_MEMBERSHIP || 'pro').replace(/'/g, '')}'`;
150
153
  const here = path.dirname(fileURLToPath(import.meta.url));
151
154
  const script = path.join(here, '..', 'bin', 'cursor-backend.js');
152
155
  const node = process.execPath;
@@ -172,7 +175,7 @@ export function bindBackend443(modelsPath, logPath, log = console.log) {
172
175
  + `pkill -9 -f 'cursor-backend.js' 2>/dev/null; `
173
176
  + `for p in $(lsof -nP -iTCP:443 -sTCP:LISTEN -t 2>/dev/null) $(lsof -nP -iTCP:8443 -sTCP:LISTEN -t 2>/dev/null); do kill -9 "$p" 2>/dev/null; done; `
174
177
  + `for i in 1 2 3 4 5 6 7 8 9 10; do lsof -nP -iTCP:443 -sTCP:LISTEN -t >/dev/null 2>&1 || break; sleep 0.5; done; `
175
- + `nohup '${node}' '${script}' 443 '${modelsPath}' '${logPath}' >/dev/null 2>&1 & `
178
+ + `nohup ${memEnv} '${node}' '${script}' 443 '${modelsPath}' '${logPath}' >/dev/null 2>&1 & `
176
179
  + 'sleep 1; true',
177
180
  );
178
181
  return { ok };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openzoo",
3
- "version": "0.30.4",
3
+ "version": "0.30.6",
4
4
  "description": "Local x402-paying proxy + MCP server for openzoo.fun — point any OpenAI-compatible harness (Cursor, Claude Code, aider, SDKs) at localhost and it pays per call from a local burner wallet. Solana and Base rails live; Robinhood experimental.",
5
5
  "license": "MIT",
6
6
  "type": "module",