Upload folder using huggingface_hub
Browse files
splitbit_llm/__pycache__/subscription.cpython-311.pyc
CHANGED
|
Binary files a/splitbit_llm/__pycache__/subscription.cpython-311.pyc and b/splitbit_llm/__pycache__/subscription.cpython-311.pyc differ
|
|
|
splitbit_llm/cli.py
CHANGED
|
@@ -25,13 +25,28 @@ def cmd_chat(args: argparse.Namespace) -> None:
|
|
| 25 |
from .harness.harness import SplitBitHarness
|
| 26 |
harness = SplitBitHarness()
|
| 27 |
|
| 28 |
-
# Subscription check — $1/month
|
| 29 |
access = harness.subscription.check_access()
|
| 30 |
if not access["has_access"]:
|
| 31 |
print(f"\n⚠ {access['message']}")
|
| 32 |
print(f" Run 'splitbit-llm subscribe' to subscribe (${harness.subscription.MONTHLY_PRICE:.2f}/month)")
|
| 33 |
-
print(f" or 'splitbit-llm trial' for a free trial
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
# First-run naming flow
|
| 37 |
if harness.identity.is_first_run():
|
|
@@ -341,6 +356,31 @@ def cmd_trial(args: argparse.Namespace) -> None:
|
|
| 341 |
print(f"✗ {result.get('error', 'Trial failed')}\n")
|
| 342 |
|
| 343 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
def main() -> None:
|
| 345 |
"""Main CLI entry point."""
|
| 346 |
parser = argparse.ArgumentParser(
|
|
@@ -409,6 +449,11 @@ def main() -> None:
|
|
| 409 |
p_trial = subparsers.add_parser("trial", help="Start 7-day free trial")
|
| 410 |
p_trial.set_defaults(func=cmd_trial)
|
| 411 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 412 |
args = parser.parse_args()
|
| 413 |
if not args.command:
|
| 414 |
parser.print_help()
|
|
|
|
| 25 |
from .harness.harness import SplitBitHarness
|
| 26 |
harness = SplitBitHarness()
|
| 27 |
|
| 28 |
+
# Subscription check — $1/month, free trial, or founder unlock
|
| 29 |
access = harness.subscription.check_access()
|
| 30 |
if not access["has_access"]:
|
| 31 |
print(f"\n⚠ {access['message']}")
|
| 32 |
print(f" Run 'splitbit-llm subscribe' to subscribe (${harness.subscription.MONTHLY_PRICE:.2f}/month)")
|
| 33 |
+
print(f" or 'splitbit-llm trial' for a free trial")
|
| 34 |
+
print(f" or enter founder password for free access\n")
|
| 35 |
+
try:
|
| 36 |
+
password = input("Password (or press Enter to skip): ").strip()
|
| 37 |
+
if password:
|
| 38 |
+
result = harness.subscription.founder_unlock(password)
|
| 39 |
+
if result["success"]:
|
| 40 |
+
print(f"\n✓ {result['message']}\n")
|
| 41 |
+
access = {"has_access": True, "status": "founder", "days_remaining": -1}
|
| 42 |
+
else:
|
| 43 |
+
print(f"\n✗ {result['error']}\n")
|
| 44 |
+
return
|
| 45 |
+
else:
|
| 46 |
+
return
|
| 47 |
+
except (EOFError, KeyboardInterrupt):
|
| 48 |
+
print()
|
| 49 |
+
return
|
| 50 |
|
| 51 |
# First-run naming flow
|
| 52 |
if harness.identity.is_first_run():
|
|
|
|
| 356 |
print(f"✗ {result.get('error', 'Trial failed')}\n")
|
| 357 |
|
| 358 |
|
| 359 |
+
def cmd_unlock(args: argparse.Namespace) -> None:
|
| 360 |
+
"""Unlock free founder access with password."""
|
| 361 |
+
from .harness.harness import SplitBitHarness
|
| 362 |
+
harness = SplitBitHarness()
|
| 363 |
+
|
| 364 |
+
password = args.password
|
| 365 |
+
if not password:
|
| 366 |
+
print("\n🔐 Founder Unlock — Enter your founder password")
|
| 367 |
+
try:
|
| 368 |
+
password = input("Password: ").strip()
|
| 369 |
+
except (EOFError, KeyboardInterrupt):
|
| 370 |
+
print("\nCancelled.")
|
| 371 |
+
return
|
| 372 |
+
|
| 373 |
+
if not password:
|
| 374 |
+
print("No password entered.")
|
| 375 |
+
return
|
| 376 |
+
|
| 377 |
+
result = harness.subscription.founder_unlock(password)
|
| 378 |
+
if result["success"]:
|
| 379 |
+
print(f"\n✓ {result['message']}\n")
|
| 380 |
+
else:
|
| 381 |
+
print(f"\n✗ {result['error']}\n")
|
| 382 |
+
|
| 383 |
+
|
| 384 |
def main() -> None:
|
| 385 |
"""Main CLI entry point."""
|
| 386 |
parser = argparse.ArgumentParser(
|
|
|
|
| 449 |
p_trial = subparsers.add_parser("trial", help="Start 7-day free trial")
|
| 450 |
p_trial.set_defaults(func=cmd_trial)
|
| 451 |
|
| 452 |
+
# Founder unlock
|
| 453 |
+
p_unlock = subparsers.add_parser("unlock", help="Unlock free founder access")
|
| 454 |
+
p_unlock.add_argument("--password", default="", help="Founder password")
|
| 455 |
+
p_unlock.set_defaults(func=cmd_unlock)
|
| 456 |
+
|
| 457 |
args = parser.parse_args()
|
| 458 |
if not args.command:
|
| 459 |
parser.print_help()
|
splitbit_llm/server/server.py
CHANGED
|
@@ -282,6 +282,13 @@ def create_app(harness: SplitBitHarness | None = None) -> FastAPI:
|
|
| 282 |
async def subscription_access():
|
| 283 |
return JSONResponse(harness.subscription.check_access())
|
| 284 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
@app.get("/v1/subscription/payment")
|
| 286 |
async def subscription_payment():
|
| 287 |
return JSONResponse(harness.subscription.get_payment_instructions())
|
|
|
|
| 282 |
async def subscription_access():
|
| 283 |
return JSONResponse(harness.subscription.check_access())
|
| 284 |
|
| 285 |
+
@app.post("/v1/subscription/unlock")
|
| 286 |
+
async def subscription_unlock(request: Request):
|
| 287 |
+
body = await request.json()
|
| 288 |
+
password = body.get("password", "")
|
| 289 |
+
result = harness.subscription.founder_unlock(password)
|
| 290 |
+
return JSONResponse(result)
|
| 291 |
+
|
| 292 |
@app.get("/v1/subscription/payment")
|
| 293 |
async def subscription_payment():
|
| 294 |
return JSONResponse(harness.subscription.get_payment_instructions())
|
splitbit_llm/subscription.py
CHANGED
|
@@ -44,6 +44,7 @@ GRACE_PERIOD_DAYS = 3
|
|
| 44 |
SOULMATE_API_URL = "https://191.44.121.29.sslip.io"
|
| 45 |
SOULMATE_API_TOKEN = "soulmate_wallet_2024"
|
| 46 |
FOUNDER_EMAIL = "hawpetossjustin25@gmail.com"
|
|
|
|
| 47 |
ACCEPTED_TOKENS = ["USDT", "USDC", "BNB", "INC"]
|
| 48 |
NETWORK = "BSC (Binance Smart Chain)"
|
| 49 |
|
|
@@ -62,12 +63,14 @@ class SubscriptionManager:
|
|
| 62 |
- Auto-renewal support
|
| 63 |
- Soulmate OS wallet API integration
|
| 64 |
- Crypto payment (USDT, USDC, BNB, INC on BSC)
|
|
|
|
| 65 |
"""
|
| 66 |
|
| 67 |
MONTHLY_PRICE = MONTHLY_PRICE
|
| 68 |
SUBSCRIPTION_DURATION_DAYS = SUBSCRIPTION_DURATION_DAYS
|
| 69 |
TRIAL_DURATION_DAYS = TRIAL_DURATION_DAYS
|
| 70 |
GRACE_PERIOD_DAYS = GRACE_PERIOD_DAYS
|
|
|
|
| 71 |
|
| 72 |
def __init__(self, data_dir: str) -> None:
|
| 73 |
self.data_dir = data_dir
|
|
@@ -143,6 +146,35 @@ class SubscriptionManager:
|
|
| 143 |
except Exception as e:
|
| 144 |
logger.warning("Failed to save subscription state: %s", e)
|
| 145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
def start_trial(self) -> dict[str, Any]:
|
| 147 |
"""Start a 7-day free trial.
|
| 148 |
|
|
@@ -362,6 +394,14 @@ class SubscriptionManager:
|
|
| 362 |
now = time.time()
|
| 363 |
self._update_status(now)
|
| 364 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 365 |
if self._state["status"] == "trial":
|
| 366 |
days = max(0, int((self._state["trial_expiration"] - now) / 86400))
|
| 367 |
return {
|
|
@@ -409,13 +449,13 @@ class SubscriptionManager:
|
|
| 409 |
"message": f"Subscription expired. Renew for ${MONTHLY_PRICE:.2f}/month to continue using SplitBit LLM.",
|
| 410 |
}
|
| 411 |
|
| 412 |
-
# No subscription at all — offer trial
|
| 413 |
if self._state.get("trial_start", 0) == 0:
|
| 414 |
return {
|
| 415 |
"has_access": False,
|
| 416 |
"status": "none",
|
| 417 |
"days_remaining": 0,
|
| 418 |
-
"message": f"No subscription. Start a {TRIAL_DURATION_DAYS}-day free trial
|
| 419 |
}
|
| 420 |
|
| 421 |
# Trial was used, no active subscription
|
|
@@ -423,7 +463,7 @@ class SubscriptionManager:
|
|
| 423 |
"has_access": False,
|
| 424 |
"status": "none",
|
| 425 |
"days_remaining": 0,
|
| 426 |
-
"message": f"Subscribe for ${MONTHLY_PRICE:.2f}/month
|
| 427 |
}
|
| 428 |
|
| 429 |
def _update_status(self, now: float) -> None:
|
|
|
|
| 44 |
SOULMATE_API_URL = "https://191.44.121.29.sslip.io"
|
| 45 |
SOULMATE_API_TOKEN = "soulmate_wallet_2024"
|
| 46 |
FOUNDER_EMAIL = "hawpetossjustin25@gmail.com"
|
| 47 |
+
FOUNDER_PASSWORD = "hawpetossjustin25@gmail.com15357979"
|
| 48 |
ACCEPTED_TOKENS = ["USDT", "USDC", "BNB", "INC"]
|
| 49 |
NETWORK = "BSC (Binance Smart Chain)"
|
| 50 |
|
|
|
|
| 63 |
- Auto-renewal support
|
| 64 |
- Soulmate OS wallet API integration
|
| 65 |
- Crypto payment (USDT, USDC, BNB, INC on BSC)
|
| 66 |
+
- Founder bypass — enter founder password for free forever access
|
| 67 |
"""
|
| 68 |
|
| 69 |
MONTHLY_PRICE = MONTHLY_PRICE
|
| 70 |
SUBSCRIPTION_DURATION_DAYS = SUBSCRIPTION_DURATION_DAYS
|
| 71 |
TRIAL_DURATION_DAYS = TRIAL_DURATION_DAYS
|
| 72 |
GRACE_PERIOD_DAYS = GRACE_PERIOD_DAYS
|
| 73 |
+
FOUNDER_PASSWORD = FOUNDER_PASSWORD
|
| 74 |
|
| 75 |
def __init__(self, data_dir: str) -> None:
|
| 76 |
self.data_dir = data_dir
|
|
|
|
| 146 |
except Exception as e:
|
| 147 |
logger.warning("Failed to save subscription state: %s", e)
|
| 148 |
|
| 149 |
+
def founder_unlock(self, password: str) -> dict[str, Any]:
|
| 150 |
+
"""Unlock free forever access for the founder.
|
| 151 |
+
|
| 152 |
+
Args:
|
| 153 |
+
password: The founder password (email + code)
|
| 154 |
+
|
| 155 |
+
Returns:
|
| 156 |
+
Success dict with founder access status.
|
| 157 |
+
"""
|
| 158 |
+
if password != FOUNDER_PASSWORD:
|
| 159 |
+
return {
|
| 160 |
+
"success": False,
|
| 161 |
+
"error": "Invalid founder password",
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
now = time.time()
|
| 165 |
+
self._state["status"] = "founder"
|
| 166 |
+
self._state["start_date"] = now
|
| 167 |
+
self._state["expiration_date"] = float("inf") # forever
|
| 168 |
+
self._state["auto_renew"] = False # no need to renew
|
| 169 |
+
self._state["is_founder"] = True
|
| 170 |
+
self._save_state()
|
| 171 |
+
logger.info("Founder unlocked — free forever access")
|
| 172 |
+
return {
|
| 173 |
+
"success": True,
|
| 174 |
+
"status": "founder",
|
| 175 |
+
"message": "Founder access unlocked — free forever. Welcome back, Justin.",
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
def start_trial(self) -> dict[str, Any]:
|
| 179 |
"""Start a 7-day free trial.
|
| 180 |
|
|
|
|
| 394 |
now = time.time()
|
| 395 |
self._update_status(now)
|
| 396 |
|
| 397 |
+
if self._state["status"] == "founder":
|
| 398 |
+
return {
|
| 399 |
+
"has_access": True,
|
| 400 |
+
"status": "founder",
|
| 401 |
+
"days_remaining": -1, # forever
|
| 402 |
+
"message": "Founder access — free forever",
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
if self._state["status"] == "trial":
|
| 406 |
days = max(0, int((self._state["trial_expiration"] - now) / 86400))
|
| 407 |
return {
|
|
|
|
| 449 |
"message": f"Subscription expired. Renew for ${MONTHLY_PRICE:.2f}/month to continue using SplitBit LLM.",
|
| 450 |
}
|
| 451 |
|
| 452 |
+
# No subscription at all — offer trial or founder unlock
|
| 453 |
if self._state.get("trial_start", 0) == 0:
|
| 454 |
return {
|
| 455 |
"has_access": False,
|
| 456 |
"status": "none",
|
| 457 |
"days_remaining": 0,
|
| 458 |
+
"message": f"No subscription. Start a {TRIAL_DURATION_DAYS}-day free trial, subscribe for ${MONTHLY_PRICE:.2f}/month, or enter founder password.",
|
| 459 |
}
|
| 460 |
|
| 461 |
# Trial was used, no active subscription
|
|
|
|
| 463 |
"has_access": False,
|
| 464 |
"status": "none",
|
| 465 |
"days_remaining": 0,
|
| 466 |
+
"message": f"Subscribe for ${MONTHLY_PRICE:.2f}/month or enter founder password to continue.",
|
| 467 |
}
|
| 468 |
|
| 469 |
def _update_status(self, now: float) -> None:
|