@kya-os/mcp-i 1.5.9-canary.15 ā 1.5.9-canary.17
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/README.md +1 -1
- package/dist/compiler/index.d.ts +1 -2
- package/dist/compiler/index.js +4 -49
- package/dist/runtime/adapter-express.js +1 -1
- package/dist/runtime/adapter-nextjs.js +1 -1
- package/dist/runtime/audit.d.ts +4 -0
- package/dist/runtime/audit.js +6 -2
- package/dist/runtime/http.js +1 -1
- package/dist/runtime/mcpi-runtime-wrapper.d.ts +2 -3
- package/dist/runtime/mcpi-runtime-wrapper.js +20 -17
- package/dist/runtime/stdio.js +1 -1
- package/package.json +17 -17
package/README.md
CHANGED
package/dist/compiler/index.d.ts
CHANGED
|
@@ -2,6 +2,5 @@ export { type Middleware } from "../types/middleware";
|
|
|
2
2
|
export type CompilerMode = "development" | "production";
|
|
3
3
|
export interface CompileOptions {
|
|
4
4
|
onBuild?: () => void;
|
|
5
|
-
platform?: 'vercel';
|
|
6
5
|
}
|
|
7
|
-
export declare function compile({ onBuild
|
|
6
|
+
export declare function compile({ onBuild }?: CompileOptions): Promise<void>;
|
package/dist/compiler/index.js
CHANGED
|
@@ -40,34 +40,26 @@ const start_http_server_1 = require("./start-http-server");
|
|
|
40
40
|
const path_validation_1 = require("../utils/path-validation");
|
|
41
41
|
const utils_1 = require("./config/utils");
|
|
42
42
|
dotenv_1.default.config();
|
|
43
|
-
async function compile({ onBuild
|
|
44
|
-
console.log('[COMPILER] compile() called with platform:', platform);
|
|
43
|
+
async function compile({ onBuild } = {}) {
|
|
45
44
|
// Initialize compiler context if not already set
|
|
46
45
|
const mode = process.env.NODE_ENV === "production" ? "production" : "development";
|
|
47
|
-
console.log('[COMPILER] Mode determined:', mode);
|
|
48
|
-
console.log('[COMPILER] NODE_ENV:', process.env.NODE_ENV);
|
|
49
46
|
// Use compiler context provider to set up the context properly
|
|
50
47
|
return new Promise((resolve, reject) => {
|
|
51
|
-
console.log('[COMPILER] Creating promise for compilation');
|
|
52
48
|
(0, compiler_context_1.compilerContextProvider)({
|
|
53
49
|
mode,
|
|
54
50
|
projectRoot: process.cwd(),
|
|
55
51
|
platforms: {},
|
|
56
52
|
}, () => {
|
|
57
|
-
|
|
58
|
-
compileInternal({ onBuild, platform }).then(resolve).catch(reject);
|
|
53
|
+
compileInternal({ onBuild }).then(resolve).catch(reject);
|
|
59
54
|
});
|
|
60
55
|
});
|
|
61
56
|
}
|
|
62
|
-
async function compileInternal({ onBuild
|
|
63
|
-
console.log('[COMPILER] compileInternal() starting - platform:', platform);
|
|
57
|
+
async function compileInternal({ onBuild } = {}) {
|
|
64
58
|
const { mode } = compiler_context_1.compilerContext.getContext();
|
|
65
59
|
const { toolPaths } = compiler_context_1.compilerContext.getContext();
|
|
66
|
-
console.log('[COMPILER] compileInternal() - mode from context:', mode);
|
|
67
60
|
const startTime = Date.now();
|
|
68
61
|
let compilerStarted = false;
|
|
69
62
|
const xmpcConfig = await (0, parse_xmcp_config_1.getConfig)();
|
|
70
|
-
console.log('[COMPILER] Config loaded, http:', !!xmpcConfig.http, 'stdio:', !!xmpcConfig.stdio);
|
|
71
63
|
compiler_context_1.compilerContext.setContext({
|
|
72
64
|
xmcpConfig: xmpcConfig,
|
|
73
65
|
});
|
|
@@ -122,7 +114,6 @@ async function compileInternal({ onBuild, platform } = {}) {
|
|
|
122
114
|
}
|
|
123
115
|
// start compiler
|
|
124
116
|
watcher.onReady(() => {
|
|
125
|
-
console.log('[COMPILER] Watcher ready - initializing compilation');
|
|
126
117
|
let firstBuild = true;
|
|
127
118
|
compilerStarted = true;
|
|
128
119
|
// delete existing runtime folder
|
|
@@ -131,7 +122,6 @@ async function compileInternal({ onBuild, platform } = {}) {
|
|
|
131
122
|
generateCode();
|
|
132
123
|
const compiler = (0, webpack_1.webpack)(webpackConfig);
|
|
133
124
|
const handleCompilation = (err, stats) => {
|
|
134
|
-
console.log('[COMPILER] handleCompilation callback called - err:', !!err, 'stats:', !!stats, 'firstBuild:', firstBuild);
|
|
135
125
|
if (err) {
|
|
136
126
|
console.error(err);
|
|
137
127
|
reject(err);
|
|
@@ -153,49 +143,14 @@ async function compileInternal({ onBuild, platform } = {}) {
|
|
|
153
143
|
console.log(`${cli_icons_1.greenCheck} Compiled in ${chalk.bold.green(`${duration}ms`)}`);
|
|
154
144
|
(0, on_first_build_1.onFirstBuild)(mode, xmpcConfig);
|
|
155
145
|
onBuild?.();
|
|
156
|
-
console.log('[COMPILER] First build completed - mode:', mode, 'platform:', platform);
|
|
157
146
|
// In production mode, close watcher and compiler, then resolve
|
|
158
147
|
if (mode === "production") {
|
|
159
|
-
|
|
160
|
-
watcher.close().then(async () => {
|
|
148
|
+
watcher.close().then(() => {
|
|
161
149
|
// Close webpack compiler to release all resources
|
|
162
150
|
compiler.close((compilerCloseErr) => {
|
|
163
151
|
if (compilerCloseErr) {
|
|
164
152
|
console.error('Error closing webpack compiler:', compilerCloseErr);
|
|
165
153
|
reject(compilerCloseErr);
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
console.log('[COMPILER] Compiler closed successfully');
|
|
169
|
-
console.log('[COMPILER] Platform value in callback:', platform);
|
|
170
|
-
console.log('[COMPILER] Checking if platform === "vercel":', platform === 'vercel');
|
|
171
|
-
// Platform-specific post-build steps (must be handled after compiler.close completes)
|
|
172
|
-
if (platform === 'vercel') {
|
|
173
|
-
console.log('[COMPILER] Vercel platform detected! Starting async build...');
|
|
174
|
-
// Wrap async operations in a separate async function
|
|
175
|
-
(async () => {
|
|
176
|
-
try {
|
|
177
|
-
console.log('[COMPILER] Inside async IIFE');
|
|
178
|
-
console.log('\nš¦ Building Vercel deployment package...');
|
|
179
|
-
// Dynamic import of Vercel build utilities
|
|
180
|
-
// This will be available when @kya-os/mcp-i-vercel is installed
|
|
181
|
-
console.log('[COMPILER] Attempting dynamic import of @kya-os/mcp-i-vercel/build');
|
|
182
|
-
const vercelModule = await import('@kya-os/mcp-i-vercel/build').catch((importErr) => {
|
|
183
|
-
console.error('[COMPILER] Dynamic import failed:', importErr);
|
|
184
|
-
throw new Error(`Cannot find @kya-os/mcp-i-vercel package. ` +
|
|
185
|
-
`Install it with: npm install @kya-os/mcp-i-vercel\n` +
|
|
186
|
-
`Original error: ${importErr instanceof Error ? importErr.message : String(importErr)}`);
|
|
187
|
-
});
|
|
188
|
-
console.log('[COMPILER] Dynamic import successful');
|
|
189
|
-
console.log('[COMPILER] Calling buildVercelOutput()');
|
|
190
|
-
await vercelModule.buildVercelOutput();
|
|
191
|
-
console.log('[COMPILER] buildVercelOutput() completed');
|
|
192
|
-
resolve();
|
|
193
|
-
}
|
|
194
|
-
catch (vercelBuildErr) {
|
|
195
|
-
console.error('[COMPILER] Error building Vercel output:', vercelBuildErr);
|
|
196
|
-
reject(vercelBuildErr);
|
|
197
|
-
}
|
|
198
|
-
})();
|
|
199
154
|
}
|
|
200
155
|
else {
|
|
201
156
|
resolve();
|