zexus 1.6.8 → 1.7.2

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.
Files changed (177) hide show
  1. package/README.md +12 -5
  2. package/package.json +1 -1
  3. package/src/__init__.py +7 -0
  4. package/src/zexus/__init__.py +1 -1
  5. package/src/zexus/__pycache__/__init__.cpython-312.pyc +0 -0
  6. package/src/zexus/__pycache__/capability_system.cpython-312.pyc +0 -0
  7. package/src/zexus/__pycache__/debug_sanitizer.cpython-312.pyc +0 -0
  8. package/src/zexus/__pycache__/environment.cpython-312.pyc +0 -0
  9. package/src/zexus/__pycache__/error_reporter.cpython-312.pyc +0 -0
  10. package/src/zexus/__pycache__/input_validation.cpython-312.pyc +0 -0
  11. package/src/zexus/__pycache__/lexer.cpython-312.pyc +0 -0
  12. package/src/zexus/__pycache__/module_cache.cpython-312.pyc +0 -0
  13. package/src/zexus/__pycache__/module_manager.cpython-312.pyc +0 -0
  14. package/src/zexus/__pycache__/object.cpython-312.pyc +0 -0
  15. package/src/zexus/__pycache__/security.cpython-312.pyc +0 -0
  16. package/src/zexus/__pycache__/security_enforcement.cpython-312.pyc +0 -0
  17. package/src/zexus/__pycache__/syntax_validator.cpython-312.pyc +0 -0
  18. package/src/zexus/__pycache__/zexus_ast.cpython-312.pyc +0 -0
  19. package/src/zexus/__pycache__/zexus_token.cpython-312.pyc +0 -0
  20. package/src/zexus/access_control_system/__pycache__/__init__.cpython-312.pyc +0 -0
  21. package/src/zexus/access_control_system/__pycache__/access_control.cpython-312.pyc +0 -0
  22. package/src/zexus/advanced_types.py +17 -2
  23. package/src/zexus/blockchain/__init__.py +411 -0
  24. package/src/zexus/blockchain/accelerator.py +1160 -0
  25. package/src/zexus/blockchain/chain.py +660 -0
  26. package/src/zexus/blockchain/consensus.py +821 -0
  27. package/src/zexus/blockchain/contract_vm.py +1019 -0
  28. package/src/zexus/blockchain/crypto.py +79 -14
  29. package/src/zexus/blockchain/events.py +526 -0
  30. package/src/zexus/blockchain/loadtest.py +721 -0
  31. package/src/zexus/blockchain/monitoring.py +350 -0
  32. package/src/zexus/blockchain/mpt.py +716 -0
  33. package/src/zexus/blockchain/multichain.py +951 -0
  34. package/src/zexus/blockchain/multiprocess_executor.py +338 -0
  35. package/src/zexus/blockchain/network.py +886 -0
  36. package/src/zexus/blockchain/node.py +666 -0
  37. package/src/zexus/blockchain/rpc.py +1203 -0
  38. package/src/zexus/blockchain/rust_bridge.py +421 -0
  39. package/src/zexus/blockchain/storage.py +423 -0
  40. package/src/zexus/blockchain/tokens.py +750 -0
  41. package/src/zexus/blockchain/upgradeable.py +1004 -0
  42. package/src/zexus/blockchain/verification.py +1602 -0
  43. package/src/zexus/blockchain/wallet.py +621 -0
  44. package/src/zexus/capability_system.py +184 -9
  45. package/src/zexus/cli/__pycache__/main.cpython-312.pyc +0 -0
  46. package/src/zexus/cli/main.py +383 -34
  47. package/src/zexus/cli/zpm.py +1 -1
  48. package/src/zexus/compiler/__pycache__/bytecode.cpython-312.pyc +0 -0
  49. package/src/zexus/compiler/__pycache__/lexer.cpython-312.pyc +0 -0
  50. package/src/zexus/compiler/__pycache__/parser.cpython-312.pyc +0 -0
  51. package/src/zexus/compiler/__pycache__/semantic.cpython-312.pyc +0 -0
  52. package/src/zexus/compiler/__pycache__/zexus_ast.cpython-312.pyc +0 -0
  53. package/src/zexus/compiler/bytecode.py +124 -7
  54. package/src/zexus/compiler/compat_runtime.py +6 -2
  55. package/src/zexus/compiler/lexer.py +16 -5
  56. package/src/zexus/compiler/parser.py +108 -7
  57. package/src/zexus/compiler/semantic.py +18 -19
  58. package/src/zexus/compiler/zexus_ast.py +26 -1
  59. package/src/zexus/concurrency_system.py +79 -0
  60. package/src/zexus/config.py +54 -0
  61. package/src/zexus/crypto_bridge.py +244 -8
  62. package/src/zexus/dap/__init__.py +10 -0
  63. package/src/zexus/dap/__main__.py +4 -0
  64. package/src/zexus/dap/dap_server.py +391 -0
  65. package/src/zexus/dap/debug_engine.py +298 -0
  66. package/src/zexus/environment.py +112 -9
  67. package/src/zexus/evaluator/__pycache__/bytecode_compiler.cpython-312.pyc +0 -0
  68. package/src/zexus/evaluator/__pycache__/core.cpython-312.pyc +0 -0
  69. package/src/zexus/evaluator/__pycache__/expressions.cpython-312.pyc +0 -0
  70. package/src/zexus/evaluator/__pycache__/functions.cpython-312.pyc +0 -0
  71. package/src/zexus/evaluator/__pycache__/resource_limiter.cpython-312.pyc +0 -0
  72. package/src/zexus/evaluator/__pycache__/statements.cpython-312.pyc +0 -0
  73. package/src/zexus/evaluator/__pycache__/unified_execution.cpython-312.pyc +0 -0
  74. package/src/zexus/evaluator/__pycache__/utils.cpython-312.pyc +0 -0
  75. package/src/zexus/evaluator/bytecode_compiler.py +457 -37
  76. package/src/zexus/evaluator/core.py +644 -50
  77. package/src/zexus/evaluator/expressions.py +358 -62
  78. package/src/zexus/evaluator/functions.py +458 -20
  79. package/src/zexus/evaluator/resource_limiter.py +4 -4
  80. package/src/zexus/evaluator/statements.py +774 -122
  81. package/src/zexus/evaluator/unified_execution.py +573 -72
  82. package/src/zexus/evaluator/utils.py +14 -2
  83. package/src/zexus/evaluator_original.py +1 -1
  84. package/src/zexus/event_loop.py +186 -0
  85. package/src/zexus/lexer.py +742 -458
  86. package/src/zexus/lsp/__init__.py +1 -1
  87. package/src/zexus/lsp/definition_provider.py +163 -9
  88. package/src/zexus/lsp/server.py +22 -8
  89. package/src/zexus/lsp/symbol_provider.py +182 -9
  90. package/src/zexus/module_cache.py +239 -9
  91. package/src/zexus/module_manager.py +129 -1
  92. package/src/zexus/object.py +76 -6
  93. package/src/zexus/parser/__pycache__/parser.cpython-312.pyc +0 -0
  94. package/src/zexus/parser/__pycache__/strategy_context.cpython-312.pyc +0 -0
  95. package/src/zexus/parser/__pycache__/strategy_structural.cpython-312.pyc +0 -0
  96. package/src/zexus/parser/parser.py +1349 -408
  97. package/src/zexus/parser/strategy_context.py +755 -58
  98. package/src/zexus/parser/strategy_structural.py +121 -21
  99. package/src/zexus/persistence.py +15 -1
  100. package/src/zexus/renderer/__init__.py +61 -0
  101. package/src/zexus/renderer/__pycache__/__init__.cpython-312.pyc +0 -0
  102. package/src/zexus/renderer/__pycache__/backend.cpython-312.pyc +0 -0
  103. package/src/zexus/renderer/__pycache__/canvas.cpython-312.pyc +0 -0
  104. package/src/zexus/renderer/__pycache__/color_system.cpython-312.pyc +0 -0
  105. package/src/zexus/renderer/__pycache__/layout.cpython-312.pyc +0 -0
  106. package/src/zexus/renderer/__pycache__/main_renderer.cpython-312.pyc +0 -0
  107. package/src/zexus/renderer/__pycache__/painter.cpython-312.pyc +0 -0
  108. package/src/zexus/renderer/backend.py +261 -0
  109. package/src/zexus/renderer/canvas.py +78 -0
  110. package/src/zexus/renderer/color_system.py +201 -0
  111. package/src/zexus/renderer/graphics.py +31 -0
  112. package/src/zexus/renderer/layout.py +222 -0
  113. package/src/zexus/renderer/main_renderer.py +66 -0
  114. package/src/zexus/renderer/painter.py +30 -0
  115. package/src/zexus/renderer/tk_backend.py +208 -0
  116. package/src/zexus/renderer/web_backend.py +260 -0
  117. package/src/zexus/runtime/__init__.py +10 -2
  118. package/src/zexus/runtime/__pycache__/__init__.cpython-312.pyc +0 -0
  119. package/src/zexus/runtime/__pycache__/async_runtime.cpython-312.pyc +0 -0
  120. package/src/zexus/runtime/__pycache__/load_manager.cpython-312.pyc +0 -0
  121. package/src/zexus/runtime/file_flags.py +137 -0
  122. package/src/zexus/runtime/load_manager.py +368 -0
  123. package/src/zexus/safety/__pycache__/__init__.cpython-312.pyc +0 -0
  124. package/src/zexus/safety/__pycache__/memory_safety.cpython-312.pyc +0 -0
  125. package/src/zexus/security.py +424 -34
  126. package/src/zexus/stdlib/fs.py +23 -18
  127. package/src/zexus/stdlib/http.py +289 -186
  128. package/src/zexus/stdlib/sockets.py +207 -163
  129. package/src/zexus/stdlib/websockets.py +282 -0
  130. package/src/zexus/stdlib_integration.py +369 -2
  131. package/src/zexus/strategy_recovery.py +6 -3
  132. package/src/zexus/type_checker.py +423 -0
  133. package/src/zexus/virtual_filesystem.py +189 -2
  134. package/src/zexus/vm/__init__.py +113 -3
  135. package/src/zexus/vm/__pycache__/async_optimizer.cpython-312.pyc +0 -0
  136. package/src/zexus/vm/__pycache__/bytecode.cpython-312.pyc +0 -0
  137. package/src/zexus/vm/__pycache__/bytecode_converter.cpython-312.pyc +0 -0
  138. package/src/zexus/vm/__pycache__/cache.cpython-312.pyc +0 -0
  139. package/src/zexus/vm/__pycache__/compiler.cpython-312.pyc +0 -0
  140. package/src/zexus/vm/__pycache__/gas_metering.cpython-312.pyc +0 -0
  141. package/src/zexus/vm/__pycache__/jit.cpython-312.pyc +0 -0
  142. package/src/zexus/vm/__pycache__/parallel_vm.cpython-312.pyc +0 -0
  143. package/src/zexus/vm/__pycache__/vm.cpython-312.pyc +0 -0
  144. package/src/zexus/vm/async_optimizer.py +80 -6
  145. package/src/zexus/vm/binary_bytecode.py +659 -0
  146. package/src/zexus/vm/bytecode.py +59 -11
  147. package/src/zexus/vm/bytecode_converter.py +26 -12
  148. package/src/zexus/vm/cabi.c +1985 -0
  149. package/src/zexus/vm/cabi.cpython-312-x86_64-linux-gnu.so +0 -0
  150. package/src/zexus/vm/cabi.h +127 -0
  151. package/src/zexus/vm/cache.py +561 -17
  152. package/src/zexus/vm/compiler.py +818 -51
  153. package/src/zexus/vm/fastops.c +15743 -0
  154. package/src/zexus/vm/fastops.cpython-312-x86_64-linux-gnu.so +0 -0
  155. package/src/zexus/vm/fastops.pyx +288 -0
  156. package/src/zexus/vm/gas_metering.py +50 -9
  157. package/src/zexus/vm/jit.py +364 -20
  158. package/src/zexus/vm/native_jit_backend.py +1816 -0
  159. package/src/zexus/vm/native_runtime.cpp +1388 -0
  160. package/src/zexus/vm/native_runtime.cpython-312-x86_64-linux-gnu.so +0 -0
  161. package/src/zexus/vm/optimizer.py +161 -11
  162. package/src/zexus/vm/parallel_vm.py +140 -45
  163. package/src/zexus/vm/peephole_optimizer.py +82 -4
  164. package/src/zexus/vm/profiler.py +38 -18
  165. package/src/zexus/vm/register_allocator.py +16 -5
  166. package/src/zexus/vm/register_vm.py +8 -5
  167. package/src/zexus/vm/vm.py +3581 -531
  168. package/src/zexus/vm/wasm_compiler.py +658 -0
  169. package/src/zexus/zexus_ast.py +137 -11
  170. package/src/zexus/zexus_token.py +16 -5
  171. package/src/zexus/zpm/installer.py +55 -15
  172. package/src/zexus/zpm/package_manager.py +1 -1
  173. package/src/zexus/zpm/registry.py +257 -28
  174. package/src/zexus.egg-info/PKG-INFO +16 -6
  175. package/src/zexus.egg-info/SOURCES.txt +129 -17
  176. package/src/zexus.egg-info/entry_points.txt +1 -0
  177. package/src/zexus.egg-info/requires.txt +4 -0
