xmcp 0.1.5 → 0.1.7
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/dist/cli.js +2 -2
- package/dist/compiler/config/constants.d.ts +41 -0
- package/dist/compiler/{parse-xmcp-config.d.ts → config/index.d.ts} +49 -49
- package/dist/compiler/config/schemas/experimental/index.d.ts +91 -0
- package/dist/compiler/config/schemas/experimental/oauth.d.ts +74 -0
- package/dist/compiler/config/schemas/index.d.ts +6 -0
- package/dist/compiler/config/schemas/paths.d.ts +9 -0
- package/dist/compiler/config/schemas/transport/http.d.ts +82 -0
- package/dist/compiler/config/schemas/transport/stdio.d.ts +9 -0
- package/dist/compiler/config/schemas/webpack.d.ts +3 -0
- package/dist/index.d.ts +2 -6
- package/dist/index.js +1 -1
- package/dist/runtime/adapter-express.js +1 -1
- package/dist/runtime/adapter-nextjs.js +1 -1
- package/dist/runtime/http.js +1 -1
- package/dist/runtime/stdio.js +1 -1
- package/dist/types/tool.d.ts +32 -0
- package/package.json +1 -1
- package/dist/compiler/compiler-context.d.ts +0 -23
- package/dist/compiler/generate-env-code.d.ts +0 -1
- package/dist/compiler/generate-import-code.d.ts +0 -1
- package/dist/compiler/get-webpack-config/get-entries.d.ts +0 -3
- package/dist/compiler/get-webpack-config/get-externals.d.ts +0 -7
- package/dist/compiler/get-webpack-config/get-injected-variables.d.ts +0 -7
- package/dist/compiler/get-webpack-config/index.d.ts +0 -4
- package/dist/compiler/get-webpack-config/plugins.d.ts +0 -8
- package/dist/compiler/get-webpack-config/resolve-tsconfig-paths.d.ts +0 -9
- package/dist/compiler/index.d.ts +0 -6
- package/dist/compiler/on-first-build.d.ts +0 -3
- package/dist/compiler/start-http-server.d.ts +0 -1
- package/dist/utils/cli-icons.d.ts +0 -3
- package/dist/utils/constants.d.ts +0 -6
- package/dist/utils/file-watcher.d.ts +0 -18
- package/dist/utils/fs-utils.d.ts +0 -2
- package/dist/utils/path-validation.d.ts +0 -3
- package/dist/utils/spawn-process.d.ts +0 -9
- package/dist/utils/subscribable.d.ts +0 -12
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export interface ToolAnnotations {
|
|
3
|
+
/** Human-readable title for the tool */
|
|
4
|
+
title?: string;
|
|
5
|
+
/** If true, the tool does not modify its environment */
|
|
6
|
+
readOnlyHint?: boolean;
|
|
7
|
+
/** If true, the tool may perform destructive updates */
|
|
8
|
+
destructiveHint?: boolean;
|
|
9
|
+
/** If true, repeated calls with same args have no additional effect */
|
|
10
|
+
idempotentHint?: boolean;
|
|
11
|
+
/** If true, tool interacts with external entities */
|
|
12
|
+
openWorldHint?: boolean;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
15
|
+
export interface ToolMetadata {
|
|
16
|
+
/** Unique identifier for the tool */
|
|
17
|
+
name: string;
|
|
18
|
+
/** Human-readable description */
|
|
19
|
+
description: string;
|
|
20
|
+
/** Optional hints about tool behavior */
|
|
21
|
+
annotations?: ToolAnnotations;
|
|
22
|
+
}
|
|
23
|
+
export interface Tool {
|
|
24
|
+
type: string;
|
|
25
|
+
handler: (args: any) => any;
|
|
26
|
+
metadata: ToolMetadata;
|
|
27
|
+
schema: Record<string, z.ZodType>;
|
|
28
|
+
}
|
|
29
|
+
export type ToolSchema = Record<string, z.ZodType<unknown, z.ZodTypeDef, unknown>>;
|
|
30
|
+
export type InferSchema<T extends ToolSchema> = {
|
|
31
|
+
[K in keyof T]: z.infer<T[K]>;
|
|
32
|
+
};
|
package/package.json
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CompilerMode } from ".";
|
|
2
|
-
import { XmcpParsedConfig } from "./parse-xmcp-config";
|
|
3
|
-
interface CompilerContext {
|
|
4
|
-
/** The mode of the compiler. */
|
|
5
|
-
mode: CompilerMode;
|
|
6
|
-
/** Whether the adapter is enabled. */
|
|
7
|
-
adapter?: boolean;
|
|
8
|
-
/** The platforms to build for. */
|
|
9
|
-
platforms: {
|
|
10
|
-
/** Generates a .vercel folder to deploy on Vercel */
|
|
11
|
-
vercel?: boolean;
|
|
12
|
-
};
|
|
13
|
-
/** The paths to the tools. */
|
|
14
|
-
toolPaths: Set<string>;
|
|
15
|
-
/** Whether the middleware is enabled. */
|
|
16
|
-
hasMiddleware: boolean;
|
|
17
|
-
/** The parsed config. */
|
|
18
|
-
xmcpConfig?: XmcpParsedConfig;
|
|
19
|
-
}
|
|
20
|
-
export declare const compilerContext: import("../utils/context").Context<CompilerContext>;
|
|
21
|
-
export declare const compilerContextProvider: (initialValue: Omit<CompilerContext, "toolPaths" | "hasMiddleware">, callback: () => void) => void;
|
|
22
|
-
export declare const getXmcpConfig: () => XmcpParsedConfig;
|
|
23
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function generateEnvCode(): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function generateImportCode(): string;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Configuration } from "webpack";
|
|
2
|
-
/**
|
|
3
|
-
* This function will decide is a file is bundled by xmcp compiler or not.
|
|
4
|
-
* We want to avoid building node modules.
|
|
5
|
-
* When using Next.js, we want to avoid building tools/*, since the nexjs compiler will handle that code.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getExternals(): Configuration["externals"];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { XmcpParsedConfig } from "@/compiler/parse-xmcp-config";
|
|
2
|
-
/**
|
|
3
|
-
* The XMCP runtime uses variables that are not defined by default.
|
|
4
|
-
*
|
|
5
|
-
* This utility will define those variables based on the user's config.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getInjectedVariables(xmcpConfig: XmcpParsedConfig): Record<string, string | number | boolean>;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Configuration } from "webpack";
|
|
2
|
-
import { XmcpParsedConfig } from "@/compiler/parse-xmcp-config";
|
|
3
|
-
/** Creates the webpack configuration that xmcp will use to bundle the user's code */
|
|
4
|
-
export declare function getWebpackConfig(xmcpConfig: XmcpParsedConfig): Configuration;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Compiler } from "webpack";
|
|
2
|
-
export declare const runtimeFiles: Record<string, string>;
|
|
3
|
-
export declare class InjectRuntimePlugin {
|
|
4
|
-
apply(compiler: Compiler): void;
|
|
5
|
-
}
|
|
6
|
-
export declare class CreateTypeDefinitionPlugin {
|
|
7
|
-
apply(compiler: Compiler): void;
|
|
8
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolve tsconfig.json paths to Webpack aliases
|
|
3
|
-
* @param {string} tsconfigPath - Path to tsconfig
|
|
4
|
-
* @param {string} webpackConfigBasePath - Path from tsconfig to Webpack config to create absolute aliases
|
|
5
|
-
* @return {object} - Webpack alias config
|
|
6
|
-
*/
|
|
7
|
-
export declare function resolveTsconfigPathsToAlias({ tsconfigPath, }?: {
|
|
8
|
-
tsconfigPath?: string | undefined;
|
|
9
|
-
}): Record<string, string>;
|
package/dist/compiler/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function startHttpServer(): Promise<void>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const runtimeFolder = ".xmcp";
|
|
2
|
-
export declare const runtimeFolderPath: string;
|
|
3
|
-
export declare const rootFolder: string;
|
|
4
|
-
export declare const processFolder: string;
|
|
5
|
-
export declare const distOutputPath: string;
|
|
6
|
-
export declare const adapterOutputPath: string;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import chokidar from "chokidar";
|
|
2
|
-
import { Subscribable } from "./subscribable";
|
|
3
|
-
interface WatcherOptions {
|
|
4
|
-
onAdd?: (path: string) => void;
|
|
5
|
-
onUnlink?: (path: string) => void;
|
|
6
|
-
onChange?: (path: string) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare class Watcher {
|
|
9
|
-
private watchers;
|
|
10
|
-
isReady: boolean;
|
|
11
|
-
globalOptions: chokidar.WatchOptions;
|
|
12
|
-
onReadySubscribable: Subscribable;
|
|
13
|
-
constructor(options?: chokidar.WatchOptions);
|
|
14
|
-
watch(path: string, options: WatcherOptions, chokidarOptions?: chokidar.WatchOptions): void;
|
|
15
|
-
onReady(callback: () => void): void;
|
|
16
|
-
private checkReady;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
package/dist/utils/fs-utils.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ChildProcess } from "child_process";
|
|
2
|
-
/**
|
|
3
|
-
* Pass in a ChildProcess, and this will spawn a watchdog process that
|
|
4
|
-
* will make sure it exits if the parent does, thus preventing any
|
|
5
|
-
* dangling detached zombie processes.
|
|
6
|
-
*
|
|
7
|
-
* If the child ends before the parent, then the watchdog will terminate.
|
|
8
|
-
*/
|
|
9
|
-
export declare const watchdog: (child: ChildProcess) => ChildProcess;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
type AnyFunction = (...args: any[]) => any;
|
|
2
|
-
export interface Subscribable<T extends AnyFunction = AnyFunction> {
|
|
3
|
-
addCallback: (callback: T, id?: string) => string;
|
|
4
|
-
removeCallback: (id: string | T) => void;
|
|
5
|
-
getCallbacks: () => T[];
|
|
6
|
-
getCallback: (id: string) => T;
|
|
7
|
-
getCallbackIds: () => string[];
|
|
8
|
-
clearCallbacks: () => void;
|
|
9
|
-
runCallbacks: T;
|
|
10
|
-
}
|
|
11
|
-
export declare const subscribable: <T extends AnyFunction = AnyFunction>() => Subscribable<T>;
|
|
12
|
-
export {};
|