@lobu/embeddings 14.13.0 → 14.15.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.
Files changed (2) hide show
  1. package/dist/server.js +15 -0
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -152,6 +152,21 @@ app.post("/api/embeddings", async (c) => {
152
152
  return c.json({ error: message }, 500);
153
153
  }
154
154
  });
155
+ // When forked by the embedded runtime (startEmbeddings), exit if the parent
156
+ // dies without a graceful teardown — otherwise the child is orphaned and leaks
157
+ // until killed by hand. Standalone `npm start` has no IPC channel, so
158
+ // process.send is undefined and this never fires. Same pattern as
159
+ // connector-worker child-runner.ts installParentDeathHandlers().
160
+ //
161
+ // Register the listener BEFORE checking process.connected: Node does not
162
+ // replay a 'disconnect' emitted before a listener exists, and the parent can
163
+ // die mid-module-load (imports run before this line). Register-then-check is
164
+ // gap-free — no event can be processed between two synchronous statements.
165
+ if (process.send) {
166
+ process.on("disconnect", () => process.exit(143));
167
+ if (!process.connected)
168
+ process.exit(143);
169
+ }
155
170
  const port = Number.parseInt(process.env.PORT || String(DEFAULT_PORT), 10);
156
171
  serve({
157
172
  fetch: app.fetch,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobu/embeddings",
3
- "version": "14.13.0",
3
+ "version": "14.15.0",
4
4
  "license": "BUSL-1.1",
5
5
  "type": "module",
6
6
  "description": "Embeddings HTTP service for Lobu memory",