@codai/axiom-mcp 1.0.23 → 2.0.0
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/LICENSE +22 -0
- package/README.md +124 -423
- package/dist/axm-lazy-WdJHPy6W.js +2 -0
- package/dist/axm-lazy.js +12776 -0
- package/dist/cli-main.js +26407 -0
- package/dist/cli.js +19 -0
- package/dist/gate-lazy.js +8979 -0
- package/dist/index.d.ts +133 -0
- package/dist/index.js +904 -0
- package/package.json +72 -36
- package/spec/biome.json +6 -0
- package/spec/codai-tools.json +283 -0
- package/spec/tools.json +1966 -0
- package/dist/mcp-stdio.js +0 -368
- package/dist/postinstall.js +0 -31
- package/dist/server.js +0 -115
- package/dist/tools/fs-probe-write.js +0 -81
- package/scripts/prepublish.js +0 -52
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { ErrorCode } from "@codai/axiom-schema";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { GuardOptions } from "@codai/axiom-checks";
|
|
4
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
+
import "@modelcontextprotocol/sdk/types.js";
|
|
6
|
+
//#region src/jsonschema.d.ts
|
|
7
|
+
export declare const SCHEMA_KINDS: readonly ["Plan", "Manifest", "ManifestBundle", "CheckReport", "ApplyResult", "Profile", "Journal"];
|
|
8
|
+
type SchemaKind = (typeof SCHEMA_KINDS)[number];
|
|
9
|
+
export declare function isSchemaKind(v: unknown): v is SchemaKind;
|
|
10
|
+
/** Draft 2020-12 JSON Schema, byte-identical to `packages/schema/schemas/<kind>.schema.json`. */
|
|
11
|
+
export declare function jsonSchemaFor(kind: SchemaKind): Record<string, unknown>;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/log.d.ts
|
|
14
|
+
/**
|
|
15
|
+
* stderr-only JSON-lines logger. stdout belongs to the MCP transport; nothing in
|
|
16
|
+
* this package may write there except the transport itself (and CLI verbs).
|
|
17
|
+
*/
|
|
18
|
+
export declare const LOG_LEVELS: readonly ["error", "warn", "info", "debug"];
|
|
19
|
+
type LogLevel = (typeof LOG_LEVELS)[number];
|
|
20
|
+
interface Logger {
|
|
21
|
+
readonly level: LogLevel;
|
|
22
|
+
error(msg: string, fields?: Record<string, unknown>): void;
|
|
23
|
+
warn(msg: string, fields?: Record<string, unknown>): void;
|
|
24
|
+
info(msg: string, fields?: Record<string, unknown>): void;
|
|
25
|
+
debug(msg: string, fields?: Record<string, unknown>): void;
|
|
26
|
+
}
|
|
27
|
+
export declare function isLogLevel(v: unknown): v is LogLevel;
|
|
28
|
+
interface LoggerOptions {
|
|
29
|
+
level?: LogLevel;
|
|
30
|
+
/** Test hook; defaults to `process.stderr.write`. */
|
|
31
|
+
write?: (line: string) => void;
|
|
32
|
+
now?: () => string;
|
|
33
|
+
}
|
|
34
|
+
export declare function createLogger(opts?: LoggerOptions): Logger;
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/roots.d.ts
|
|
37
|
+
/** Frozen allowlist of realpath'd root directories (§5.3). */
|
|
38
|
+
interface RootsPolicy {
|
|
39
|
+
readonly roots: ReadonlySet<string>;
|
|
40
|
+
}
|
|
41
|
+
interface ResolvedRoot {
|
|
42
|
+
/** realpath of the requested directory (or the single allowlisted root). */
|
|
43
|
+
rootReal: string;
|
|
44
|
+
/** The allowlisted root that contains `rootReal` (equal to it in the common case). */
|
|
45
|
+
effectiveRoot: string;
|
|
46
|
+
}
|
|
47
|
+
/** True iff `child` equals `parent` or lies inside it (case-insensitive on win32). */
|
|
48
|
+
export declare function isSameOrInside(parent: string, child: string): boolean;
|
|
49
|
+
/** Build the policy from `--root <abs>` arguments. Each must exist and be a directory. */
|
|
50
|
+
export declare function createRootsPolicy(rootArgs: readonly string[]): Promise<RootsPolicy>;
|
|
51
|
+
/**
|
|
52
|
+
* Resolve a tool's `root` argument against the allowlist. No env fallback, no cwd:
|
|
53
|
+
* none requested + one root → that root; none + many → ERR_ROOT_REQUIRED;
|
|
54
|
+
* requested → realpath, must equal or be inside an allowlisted root → else ERR_ROOT_NOT_ALLOWED.
|
|
55
|
+
*/
|
|
56
|
+
export declare function resolveRoot(policy: RootsPolicy, requested?: string): Promise<ResolvedRoot>;
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/tools.d.ts
|
|
59
|
+
/** Hard cap on any single `bundle`/`plan` argument, measured as UTF-8 JSON bytes (§(f) payload size). */
|
|
60
|
+
export declare const BUNDLE_BYTES_MAX: number;
|
|
61
|
+
/** Findings/errors echoed in the text summary. */
|
|
62
|
+
export declare const SUMMARY_LIST_MAX = 20;
|
|
63
|
+
type RiskClass = "READ" | "ACT" | "SENSITIVE";
|
|
64
|
+
interface ToolAnnotations {
|
|
65
|
+
readOnlyHint: boolean;
|
|
66
|
+
destructiveHint: boolean;
|
|
67
|
+
idempotentHint: boolean;
|
|
68
|
+
openWorldHint: boolean;
|
|
69
|
+
}
|
|
70
|
+
interface ToolContext {
|
|
71
|
+
policy: RootsPolicy;
|
|
72
|
+
log: Logger;
|
|
73
|
+
/** Roots that received a stored manifest/report during this process (for DigestRef lookups). */
|
|
74
|
+
seenRoots: Set<string>;
|
|
75
|
+
/** `--allow-guards` / `--guard-allowlist` from startup (§3.2); absent = guards disabled. */
|
|
76
|
+
guards?: GuardOptions;
|
|
77
|
+
}
|
|
78
|
+
interface ToolDef<I extends z.ZodRawShape = z.ZodRawShape, O extends z.ZodType = z.ZodType> {
|
|
79
|
+
name: string;
|
|
80
|
+
title: string;
|
|
81
|
+
description: string;
|
|
82
|
+
inputSchema: I;
|
|
83
|
+
outputSchema: O;
|
|
84
|
+
annotations: ToolAnnotations;
|
|
85
|
+
riskClass: RiskClass;
|
|
86
|
+
handler: (ctx: ToolContext, input: z.output<z.ZodObject<I>>) => Promise<z.output<O>>;
|
|
87
|
+
/** Small text projection of the output for `content[0].text`. Never the whole bundle. */
|
|
88
|
+
summarize: (output: z.output<O>) => unknown;
|
|
89
|
+
}
|
|
90
|
+
type AnyToolDef = ToolDef<z.ZodRawShape, z.ZodType>;
|
|
91
|
+
export declare function riskClassOf(a: ToolAnnotations): RiskClass;
|
|
92
|
+
export declare const TOOL_DEFS: readonly AnyToolDef[];
|
|
93
|
+
export declare function toolByName(name: string): AnyToolDef | undefined;
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/server.d.ts
|
|
96
|
+
export declare const SERVER_NAME = "axiom";
|
|
97
|
+
export declare const SERVER_VERSION: string;
|
|
98
|
+
interface CreateServerOptions {
|
|
99
|
+
log?: Logger;
|
|
100
|
+
tools?: readonly AnyToolDef[];
|
|
101
|
+
/** `--allow-guards` / `--guard-allowlist` (§3.2). Omit to keep guards disabled. */
|
|
102
|
+
guards?: ToolContext["guards"];
|
|
103
|
+
}
|
|
104
|
+
interface StructuredError {
|
|
105
|
+
code: ErrorCode;
|
|
106
|
+
message: string;
|
|
107
|
+
path?: string;
|
|
108
|
+
details?: Record<string, unknown>;
|
|
109
|
+
}
|
|
110
|
+
export declare function toStructuredError(err: unknown): StructuredError;
|
|
111
|
+
export declare function createServer(policy: RootsPolicy, opts?: CreateServerOptions): McpServer;
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/spec.d.ts
|
|
114
|
+
/** One entry of `spec/tools.json` — the codai agent-core tool manifest shape. */
|
|
115
|
+
interface ToolSpecEntry {
|
|
116
|
+
name: string;
|
|
117
|
+
description: string;
|
|
118
|
+
riskClass: "READ" | "ACT" | "SENSITIVE";
|
|
119
|
+
annotations: {
|
|
120
|
+
readOnlyHint: boolean;
|
|
121
|
+
destructiveHint: boolean;
|
|
122
|
+
idempotentHint: boolean;
|
|
123
|
+
openWorldHint: boolean;
|
|
124
|
+
};
|
|
125
|
+
inputSchema: Record<string, unknown>;
|
|
126
|
+
outputSchema: Record<string, unknown>;
|
|
127
|
+
}
|
|
128
|
+
export declare function buildToolsSpec(): ToolSpecEntry[];
|
|
129
|
+
/** Stable text form (2-space JSON + trailing newline) used both by the generator and the parity test. */
|
|
130
|
+
export declare function renderToolsSpec(): string;
|
|
131
|
+
//#endregion
|
|
132
|
+
export type { AnyToolDef, CreateServerOptions, LogLevel, Logger, ResolvedRoot, RiskClass, RootsPolicy, SchemaKind, StructuredError, ToolAnnotations, ToolContext, ToolDef, ToolSpecEntry };
|
|
133
|
+
//# sourceMappingURL=index.d.ts.map
|