jungle-grid 0.1.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/dist/api.d.ts +208 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +118 -0
- package/dist/api.js.map +1 -0
- package/dist/auth.d.ts +66 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +151 -0
- package/dist/auth.js.map +1 -0
- package/dist/banner.d.ts +5 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/banner.js +11 -0
- package/dist/banner.js.map +1 -0
- package/dist/config.d.ts +30 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +114 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1769 -0
- package/dist/index.js.map +1 -0
- package/dist/node-agent-installer.d.ts +56 -0
- package/dist/node-agent-installer.d.ts.map +1 -0
- package/dist/node-agent-installer.js +332 -0
- package/dist/node-agent-installer.js.map +1 -0
- package/dist/node-config.d.ts +40 -0
- package/dist/node-config.d.ts.map +1 -0
- package/dist/node-config.js +129 -0
- package/dist/node-config.js.map +1 -0
- package/dist/prompt.d.ts +4 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +58 -0
- package/dist/prompt.js.map +1 -0
- package/dist/repl.d.ts +10 -0
- package/dist/repl.d.ts.map +1 -0
- package/dist/repl.js +200 -0
- package/dist/repl.js.map +1 -0
- package/dist/ui.d.ts +29 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +165 -0
- package/dist/ui.js.map +1 -0
- package/dist/version.d.ts +22 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +83 -0
- package/dist/version.js.map +1 -0
- package/package.json +27 -0
package/dist/config.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* config.ts — CLI configuration loader for Jungle Grid.
|
|
4
|
+
*
|
|
5
|
+
* Architecture role: Pillar 1 (Abstract GPU Selection) support module.
|
|
6
|
+
* The CLI must know where the orchestrator API lives, but never what
|
|
7
|
+
* hardware sits behind it. This module resolves the API base URL from
|
|
8
|
+
* three sources in priority order:
|
|
9
|
+
* 1. JUNGLE_GRID_API environment variable (highest priority)
|
|
10
|
+
* 2. ~/.jungle-grid/config.json file
|
|
11
|
+
* 3. Built-in default (http://api.junglegrid.jaguarbuilds.dev:8080)
|
|
12
|
+
*
|
|
13
|
+
* Upstream: Called by api.ts to build request URLs.
|
|
14
|
+
* Downstream: Reads from filesystem (~/.jungle-grid/config.json).
|
|
15
|
+
*/
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
+
}) : function(o, v) {
|
|
30
|
+
o["default"] = v;
|
|
31
|
+
});
|
|
32
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
33
|
+
var ownKeys = function(o) {
|
|
34
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
35
|
+
var ar = [];
|
|
36
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
return ownKeys(o);
|
|
40
|
+
};
|
|
41
|
+
return function (mod) {
|
|
42
|
+
if (mod && mod.__esModule) return mod;
|
|
43
|
+
var result = {};
|
|
44
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
45
|
+
__setModuleDefault(result, mod);
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
})();
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.getApiUrl = getApiUrl;
|
|
51
|
+
exports.getConfigDir = getConfigDir;
|
|
52
|
+
const fs = __importStar(require("fs"));
|
|
53
|
+
const path = __importStar(require("path"));
|
|
54
|
+
const os = __importStar(require("os"));
|
|
55
|
+
/**
|
|
56
|
+
* Directory where all Jungle Grid CLI state lives.
|
|
57
|
+
* Stored in the user's home directory so it persists across shell sessions.
|
|
58
|
+
* If this path changes, credentials.ts must also be updated.
|
|
59
|
+
*/
|
|
60
|
+
const CONFIG_DIR = path.join(os.homedir(), ".jungle-grid");
|
|
61
|
+
/**
|
|
62
|
+
* Path to the JSON config file.
|
|
63
|
+
* Currently only holds `api_url`. Extensible for future settings
|
|
64
|
+
* (e.g., default optimization mode, output format preferences).
|
|
65
|
+
*/
|
|
66
|
+
const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
67
|
+
/**
|
|
68
|
+
* Default API URL used when neither the env var nor the config file provides one.
|
|
69
|
+
* Points to localhost for local development. Production users must set
|
|
70
|
+
* JUNGLE_GRID_API or write a config file.
|
|
71
|
+
*/
|
|
72
|
+
const DEFAULT_API_URL = "http://api.junglegrid.jaguarbuilds.dev:8080";
|
|
73
|
+
/**
|
|
74
|
+
* Resolves the orchestrator API base URL.
|
|
75
|
+
*
|
|
76
|
+
* Priority: JUNGLE_GRID_API env > config.json > default.
|
|
77
|
+
*
|
|
78
|
+
* @returns The API base URL string, never empty, never trailing-slashed.
|
|
79
|
+
*/
|
|
80
|
+
function getApiUrl() {
|
|
81
|
+
// Priority 1: Environment variable — allows per-invocation override
|
|
82
|
+
// and is the standard pattern for CI/CD and containerized usage.
|
|
83
|
+
const envUrl = process.env.JUNGLE_GRID_API;
|
|
84
|
+
if (envUrl) {
|
|
85
|
+
return envUrl.replace(/\/+$/, "");
|
|
86
|
+
}
|
|
87
|
+
// Priority 2: Config file — set once by the user, persists across sessions.
|
|
88
|
+
try {
|
|
89
|
+
if (fs.existsSync(CONFIG_FILE)) {
|
|
90
|
+
const raw = fs.readFileSync(CONFIG_FILE, "utf-8");
|
|
91
|
+
const config = JSON.parse(raw);
|
|
92
|
+
if (config.api_url) {
|
|
93
|
+
return config.api_url.replace(/\/+$/, "");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
// Malformed config file — fall through to default silently.
|
|
99
|
+
// We don't warn here because the CLI should work out of the box
|
|
100
|
+
// even if the config file is corrupted; the user can fix it later.
|
|
101
|
+
}
|
|
102
|
+
// Priority 3: Built-in default for local development.
|
|
103
|
+
return DEFAULT_API_URL;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Returns the path to the Jungle Grid config directory.
|
|
107
|
+
* Used by auth.ts to know where to write credentials.
|
|
108
|
+
*
|
|
109
|
+
* @returns Absolute path to ~/.jungle-grid/
|
|
110
|
+
*/
|
|
111
|
+
function getConfigDir() {
|
|
112
|
+
return CONFIG_DIR;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CH,8BAyBC;AAQD,oCAEC;AA5ED,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAEzB;;;;GAIG;AACH,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,cAAc,CAAC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAEzD;;;;GAIG;AACH,MAAM,eAAe,GAAG,6CAA6C,CAAC;AAWtE;;;;;;GAMG;AACH,SAAgB,SAAS;IACvB,oEAAoE;IACpE,iEAAiE;IACjE,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;IAC3C,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,4EAA4E;IAC5E,IAAI,CAAC;QACH,IAAI,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YAC/B,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAClD,MAAM,MAAM,GAAc,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC1C,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,4DAA4D;QAC5D,gEAAgE;QAChE,mEAAmE;IACrE,CAAC;IAED,sDAAsD;IACtD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED;;;;;GAKG;AACH,SAAgB,YAAY;IAC1B,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* index.ts — Entry point for the Jungle Grid CLI (`jungle` command).
|
|
4
|
+
*
|
|
5
|
+
* Architecture role: Pillar 1 (Abstract GPU Selection) — primary user interface.
|
|
6
|
+
* This is the main user-facing surface of Jungle Grid. Every command must
|
|
7
|
+
* uphold the abstraction boundary: users declare WHAT they want to run
|
|
8
|
+
* (workload type, model size, optimization preference), never WHERE or HOW.
|
|
9
|
+
*
|
|
10
|
+
* PILLAR 1 INVARIANTS enforced here:
|
|
11
|
+
* - `jungle submit` accepts --workload and --model-size, NOT --gpu-type.
|
|
12
|
+
* - Job-oriented commands stay workload-first and scheduling-focused.
|
|
13
|
+
* - `jungle nodes` is a marketplace overview, while `jungle nodes show`
|
|
14
|
+
* intentionally exposes full node capability and pricing metadata.
|
|
15
|
+
* - The CLI never prints node API keys, shared secrets, or auth material.
|
|
16
|
+
*
|
|
17
|
+
* Pillar 2 (Intelligent Routing): The CLI does not route — it delegates to
|
|
18
|
+
* the orchestrator API, which runs the classifier and matcher server-side.
|
|
19
|
+
*
|
|
20
|
+
* Upstream: User's terminal.
|
|
21
|
+
* Downstream: Orchestrator REST API via api.ts; local credentials via auth.ts.
|
|
22
|
+
*/
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;GAoBG"}
|