amalgm 0.1.87 → 0.1.88

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amalgm",
3
- "version": "0.1.87",
3
+ "version": "0.1.88",
4
4
  "description": "Amalgm local computer runtime: login, MCP, chat, events, previews, and tunnels.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -93,7 +93,13 @@ const SERVICE_PORTS = {
93
93
  mcp: runtimePort('amalgm-mcp'),
94
94
  chat: runtimePort('chat-server'),
95
95
  };
96
- const LOCAL_AGENT_APP_PORT = Number.parseInt(process.env.AMALGM_LOCAL_APP_PORT || '3456', 10);
96
+ function parseOptionalPort(value) {
97
+ const raw = String(value || '').trim();
98
+ if (!raw) return null;
99
+ const port = Number.parseInt(raw, 10);
100
+ return Number.isInteger(port) && port > 0 && port <= 65535 ? port : null;
101
+ }
102
+ const LOCAL_AGENT_APP_PORT = parseOptionalPort(process.env.AMALGM_LOCAL_APP_PORT);
97
103
 
98
104
  const HOP_BY_HOP_HEADERS = new Set([
99
105
  'connection',
@@ -201,7 +207,7 @@ function activeAppPorts() {
201
207
 
202
208
  function isInternalRuntimePort(port) {
203
209
  return (
204
- port === LOCAL_AGENT_APP_PORT
210
+ (LOCAL_AGENT_APP_PORT !== null && port === LOCAL_AGENT_APP_PORT)
205
211
  || Object.values(SERVICE_PORTS).some((value) => Number(value) === port)
206
212
  );
207
213
  }
@@ -19,7 +19,13 @@ const AGENT_PORT = parseInt(process.env.PORT || '8080');
19
19
  const AMALGM_MCP_PORT = runtimePort('amalgm-mcp');
20
20
  const CHAT_SERVER_PORT = runtimePort('chat-server');
21
21
  const AMALGM_GATEWAY_PORT = runtimePort('local-gateway');
22
- const LOCAL_AGENT_APP_PORT = parseInt(process.env.AMALGM_LOCAL_APP_PORT || '3456', 10);
22
+ function parseOptionalPort(value) {
23
+ const raw = String(value || '').trim();
24
+ if (!raw) return null;
25
+ const port = parseInt(raw, 10);
26
+ return Number.isInteger(port) && port > 0 && port <= 65535 ? port : null;
27
+ }
28
+ const LOCAL_AGENT_APP_PORT = parseOptionalPort(process.env.AMALGM_LOCAL_APP_PORT);
23
29
  const INTERNAL_SERVICE_PORTS = new Set([
24
30
  AGENT_PORT,
25
31
  LOCAL_AGENT_APP_PORT,
@@ -28,7 +34,7 @@ const INTERNAL_SERVICE_PORTS = new Set([
28
34
  CHAT_SERVER_PORT,
29
35
  AMALGM_GATEWAY_PORT,
30
36
  4096,
31
- ]);
37
+ ].filter(Number.isInteger));
32
38
  const COMMON_DEV_PORTS = new Set([3000, 3001, 3002, 3003, 4000, 4200, 4321, 5000, 5001, 5173, 5174, 6006, 7000, 8000, 8001, 8888]);
33
39
  const BLOCKED_PREVIEW_PROCESSES = new Set(['.opencode', 'controlce', 'figma_age', 'figma_agent', 'loom', 'opencode', 'rapportd']);
34
40
  const DEV_PREVIEW_PROCESS_RE = /^(node|bun|deno|npm|pnpm|yarn|vite|next|astro|nuxt|svelte|remix|webpack|rspack|parcel|serve|http-server|tsx|python|python3|uvicorn|gunicorn|flask|django|ruby|rails|puma|php|java|go|air|cargo|trunk|dotnet|nginx)$/i;