@@ -1,27 +1,136 @@
1
1
  """
2
2
  Package Registry - Manages package discovery and metadata
3
+
4
+ Supports both a local cache and a remote HTTP registry.
5
+ The registry URL defaults to ``https://registry.zexus.dev`` and can be
6
+ overridden via the ``ZPM_REGISTRY`` environment variable.
7
+
8
+ Auth tokens are read from ``~/.zpm/auth_token`` or the ``ZPM_AUTH_TOKEN``
9
+ environment variable.
10
+
11
+ REST API contract
12
+ -----------------
13
+ The following endpoints are expected on the registry server:
14
+
15
+ GET /packages/<name> → package metadata (latest)
16
+ GET /packages/<name>/<version> → package metadata for version
17
+ GET /packages/<name>/versions → {"versions": ["0.1.0", …]}
18
+ GET /search?q=<query> → {"results": [{…}, …]}
19
+ POST /packages → publish (multipart: meta + tarball)
20
+ GET /packages/<name>/<version>/download → tarball stream
3
21
  """
4
22
  import os
5
23
  import json
24
+ import urllib.request
25
+ import urllib.error
26
+ import urllib.parse
6
27
  from pathlib import Path
7
28
  from typing import Dict, List, Optional
8
29
 
9
30
 
31
+ class RegistryError(Exception):
32
+ """Raised when a registry operation fails."""
33
+
34
+
10
35
  class PackageRegistry:
