@jlongo78/agent-spaces 0.3.4 → 0.3.12
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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/required-server-files.json +19 -19
- package/.next/standalone/.next/server/app/(desktop)/admin/analytics/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/admin/users/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/analytics/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/network/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/sessions/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/terminal/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/terminal/pane/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/terminal/remote/[nodeId]/[workspaceId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/workspaces/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +2 -2
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/admin/analytics.html +1 -1
- package/.next/standalone/.next/server/app/admin/analytics.rsc +2 -2
- package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin/analytics/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin/analytics.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/analytics.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/admin/analytics.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/analytics.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/admin/analytics.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/admin/users.html +1 -1
- package/.next/standalone/.next/server/app/admin/users.rsc +2 -2
- package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin/users/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin/users.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/users.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/admin/users.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/users.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/admin/users.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/analytics.html +1 -1
- package/.next/standalone/.next/server/app/analytics.rsc +2 -2
- package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap/analytics/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap/analytics.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/analytics.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/analytics.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/analytics.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/analytics.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/login.html +1 -1
- package/.next/standalone/.next/server/app/login.rsc +2 -2
- package/.next/standalone/.next/server/app/login.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/login.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/login.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/m/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/m/projects.html +1 -1
- package/.next/standalone/.next/server/app/m/projects.rsc +2 -2
- package/.next/standalone/.next/server/app/m/projects.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/projects.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/projects.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/projects.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/projects.segments/m/projects/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/projects.segments/m/projects.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/projects.segments/m.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/m/sessions/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/m/sessions.html +1 -1
- package/.next/standalone/.next/server/app/m/sessions.rsc +2 -2
- package/.next/standalone/.next/server/app/m/sessions.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/sessions.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/sessions.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/sessions.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/sessions.segments/m/sessions/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/sessions.segments/m/sessions.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/sessions.segments/m.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/m/settings.html +1 -1
- package/.next/standalone/.next/server/app/m/settings.rsc +2 -2
- package/.next/standalone/.next/server/app/m/settings.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/settings.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/settings.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/settings.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/settings.segments/m/settings/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/settings.segments/m/settings.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/settings.segments/m.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/terminal/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/m/terminal.html +1 -1
- package/.next/standalone/.next/server/app/m/terminal.rsc +2 -2
- package/.next/standalone/.next/server/app/m/terminal.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/terminal.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/terminal.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/terminal.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/terminal.segments/m/terminal/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/terminal.segments/m/terminal.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/terminal.segments/m.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m.html +1 -1
- package/.next/standalone/.next/server/app/m.rsc +2 -2
- package/.next/standalone/.next/server/app/m.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m.segments/m/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m.segments/m.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/network.html +1 -1
- package/.next/standalone/.next/server/app/network.rsc +2 -2
- package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap/network/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap/network.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/network.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/network.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/network.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/network.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/projects.html +1 -1
- package/.next/standalone/.next/server/app/projects.rsc +2 -2
- package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap/projects/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap/projects.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/projects.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/projects.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/projects.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/projects.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/sessions.html +1 -1
- package/.next/standalone/.next/server/app/sessions.rsc +2 -2
- package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap/sessions/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap/sessions.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/sessions.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/sessions.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/sessions.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/sessions.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/settings.html +1 -1
- package/.next/standalone/.next/server/app/settings.rsc +2 -2
- package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap/settings/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap/settings.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/settings.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/settings.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/terminal.html +1 -1
- package/.next/standalone/.next/server/app/terminal.rsc +2 -2
- package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap/terminal/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap/terminal.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/terminal.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/terminal.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/terminal.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/terminal.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/workspaces.html +1 -1
- package/.next/standalone/.next/server/app/workspaces.rsc +2 -2
- package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap/workspaces/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap/workspaces.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/workspaces.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/workspaces.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/workspaces.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/workspaces.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/chunks/[externals]_node:path_d28a9bfe._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__7fae7bd7._.js +1 -1
- package/.next/standalone/.next/server/middleware-manifest.json +5 -5
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +2 -2
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/static/chunks/b873b989ec82be01.css +3 -0
- package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/README.md +46 -0
- package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/glib-2.0/include/glibconfig.h +221 -0
- package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/index.js +1 -0
- package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3 +0 -0
- package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/package.json +42 -0
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/README.md +46 -0
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/glib-2.0/include/glibconfig.h +221 -0
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/index.js +1 -0
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/libvips-cpp.so.8.17.3 +0 -0
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/package.json +42 -0
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/versions.json +30 -0
- package/.next/standalone/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node +0 -0
- package/.next/standalone/node_modules/@img/{sharp-win32-x64 → sharp-linux-x64}/package.json +46 -39
- package/.next/standalone/node_modules/@img/sharp-linuxmusl-x64/lib/sharp-linuxmusl-x64.node +0 -0
- package/.next/standalone/node_modules/@img/sharp-linuxmusl-x64/package.json +46 -0
- package/.next/standalone/node_modules/better-sqlite3-90e2652d1716b047/index.js +1 -0
- package/.next/standalone/node_modules/better-sqlite3-90e2652d1716b047/package.json +1 -0
- package/.next/standalone/package.json +91 -89
- package/.next/standalone/server.js +1 -1
- package/.next/standalone/tsconfig.json +34 -34
- package/LICENSE +661 -21
- package/README.md +131 -121
- package/bin/fix-standalone-externals.js +79 -0
- package/bin/mdns-service.js +171 -171
- package/bin/postinstall.js +35 -41
- package/bin/setup-admin.js +189 -189
- package/bin/spaces-dev.js +108 -108
- package/bin/spaces.js +155 -155
- package/bin/terminal-server.js +990 -990
- package/package.json +91 -91
- package/.next/standalone/.next/server/chunks/[externals]_node +0 -0
- package/.next/standalone/.next/static/chunks/01580b24a27526a9.css +0 -3
- package/.next/standalone/node_modules/@img/sharp-win32-x64/lib/sharp-win32-x64.node +0 -0
- package/.next/standalone/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
- package/.next/standalone/node_modules/better-sqlite3/lib/database.js +0 -90
- package/.next/standalone/node_modules/better-sqlite3/lib/index.js +0 -3
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/aggregate.js +0 -43
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/backup.js +0 -67
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/function.js +0 -31
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/inspect.js +0 -7
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/pragma.js +0 -12
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/serialize.js +0 -16
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/table.js +0 -189
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/transaction.js +0 -78
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/wrappers.js +0 -54
- package/.next/standalone/node_modules/better-sqlite3/lib/sqlite-error.js +0 -20
- package/.next/standalone/node_modules/better-sqlite3/lib/util.js +0 -12
- package/.next/standalone/node_modules/better-sqlite3/package.json +0 -59
- package/.next/standalone/node_modules/bindings/bindings.js +0 -221
- package/.next/standalone/node_modules/bindings/package.json +0 -28
- package/.next/standalone/node_modules/detect-libc/lib/detect-libc.js +0 -313
- package/.next/standalone/node_modules/detect-libc/lib/elf.js +0 -39
- package/.next/standalone/node_modules/detect-libc/lib/filesystem.js +0 -51
- package/.next/standalone/node_modules/detect-libc/lib/process.js +0 -24
- package/.next/standalone/node_modules/detect-libc/package.json +0 -44
- package/.next/standalone/node_modules/file-uri-to-path/index.js +0 -66
- package/.next/standalone/node_modules/file-uri-to-path/package.json +0 -32
- /package/.next/standalone/.next/static/{kBuXyJd5flokJeECxOXkh → _8ZLzufn5gU1vrGxPWqKS}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{kBuXyJd5flokJeECxOXkh → _8ZLzufn5gU1vrGxPWqKS}/_clientMiddlewareManifest.json +0 -0
- /package/.next/standalone/.next/static/{kBuXyJd5flokJeECxOXkh → _8ZLzufn5gU1vrGxPWqKS}/_ssgManifest.js +0 -0
- /package/.next/standalone/node_modules/@img/{sharp-win32-x64 → sharp-libvips-linux-x64}/versions.json +0 -0
package/bin/mdns-service.js
CHANGED
|
@@ -1,171 +1,171 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* mDNS service: advertises this Spaces node on the LAN and discovers peers.
|
|
3
|
-
* Required by terminal-server.js.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const fs = require('fs');
|
|
7
|
-
const path = require('path');
|
|
8
|
-
const os = require('os');
|
|
9
|
-
|
|
10
|
-
const NODE_JSON_PATH = path.join(os.homedir(), '.spaces', 'node.json');
|
|
11
|
-
const NETWORK_DB_PATH = path.join(os.homedir(), '.spaces', 'network.db');
|
|
12
|
-
|
|
13
|
-
function getNodeIdentity() {
|
|
14
|
-
try {
|
|
15
|
-
if (fs.existsSync(NODE_JSON_PATH)) {
|
|
16
|
-
return JSON.parse(fs.readFileSync(NODE_JSON_PATH, 'utf-8'));
|
|
17
|
-
}
|
|
18
|
-
} catch { /* ignore */ }
|
|
19
|
-
|
|
20
|
-
// Create lazily
|
|
21
|
-
const crypto = require('crypto');
|
|
22
|
-
const identity = {
|
|
23
|
-
nodeId: crypto.randomUUID(),
|
|
24
|
-
nodeName: os.hostname(),
|
|
25
|
-
createdAt: new Date().toISOString(),
|
|
26
|
-
};
|
|
27
|
-
const dir = path.dirname(NODE_JSON_PATH);
|
|
28
|
-
if (!fs.existsSync(dir)) {
|
|
29
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
30
|
-
}
|
|
31
|
-
fs.writeFileSync(NODE_JSON_PATH, JSON.stringify(identity, null, 2), { mode: 0o600 });
|
|
32
|
-
return identity;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function getVersion() {
|
|
36
|
-
try {
|
|
37
|
-
const pkgPath = path.join(__dirname, '..', 'package.json');
|
|
38
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
39
|
-
return pkg.version || '0.0.0';
|
|
40
|
-
} catch {
|
|
41
|
-
return '0.0.0';
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
let _networkDbRW = null;
|
|
46
|
-
|
|
47
|
-
function getNetworkDbRW() {
|
|
48
|
-
if (_networkDbRW) return _networkDbRW;
|
|
49
|
-
try {
|
|
50
|
-
const Database = require('better-sqlite3');
|
|
51
|
-
const dir = path.dirname(NETWORK_DB_PATH);
|
|
52
|
-
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
53
|
-
const db = new Database(NETWORK_DB_PATH);
|
|
54
|
-
db.pragma('journal_mode = WAL');
|
|
55
|
-
db.pragma('busy_timeout = 5000');
|
|
56
|
-
db.exec(`
|
|
57
|
-
CREATE TABLE IF NOT EXISTS nodes (
|
|
58
|
-
id TEXT PRIMARY KEY,
|
|
59
|
-
name TEXT NOT NULL,
|
|
60
|
-
url TEXT NOT NULL,
|
|
61
|
-
api_key_encrypted TEXT NOT NULL DEFAULT '',
|
|
62
|
-
api_key_hint TEXT NOT NULL DEFAULT '',
|
|
63
|
-
status TEXT NOT NULL DEFAULT 'unknown',
|
|
64
|
-
last_seen TEXT,
|
|
65
|
-
last_error TEXT,
|
|
66
|
-
session_count INTEGER DEFAULT 0,
|
|
67
|
-
version TEXT,
|
|
68
|
-
discovered_via TEXT DEFAULT 'manual',
|
|
69
|
-
created TEXT DEFAULT (datetime('now')),
|
|
70
|
-
updated TEXT DEFAULT (datetime('now'))
|
|
71
|
-
);
|
|
72
|
-
`);
|
|
73
|
-
_networkDbRW = db;
|
|
74
|
-
return db;
|
|
75
|
-
} catch (err) {
|
|
76
|
-
console.error('[mDNS] Failed to open network DB:', err.message);
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function upsertDiscoveredNode(info) {
|
|
82
|
-
const db = getNetworkDbRW();
|
|
83
|
-
if (!db) return;
|
|
84
|
-
try {
|
|
85
|
-
db.prepare(`
|
|
86
|
-
INSERT INTO nodes (id, name, url, api_key_encrypted, api_key_hint, status, version, discovered_via, last_seen)
|
|
87
|
-
VALUES (?, ?, ?, '', '', 'online', ?, 'mdns', datetime('now'))
|
|
88
|
-
ON CONFLICT(id) DO UPDATE SET
|
|
89
|
-
name = excluded.name,
|
|
90
|
-
url = excluded.url,
|
|
91
|
-
version = excluded.version,
|
|
92
|
-
status = 'online',
|
|
93
|
-
last_seen = datetime('now'),
|
|
94
|
-
updated = datetime('now')
|
|
95
|
-
`).run(info.nodeId, info.nodeName, info.url, info.version);
|
|
96
|
-
console.log(`[mDNS] Discovered: ${info.nodeName} at ${info.url}`);
|
|
97
|
-
} catch (err) {
|
|
98
|
-
console.error('[mDNS] DB upsert error:', err.message);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function markNodeOffline(nodeId) {
|
|
103
|
-
const db = getNetworkDbRW();
|
|
104
|
-
if (!db) return;
|
|
105
|
-
try {
|
|
106
|
-
db.prepare(`
|
|
107
|
-
UPDATE nodes SET status = 'offline', updated = datetime('now')
|
|
108
|
-
WHERE id = ? AND discovered_via = 'mdns'
|
|
109
|
-
`).run(nodeId);
|
|
110
|
-
} catch { /* ignore */ }
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function startMdns(port) {
|
|
114
|
-
let Bonjour;
|
|
115
|
-
try {
|
|
116
|
-
Bonjour = require('bonjour-service').Bonjour;
|
|
117
|
-
} catch (err) {
|
|
118
|
-
console.log('[mDNS] bonjour-service not available, skipping discovery:', err.message);
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const identity = getNodeIdentity();
|
|
123
|
-
const version = getVersion();
|
|
124
|
-
const bonjour = new Bonjour();
|
|
125
|
-
|
|
126
|
-
// Advertise this node
|
|
127
|
-
const service = bonjour.publish({
|
|
128
|
-
name: identity.nodeName,
|
|
129
|
-
type: 'spaces-agent',
|
|
130
|
-
port: port,
|
|
131
|
-
txt: {
|
|
132
|
-
nodeId: identity.nodeId,
|
|
133
|
-
version: version,
|
|
134
|
-
protocol: 'http',
|
|
135
|
-
},
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
console.log(`[mDNS] Advertising as "${identity.nodeName}" (${identity.nodeId.slice(0, 8)}) on port ${port}`);
|
|
139
|
-
|
|
140
|
-
// Browse for peers
|
|
141
|
-
const browser = bonjour.find({ type: 'spaces-agent' });
|
|
142
|
-
|
|
143
|
-
browser.on('up', (svc) => {
|
|
144
|
-
const remoteNodeId = svc.txt?.nodeId;
|
|
145
|
-
if (!remoteNodeId || remoteNodeId === identity.nodeId) return; // Skip self
|
|
146
|
-
|
|
147
|
-
const protocol = svc.txt?.protocol || 'http';
|
|
148
|
-
const host = svc.host || svc.referer?.address;
|
|
149
|
-
if (!host) return;
|
|
150
|
-
|
|
151
|
-
const url = `${protocol}://${host}:${svc.port}`;
|
|
152
|
-
upsertDiscoveredNode({
|
|
153
|
-
nodeId: remoteNodeId,
|
|
154
|
-
nodeName: svc.name || host,
|
|
155
|
-
url,
|
|
156
|
-
version: svc.txt?.version || '',
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
browser.on('down', (svc) => {
|
|
161
|
-
const remoteNodeId = svc.txt?.nodeId;
|
|
162
|
-
if (remoteNodeId && remoteNodeId !== identity.nodeId) {
|
|
163
|
-
markNodeOffline(remoteNodeId);
|
|
164
|
-
console.log(`[mDNS] Node went down: ${svc.name}`);
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
return { bonjour, service, browser };
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
module.exports = { startMdns };
|
|
1
|
+
/**
|
|
2
|
+
* mDNS service: advertises this Spaces node on the LAN and discovers peers.
|
|
3
|
+
* Required by terminal-server.js.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const os = require('os');
|
|
9
|
+
|
|
10
|
+
const NODE_JSON_PATH = path.join(os.homedir(), '.spaces', 'node.json');
|
|
11
|
+
const NETWORK_DB_PATH = path.join(os.homedir(), '.spaces', 'network.db');
|
|
12
|
+
|
|
13
|
+
function getNodeIdentity() {
|
|
14
|
+
try {
|
|
15
|
+
if (fs.existsSync(NODE_JSON_PATH)) {
|
|
16
|
+
return JSON.parse(fs.readFileSync(NODE_JSON_PATH, 'utf-8'));
|
|
17
|
+
}
|
|
18
|
+
} catch { /* ignore */ }
|
|
19
|
+
|
|
20
|
+
// Create lazily
|
|
21
|
+
const crypto = require('crypto');
|
|
22
|
+
const identity = {
|
|
23
|
+
nodeId: crypto.randomUUID(),
|
|
24
|
+
nodeName: os.hostname(),
|
|
25
|
+
createdAt: new Date().toISOString(),
|
|
26
|
+
};
|
|
27
|
+
const dir = path.dirname(NODE_JSON_PATH);
|
|
28
|
+
if (!fs.existsSync(dir)) {
|
|
29
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
fs.writeFileSync(NODE_JSON_PATH, JSON.stringify(identity, null, 2), { mode: 0o600 });
|
|
32
|
+
return identity;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function getVersion() {
|
|
36
|
+
try {
|
|
37
|
+
const pkgPath = path.join(__dirname, '..', 'package.json');
|
|
38
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
39
|
+
return pkg.version || '0.0.0';
|
|
40
|
+
} catch {
|
|
41
|
+
return '0.0.0';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
let _networkDbRW = null;
|
|
46
|
+
|
|
47
|
+
function getNetworkDbRW() {
|
|
48
|
+
if (_networkDbRW) return _networkDbRW;
|
|
49
|
+
try {
|
|
50
|
+
const Database = require('better-sqlite3');
|
|
51
|
+
const dir = path.dirname(NETWORK_DB_PATH);
|
|
52
|
+
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
53
|
+
const db = new Database(NETWORK_DB_PATH);
|
|
54
|
+
db.pragma('journal_mode = WAL');
|
|
55
|
+
db.pragma('busy_timeout = 5000');
|
|
56
|
+
db.exec(`
|
|
57
|
+
CREATE TABLE IF NOT EXISTS nodes (
|
|
58
|
+
id TEXT PRIMARY KEY,
|
|
59
|
+
name TEXT NOT NULL,
|
|
60
|
+
url TEXT NOT NULL,
|
|
61
|
+
api_key_encrypted TEXT NOT NULL DEFAULT '',
|
|
62
|
+
api_key_hint TEXT NOT NULL DEFAULT '',
|
|
63
|
+
status TEXT NOT NULL DEFAULT 'unknown',
|
|
64
|
+
last_seen TEXT,
|
|
65
|
+
last_error TEXT,
|
|
66
|
+
session_count INTEGER DEFAULT 0,
|
|
67
|
+
version TEXT,
|
|
68
|
+
discovered_via TEXT DEFAULT 'manual',
|
|
69
|
+
created TEXT DEFAULT (datetime('now')),
|
|
70
|
+
updated TEXT DEFAULT (datetime('now'))
|
|
71
|
+
);
|
|
72
|
+
`);
|
|
73
|
+
_networkDbRW = db;
|
|
74
|
+
return db;
|
|
75
|
+
} catch (err) {
|
|
76
|
+
console.error('[mDNS] Failed to open network DB:', err.message);
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function upsertDiscoveredNode(info) {
|
|
82
|
+
const db = getNetworkDbRW();
|
|
83
|
+
if (!db) return;
|
|
84
|
+
try {
|
|
85
|
+
db.prepare(`
|
|
86
|
+
INSERT INTO nodes (id, name, url, api_key_encrypted, api_key_hint, status, version, discovered_via, last_seen)
|
|
87
|
+
VALUES (?, ?, ?, '', '', 'online', ?, 'mdns', datetime('now'))
|
|
88
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
89
|
+
name = excluded.name,
|
|
90
|
+
url = excluded.url,
|
|
91
|
+
version = excluded.version,
|
|
92
|
+
status = 'online',
|
|
93
|
+
last_seen = datetime('now'),
|
|
94
|
+
updated = datetime('now')
|
|
95
|
+
`).run(info.nodeId, info.nodeName, info.url, info.version);
|
|
96
|
+
console.log(`[mDNS] Discovered: ${info.nodeName} at ${info.url}`);
|
|
97
|
+
} catch (err) {
|
|
98
|
+
console.error('[mDNS] DB upsert error:', err.message);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function markNodeOffline(nodeId) {
|
|
103
|
+
const db = getNetworkDbRW();
|
|
104
|
+
if (!db) return;
|
|
105
|
+
try {
|
|
106
|
+
db.prepare(`
|
|
107
|
+
UPDATE nodes SET status = 'offline', updated = datetime('now')
|
|
108
|
+
WHERE id = ? AND discovered_via = 'mdns'
|
|
109
|
+
`).run(nodeId);
|
|
110
|
+
} catch { /* ignore */ }
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function startMdns(port) {
|
|
114
|
+
let Bonjour;
|
|
115
|
+
try {
|
|
116
|
+
Bonjour = require('bonjour-service').Bonjour;
|
|
117
|
+
} catch (err) {
|
|
118
|
+
console.log('[mDNS] bonjour-service not available, skipping discovery:', err.message);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const identity = getNodeIdentity();
|
|
123
|
+
const version = getVersion();
|
|
124
|
+
const bonjour = new Bonjour();
|
|
125
|
+
|
|
126
|
+
// Advertise this node
|
|
127
|
+
const service = bonjour.publish({
|
|
128
|
+
name: identity.nodeName,
|
|
129
|
+
type: 'spaces-agent',
|
|
130
|
+
port: port,
|
|
131
|
+
txt: {
|
|
132
|
+
nodeId: identity.nodeId,
|
|
133
|
+
version: version,
|
|
134
|
+
protocol: 'http',
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
console.log(`[mDNS] Advertising as "${identity.nodeName}" (${identity.nodeId.slice(0, 8)}) on port ${port}`);
|
|
139
|
+
|
|
140
|
+
// Browse for peers
|
|
141
|
+
const browser = bonjour.find({ type: 'spaces-agent' });
|
|
142
|
+
|
|
143
|
+
browser.on('up', (svc) => {
|
|
144
|
+
const remoteNodeId = svc.txt?.nodeId;
|
|
145
|
+
if (!remoteNodeId || remoteNodeId === identity.nodeId) return; // Skip self
|
|
146
|
+
|
|
147
|
+
const protocol = svc.txt?.protocol || 'http';
|
|
148
|
+
const host = svc.host || svc.referer?.address;
|
|
149
|
+
if (!host) return;
|
|
150
|
+
|
|
151
|
+
const url = `${protocol}://${host}:${svc.port}`;
|
|
152
|
+
upsertDiscoveredNode({
|
|
153
|
+
nodeId: remoteNodeId,
|
|
154
|
+
nodeName: svc.name || host,
|
|
155
|
+
url,
|
|
156
|
+
version: svc.txt?.version || '',
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
browser.on('down', (svc) => {
|
|
161
|
+
const remoteNodeId = svc.txt?.nodeId;
|
|
162
|
+
if (remoteNodeId && remoteNodeId !== identity.nodeId) {
|
|
163
|
+
markNodeOffline(remoteNodeId);
|
|
164
|
+
console.log(`[mDNS] Node went down: ${svc.name}`);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
return { bonjour, service, browser };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
module.exports = { startMdns };
|
package/bin/postinstall.js
CHANGED
|
@@ -1,41 +1,35 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
path.join(aliasPath, 'package.json'),
|
|
37
|
-
JSON.stringify({ name: alias, version: '1.0.0', main: 'index.js' }) + '\n'
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Postinstall script for @jlongo78/agent-spaces
|
|
4
|
+
//
|
|
5
|
+
// 1. Rebuilds better-sqlite3 native addon for the current Node.js version
|
|
6
|
+
// 2. Removes any pre-compiled native modules from the standalone bundle
|
|
7
|
+
// so they resolve from the parent node_modules/ (where they were just rebuilt)
|
|
8
|
+
|
|
9
|
+
const { execSync } = require('child_process');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
|
|
13
|
+
// Step 1: Rebuild native modules for this Node version
|
|
14
|
+
console.log('[postinstall] Rebuilding better-sqlite3 for Node', process.version, '...');
|
|
15
|
+
try {
|
|
16
|
+
execSync('npm rebuild better-sqlite3', { stdio: 'inherit' });
|
|
17
|
+
} catch (e) {
|
|
18
|
+
console.error('[postinstall] Warning: failed to rebuild better-sqlite3:', e.message);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Step 2: Remove stale native binaries from standalone bundle
|
|
22
|
+
// Next.js standalone mode copies native modules built on the CI Node version.
|
|
23
|
+
// These will crash at runtime if the user's Node version differs.
|
|
24
|
+
const standaloneModules = path.join(__dirname, '..', '.next', 'standalone', 'node_modules');
|
|
25
|
+
const nativeModules = ['better-sqlite3', 'node-pty', 'bindings', 'file-uri-to-path', 'detect-libc'];
|
|
26
|
+
|
|
27
|
+
for (const mod of nativeModules) {
|
|
28
|
+
const modDir = path.join(standaloneModules, mod);
|
|
29
|
+
if (fs.existsSync(modDir)) {
|
|
30
|
+
fs.rmSync(modDir, { recursive: true, force: true });
|
|
31
|
+
console.log(`[postinstall] Removed stale native module from standalone: ${mod}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
console.log('[postinstall] Done.');
|