tokensafe 1.3.11 → 1.3.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokensafe",
3
- "version": "1.3.11",
3
+ "version": "1.3.12",
4
4
  "description": "Autonomous Zero-Loss Token Economy & Context Optimizer for AI Coding Agents",
5
5
  "main": "bin/tokensafe.js",
6
6
  "bin": {
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agy-token-optimizer",
3
3
  "displayName": "TokenSafe",
4
- "version": "1.3.11",
4
+ "version": "1.3.12",
5
5
  "description": "Zero-Loss Token Economy & Context Optimizer for AI Agents. Compresses prompts, slices AST/tool outputs, and prevents stuck loops.",
6
6
  "logo": "assets/logo.svg",
7
7
  "author": {
package/src/__init__.py CHANGED
@@ -2,5 +2,5 @@
2
2
  TokenSafe: Autonomous Zero-Loss Token Economy & Context Optimizer for AI Coding Agents.
3
3
  """
4
4
 
5
- __version__ = "1.3.11"
5
+ __version__ = "1.3.12"
6
6
  __author__ = "TokenSafe Team"
@@ -18,7 +18,7 @@ DATA_DIR = os.path.join(PROJECT_ROOT, "data")
18
18
  LICENSE_FILE = os.path.join(DATA_DIR, "license.json")
19
19
 
20
20
  # Master Public Key for client-side offline verification (RFC 8032 Ed25519)
21
- DEFAULT_ED25519_PUBLIC_KEY = "beb27bc42a723943822ea1ba5d50b7abb55e430cb691518b0b05edef889d0132"
21
+ DEFAULT_ED25519_PUBLIC_KEY = os.environ.get("TOKENSAFE_PUBLIC_KEY", "3911e2ffe5ad07ee23be392b88f238af302f9d3a0bf51881de8b5e0e6af71430")
22
22
  # Private key for cloud server signing (never distributed to client, loaded strictly from environment)
23
23
  DEFAULT_ED25519_PRIVATE_KEY = os.environ.get("TOKENSAFE_PRIVATE_KEY", "")
24
24
  # Rotated HMAC salt for backward compatibility with TS1 legacy licenses
@@ -170,7 +170,8 @@ class LicenseManager:
170
170
  if not priv_hex:
171
171
  raise ValueError("TOKENSAFE_PRIVATE_KEY environment variable is required to generate license signatures.")
172
172
  priv_bytes = bytes.fromhex(priv_hex)
173
- pub_bytes = bytes.fromhex(DEFAULT_ED25519_PUBLIC_KEY)
173
+ pub_hex = os.environ.get("TOKENSAFE_PUBLIC_KEY") or DEFAULT_ED25519_PUBLIC_KEY
174
+ pub_bytes = bytes.fromhex(pub_hex)
174
175
  sig_raw = _ed25519_sign_bytes(payload_bytes, priv_bytes, pub_bytes)
175
176
  sig_b64 = base64.urlsafe_b64encode(sig_raw).decode("ascii").rstrip("=")
176
177
  return f"TS2.{payload_b64}.{sig_b64}"
@@ -211,7 +212,7 @@ class LicenseManager:
211
212
 
212
213
  # 1. Asymmetric Ed25519 Verification (TS2)
213
214
  if schema_ver == "TS2":
214
- pub_hex = public_key or DEFAULT_ED25519_PUBLIC_KEY
215
+ pub_hex = public_key or os.environ.get("TOKENSAFE_PUBLIC_KEY") or DEFAULT_ED25519_PUBLIC_KEY
215
216
  try:
216
217
  pub_bytes = bytes.fromhex(pub_hex)
217
218
  padded_sig = sig_part + "=" * (-len(sig_part) % 4)
@@ -14,7 +14,7 @@ import urllib.request
14
14
  import urllib.error
15
15
  from typing import Dict, Any, Optional, Tuple
16
16
 
17
- CURRENT_VERSION = "1.3.11"
17
+ CURRENT_VERSION = "1.3.12"
18
18
  CACHE_TTL = 86400 # 24 hours
19
19
 
20
20
  PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))