11
36
  """Package registry for discovering and managing packages"""
12
37
 
13
38
  def __init__(self, registry_url: str = None):
14
- self.registry_url = registry_url or os.environ.get(
15
- "ZPM_REGISTRY",
16
- "https://registry.zexus.dev" # Default registry
17
- )
39
+ self.registry_url = (
40
+ registry_url
41
+ or os.environ.get("ZPM_REGISTRY", "https://registry.zexus.dev")
42
+ ).rstrip("/")
18
43
 
19
44
  # Local cache directory
20
45
  self.cache_dir = Path.home() / ".zpm" / "cache"
21
46
  self.cache_dir.mkdir(parents=True, exist_ok=True)
22
47
 
48
+ # Auth token for publish operations
49
+ self._auth_token: Optional[str] = None
50
+
23
51
  # Built-in packages
24
52
  self.builtin_packages = self._load_builtin_packages()
53
+
54
+ # ------------------------------------------------------------------
55
+ # Auth helpers
56
+ # ------------------------------------------------------------------
57
+
58
+ @property
59
+ def auth_token(self) -> Optional[str]:
60
+ """Lazily resolve the auth token from env or disk."""
61
+ if self._auth_token is not None:
62
+ return self._auth_token
63
+ # 1. Environment variable
64
+ token = os.environ.get("ZPM_AUTH_TOKEN")
65
+ if token:
66
+ self._auth_token = token
67
+ return token
68
+ # 2. Token file
69
+ token_path = Path.home() / ".zpm" / "auth_token"
70
+ if token_path.exists():
71
+ token = token_path.read_text().strip()
72
+ if token:
73
+ self._auth_token = token
74
+ return token
75
+ return None
76
+
77
+ def login(self, token: str) -> None:
78
+ """Store an auth token to ``~/.zpm/auth_token``."""
79
+ self._auth_token = token
80
+ token_path = Path.home() / ".zpm" / "auth_token"
81
+ token_path.parent.mkdir(parents=True, exist_ok=True)
82
+ token_path.write_text(token + "\n")
83
+ # Restrict permissions (owner-only read/write)
84
+ try:
85
+ token_path.chmod(0o600)
86
+ except OSError:
87
+ pass
88
+
89
+ # ------------------------------------------------------------------
90
+ # HTTP helpers
91
+ # ------------------------------------------------------------------
92
+
93
+ def _request(self, path: str, *, method: str = "GET",
94
+ data: bytes = None, headers: dict = None,
95
+ timeout: int = 30) -> Optional[bytes]:
96
+ """Perform an HTTP request against the registry.
97
+
98
+ Returns the response body on success, or ``None`` when the
99
+ resource is not found (HTTP 404). Raises ``RegistryError`` for
100
+ other HTTP errors or connection failures.
101
+ """
102
+ url = f"{self.registry_url}{path}"
103
+ hdrs = {"User-Agent": "zpm/1.0"}
104
+ if self.auth_token:
105
+ hdrs["Authorization"] = f"Bearer {self.auth_token}"
106
+ if headers:
107
+ hdrs.update(headers)
108
+
109
+ req = urllib.request.Request(url, data=data, headers=hdrs, method=method)
110
+ try:
111
+ with urllib.request.urlopen(req, timeout=timeout) as resp:
112
+ return resp.read()
113
+ except urllib.error.HTTPError as exc:
114
+ if exc.code == 404:
115
+ return None
116
+ raise RegistryError(
117
+ f"Registry HTTP {exc.code} for {method} {path}: {exc.reason}"
118
+ ) from exc
119
+ except urllib.error.URLError as exc:
120
+ raise RegistryError(
121
+ f"Cannot reach registry at {self.registry_url}: {exc.reason}"
122
+ ) from exc
123
+
124
+ def _get_json(self, path: str) -> Optional[Dict]:
125
+ """GET ``path`` and parse the JSON body. Returns None on 404."""
126
+ body = self._request(path)
127
+ if body is None:
128
+ return None
129
+ return json.loads(body)
130
+
131
+ # ------------------------------------------------------------------
132
+ # Built-in packages
133
+ # ------------------------------------------------------------------
25
134
 
