@smartmemory/compose 0.2.33-beta → 0.2.34-beta
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/bin/compose.js +5 -2
- package/lib/resolve-port.js +8 -2
- package/package.json +1 -1
- package/server/agent-hooks.js +4 -2
- package/server/agent-server.js +1 -1
- package/server/compose-mcp-tools.js +3 -2
- package/server/supervisor.js +3 -3
package/bin/compose.js
CHANGED
|
@@ -16,6 +16,7 @@ import { spawn, spawnSync } from 'child_process'
|
|
|
16
16
|
import { fileURLToPath } from 'url'
|
|
17
17
|
import { findProjectRoot } from '../server/find-root.js'
|
|
18
18
|
import { resolveWorkspace, getWorkspaceFlag } from '../lib/resolve-workspace.js'
|
|
19
|
+
import { resolvePort } from '../lib/resolve-port.js'
|
|
19
20
|
|
|
20
21
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
21
22
|
const PACKAGE_ROOT = resolve(__dirname, '..')
|
|
@@ -2772,8 +2773,10 @@ if (cmd === 'build') {
|
|
|
2772
2773
|
process.exit(1)
|
|
2773
2774
|
}
|
|
2774
2775
|
|
|
2775
|
-
// Resolve compose server URL
|
|
2776
|
-
|
|
2776
|
+
// Resolve compose server URL. Default must match the API server port
|
|
2777
|
+
// (resolvePort: COMPOSE_PORT > PORT > 4001) — a stale :3000 here made every
|
|
2778
|
+
// `compose loops` call fail with ECONNREFUSED in a default install.
|
|
2779
|
+
const baseUrl = process.env.COMPOSE_URL || `http://127.0.0.1:${resolvePort()}`
|
|
2777
2780
|
|
|
2778
2781
|
// COMP-WORKSPACE-HTTP T7: resolve workspace tolerantly so we can attach
|
|
2779
2782
|
// X-Compose-Workspace-Id to the HTTP calls below. Loops CLI did not previously
|
package/lib/resolve-port.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Canonical port resolution for the Compose server.
|
|
3
|
-
* Single source of truth: COMPOSE_PORT > PORT >
|
|
3
|
+
* Single source of truth: COMPOSE_PORT > PORT > 4001.
|
|
4
|
+
*
|
|
5
|
+
* The default MUST match server/index.js (`PORT || 4001`) and the supervisor,
|
|
6
|
+
* which start the API server on 4001. A stale 3001 default here silently sent
|
|
7
|
+
* every CLI probe / MCP lifecycle call / agent-hook to a dead port while the
|
|
8
|
+
* real server was alive on 4001 — gates fell back to readline, completions and
|
|
9
|
+
* loops failed with ECONNREFUSED.
|
|
4
10
|
*/
|
|
5
11
|
export function resolvePort() {
|
|
6
|
-
return Number(process.env.COMPOSE_PORT) || Number(process.env.PORT) ||
|
|
12
|
+
return Number(process.env.COMPOSE_PORT) || Number(process.env.PORT) || 4001;
|
|
7
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartmemory/compose",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.34-beta",
|
|
4
4
|
"description": "Structured AI dev pipeline — goal-to-product orchestration with gates, iteration loops, and feature lifecycle management.",
|
|
5
5
|
"author": "SmartMemory",
|
|
6
6
|
"license": "MIT",
|
package/server/agent-hooks.js
CHANGED
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
* SDK hook callbacks for the Agent Server.
|
|
3
3
|
*
|
|
4
4
|
* These are in-process JavaScript functions passed to query() — not shell
|
|
5
|
-
* scripts. They POST structured events to the api-server (port
|
|
5
|
+
* scripts. They POST structured events to the api-server (port 4001), which
|
|
6
6
|
* feeds SessionManager and VisionServer, preserving all Phase 3 monitoring.
|
|
7
7
|
*
|
|
8
8
|
* Single source of truth for TOOL_CATEGORIES (previously duplicated in
|
|
9
9
|
* Terminal.jsx and vision-server.js).
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
import { resolvePort } from '../lib/resolve-port.js';
|
|
13
|
+
|
|
14
|
+
const API_SERVER = `http://127.0.0.1:${resolvePort()}`;
|
|
13
15
|
|
|
14
16
|
/** Semantic category for each Claude Code tool */
|
|
15
17
|
export const TOOL_CATEGORIES = {
|
package/server/agent-server.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* User input arrives via POST — SSE is the right transport for a unidirectional
|
|
7
7
|
* async iterator.
|
|
8
8
|
*
|
|
9
|
-
* Process isolation: this server only talks to api-server (
|
|
9
|
+
* Process isolation: this server only talks to api-server (4001) via SDK hooks.
|
|
10
10
|
* SessionManager and VisionServer require zero changes.
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -114,6 +114,7 @@ export function assertTerminalStatusAuthorized(args, toolName, capsOverride) {
|
|
|
114
114
|
}
|
|
115
115
|
import { resolveWorkspace } from '../lib/resolve-workspace.js';
|
|
116
116
|
import { discoverWorkspaces } from '../lib/discover-workspaces.js';
|
|
117
|
+
import { resolvePort } from '../lib/resolve-port.js';
|
|
117
118
|
|
|
118
119
|
export function getVisionFile() { return path.join(getDataDir(), 'vision-state.json'); }
|
|
119
120
|
export function getSessionsFile() { return path.join(getDataDir(), 'sessions.json'); }
|
|
@@ -549,7 +550,7 @@ export async function toolBindSession({ featureCode, profile } = {}) {
|
|
|
549
550
|
// ---------------------------------------------------------------------------
|
|
550
551
|
|
|
551
552
|
function _getComposeApi() {
|
|
552
|
-
return `http://127.0.0.1:${
|
|
553
|
+
return `http://127.0.0.1:${resolvePort()}`;
|
|
553
554
|
}
|
|
554
555
|
|
|
555
556
|
async function _postLifecycle(itemId, action, body) {
|
|
@@ -592,7 +593,7 @@ async function _postGate(gateId, action, body) {
|
|
|
592
593
|
* COMP-WORKSPACE-HTTP T5.
|
|
593
594
|
*/
|
|
594
595
|
async function _httpRequest(method, urlPath, body = null) {
|
|
595
|
-
const port =
|
|
596
|
+
const port = resolvePort();
|
|
596
597
|
const headers = { 'Content-Type': 'application/json' };
|
|
597
598
|
if (_binding?.id) headers['X-Compose-Workspace-Id'] = _binding.id;
|
|
598
599
|
let payload = null;
|
package/server/supervisor.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Process supervisor for Compose.
|
|
3
3
|
* Manages three independent processes:
|
|
4
|
-
* 1. API server (port
|
|
5
|
-
* 2. Agent server (port
|
|
6
|
-
* 3. Vite dev server (port
|
|
4
|
+
* 1. API server (port 4001) — Express + file-watcher + vision
|
|
5
|
+
* 2. Agent server (port 4002) — SDK streaming, structured messages (Tier 1, immortal)
|
|
6
|
+
* 3. Vite dev server (port 5195) — Frontend HMR
|
|
7
7
|
*
|
|
8
8
|
* Each process gets independent restart with exponential backoff.
|
|
9
9
|
* If a process keeps crashing for > 1 minute, the supervisor gives up on it.
|