@tera-system/core 0.1.5 → 0.2.0

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/MANIFEST.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tera-system/core",
3
- "version": "0.1.5",
3
+ "version": "0.2.0",
4
4
  "description": "Build manifest for the Tera System OpenCode Plugin component.",
5
5
  "compatibleEnvironments": [
6
6
  "opencode"
package/RELEASES.md CHANGED
@@ -4,6 +4,62 @@
4
4
 
5
5
  ---
6
6
 
7
+ ## 0.2.0 (2026-08-21)
8
+
9
+ ### النسخة الشخصية النظيفة (Personal Edition)
10
+
11
+ **ما تغيّر:**
12
+ - إزالة كل بوابات الترخيص من الوكلاء والأوامر — هذه النسخة للاستخدام الشخصي الحر
13
+ - إزالة ملفات الحماية (license-gate, integrity, preflight)
14
+ - استعادة `install.js` للنسخة البسيطة الأصلية (تسجيل حالة ترخيص غير مُلزم)
15
+ - الفصل عن الحزمة التجارية: `@tera-system/pro`
16
+
17
+ **لماذا هذا التحديث:**
18
+ - `@tera-system/core` = نسخة شخصية للمالك (Majed) تستخدم في مشاريعه بحرية
19
+ - الحماية التجارية (الترخيص، sync من السيرفر، heartbeat) تنتقل إلى `@tera-system/pro`
20
+
21
+ ---
22
+
23
+ ## 0.1.5 (2026-08-21)
24
+
25
+ ### ترقية: التحقق من الترخيص عبر API (أونلاين) مع fallback أوفلاين
26
+
27
+ **ما تم تحسينه:**
28
+ - **التحقق الأونلاين أولاً:** المُثبِّت يحاول الاتصال بـ API التحقق أولاً
29
+ - **Fallback أوفلاين:** إذا فشل الاتصال، يتحقق محلياً بـ Ed25519
30
+ - **لا يُوقف التثبيت:** التحقق لا يُوقف التثبيت أبداً
31
+ - **dıagnostic واضح:** يُظهر مصدر التحقق (☁️ API / 🔒 Offline / 🔄 Fallback)
32
+
33
+ **المتغيرات البيئية الجديدة:**
34
+ | المتغير | الوصف | القيمة الافتراضية |
35
+ |---------|-------|-------------------|
36
+ | `TERA_LICENSE_API` | رابط API التحقق | `https://teranoo.com/api/license` |
37
+ | `TERA_OFFLINE_ONLY` | تعطيل التحقق الأونلاين | `0` (مفعّل) |
38
+
39
+ **لماذا هذا التحديث:**
40
+ - التحقق الأونلاين يمنع التkey lowering
41
+ - Fallback يضمن عمل التثبيت حتى بدون إنترنت
42
+ - استعداد للعميل الذي يُنفّذ API التحقق
43
+
44
+ **ملاحظات:**
45
+ - API التحقق بانتظار تنفيذ العميل
46
+ - التحقق الأوفلاين يعمل بشكل مستقل حتى بدون API
47
+
48
+ ---
49
+
50
+ ## 0.1.4 (2026-08-21)
51
+
52
+ ### إصلاح: تغيير حالة الترخيص عبر npm
53
+
54
+ **ما تم إصلاحه:**
55
+ - تحديث حالة الترخيص من "Active" إلى "Unlicensed" عبر npm
56
+ - توثيق حالة الترخيص في LICENSE.md
57
+
58
+ **ملاحظات:**
59
+ - هذا إصلاح طارئ بعد النشر
60
+
61
+ ---
62
+
7
63
  ## 0.1.1 (2026-08-21)
8
64
 
9
65
  ### تحديث: توضيح الترخيص والتوثيق
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tera-system/core",
3
- "version": "0.1.5",
4
- "description": "Tera System OpenCode Plugin — governance core, 20 agents, 10 commands, distribution tools",
3
+ "version": "0.2.0",
4
+ "description": "Tera System OpenCode Plugin — governance core, 20 agents, 11 commands, distribution tools (personal edition)",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "module",
7
7
  "engines": {
@@ -213,135 +213,23 @@ fs.mkdirSync(path.dirname(manifestPath), { recursive: true });
213
213
  fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
214
214
 
215
215
  /* ------------------- license state (non-blocking, never breaks install) ------------------- */
216
-
217
- /**
218
- * License verification with API-first strategy + offline fallback.
219
- *
220
- * Flow:
221
- * 1. Try online API verification (if API URL is configured)
222
- * 2. On API failure → fallback to offline Ed25519 verification
223
- * 3. Never blocks install — always continues
224
- *
225
- * Environment variables:
226
- * TERA_LICENSE_API — API base URL (e.g. https://teranoo.com/api/license)
227
- * TERA_LICENSE_KEY — Manual license key override
228
- */
229
- const LICENSE_API_URL = process.env.TERA_LICENSE_API || "https://teranoo.com/api/license";
230
- const LICENSE_TIMEOUT_MS = 5000; // 5 seconds max for API call
231
-
232
- /**
233
- * Verify license via remote API (online).
234
- * Returns: { ok: boolean, state: string, reason: string, expiresAt?: string, source: "api" }
235
- */
236
- async function verifyViaAPI(licenseKey) {
237
- if (!licenseKey) return { ok: false, state: "Unlicensed", reason: "no-key", source: "api" };
238
-
239
- try {
240
- const controller = new AbortController();
241
- const timeout = setTimeout(() => controller.abort(), LICENSE_TIMEOUT_MS);
242
-
243
- const res = await fetch(`${LICENSE_API_URL}/verify`, {
244
- method: "POST",
245
- headers: { "Content-Type": "application/json" },
246
- body: JSON.stringify({ licenseKey }),
247
- signal: controller.signal,
248
- });
249
- clearTimeout(timeout);
250
-
251
- if (!res.ok) {
252
- return { ok: false, state: "Invalid", reason: `api-http-${res.status}`, source: "api" };
253
- }
254
-
255
- const data = await res.json();
256
- return {
257
- ok: data.valid === true,
258
- state: data.state || "Invalid",
259
- reason: data.reason || "api-response",
260
- expiresAt: data.expiresAt || null,
261
- source: "api",
262
- };
263
- } catch (err) {
264
- // Network error, timeout, abort — fall through to offline
265
- return { ok: false, state: "Unknown", reason: `api-error: ${err.message}`, source: "api-fallback" };
266
- }
267
- }
268
-
269
- /**
270
- * Verify license offline (Ed25519 signature check).
271
- * Returns: { ok: boolean, state: string, reason: string, expiresAt?: string, source: "offline" }
272
- */
273
- function verifyOffline(licenseKey) {
216
+ try {
217
+ const stateFile = path.join(target, ".tera", "license.state.json");
218
+ let licenseKey = (readLicenseState(stateFile) || {}).licenseKey;
219
+ if (!licenseKey) licenseKey = process.env.TERA_LICENSE_KEY || undefined;
274
220
  const state = assessLicenseState(licenseKey);
275
- return {
276
- ok: state.state === "Active" || state.state === "Grace",
221
+ writeLicenseState(stateFile, {
277
222
  state: state.state,
278
223
  reason: state.reason,
224
+ licenseKey: licenseKey || null,
279
225
  expiresAt: state.expiresAt || null,
280
- graceUntil: state.graceUntil || null,
281
- source: "offline",
282
- };
226
+ checkedAt: new Date().toISOString(),
227
+ });
228
+ console.log(` [license ] state=${state.state} (${state.reason})`);
229
+ } catch (err) {
230
+ console.log(` [license ] skipped (${err.message}) — install continues`);
283
231
  }
284
232
 
285
- /**
286
- * Combined verification: API-first, offline fallback.
287
- * Always returns a result — never throws.
288
- */
289
- async function verifyLicense(licenseKey) {
290
- // Step 1: Try API (unless explicitly disabled)
291
- if (process.env.TERA_OFFLINE_ONLY === "1") {
292
- return verifyOffline(licenseKey);
293
- }
294
-
295
- const apiResult = await verifyViaAPI(licenseKey);
296
-
297
- // If API succeeded and gave a definitive answer, use it
298
- if (apiResult.source === "api" && apiResult.ok !== undefined) {
299
- return apiResult;
300
- }
301
-
302
- // Step 2: Fallback to offline
303
- const offlineResult = verifyOffline(licenseKey);
304
-
305
- // If offline confirms API's failure, use offline (more trusted)
306
- if (!apiResult.ok && !offlineResult.ok) {
307
- return offlineResult;
308
- }
309
-
310
- // If API failed but offline says active, trust offline (API might be down)
311
- if (!apiResult.ok && offlineResult.ok) {
312
- return { ...offlineResult, reason: `offline-verified (api-unavailable: ${apiResult.reason})` };
313
- }
314
-
315
- // Default: trust API
316
- return apiResult;
317
- }
318
-
319
- // Run license check (async wrapper, non-blocking)
320
- (async () => {
321
- try {
322
- const stateFile = path.join(target, ".tera", "license.state.json");
323
- let licenseKey = (readLicenseState(stateFile) || {}).licenseKey;
324
- if (!licenseKey) licenseKey = process.env.TERA_LICENSE_KEY || undefined;
325
-
326
- const result = await verifyLicense(licenseKey);
327
-
328
- writeLicenseState(stateFile, {
329
- state: result.state,
330
- reason: result.reason,
331
- licenseKey: licenseKey || null,
332
- expiresAt: result.expiresAt || null,
333
- graceUntil: result.graceUntil || null,
334
- source: result.source,
335
- checkedAt: new Date().toISOString(),
336
- });
337
-
338
- const sourceTag = result.source === "api" ? "☁️" : result.source === "offline" ? "🔒" : "🔄";
339
- console.log(` [license ] ${sourceTag} state=${result.state} (${result.reason})`);
340
- } catch (err) {
341
- console.log(` [license ] skipped (${err.message}) — install continues`);
342
- }
343
- })();
344
-
345
233
  console.log("\n summary:");
346
234
  console.log(` installed : ${stats.installed}`);
347
235
  console.log(` updated : ${stats.updated}`);