26
135
  def _load_builtin_packages(self) -> Dict:
27
136
  """Load built-in package definitions"""
@@ -55,56 +164,176 @@ class PackageRegistry:
55
164
  "files": []
56
165
  }
57
166
  }
167
+
168
+ # ------------------------------------------------------------------
169
+ # Public API
170
+ # ------------------------------------------------------------------
58
171
 
59
172
  def get_package(self, name: str, version: str = "latest") -> Optional[Dict]:
60
- """Get package metadata from registry"""
61
- # Check built-in packages first
173
+ """Get package metadata from registry.
174
+
175
+ Resolution order:
176
+ 1. Built-in packages
177
+ 2. Local cache (``~/.zpm/cache/<name>-<version>.json``)
178
+ 3. Remote registry (``GET /packages/<name>[/<version>]``)
179
+ """
180
+ # 1. Check built-in packages
62
181
  if name in self.builtin_packages:
63
182
  return self.builtin_packages[name]
64
183
 
65
- # Check cache
184
+ # 2. Check local cache
66
185
  cache_file = self.cache_dir / f"{name}-{version}.json"
67
186
  if cache_file.exists():
68
187
  with open(cache_file) as f:
69
188
  return json.load(f)
70
189
 
71
- # TODO: Fetch from remote registry
72
- # For now, return None if not found
190
+ # 3. Fetch from remote registry
191
+ try:
192
+ path = f"/packages/{urllib.parse.quote(name)}"
193
+ if version and version != "latest":
194
+ path += f"/{urllib.parse.quote(version)}"
195
+ meta = self._get_json(path)
196
+ if meta:
197
+ # Cache the result locally
198
+ self._cache_metadata(name, meta.get("version", version), meta)
199
+ return meta
200
+ except RegistryError as e:
201
+ # Log but don't crash — fall through to None
202
+ print(f"⚠️ Registry lookup failed for {name}: {e}")
203
+
73
204
  return None
