Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

fix(node-services): keep the Document Runtime on its configured address

claude-opus-5-5-medium25e408928932
diff --git a/apps/node-services/release-lockfiles/computer.yaml b/apps/node-services/release-lockfiles/computer.yaml
index f9edb2d5..16993a01 100644
--- a/apps/node-services/release-lockfiles/computer.yaml
+++ b/apps/node-services/release-lockfiles/computer.yaml
@@ -6,7 +6,7 @@ settings:
overrides:
xlsx: npm:@e965/[email protected]
patchedDependencies:
- "@hocuspocus/[email protected]": 26806fa621c7cafd75f6e2737e820e6a341b46132399176083b6b342198eab76
+ "@hocuspocus/[email protected]": c6b938c4b952964ade14a2e8099774cb3f489c06a7522ed2264f158b14387b70
"@livekit/[email protected]": a2a99608ccad5c400634accbbb04b77a0f96bba6949baaa6c88b4568f7526753
[email protected]: 7a922549743b0a521c959c1d7400ddb6cad1ca8c43c7692e2dc8847bd3f2ea25
[email protected]: 78d5eb47c9c7095d8c87a9f21aba2d7f240636ea9a759299d3f99d7f7f9bcd5e
diff --git a/apps/node-services/tests/document/hocuspocus-listen-address.test.ts b/apps/node-services/tests/document/hocuspocus-listen-address.test.ts
new file mode 100644
index 00000000..bef83d75
--- /dev/null
+++ b/apps/node-services/tests/document/hocuspocus-listen-address.test.ts
@@ -0,0 +1,21 @@
+import { Server } from "@hocuspocus/server";
+import { afterEach, expect, it } from "vitest";
+
+const servers: Server[] = [];
+afterEach(async () => {
+ for (const server of servers.splice(0)) await server.destroy();
+});
+
+// The Document Runtime binds DOCUMENT_RUNTIME_HTTP_ADDRESS's host through
+// Hocuspocus's `address`; a local installation must stay on loopback.
+it("listens only on the configured address", async () => {
+ const server = new Server({
+ address: "127.0.0.1",
+ port: 0,
+ quiet: true,
+ stopOnSignals: false,
+ });
+ servers.push(server);
+ await server.listen();
+ expect(server.httpServer.address()).toMatchObject({ address: "127.0.0.1" });
+});
diff --git a/patches/@[email protected] b/patches/@[email protected]
index f56e4acf..a49d93eb 100644
--- a/patches/@[email protected]
+++ b/patches/@[email protected]
@@ -1,5 +1,5 @@
diff --git a/dist/hocuspocus-server.cjs b/dist/hocuspocus-server.cjs
-index a8b29cbd57ea85479df6b0a08c0e74465c26475a..204a8e51ac09dd83ef7d08b190f825b73527f855 100644
+index a8b29cbd57ea85479df6b0a08c0e74465c26475a..f0ea29b1dbc078e7b677215e52650ba3cd46bc09 100644
--- a/dist/hocuspocus-server.cjs
+++ b/dist/hocuspocus-server.cjs
@@ -232,9 +232,15 @@ var MessageReceiver = class {
@@ -20,7 +20,7 @@ index a8b29cbd57ea85479df6b0a08c0e74465c26475a..204a8e51ac09dd83ef7d08b190f825b7
} finally {
scratch.destroy();
scratchDoc.destroy();
-@@ -500,6 +506,8 @@ var Connection = class {
+@@ -503,6 +509,8 @@ var Connection = class {
code: "code" in e && typeof e.code === "number" ? e.code : _hocuspocus_common.ResetConnection.code,
reason: "reason" in e ? e.reason : _hocuspocus_common.ResetConnection.reason
});
@@ -46,8 +46,17 @@ index a8b29cbd57ea85479df6b0a08c0e74465c26475a..204a8e51ac09dd83ef7d08b190f825b7
states
});
});
+@@ -5631,7 +5640,7 @@ var Server = class {
+ return new Promise((resolve, reject) => {
+ this.httpServer.listen({
+ port: this.configuration.port,
+- address: this.configuration.address
++ host: this.configuration.address
+ }, async () => {
+ if (!this.configuration.quiet && String(process.env.NODE_ENV) !== "testing") this.showStartScreen();
+ const onListenPayload = {
diff --git a/dist/hocuspocus-server.esm.js b/dist/hocuspocus-server.esm.js
-index f9eec1a1a1f15438484713c2d12d4e4674418446..62a8bb3ceb4ce5e7511cd4918a384dc26824ef58 100644
+index f9eec1a1a1f15438484713c2d12d4e4674418446..ec892fb011794460266d41f712a45f05d27dfc30 100644
--- a/dist/hocuspocus-server.esm.js
+++ b/dist/hocuspocus-server.esm.js
@@ -202,9 +202,15 @@ var MessageReceiver = class {
@@ -68,7 +77,7 @@ index f9eec1a1a1f15438484713c2d12d4e4674418446..62a8bb3ceb4ce5e7511cd4918a384dc2
} finally {
scratch.destroy();
scratchDoc.destroy();
-@@ -470,6 +476,8 @@ var Connection = class {
+@@ -473,6 +479,8 @@ var Connection = class {
code: "code" in e && typeof e.code === "number" ? e.code : ResetConnection.code,
reason: "reason" in e ? e.reason : ResetConnection.reason
});
@@ -94,8 +103,17 @@ index f9eec1a1a1f15438484713c2d12d4e4674418446..62a8bb3ceb4ce5e7511cd4918a384dc2
states
});
});
+@@ -1576,7 +1585,7 @@ var Server = class {
+ return new Promise((resolve, reject) => {
+ this.httpServer.listen({
+ port: this.configuration.port,
+- address: this.configuration.address
++ host: this.configuration.address
+ }, async () => {
+ if (!this.configuration.quiet && String("development") !== "testing") this.showStartScreen();
+ const onListenPayload = {
diff --git a/dist/index.d.ts b/dist/index.d.ts
-index c3c6d1c80e1cfba5085f285226c138604a92363a..b27d2e9a3abd40770df476ff646b510ed52d3fb2 100644
+index c3c6d1c80e1cfba5085f285226c138604a92363a..0c33248f8bba371ef65f4d302a4a3a9c2c1814d0 100644
--- a/dist/index.d.ts
+++ b/dist/index.d.ts
@@ -13,7 +13,7 @@ declare class Document extends Doc {
@@ -129,9 +147,10 @@ index c3c6d1c80e1cfba5085f285226c138604a92363a..b27d2e9a3abd40770df476ff646b510e
/**
* The `TransactionOrigin` that will be passed to `applyAwarenessUpdate`.
diff --git a/src/Connection.ts b/src/Connection.ts
+index 82356aa7845ed414a533e382ebe0db695f206416..1981acb5c99d7bacb27797dbe36dfee04d3dbf74 100644
--- a/src/Connection.ts
+++ b/src/Connection.ts
-@@ -287,6 +287,8 @@ export class Connection<Context = any> {
+@@ -293,6 +293,8 @@ export class Connection<Context = any> {
code: "code" in e && typeof e.code === 'number' ? e.code : ResetConnection.code,
reason: "reason" in e ? e.reason : ResetConnection.reason,
});
@@ -225,6 +244,19 @@ index 8d0b279b82f30f8536ff233530fa918f10ce5ae9..b1afa5709864470e92fb4961f65b16a1
} finally {
scratch.destroy();
scratchDoc.destroy();
+diff --git a/src/Server.ts b/src/Server.ts
+index 53f3867fe7025e271fb6aa222785c007aa6590ca..8a3656478da41e219261e7d8d483f5d28a07077b 100644
+--- a/src/Server.ts
++++ b/src/Server.ts
+@@ -162,7 +162,7 @@ export class Server<Context = any> {
+ this.httpServer.listen(
+ {
+ port: this.configuration.port,
+- address: this.configuration.address,
++ host: this.configuration.address,
+ } as ListenOptions,
+ async () => {
+ if (
diff --git a/src/types.ts b/src/types.ts
index 6649551d908bb1e33fed80f709f894f3cc89c552..695fa1c38c07e7caeb4615163d53f5b375d71f38 100644
--- a/src/types.ts
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1ece6d34..fde70abc 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -8,7 +8,7 @@ overrides:
xlsx: npm:@e965/[email protected]
patchedDependencies:
- '@hocuspocus/[email protected]': 26806fa621c7cafd75f6e2737e820e6a341b46132399176083b6b342198eab76
+ '@hocuspocus/[email protected]': c6b938c4b952964ade14a2e8099774cb3f489c06a7522ed2264f158b14387b70
'@livekit/[email protected]': a2a99608ccad5c400634accbbb04b77a0f96bba6949baaa6c88b4568f7526753
[email protected]: 7a922549743b0a521c959c1d7400ddb6cad1ca8c43c7692e2dc8847bd3f2ea25
[email protected]: 78d5eb47c9c7095d8c87a9f21aba2d7f240636ea9a759299d3f99d7f7f9bcd5e
@@ -226,7 +226,7 @@ importers:
dependencies:
'@hocuspocus/server':
specifier: ^4.3.0
- version: 4.3.0(patch_hash=26806fa621c7cafd75f6e2737e820e6a341b46132399176083b6b342198eab76)([email protected]([email protected]))([email protected])
+ version: 4.3.0(patch_hash=c6b938c4b952964ade14a2e8099774cb3f489c06a7522ed2264f158b14387b70)([email protected]([email protected]))([email protected])
'@hono/node-server':
specifier: ^1.19.14
version: 1.19.15([email protected])
@@ -8777,7 +8777,7 @@ snapshots:
y-protocols: 1.0.7([email protected])
yjs: 13.6.31
- '@hocuspocus/[email protected](patch_hash=26806fa621c7cafd75f6e2737e820e6a341b46132399176083b6b342198eab76)([email protected]([email protected]))([email protected])':
+ '@hocuspocus/[email protected](patch_hash=c6b938c4b952964ade14a2e8099774cb3f489c06a7522ed2264f158b14387b70)([email protected]([email protected]))([email protected])':
dependencies:
'@hocuspocus/common': 4.3.0
async-mutex: 0.5.0