@nepopsx/cli 0.0.23 → 0.0.24
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/dist/commands/init.js +1 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install.js +3 -3
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/login.d.ts +3 -3
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +14 -36
- package/dist/commands/login.js.map +1 -1
- package/dist/config/api-config.d.ts +9 -0
- package/dist/config/api-config.d.ts.map +1 -1
- package/dist/config/api-config.js +10 -1
- package/dist/config/api-config.js.map +1 -1
- package/dist/index.js +0 -6
- package/dist/index.js.map +1 -1
- package/dist/licensing/index.d.ts +1 -1
- package/dist/licensing/index.d.ts.map +1 -1
- package/dist/licensing/index.js +1 -1
- package/dist/licensing/index.js.map +1 -1
- package/dist/licensing/installer.d.ts +7 -8
- package/dist/licensing/installer.d.ts.map +1 -1
- package/dist/licensing/installer.js +9 -17
- package/dist/licensing/installer.js.map +1 -1
- package/dist/licensing/license-manager.d.ts +24 -51
- package/dist/licensing/license-manager.d.ts.map +1 -1
- package/dist/licensing/license-manager.js +52 -275
- package/dist/licensing/license-manager.js.map +1 -1
- package/dist/mcp/config-generator.d.ts +6 -6
- package/dist/mcp/config-generator.d.ts.map +1 -1
- package/dist/mcp/config-generator.js +4 -4
- package/dist/mcp/config-generator.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Agent bundle installer — downloads,
|
|
2
|
+
* Agent bundle installer — downloads, decodes, verifies, and writes
|
|
3
3
|
* agent template files from the NEPOPSX API.
|
|
4
4
|
*
|
|
5
5
|
* Flow:
|
|
6
|
-
* 1. downloadBundle — POST /v1/templates/:agent/:version (auth: Bearer <
|
|
7
|
-
* 2. decryptBundle —
|
|
6
|
+
* 1. downloadBundle — POST /v1/templates/:agent/:version (auth: Bearer <device token>)
|
|
7
|
+
* 2. decryptBundle — base64-decode the plaintext payload (served over TLS)
|
|
8
8
|
* 3. verifyBundleSha — SHA-256 of raw JSON must match server-provided sha256
|
|
9
9
|
* 4. writeAgentFiles — atomic write via temp + rename into .github/<relative-path>
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import { createHash } from "node:crypto";
|
|
12
12
|
import { existsSync, mkdirSync, renameSync, writeFileSync } from "node:fs";
|
|
13
13
|
import { dirname, join } from "node:path";
|
|
14
14
|
import { resolveApiBase } from "../config/api-config.js";
|
|
@@ -65,20 +65,12 @@ export async function downloadBootstrapConfig(cwd, license, agent, version, cust
|
|
|
65
65
|
}
|
|
66
66
|
// ─── Decrypt ────────────────────────────────────────────────
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
69
|
-
* Returns the raw JSON string
|
|
68
|
+
* Decode a bundle payload. The backend now serves plaintext base64 over TLS to an
|
|
69
|
+
* authenticated request (no at-rest encryption). Returns the raw JSON string. The
|
|
70
|
+
* second arg is accepted-and-ignored for call-site compatibility.
|
|
70
71
|
*/
|
|
71
|
-
export function decryptBundle(bundle,
|
|
72
|
-
|
|
73
|
-
.update(`${licenseKey}:nepopsx-template-key`)
|
|
74
|
-
.digest();
|
|
75
|
-
const iv = Buffer.from(bundle.iv, "base64");
|
|
76
|
-
const tag = Buffer.from(bundle.tag, "base64");
|
|
77
|
-
const encrypted = Buffer.from(bundle.payload, "base64");
|
|
78
|
-
const decipher = createDecipheriv("aes-256-gcm", key, iv);
|
|
79
|
-
decipher.setAuthTag(tag);
|
|
80
|
-
const decrypted = Buffer.concat([decipher.update(encrypted), decipher.final()]);
|
|
81
|
-
return decrypted.toString("utf-8");
|
|
72
|
+
export function decryptBundle(bundle, _credential) {
|
|
73
|
+
return Buffer.from(bundle.payload, "base64").toString("utf-8");
|
|
82
74
|
}
|
|
83
75
|
// ─── Verify ─────────────────────────────────────────────────
|
|
84
76
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installer.js","sourceRoot":"","sources":["../../src/licensing/installer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"installer.js","sourceRoot":"","sources":["../../src/licensing/installer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAuB3D,+DAA+D;AAE/D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAW,EACX,OAAgB,EAChB,KAAa,EACb,OAAe,EACf,qBAA0C,EAAE,EAC5C,YAA8B,EAAE;IAEhC,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,GAAG,GAAG,GAAG,OAAO,cAAc,kBAAkB,CAAC,KAAK,CAAC,IAAI,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;IAE/F,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,GAAG,EAAE;QAC3C,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,OAAO,CAAC,GAAG,EAAE;YACtC,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,SAAS,EAAE,oBAAoB,CAAC,GAAG,EAAE,OAAO,CAAC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OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1C,CAAC;QAED,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACrC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAEtB,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,53 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Auth/session helpers. Post-migration the CLI has ONE credential: the opaque
|
|
3
|
+
* device token from `nepopsx login`, stored in `.nepopsx/config.json`. The
|
|
4
|
+
* `License` shape is kept as a thin compatibility view — `.key` IS the device
|
|
5
|
+
* token — so existing commands send the right Bearer credential unchanged. Auth
|
|
6
|
+
* and entitlement are server-authoritative now (the backend 401/402s); there is
|
|
7
|
+
* no license.json, no machine binding, and no online validate/refresh.
|
|
4
8
|
*/
|
|
5
9
|
import { type License, type LicenseStatus, type LicenseTier, type WorkspaceConfig, type Entitlement } from '@nepopsx/core';
|
|
6
10
|
/**
|
|
7
|
-
*
|
|
11
|
+
* Build a `License`-shaped view from the stored device token. `.key` IS the opaque
|
|
12
|
+
* `opsx_dvc_…` token sent as a Bearer credential; `org`/`tier` come from the plan
|
|
13
|
+
* captured at login; `workspace` is the live local name. Returns null if not
|
|
14
|
+
* logged in. (No license.json — the device token in config.json is the credential.)
|
|
8
15
|
*/
|
|
9
16
|
export declare function readLicense(rootDir: string): License | null;
|
|
17
|
+
/** No-op: the workspace is sourced live from disk in `readLicense` now. */
|
|
18
|
+
export declare function reconcileLicenseWorkspace<T extends License | null>(_rootDir: string, license: T): T;
|
|
19
|
+
/** No-op kept for callers: there is no license.json to write any more. */
|
|
20
|
+
export declare function writeLicense(_rootDir: string, _license: License): void;
|
|
10
21
|
/**
|
|
11
|
-
*
|
|
22
|
+
* Confirm a device token is present. Auth + entitlement are enforced by the
|
|
23
|
+
* backend (401/402) — this no longer calls the server.
|
|
12
24
|
*/
|
|
13
|
-
export declare function
|
|
25
|
+
export declare function validateLicense(rootDir: string, _config: WorkspaceConfig): Promise<LicenseStatus>;
|
|
14
26
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* `workspace: "unknown"`. Once the real config exists, reconcile the in-memory
|
|
19
|
-
* license (and persist it) so every downstream `license.workspace` read — and
|
|
20
|
-
* every backend call derived from it — uses the live workspace name instead of
|
|
21
|
-
* the stale snapshot. Best-effort: returns the license unchanged when the config
|
|
22
|
-
* is absent or already matches. Accepts/returns `null` for the no-license path.
|
|
23
|
-
*/
|
|
24
|
-
export declare function reconcileLicenseWorkspace<T extends License | null>(rootDir: string, license: T): T;
|
|
25
|
-
export interface ActivationResult {
|
|
26
|
-
success: boolean;
|
|
27
|
-
license?: License;
|
|
28
|
-
error?: string;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Activate a license key for this machine + workspace.
|
|
32
|
-
* Calls the remote API to validate the key and bind it.
|
|
33
|
-
*/
|
|
34
|
-
export declare function activateLicense(rootDir: string, licenseKey: string, workspaceName: string): Promise<ActivationResult>;
|
|
35
|
-
/**
|
|
36
|
-
* Validate the current license. Attempts online refresh if expired.
|
|
37
|
-
* Returns detailed status.
|
|
38
|
-
*/
|
|
39
|
-
export declare function validateLicense(rootDir: string, config: WorkspaceConfig): Promise<LicenseStatus>;
|
|
40
|
-
/** Result of a successful refresh: the updated license + the org's entitlement (if returned). */
|
|
41
|
-
export interface RefreshResult {
|
|
42
|
-
license: License;
|
|
43
|
-
entitlement?: Entitlement;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Resolve the org's entitlement for DISPLAY: cache → synthesized from the plan manifest +
|
|
47
|
-
* the license's (denormalized) tier when offline or on an older backend. Never throws.
|
|
48
|
-
*
|
|
49
|
-
* This is advisory only — the backend's 402 responses are the single hard authority. Use it
|
|
50
|
-
* to show the user their current plan/limits, not to allow/deny an operation locally.
|
|
27
|
+
* Resolve the org's entitlement for DISPLAY: cache → synthesized from the plan
|
|
28
|
+
* manifest + the session's plan. Advisory only — the backend's 402s are the hard
|
|
29
|
+
* authority. Never throws.
|
|
51
30
|
*/
|
|
52
31
|
export declare function resolveEntitlement(rootDir: string, license: License): Promise<Entitlement>;
|
|
53
32
|
export interface TierViolation {
|
|
@@ -57,17 +36,11 @@ export interface TierViolation {
|
|
|
57
36
|
required_tier: LicenseTier;
|
|
58
37
|
}
|
|
59
38
|
/**
|
|
60
|
-
* Check whether the workspace config exceeds the
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* surface violations as a *warning* + upgrade hint and proceed; they must not hard-block on
|
|
64
|
-
* this result. Agent quality (customs, philosophy, prompts) is identical across all tiers —
|
|
65
|
-
* the differentiators are scale (services / agent packages) and tooling access (LLM scan).
|
|
39
|
+
* Check whether the workspace config exceeds the tier's scale limits.
|
|
40
|
+
* **Advisory only** — the server is the enforcement authority (402). Surface as a
|
|
41
|
+
* warning + upgrade hint and proceed; never hard-block on this result.
|
|
66
42
|
*/
|
|
67
43
|
export declare function enforceTierLimits(config: WorkspaceConfig, tier: LicenseTier): TierViolation[];
|
|
68
|
-
/**
|
|
69
|
-
* Check if the CLI is running in dev mode (for NEPOPSX agent developers).
|
|
70
|
-
* Set NEPOPSX_DEV=1 to bypass license checks.
|
|
71
|
-
*/
|
|
44
|
+
/** Set NEPOPSX_DEV=1 to bypass auth checks (for NEPOPSX agent developers). */
|
|
72
45
|
export declare function isDevMode(): boolean;
|
|
73
46
|
//# sourceMappingURL=license-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"license-manager.d.ts","sourceRoot":"","sources":["../../src/licensing/license-manager.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"license-manager.d.ts","sourceRoot":"","sources":["../../src/licensing/license-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,WAAW,EAIjB,MAAM,eAAe,CAAC;AAQvB;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAc3D;AAED,2EAA2E;AAC3E,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,OAAO,GAAG,IAAI,EAChE,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,CAAC,GACT,CAAC,CAEH;AAED,0EAA0E;AAC1E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAEtE;AAID;;;GAGG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,aAAa,CAAC,CA0BxB;AAID;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,WAAW,CAAC,CActB;AAID,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,WAAW,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,WAAW,GAChB,aAAa,EAAE,CA4BjB;AAID,8EAA8E;AAC9E,wBAAgB,SAAS,IAAI,OAAO,CAEnC"}
|
|
@@ -1,134 +1,54 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Auth/session helpers. Post-migration the CLI has ONE credential: the opaque
|
|
3
|
+
* device token from `nepopsx login`, stored in `.nepopsx/config.json`. The
|
|
4
|
+
* `License` shape is kept as a thin compatibility view — `.key` IS the device
|
|
5
|
+
* token — so existing commands send the right Bearer credential unchanged. Auth
|
|
6
|
+
* and entitlement are server-authoritative now (the backend 401/402s); there is
|
|
7
|
+
* no license.json, no machine binding, and no online validate/refresh.
|
|
4
8
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { TIER_LIMITS, generateMachineId, generateFingerprint, checkExpiry, } from '@nepopsx/core';
|
|
8
|
-
import { resolveApiBase } from '../config/api-config.js';
|
|
9
|
-
import { fetchWithTimeout } from '../utils/fetch.js';
|
|
9
|
+
import { TIER_LIMITS, generateMachineId, generateFingerprint, } from '@nepopsx/core';
|
|
10
|
+
import { readLocalConfig } from '../config/api-config.js';
|
|
10
11
|
import { fetchPlanManifest } from '../utils/fetch-plan-manifest.js';
|
|
11
|
-
import { API_TIMEOUT_MS } from '../constants.js';
|
|
12
12
|
import { readWorkspaceNameFromDisk } from './workspace-name.js';
|
|
13
|
-
import { getCachedEntitlement
|
|
14
|
-
|
|
15
|
-
const LICENSE_FILE = 'license.json';
|
|
16
|
-
// ─── License file operations ────────────────────────────────
|
|
13
|
+
import { getCachedEntitlement } from './entitlement-cache.js';
|
|
14
|
+
// ─── Session (device token) ─────────────────────────────────
|
|
17
15
|
/**
|
|
18
|
-
*
|
|
16
|
+
* Build a `License`-shaped view from the stored device token. `.key` IS the opaque
|
|
17
|
+
* `opsx_dvc_…` token sent as a Bearer credential; `org`/`tier` come from the plan
|
|
18
|
+
* captured at login; `workspace` is the live local name. Returns null if not
|
|
19
|
+
* logged in. (No license.json — the device token in config.json is the credential.)
|
|
19
20
|
*/
|
|
20
21
|
export function readLicense(rootDir) {
|
|
21
|
-
const
|
|
22
|
-
if (!
|
|
22
|
+
const auth = readLocalConfig(rootDir).auth;
|
|
23
|
+
if (!auth?.token)
|
|
23
24
|
return null;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
25
|
+
return {
|
|
26
|
+
key: auth.token,
|
|
27
|
+
org: auth.org ?? '',
|
|
28
|
+
tier: auth.plan ?? 'free',
|
|
29
|
+
valid_until: '',
|
|
30
|
+
refresh_token: '',
|
|
31
|
+
machine_id: generateMachineId(),
|
|
32
|
+
workspace: readWorkspaceNameFromDisk(rootDir) ?? 'unknown',
|
|
33
|
+
activated_at: '',
|
|
34
|
+
last_refreshed: '',
|
|
35
|
+
};
|
|
36
36
|
}
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
export function writeLicense(rootDir, license) {
|
|
41
|
-
const dir = join(rootDir, LICENSE_DIR);
|
|
42
|
-
if (!existsSync(dir)) {
|
|
43
|
-
mkdirSync(dir, { recursive: true });
|
|
44
|
-
}
|
|
45
|
-
writeFileSync(join(dir, LICENSE_FILE), JSON.stringify(license, null, 2) + '\n', 'utf-8');
|
|
37
|
+
/** No-op: the workspace is sourced live from disk in `readLicense` now. */
|
|
38
|
+
export function reconcileLicenseWorkspace(_rootDir, license) {
|
|
39
|
+
return license;
|
|
46
40
|
}
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
* The license is activated before `workspace.yaml` exists, so it is born with
|
|
51
|
-
* `workspace: "unknown"`. Once the real config exists, reconcile the in-memory
|
|
52
|
-
* license (and persist it) so every downstream `license.workspace` read — and
|
|
53
|
-
* every backend call derived from it — uses the live workspace name instead of
|
|
54
|
-
* the stale snapshot. Best-effort: returns the license unchanged when the config
|
|
55
|
-
* is absent or already matches. Accepts/returns `null` for the no-license path.
|
|
56
|
-
*/
|
|
57
|
-
export function reconcileLicenseWorkspace(rootDir, license) {
|
|
58
|
-
if (!license)
|
|
59
|
-
return license;
|
|
60
|
-
const liveName = readWorkspaceNameFromDisk(rootDir);
|
|
61
|
-
if (!liveName || liveName === license.workspace)
|
|
62
|
-
return license;
|
|
63
|
-
const reconciled = { ...license, workspace: liveName };
|
|
64
|
-
try {
|
|
65
|
-
writeLicense(rootDir, reconciled);
|
|
66
|
-
}
|
|
67
|
-
catch {
|
|
68
|
-
// Persisting is best-effort — the in-memory heal is what callers rely on.
|
|
69
|
-
}
|
|
70
|
-
return reconciled;
|
|
41
|
+
/** No-op kept for callers: there is no license.json to write any more. */
|
|
42
|
+
export function writeLicense(_rootDir, _license) {
|
|
43
|
+
/* the device token is written to config.json by `nepopsx login` */
|
|
71
44
|
}
|
|
45
|
+
// ─── Validation (local, advisory) ───────────────────────────
|
|
72
46
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
47
|
+
* Confirm a device token is present. Auth + entitlement are enforced by the
|
|
48
|
+
* backend (401/402) — this no longer calls the server.
|
|
75
49
|
*/
|
|
76
|
-
export async function
|
|
77
|
-
const
|
|
78
|
-
const apiBase = resolveApiBase(rootDir);
|
|
79
|
-
try {
|
|
80
|
-
const response = await fetchWithTimeout(`${apiBase}/license/activate`, {
|
|
81
|
-
method: 'POST',
|
|
82
|
-
headers: { 'Content-Type': 'application/json' },
|
|
83
|
-
body: JSON.stringify({
|
|
84
|
-
key: licenseKey,
|
|
85
|
-
machine_id: machineId,
|
|
86
|
-
workspace: workspaceName,
|
|
87
|
-
}),
|
|
88
|
-
}, API_TIMEOUT_MS);
|
|
89
|
-
if (!response.ok) {
|
|
90
|
-
const body = await response.text();
|
|
91
|
-
return {
|
|
92
|
-
success: false,
|
|
93
|
-
error: `Activation failed (${response.status}): ${body}`,
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
const data = await response.json();
|
|
97
|
-
const license = {
|
|
98
|
-
key: licenseKey,
|
|
99
|
-
org: data.org,
|
|
100
|
-
tier: data.tier,
|
|
101
|
-
valid_until: data.valid_until,
|
|
102
|
-
refresh_token: data.refresh_token,
|
|
103
|
-
machine_id: machineId,
|
|
104
|
-
workspace: workspaceName,
|
|
105
|
-
activated_at: new Date().toISOString(),
|
|
106
|
-
last_refreshed: new Date().toISOString(),
|
|
107
|
-
};
|
|
108
|
-
writeLicense(rootDir, license);
|
|
109
|
-
return { success: true, license };
|
|
110
|
-
}
|
|
111
|
-
catch (err) {
|
|
112
|
-
// Network failure — might be offline
|
|
113
|
-
return {
|
|
114
|
-
success: false,
|
|
115
|
-
error: `Cannot reach NEPOPSX API: ${err instanceof Error ? err.message : String(err)}. Check your internet connection.`,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
// ─── Validation ─────────────────────────────────────────────
|
|
120
|
-
/**
|
|
121
|
-
* Validate the current license. Attempts online refresh if expired.
|
|
122
|
-
* Returns detailed status.
|
|
123
|
-
*/
|
|
124
|
-
export async function validateLicense(rootDir, config) {
|
|
125
|
-
// Heal a stale `workspace: "unknown"` against the live config before any
|
|
126
|
-
// backend call uses it. validateLicense always runs with a loaded config, so
|
|
127
|
-
// this self-heals license.json and every later readLicense() returns the
|
|
128
|
-
// correct workspace.
|
|
129
|
-
const license = reconcileLicenseWorkspace(rootDir, readLicense(rootDir));
|
|
130
|
-
const apiBase = resolveApiBase(rootDir);
|
|
131
|
-
// No license file
|
|
50
|
+
export async function validateLicense(rootDir, _config) {
|
|
51
|
+
const license = readLicense(rootDir);
|
|
132
52
|
if (!license) {
|
|
133
53
|
return {
|
|
134
54
|
valid: false,
|
|
@@ -137,159 +57,24 @@ export async function validateLicense(rootDir, config) {
|
|
|
137
57
|
tier: 'free',
|
|
138
58
|
org: '',
|
|
139
59
|
fingerprint: '',
|
|
140
|
-
message: '
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
// Machine binding check
|
|
144
|
-
const currentMachineId = generateMachineId();
|
|
145
|
-
if (license.machine_id !== currentMachineId) {
|
|
146
|
-
return {
|
|
147
|
-
valid: false,
|
|
148
|
-
expired: false,
|
|
149
|
-
days_remaining: 0,
|
|
150
|
-
tier: license.tier,
|
|
151
|
-
org: license.org,
|
|
152
|
-
fingerprint: '',
|
|
153
|
-
message: 'License is bound to a different machine. Run `nepopsx activate <key>` to re-activate.',
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
const { expired, daysRemaining } = checkExpiry(license.valid_until);
|
|
157
|
-
const fingerprint = generateFingerprint(license.org, license.key, license.workspace);
|
|
158
|
-
// Still valid — return immediately
|
|
159
|
-
if (!expired) {
|
|
160
|
-
try {
|
|
161
|
-
const response = await fetchWithTimeout(`${apiBase}/license/validate`, {
|
|
162
|
-
method: 'POST',
|
|
163
|
-
headers: { 'Content-Type': 'application/json' },
|
|
164
|
-
body: JSON.stringify({
|
|
165
|
-
key: license.key,
|
|
166
|
-
machine_id: license.machine_id,
|
|
167
|
-
workspace: license.workspace,
|
|
168
|
-
}),
|
|
169
|
-
}, API_TIMEOUT_MS);
|
|
170
|
-
if (response.ok) {
|
|
171
|
-
const data = await response.json();
|
|
172
|
-
if (data.valid) {
|
|
173
|
-
const updatedLicense = {
|
|
174
|
-
...license,
|
|
175
|
-
org: data.org,
|
|
176
|
-
tier: data.tier,
|
|
177
|
-
valid_until: data.valid_until,
|
|
178
|
-
last_refreshed: new Date().toISOString(),
|
|
179
|
-
};
|
|
180
|
-
writeLicense(rootDir, updatedLicense);
|
|
181
|
-
if (data.entitlement) {
|
|
182
|
-
setCachedEntitlement(rootDir, updatedLicense.key, data.entitlement);
|
|
183
|
-
}
|
|
184
|
-
const onlineExpiry = checkExpiry(updatedLicense.valid_until);
|
|
185
|
-
return {
|
|
186
|
-
valid: true,
|
|
187
|
-
expired: false,
|
|
188
|
-
days_remaining: onlineExpiry.daysRemaining,
|
|
189
|
-
tier: updatedLicense.tier,
|
|
190
|
-
org: updatedLicense.org,
|
|
191
|
-
fingerprint,
|
|
192
|
-
message: data.message,
|
|
193
|
-
entitlement: data.entitlement,
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
return {
|
|
197
|
-
valid: false,
|
|
198
|
-
expired: false,
|
|
199
|
-
days_remaining: daysRemaining,
|
|
200
|
-
tier: license.tier,
|
|
201
|
-
org: license.org,
|
|
202
|
-
fingerprint,
|
|
203
|
-
message: data.message,
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
catch {
|
|
208
|
-
// Fall back to local validation when offline or backend is unavailable.
|
|
209
|
-
}
|
|
210
|
-
return {
|
|
211
|
-
valid: true,
|
|
212
|
-
expired: false,
|
|
213
|
-
days_remaining: daysRemaining,
|
|
214
|
-
tier: license.tier,
|
|
215
|
-
org: license.org,
|
|
216
|
-
fingerprint,
|
|
217
|
-
message: daysRemaining <= 7
|
|
218
|
-
? `License expires in ${daysRemaining} day(s). Renew at nepopsx.dev.`
|
|
219
|
-
: `Licensed to ${license.org} (${license.tier}).`,
|
|
60
|
+
message: 'Not logged in. Run `nepopsx login` to authorize this machine.',
|
|
220
61
|
};
|
|
221
62
|
}
|
|
222
|
-
// Expired — attempt online refresh
|
|
223
|
-
const refreshed = await refreshLicense(rootDir, license);
|
|
224
|
-
if (refreshed) {
|
|
225
|
-
const { license: refreshedLicense, entitlement } = refreshed;
|
|
226
|
-
const newExpiry = checkExpiry(refreshedLicense.valid_until);
|
|
227
|
-
return {
|
|
228
|
-
valid: true,
|
|
229
|
-
expired: false,
|
|
230
|
-
days_remaining: newExpiry.daysRemaining,
|
|
231
|
-
tier: refreshedLicense.tier,
|
|
232
|
-
org: refreshedLicense.org,
|
|
233
|
-
fingerprint,
|
|
234
|
-
message: `License refreshed. Valid until ${refreshedLicense.valid_until}.`,
|
|
235
|
-
entitlement,
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
// Refresh failed — license is truly expired
|
|
239
63
|
return {
|
|
240
|
-
valid:
|
|
241
|
-
expired:
|
|
242
|
-
days_remaining:
|
|
64
|
+
valid: true,
|
|
65
|
+
expired: false,
|
|
66
|
+
days_remaining: 365,
|
|
243
67
|
tier: license.tier,
|
|
244
68
|
org: license.org,
|
|
245
|
-
fingerprint,
|
|
246
|
-
message: `
|
|
69
|
+
fingerprint: generateFingerprint(license.org, license.key, license.workspace),
|
|
70
|
+
message: `Logged in to ${license.org || 'your org'} (${license.tier}).`,
|
|
247
71
|
};
|
|
248
72
|
}
|
|
249
|
-
/**
|
|
250
|
-
* Attempt to refresh the license via the remote API.
|
|
251
|
-
* Returns the updated license (+ entitlement when the backend provides it) on success,
|
|
252
|
-
* null on failure.
|
|
253
|
-
*/
|
|
254
|
-
async function refreshLicense(rootDir, license) {
|
|
255
|
-
const apiBase = resolveApiBase(rootDir);
|
|
256
|
-
try {
|
|
257
|
-
const response = await fetchWithTimeout(`${apiBase}/license/refresh`, {
|
|
258
|
-
method: 'POST',
|
|
259
|
-
headers: { 'Content-Type': 'application/json' },
|
|
260
|
-
body: JSON.stringify({
|
|
261
|
-
refresh_token: license.refresh_token,
|
|
262
|
-
machine_id: license.machine_id,
|
|
263
|
-
}),
|
|
264
|
-
}, API_TIMEOUT_MS);
|
|
265
|
-
if (!response.ok)
|
|
266
|
-
return null;
|
|
267
|
-
const data = await response.json();
|
|
268
|
-
const updated = {
|
|
269
|
-
...license,
|
|
270
|
-
tier: data.tier,
|
|
271
|
-
valid_until: data.valid_until,
|
|
272
|
-
refresh_token: data.refresh_token,
|
|
273
|
-
last_refreshed: new Date().toISOString(),
|
|
274
|
-
};
|
|
275
|
-
writeLicense(rootDir, updated);
|
|
276
|
-
if (data.entitlement) {
|
|
277
|
-
setCachedEntitlement(rootDir, updated.key, data.entitlement);
|
|
278
|
-
}
|
|
279
|
-
return { license: updated, entitlement: data.entitlement };
|
|
280
|
-
}
|
|
281
|
-
catch {
|
|
282
|
-
// Network failure — can't refresh
|
|
283
|
-
return null;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
73
|
// ─── Resolved entitlement (display / advisory) ──────────────
|
|
287
74
|
/**
|
|
288
|
-
* Resolve the org's entitlement for DISPLAY: cache → synthesized from the plan
|
|
289
|
-
* the
|
|
290
|
-
*
|
|
291
|
-
* This is advisory only — the backend's 402 responses are the single hard authority. Use it
|
|
292
|
-
* to show the user their current plan/limits, not to allow/deny an operation locally.
|
|
75
|
+
* Resolve the org's entitlement for DISPLAY: cache → synthesized from the plan
|
|
76
|
+
* manifest + the session's plan. Advisory only — the backend's 402s are the hard
|
|
77
|
+
* authority. Never throws.
|
|
293
78
|
*/
|
|
294
79
|
export async function resolveEntitlement(rootDir, license) {
|
|
295
80
|
const cached = getCachedEntitlement(rootDir, license.key);
|
|
@@ -302,22 +87,18 @@ export async function resolveEntitlement(rootDir, license) {
|
|
|
302
87
|
status: license.tier === 'free' ? 'free' : 'active',
|
|
303
88
|
limits: spec.limits,
|
|
304
89
|
features: spec.features,
|
|
305
|
-
validUntil:
|
|
90
|
+
validUntil: null,
|
|
306
91
|
trialEndsAt: null,
|
|
307
92
|
};
|
|
308
93
|
}
|
|
309
94
|
/**
|
|
310
|
-
* Check whether the workspace config exceeds the
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* surface violations as a *warning* + upgrade hint and proceed; they must not hard-block on
|
|
314
|
-
* this result. Agent quality (customs, philosophy, prompts) is identical across all tiers —
|
|
315
|
-
* the differentiators are scale (services / agent packages) and tooling access (LLM scan).
|
|
95
|
+
* Check whether the workspace config exceeds the tier's scale limits.
|
|
96
|
+
* **Advisory only** — the server is the enforcement authority (402). Surface as a
|
|
97
|
+
* warning + upgrade hint and proceed; never hard-block on this result.
|
|
316
98
|
*/
|
|
317
99
|
export function enforceTierLimits(config, tier) {
|
|
318
100
|
const limits = TIER_LIMITS[tier];
|
|
319
101
|
const violations = [];
|
|
320
|
-
// Service count
|
|
321
102
|
if (config.services.length > limits.max_services) {
|
|
322
103
|
violations.push({
|
|
323
104
|
feature: 'services',
|
|
@@ -326,7 +107,6 @@ export function enforceTierLimits(config, tier) {
|
|
|
326
107
|
required_tier: tier === 'free' ? 'team' : 'enterprise',
|
|
327
108
|
});
|
|
328
109
|
}
|
|
329
|
-
// Agent count
|
|
330
110
|
if (config.agents) {
|
|
331
111
|
const enabledAgents = Object.values(config.agents).filter((a) => a.enabled).length;
|
|
332
112
|
if (enabledAgents > limits.max_agents) {
|
|
@@ -341,10 +121,7 @@ export function enforceTierLimits(config, tier) {
|
|
|
341
121
|
return violations;
|
|
342
122
|
}
|
|
343
123
|
// ─── Dev mode bypass ────────────────────────────────────────
|
|
344
|
-
/**
|
|
345
|
-
* Check if the CLI is running in dev mode (for NEPOPSX agent developers).
|
|
346
|
-
* Set NEPOPSX_DEV=1 to bypass license checks.
|
|
347
|
-
*/
|
|
124
|
+
/** Set NEPOPSX_DEV=1 to bypass auth checks (for NEPOPSX agent developers). */
|
|
348
125
|
export function isDevMode() {
|
|
349
126
|
return process.env.NEPOPSX_DEV === '1';
|
|
350
127
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"license-manager.js","sourceRoot":"","sources":["../../src/licensing/license-manager.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"license-manager.js","sourceRoot":"","sources":["../../src/licensing/license-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAML,WAAW,EACX,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,+DAA+D;AAE/D;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC;IAC3C,IAAI,CAAC,IAAI,EAAE,KAAK;QAAE,OAAO,IAAI,CAAC;IAC9B,OAAO;QACL,GAAG,EAAE,IAAI,CAAC,KAAK;QACf,GAAG,EAAE,IAAI,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AAC,YAAY;SACvD,CAAC,CAAC;IACL,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CACvD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CACjB,CAAC,MAAM,CAAC;QACT,IAAI,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;YACtC,UAAU,CAAC,IAAI,CAAC;gBACd,OAAO,EAAE,QAAQ;gBACjB,KAAK,EAAE,GAAG,MAAM,CAAC,UAAU,EAAE;gBAC7B,MAAM,EAAE,GAAG,aAAa,EAAE;gBAC1B,aAAa,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY;aACvD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,+DAA+D;AAE/D,8EAA8E;AAC9E,MAAM,UAAU,SAAS;IACvB,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,GAAG,CAAC;AACzC,CAAC"}
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* `learning_search` / `learning_store` for governed team recall.
|
|
5
5
|
*
|
|
6
6
|
* Claude Code's remote HTTP MCP form is `{ type: "http", url, headers }`, and it
|
|
7
|
-
* expands `${VAR}` in the config — so we embed the
|
|
8
|
-
* placeholder (`${
|
|
9
|
-
* committed `.mcp.json` shareable across the team without leaking the
|
|
7
|
+
* expands `${VAR}` in the config — so we embed the device token as an env
|
|
8
|
+
* placeholder (`${NEPOPSX_DEVICE_TOKEN}`) rather than the raw secret, keeping the
|
|
9
|
+
* committed `.mcp.json` shareable across the team without leaking the token.
|
|
10
10
|
*/
|
|
11
11
|
export declare const MEMORY_SERVER_NAME = "nepopsx-memory";
|
|
12
|
-
export declare const LICENSE_ENV_VAR = "
|
|
12
|
+
export declare const LICENSE_ENV_VAR = "NEPOPSX_DEVICE_TOKEN";
|
|
13
13
|
export interface McpHttpServer {
|
|
14
14
|
type: 'http';
|
|
15
15
|
url: string;
|
|
@@ -23,9 +23,9 @@ export interface McpSetupOptions {
|
|
|
23
23
|
rootDir: string;
|
|
24
24
|
/** Backend API base, including `/v1` (e.g. http://localhost:3100/v1). */
|
|
25
25
|
apiUrl: string;
|
|
26
|
-
/** Raw
|
|
26
|
+
/** Raw device token — only embedded when `inlineKey` is true (dev convenience). */
|
|
27
27
|
licenseKey?: string;
|
|
28
|
-
/** Embed the raw
|
|
28
|
+
/** Embed the raw token instead of the `${NEPOPSX_DEVICE_TOKEN}` placeholder. */
|
|
29
29
|
inlineKey?: boolean;
|
|
30
30
|
}
|
|
31
31
|
/** Build the `nepopsx-memory` HTTP server entry for `.mcp.json`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-generator.d.ts","sourceRoot":"","sources":["../../src/mcp/config-generator.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AAEH,eAAO,MAAM,kBAAkB,mBAAmB,CAAC;AACnD,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"config-generator.d.ts","sourceRoot":"","sources":["../../src/mcp/config-generator.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AAEH,eAAO,MAAM,kBAAkB,mBAAmB,CAAC;AACnD,eAAO,MAAM,eAAe,yBAAyB,CAAC;AAEtD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC1C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,MAAM,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,oEAAoE;AACpE,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,GACtD,aAAa,CAWf;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,EAAE,CA4BpE"}
|