74
205
 
75
206
  def search(self, query: str) -> List[Dict]:
76
- """Search for packages"""
207
+ """Search for packages.
208
+
209
+ Searches built-in packages locally *and* queries the remote
210
+ registry via ``GET /search?q=<query>``.
211
+ """
77
212
  results = []
78
213
 
79
214
  # Search built-in packages
215
+ q = query.lower()
80
216
  for name, pkg in self.builtin_packages.items():
81
- if query.lower() in name.lower() or query.lower() in pkg.get("description", "").lower():
217
+ if q in name.lower() or q in pkg.get("description", "").lower():
82
218
  results.append(pkg)
83
219
 
84
- # TODO: Search remote registry
220
+ # Search remote registry
221
+ try:
222
+ encoded = urllib.parse.urlencode({"q": query})
223
+ data = self._get_json(f"/search?{encoded}")
224
+ if data and isinstance(data.get("results"), list):
225
+ for pkg in data["results"]:
226
+ # Deduplicate against builtins
227
+ if pkg.get("name") not in self.builtin_packages:
228
+ results.append(pkg)
229
+ except RegistryError as e:
230
+ print(f"⚠️ Remote search failed: {e}")
85
231
 
86
232
  return results
87
233
 
88
234
  def publish_package(self, package_data: Dict, files: List[str]) -> bool:
