pumuki 6.3.75 → 6.3.76

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.
@@ -39,6 +39,14 @@ type EnterpriseStatusPayload = {
39
39
  evidence: ReturnType<typeof toStatusPayload>;
40
40
  };
41
41
 
42
+ type EnterpriseHealthPayload = {
43
+ status: 'ok';
44
+ repoRoot: string;
45
+ experimentalFeatures: {
46
+ mcp_enterprise: ReturnType<typeof resolveMcpEnterpriseExperimentalFeature>;
47
+ };
48
+ };
49
+
42
50
  const ENTERPRISE_RESOURCES = [
43
51
  'evidence://status',
44
52
  'gitflow://state',
@@ -650,6 +658,14 @@ const buildStatusPayload = (repoRoot: string): EnterpriseStatusPayload => ({
650
658
  evidence: toStatusPayload(repoRoot),
651
659
  });
652
660
 
661
+ const buildHealthPayload = (repoRoot: string): EnterpriseHealthPayload => ({
662
+ status: 'ok',
663
+ repoRoot,
664
+ experimentalFeatures: {
665
+ mcp_enterprise: readMcpEnterpriseExperimentalState(),
666
+ },
667
+ });
668
+
653
669
  export const startEnterpriseMcpServer = (
654
670
  options: EnterpriseServerOptions = {}
655
671
  ): EnterpriseServerHandle => {
@@ -680,7 +696,7 @@ export const startEnterpriseMcpServer = (
680
696
  sendJson(res, 405, { error: 'Method not allowed' });
681
697
  return;
682
698
  }
683
- sendJson(res, 200, { status: 'ok' });
699
+ sendJson(res, 200, buildHealthPayload(repoRoot));
684
700
  return;
685
701
  }
686
702
 
@@ -1,5 +1,6 @@
1
1
  import { Socket, createServer } from 'node:net';
2
2
  import { startEnterpriseMcpServer } from './enterpriseServer';
3
+ import { resolveMcpEnterpriseExperimentalFeature } from '../policy/experimentalFeatures';
3
4
 
4
5
  type JsonRpcId = string | number | null;
5
6
 
@@ -98,11 +99,32 @@ const fetchJson = async (url: string, options?: RequestInit): Promise<unknown> =
98
99
  }
99
100
  };
100
101
 
102
+ type EnterpriseHealthPayload = {
103
+ status?: string;
104
+ repoRoot?: string;
105
+ experimentalFeatures?: {
106
+ mcp_enterprise?: {
107
+ mode?: string;
108
+ };
109
+ };
110
+ };
111
+
112
+ const canReuseEnterpriseHttp = (
113
+ health: EnterpriseHealthPayload,
114
+ repoRoot: string,
115
+ expectedMcpMode: string
116
+ ): boolean =>
117
+ health.status === 'ok'
118
+ && health.repoRoot === repoRoot
119
+ && health.experimentalFeatures?.mcp_enterprise?.mode === expectedMcpMode;
120
+
101
121
  const startOrReuseEnterpriseHttp = async (): Promise<{
102
122
  host: string;
103
123
  port: number;
104
124
  startedByThisProcess: boolean;
105
125
  }> => {
126
+ const repoRoot = process.cwd();
127
+ const expectedMcpMode = resolveMcpEnterpriseExperimentalFeature().mode;
106
128
  const host = process.env.PUMUKI_ENTERPRISE_MCP_HOST ?? '127.0.0.1';
107
129
  const parsedPort = Number.parseInt(process.env.PUMUKI_ENTERPRISE_MCP_PORT ?? '', 10);
108
130
  const preferredPort = Number.isFinite(parsedPort) ? parsedPort : 7391;
@@ -110,16 +132,21 @@ const startOrReuseEnterpriseHttp = async (): Promise<{
110
132
 
111
133
  const healthUrl = `http://${host}:${requestedPort}/health`;
112
134
  try {
113
- const health = (await fetchJson(healthUrl)) as { status?: string };
114
- if (health.status === 'ok') {
135
+ const health = (await fetchJson(healthUrl)) as EnterpriseHealthPayload;
136
+ if (canReuseEnterpriseHttp(health, repoRoot, expectedMcpMode)) {
115
137
  return {
116
138
  host,
117
139
  port: requestedPort,
118
140
  startedByThisProcess: false,
119
141
  };
120
142
  }
121
- } catch {
122
- // Intentionally ignored: endpoint not available yet.
143
+ } catch (error) {
144
+ if (process.env.PUMUKI_DEBUG_MCP === '1') {
145
+ const message = error instanceof Error ? error.message : String(error);
146
+ process.stderr.write(
147
+ `[pumuki-mcp-enterprise-stdio] health probe reuse skipped: ${message}\n`
148
+ );
149
+ }
123
150
  }
124
151
 
125
152
  const portInUse = await isPortInUse(host, requestedPort);
@@ -127,7 +154,7 @@ const startOrReuseEnterpriseHttp = async (): Promise<{
127
154
  startEnterpriseMcpServer({
128
155
  host,
129
156
  port: resolvedPort,
130
- repoRoot: process.cwd(),
157
+ repoRoot,
131
158
  });
132
159
 
133
160
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki",
3
- "version": "6.3.75",
3
+ "version": "6.3.76",
4
4
  "description": "Enterprise-grade AST Intelligence System with multi-platform support (iOS, Android, Backend, Frontend) and Feature-First + DDD + Clean Architecture enforcement. Includes dynamic violations API for intelligent querying.",
5
5
  "main": "index.js",
6
6
  "bin": {