@andespindola/brainlink 1.6.1 → 1.6.3
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/application/frontend/client/graph-renderer.js +690 -0
- package/dist/application/frontend/client/worker-bootstrap.js +113 -41
- package/dist/application/frontend/client-js.js +2 -0
- package/dist/application/frontend/client-render-worker-js.js +14 -677
- package/dist/application/frontend/login-page.js +331 -0
- package/dist/application/server/routes.js +92 -1
- package/dist/application/server/web-auth.js +168 -0
- package/dist/application/start-server.js +7 -2
- package/dist/cli/commands/write/server-commands.js +17 -5
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { join } from 'node:path';
|
|
|
3
3
|
import { platform, tmpdir } from 'node:os';
|
|
4
4
|
import { spawn, spawnSync } from 'node:child_process';
|
|
5
5
|
import { startServer } from '../../../application/start-server.js';
|
|
6
|
+
import { resolveWebAuth } from '../../../application/server/web-auth.js';
|
|
6
7
|
import { isBucketVaultPath } from '../../../infrastructure/file-system-vault.js';
|
|
7
8
|
import { startRemoteMcpServer } from '../../../mcp/http-server.js';
|
|
8
9
|
import { parsePositiveInteger, print, resolveOptions } from '../../runtime.js';
|
|
@@ -489,32 +490,43 @@ export const registerServerCommands = (program) => {
|
|
|
489
490
|
.option('--no-open', 'do not open the graph UI automatically')
|
|
490
491
|
.option('-w, --watch', 'watch markdown files and reindex on changes', true)
|
|
491
492
|
.option('--no-watch', 'disable markdown file watching')
|
|
493
|
+
.option('--expose', 'expose an authenticated remote graph UI (branded login) instead of the local loopback UI')
|
|
492
494
|
.option('--json', 'print machine-readable JSON')
|
|
493
|
-
.description('start a
|
|
495
|
+
.description('start a web UI for the knowledge graph (local by default, or authenticated remote with --expose)')
|
|
494
496
|
.action(async (options) => {
|
|
495
497
|
const resolved = await resolveOptions(options);
|
|
498
|
+
const expose = options.expose === true;
|
|
499
|
+
// Exposed mode must never serve the vault unauthenticated: require credentials
|
|
500
|
+
// (persistent web-auth store or BRAINLINK_WEB_USER/PASSWORD env) before binding.
|
|
501
|
+
if (expose && (await resolveWebAuth()) === null) {
|
|
502
|
+
throw new Error('Refusing to expose the graph UI without authentication. Configure credentials first (BRAINLINK_WEB_USER + BRAINLINK_WEB_PASSWORD, or a persisted web-auth store).');
|
|
503
|
+
}
|
|
496
504
|
const shouldWatch = options.watch !== false && !isBucketVaultPath(resolved.vault);
|
|
497
505
|
const server = await startServer({
|
|
498
506
|
vaultPath: resolved.vault,
|
|
499
507
|
host: options.host ?? resolved.config.host,
|
|
500
508
|
port: parsePositiveInteger(options.port ?? String(resolved.config.port), resolved.config.port),
|
|
501
509
|
shouldIndex: options.index,
|
|
502
|
-
shouldWatch
|
|
510
|
+
shouldWatch,
|
|
511
|
+
expose
|
|
503
512
|
});
|
|
504
|
-
|
|
513
|
+
// Never auto-open a browser in exposed mode (it runs headless behind a proxy).
|
|
514
|
+
const openResult = options.open !== false && !expose ? openUrlInUi(server.url, process.pid) : { opened: false, mode: 'none' };
|
|
505
515
|
print(options.json, {
|
|
506
516
|
url: server.url,
|
|
517
|
+
mode: expose ? 'exposed' : 'local',
|
|
518
|
+
auth: expose ? 'branded-login' : 'none',
|
|
507
519
|
watch: shouldWatch,
|
|
508
520
|
readonly: true,
|
|
509
521
|
openedUi: openResult.opened,
|
|
510
522
|
openMode: openResult.mode
|
|
511
|
-
}, () => `Brainlink graph server running at ${server.url} (${shouldWatch ? 'watching for changes' : 'watch disabled'})${openResult.opened
|
|
523
|
+
}, () => `Brainlink graph server running at ${server.url} (${expose ? 'exposed, branded login' : 'local'}${shouldWatch ? ', watching for changes' : ', watch disabled'})${openResult.opened
|
|
512
524
|
? openResult.mode === 'native-gui'
|
|
513
525
|
? ' (opened in native desktop GUI)'
|
|
514
526
|
: openResult.mode === 'app-window'
|
|
515
527
|
? ' (opened in dedicated app window)'
|
|
516
528
|
: ' (opened in browser)'
|
|
517
|
-
: options.open === false
|
|
529
|
+
: options.open === false || expose
|
|
518
530
|
? ' (auto-open disabled)'
|
|
519
531
|
: ''}`);
|
|
520
532
|
});
|
package/package.json
CHANGED