fluxy-bot 0.1.26 → 0.1.28
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/bin/cli.js +23 -3
- package/package.json +3 -1
- package/scripts/postinstall.js +30 -0
- package/supervisor/tunnel.ts +3 -1
package/bin/cli.js
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { spawn, execSync } from 'child_process';
|
|
3
|
+
import { spawn, spawnSync, execSync } from 'child_process';
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import os from 'os';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
8
|
|
|
9
9
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
|
|
11
|
+
// Delegate to ~/.fluxy/app/ if we're not already running from there
|
|
12
|
+
const FLUXY_APP_DIR = path.join(os.homedir(), '.fluxy', 'app');
|
|
13
|
+
const FLUXY_APP_CLI = path.join(FLUXY_APP_DIR, 'bin', 'cli.js');
|
|
14
|
+
if (
|
|
15
|
+
fs.existsSync(FLUXY_APP_CLI) &&
|
|
16
|
+
path.resolve(__dirname) !== path.resolve(path.join(FLUXY_APP_DIR, 'bin'))
|
|
17
|
+
) {
|
|
18
|
+
const { status } = spawnSync(
|
|
19
|
+
process.execPath,
|
|
20
|
+
[FLUXY_APP_CLI, ...process.argv.slice(2)],
|
|
21
|
+
{ stdio: 'inherit' },
|
|
22
|
+
);
|
|
23
|
+
process.exit(status ?? 0);
|
|
24
|
+
}
|
|
25
|
+
|
|
10
26
|
const ROOT = path.resolve(__dirname, '..');
|
|
11
27
|
const DATA_DIR = path.join(os.homedir(), '.fluxy');
|
|
12
28
|
const CONFIG_PATH = path.join(DATA_DIR, 'config.json');
|
|
@@ -314,7 +330,9 @@ async function init() {
|
|
|
314
330
|
process.stdout.write(` ${c.dim}${d.toString().trim()}${c.reset}\n`);
|
|
315
331
|
});
|
|
316
332
|
child.stderr.on('data', (d) => {
|
|
317
|
-
|
|
333
|
+
const line = d.toString().trim();
|
|
334
|
+
if (!line || line.includes('AssignProcessToJobObject')) return;
|
|
335
|
+
process.stderr.write(` ${c.dim}${line}${c.reset}\n`);
|
|
318
336
|
});
|
|
319
337
|
}
|
|
320
338
|
|
|
@@ -351,7 +369,9 @@ async function start() {
|
|
|
351
369
|
process.stdout.write(` ${c.dim}${d.toString().trim()}${c.reset}\n`);
|
|
352
370
|
});
|
|
353
371
|
child.stderr.on('data', (d) => {
|
|
354
|
-
|
|
372
|
+
const line = d.toString().trim();
|
|
373
|
+
if (!line || line.includes('AssignProcessToJobObject')) return;
|
|
374
|
+
process.stderr.write(` ${c.dim}${line}${c.reset}\n`);
|
|
355
375
|
});
|
|
356
376
|
}
|
|
357
377
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fluxy-bot",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
4
4
|
"description": "Self-hosted AI bot — run your own AI assistant from anywhere",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"shared/",
|
|
15
15
|
"client/",
|
|
16
16
|
"dist/",
|
|
17
|
+
"scripts/",
|
|
17
18
|
"vite.config.ts",
|
|
18
19
|
"tsconfig.json",
|
|
19
20
|
"postcss.config.js",
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
"dev": "concurrently \"tsx watch supervisor/index.ts\" \"vite\"",
|
|
36
37
|
"build": "vite build",
|
|
37
38
|
"start": "node --import tsx/esm supervisor/index.ts",
|
|
39
|
+
"postinstall": "node scripts/postinstall.js",
|
|
38
40
|
"prepublishOnly": "npm run build"
|
|
39
41
|
},
|
|
40
42
|
"dependencies": {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Links the npm-installed package to ~/.fluxy/app/ so everything
|
|
4
|
+
// lives in one predictable location for the Claude Agent SDK.
|
|
5
|
+
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import os from 'os';
|
|
9
|
+
import { fileURLToPath } from 'url';
|
|
10
|
+
|
|
11
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const PKG_ROOT = path.resolve(__dirname, '..');
|
|
13
|
+
const FLUXY_HOME = path.join(os.homedir(), '.fluxy');
|
|
14
|
+
const APP_DIR = path.join(FLUXY_HOME, 'app');
|
|
15
|
+
|
|
16
|
+
// Skip if already at the target location
|
|
17
|
+
if (path.resolve(PKG_ROOT) === path.resolve(APP_DIR)) {
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Create ~/.fluxy/ if needed
|
|
22
|
+
fs.mkdirSync(FLUXY_HOME, { recursive: true });
|
|
23
|
+
|
|
24
|
+
// Remove existing app link/dir
|
|
25
|
+
try {
|
|
26
|
+
fs.rmSync(APP_DIR, { recursive: true, force: true });
|
|
27
|
+
} catch {}
|
|
28
|
+
|
|
29
|
+
// Create symlink: ~/.fluxy/app → npm install location
|
|
30
|
+
fs.symlinkSync(PKG_ROOT, APP_DIR, 'junction');
|
package/supervisor/tunnel.ts
CHANGED
|
@@ -67,7 +67,9 @@ export function startTunnel(port: number): Promise<string> {
|
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
const onData = (d: Buffer) => {
|
|
70
|
-
const
|
|
70
|
+
const text = d.toString();
|
|
71
|
+
if (text.includes('AssignProcessToJobObject')) return;
|
|
72
|
+
const m = text.match(/https:\/\/[^\s]+\.trycloudflare\.com/);
|
|
71
73
|
if (m) { clearTimeout(timeout); resolve(m[0]); }
|
|
72
74
|
};
|
|
73
75
|
|