89
- """Publish a package to registry"""
90
- # For now, just cache locally
91
- name = package_data["name"]
92
- version = package_data["version"]
93
-
94
- cache_file = self.cache_dir / f"{name}-{version}.json"
95
- with open(cache_file, "w") as f:
96
- json.dump(package_data, f, indent=2)
97
-
98
- print(f"✅ Package cached locally at {cache_file}")
99
- print(f"⚠️ Remote registry publication not yet implemented")
100
-
101
- # TODO: Upload to remote registry
102
- return True
235
+ """Publish a package to the registry.
236
+
237
+ Sends a multipart POST to ``/packages`` with the package metadata
238
+ (JSON) and the tarball (binary). Requires an auth token.
239
+ """
240
+ name = package_data.get("name", "")
241
+ version = package_data.get("version", "")
242
+
243
+ # Always cache locally first
244
+ self._cache_metadata(name, version, package_data)
245
+
246
+ # Attempt remote publish
247
+ if not self.auth_token:
248
+ print(f"⚠️ No auth token — package cached locally only.")
249
+ print(f" Run 'zpm login <token>' to enable remote publishing.")
250
+ return True
251
+
252
+ tarball_path = package_data.get("tarball")
253
+ try:
254
+ import mimetypes
255
+ boundary = "----ZPMPublishBoundary"
256
+ body_parts = []
257
+
258
+ # Part 1: metadata JSON
259
+ body_parts.append(f"--{boundary}".encode())
260
+ body_parts.append(b'Content-Disposition: form-data; name="metadata"')
261
+ body_parts.append(b"Content-Type: application/json")
262
+ body_parts.append(b"")
263
+ body_parts.append(json.dumps(package_data).encode())
264
+
265
+ # Part 2: tarball file (if present)
266
+ if tarball_path and os.path.isfile(tarball_path):
267
+ body_parts.append(f"--{boundary}".encode())
268
+ body_parts.append(
269
+ f'Content-Disposition: form-data; name="tarball"; '
270
+ f'filename="{os.path.basename(tarball_path)}"'.encode()
271
+ )
272
+ body_parts.append(b"Content-Type: application/gzip")
273
+ body_parts.append(b"")
274
+ with open(tarball_path, "rb") as f:
275
+ body_parts.append(f.read())
276
+
277
+ body_parts.append(f"--{boundary}--".encode())
278
+ body = b"\r\n".join(body_parts)
279
+
280
+ self._request(
281
+ "/packages",
282
+ method="POST",
283
+ data=body,
284
+ headers={"Content-Type": f"multipart/form-data; boundary={boundary}"},
285
+ )
286
+ print(f"✅ Published {name}@{version} to {self.registry_url}")
287
+ return True
288
+ except RegistryError as e:
289
+ print(f"❌ Remote publish failed: {e}")
290
+ print(f" Package was cached locally at ~/.zpm/cache/")
291
+ return False
103
292
 
