@jean2/client 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/dist/cli.mjs ADDED
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/cli.ts
4
+ import http from "node:http";
5
+ import fs from "node:fs";
6
+ import path from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ import { parseArgs } from "node:util";
9
+ import open from "open";
10
+ var __filename = fileURLToPath(import.meta.url);
11
+ var __dirname = path.dirname(__filename);
12
+ var distPath = __dirname;
13
+ var { values } = parseArgs({
14
+ options: {
15
+ port: {
16
+ type: "string",
17
+ default: "3774"
18
+ }
19
+ },
20
+ argv: process.argv.slice(2)
21
+ });
22
+ var PORT = parseInt(values.port, 10);
23
+ var MIME_TYPES = {
24
+ ".html": "text/html",
25
+ ".js": "application/javascript",
26
+ ".mjs": "application/javascript",
27
+ ".css": "text/css",
28
+ ".json": "application/json",
29
+ ".png": "image/png",
30
+ ".jpg": "image/jpeg",
31
+ ".gif": "image/gif",
32
+ ".svg": "image/svg+xml",
33
+ ".ico": "image/x-icon",
34
+ ".woff": "font/woff",
35
+ ".woff2": "font/woff2"
36
+ };
37
+ function getContentType(filePath) {
38
+ const ext = path.extname(filePath).toLowerCase();
39
+ return MIME_TYPES[ext] || "application/octet-stream";
40
+ }
41
+ function serveFile(res, filePath, contentType) {
42
+ fs.readFile(filePath, (err, data) => {
43
+ if (err) {
44
+ res.writeHead(404, { "Content-Type": "text/plain" });
45
+ res.end("Not Found");
46
+ return;
47
+ }
48
+ res.writeHead(200, { "Content-Type": contentType });
49
+ res.end(data);
50
+ });
51
+ }
52
+ var server = http.createServer((req, res) => {
53
+ let urlPath = (req.url ?? "/").split("?")[0];
54
+ if (urlPath === "/") {
55
+ urlPath = "/index.html";
56
+ }
57
+ const filePath = path.join(distPath, urlPath);
58
+ fs.stat(filePath, (err, stats) => {
59
+ if (err || !stats.isFile()) {
60
+ const indexPath = path.join(distPath, "index.html");
61
+ serveFile(res, indexPath, "text/html");
62
+ return;
63
+ }
64
+ const contentType = getContentType(filePath);
65
+ serveFile(res, filePath, contentType);
66
+ });
67
+ });
68
+ server.on("error", (err) => {
69
+ console.error("Server error:", err.message);
70
+ process.exit(1);
71
+ });
72
+ server.listen(PORT, () => {
73
+ const url = `http://localhost:${PORT}`;
74
+ console.log(`Jean2 client running at ${url}`);
75
+ open(url);
76
+ });
77
+ function shutdown() {
78
+ console.log("\nShutting down...");
79
+ server.close(() => {
80
+ process.exit(0);
81
+ });
82
+ }
83
+ process.on("SIGINT", shutdown);
84
+ process.on("SIGTERM", shutdown);
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
6
+ <meta name="mobile-web-app-capable" content="yes" />
7
+ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
8
+ <title>AI Agent Client</title>
9
+ <script type="module" crossorigin src="/assets/index-DW0N73wx.js"></script>
10
+ <link rel="stylesheet" crossorigin href="/assets/index-CBTw9Ux9.css">
11
+ </head>
12
+ <body>
13
+ <div id="root"></div>
14
+ </body>
15
+ </html>
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@jean2/client",
3
+ "version": "0.2.0",
4
+ "description": "Jean2 AI Agent Client - Run the Jean2 web UI locally via npx",
5
+ "private": false,
6
+ "type": "module",
7
+ "bin": {
8
+ "j2": "./dist/cli.mjs"
9
+ },
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/rabbyte-tech/jean2.git",
16
+ "directory": "packages/client"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/rabbyte-tech/jean2/issues"
20
+ },
21
+ "homepage": "https://github.com/rabbyte-tech/jean2#readme",
22
+ "license": "MIT",
23
+ "dependencies": {
24
+ "open": "^10.1.0"
25
+ }
26
+ }