104
293
  def get_versions(self, package: str) -> List[str]:
105
- """Get all available versions of a package"""
294
+ """Get all available versions of a package."""
106
295
  if package in self.builtin_packages:
107
296
  return [self.builtin_packages[package]["version"]]
108
297
 
109
- # TODO: Query remote registry
298
+ # Check remote registry
299
+ try:
300
+ encoded = urllib.parse.quote(package)
301
+ data = self._get_json(f"/packages/{encoded}/versions")
302
+ if data and isinstance(data.get("versions"), list):
303
+ return data["versions"]
304
+ except RegistryError as e:
305
+ print(f"⚠️ Version lookup failed for {package}: {e}")
306
+
110
307
  return []
308
+
309
+ def download_tarball(self, name: str, version: str) -> Optional[Path]:
310
+ """Download a package tarball from the registry.
311
+
312
+ Returns the local path to the downloaded ``.tar.gz`` file,
313
+ or ``None`` on failure.
314
+ """
315
+ tarball_cache = self.cache_dir / f"{name}-{version}.tar.gz"
316
+ if tarball_cache.exists():
317
+ return tarball_cache
318
+
319
+ try:
320
+ encoded_name = urllib.parse.quote(name)
321
+ encoded_ver = urllib.parse.quote(version)
322
+ body = self._request(f"/packages/{encoded_name}/{encoded_ver}/download")
323
+ if body is None:
324
+ return None
325
+ tarball_cache.write_bytes(body)
326
+ return tarball_cache
327
+ except RegistryError as e:
328
+ print(f"⚠️ Tarball download failed for {name}@{version}: {e}")
329
+ return None
330
+
331
+ # ------------------------------------------------------------------
332
+ # Internal helpers
333
+ # ------------------------------------------------------------------
334
+
335
+ def _cache_metadata(self, name: str, version: str, meta: Dict) -> None:
336
+ """Write package metadata to the local cache."""
337
+ cache_file = self.cache_dir / f"{name}-{version}.json"
338
+ with open(cache_file, "w") as f:
339
+ json.dump(meta, f, indent=2)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zexus
3
- Version: 1.6.8
3
+ Version: 1.7.2
4
4
  Summary: A modern, security-first programming language with blockchain support
5
5
  Home-page: https://github.com/Zaidux/zexus-interpreter
6
6
  Author: Zaidux
@@ -41,6 +41,9 @@ Requires-Dist: mypy>=0.900; extra == "dev"
41
41
  Provides-Extra: blockchain
42
42
  Requires-Dist: web3>=5.0; extra == "blockchain"
43
43
  Requires-Dist: eth-account>=0.5; extra == "blockchain"
44
+ Provides-Extra: jit
45
+ Requires-Dist: llvmlite>=0.41.0; extra == "jit"
46
+ Requires-Dist: Cython>=0.29; extra == "jit"
44
47
  Dynamic: author
45
48
  Dynamic: home-page
46
49
  Dynamic: license-file
@@ -50,14 +53,14 @@ Dynamic: requires-python
50
53
 
51
54
  <div align="center">
52
55
 
53
- ![Zexus Logo](https://img.shields.io/badge/Zexus-v1.6.8-FF6B35?style=for-the-badge)
56
+ ![Zexus Logo](https://img.shields.io/badge/Zexus-v1.7.2-FF6B35?style=for-the-badge)
54
57
  [![License](https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge)](LICENSE)
55
58
  [![Python](https://img.shields.io/badge/Python-3.8+-3776AB?style=for-the-badge&logo=python)](https://python.org)
56
59
  [![GitHub](https://img.shields.io/badge/GitHub-Zaidux/zexus--interpreter-181717?style=for-the-badge&logo=github)](https://github.com/Zaidux/zexus-interpreter)
57
60
 
58
61
  **A modern, security-first programming language with built-in blockchain support, VM-accelerated execution, advanced memory management, and policy-as-code**
59
62
 
60
- [What's New](#-whats-new-in-v150) • [Features](#-key-features) • [Installation](#-installation) • [Quick Start](#-quick-start) • [Keywords](#-complete-keyword-reference) • [Documentation](#-documentation) • [Examples](#-examples) • [Troubleshooting](#-getting-help--troubleshooting)
63
+ [What's New](#-whats-new-in-v171) • [Features](#-key-features) • [Installation](#-installation) • [Quick Start](#-quick-start) • [Keywords](#-complete-keyword-reference) • [Documentation](#-documentation) • [Examples](#-examples) • [Troubleshooting](#-getting-help--troubleshooting)
61
64
 
62
65
  </div>
63
66
 
@@ -66,7 +69,7 @@ Dynamic: requires-python
66
69
  ## 📋 Table of Contents
67
70
 
68
71
  - [What is Zexus?](#-what-is-zexus)
69
- - [What's New](#-whats-new-in-v150)
72
+ - [What's New](#-whats-new-in-v171)
70
73
  - [Key Features](#-key-features)
71
74
  - [VM-Accelerated Performance](#-vm-accelerated-performance-new)
72
75
  - [Security & Policy-as-Code](#-security--policy-as-code--verify-enhanced)
@@ -115,9 +118,16 @@ Zexus is a next-generation, general-purpose programming language designed for se
115
118
 
116
119
  ---
117
120
 
118
- ## 🎉 What's New in v1.6.3
121
+ ## 🎉 What's New in v1.7.2
119
122
 
120
- ### Latest Features (v1.6.3)
123
+ ### Latest Features (v1.7.2)
124
+
125
+ ✅ **FIND Keyword** - Declarative project search that resolves exact module paths with scope filtering and smart suggestions
126
+ ✅ **LOAD Keyword & Manager** - Provider-aware configuration loader with built-in ENV, JSON, and YAML support plus caching
127
+ ✅ **VM + Bytecode Support** - FIND/LOAD now compile to bytecode with helper bridges so scripts run identically in the VM and interpreter
128
+ ✅ **Targeted Test Coverage** - Added regression tests that exercise both interpreter and VM paths for FIND/LOAD workflows
129
+
130
+ ### Previous Features (v1.6.3)
121
131
 
122
132
  ✅ **Complete Database Ecosystem** - Production-ready database drivers
123
133
  ✅ **4 Database Drivers** - SQLite, PostgreSQL, MySQL, MongoDB fully tested