reasonix 0.4.5 → 0.4.6
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/index.js +388 -83
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +48 -1
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1152,9 +1152,18 @@ declare class McpClient {
|
|
|
1152
1152
|
private readerStarted;
|
|
1153
1153
|
private initialized;
|
|
1154
1154
|
private _serverCapabilities;
|
|
1155
|
+
private _serverInfo;
|
|
1156
|
+
private _protocolVersion;
|
|
1157
|
+
private _instructions;
|
|
1155
1158
|
constructor(opts: McpClientOptions);
|
|
1156
1159
|
/** Server's advertised capabilities, available after initialize(). */
|
|
1157
1160
|
get serverCapabilities(): InitializeResult["capabilities"];
|
|
1161
|
+
/** Server's self-reported name + version, available after initialize(). */
|
|
1162
|
+
get serverInfo(): InitializeResult["serverInfo"];
|
|
1163
|
+
/** Protocol version the server agreed to during the handshake. */
|
|
1164
|
+
get protocolVersion(): string;
|
|
1165
|
+
/** Optional free-form instructions the server provides at handshake. */
|
|
1166
|
+
get serverInstructions(): string | undefined;
|
|
1158
1167
|
/**
|
|
1159
1168
|
* Complete the initialize → initialized handshake. Must be called
|
|
1160
1169
|
* before any other method (otherwise compliant servers reject).
|
|
@@ -1370,6 +1379,44 @@ interface SseMcpSpec {
|
|
|
1370
1379
|
type McpSpec = StdioMcpSpec | SseMcpSpec;
|
|
1371
1380
|
declare function parseMcpSpec(input: string): McpSpec;
|
|
1372
1381
|
|
|
1382
|
+
/**
|
|
1383
|
+
* Gather a full inspection report from an initialized MCP client:
|
|
1384
|
+
* server info, capabilities, tools, resources, prompts. Methods the
|
|
1385
|
+
* server doesn't support come back as `{ supported: false }` instead
|
|
1386
|
+
* of throwing, so a CLI or UI can render a consistent "what this
|
|
1387
|
+
* server exposes" summary even against minimal implementations.
|
|
1388
|
+
*
|
|
1389
|
+
* Pure with respect to I/O beyond the passed-in client — the CLI
|
|
1390
|
+
* layer owns argument parsing, connection setup, and printing.
|
|
1391
|
+
*/
|
|
1392
|
+
|
|
1393
|
+
interface InspectionReport {
|
|
1394
|
+
protocolVersion: string;
|
|
1395
|
+
serverInfo: {
|
|
1396
|
+
name: string;
|
|
1397
|
+
version: string;
|
|
1398
|
+
};
|
|
1399
|
+
capabilities: Record<string, unknown>;
|
|
1400
|
+
instructions?: string;
|
|
1401
|
+
tools: SectionResult<McpTool>;
|
|
1402
|
+
resources: SectionResult<McpResource>;
|
|
1403
|
+
prompts: SectionResult<McpPrompt>;
|
|
1404
|
+
}
|
|
1405
|
+
type SectionResult<T> = {
|
|
1406
|
+
supported: true;
|
|
1407
|
+
items: T[];
|
|
1408
|
+
} | {
|
|
1409
|
+
supported: false;
|
|
1410
|
+
reason: string;
|
|
1411
|
+
};
|
|
1412
|
+
/**
|
|
1413
|
+
* Run an inspection against a **already-initialized** client. Caller
|
|
1414
|
+
* is responsible for `initialize()` before this and `close()` after.
|
|
1415
|
+
* We keep this pure so unit tests can feed in a FakeMcpTransport and
|
|
1416
|
+
* verify the aggregate shape without spinning up a real process.
|
|
1417
|
+
*/
|
|
1418
|
+
declare function inspectMcpServer(client: McpClient): Promise<InspectionReport>;
|
|
1419
|
+
|
|
1373
1420
|
/**
|
|
1374
1421
|
* Aider-style SEARCH/REPLACE edit blocks.
|
|
1375
1422
|
*
|
|
@@ -1532,4 +1579,4 @@ declare function redactKey(key: string): string;
|
|
|
1532
1579
|
|
|
1533
1580
|
declare const VERSION = "0.4.3";
|
|
1534
1581
|
|
|
1535
|
-
export { AppendOnlyLog, type ApplyResult, type ApplyStatus, type BranchOptions, type BranchProgress, type BranchResult, type BranchSample, type BranchSelector, type BranchSummary, type BridgeOptions, type BridgeResult, CODE_SYSTEM_PROMPT, CacheFirstLoop, type CacheFirstLoopOptions, type CallToolResult, type ChatMessage, type ChatResponse, DEFAULT_MAX_RESULT_CHARS, DeepSeekClient, type DeepSeekClientOptions, type RenderOptions as DiffRenderOptions, type DiffReport, type DiffSide, type EditBlock, type EditSnapshot, type EventRole, type FlattenDecision, type FlattenOptions, type GetPromptResult, type HarvestOptions, ImmutablePrefix, type ImmutablePrefixOptions, type InitializeResult, type JSONSchema, type JsonRpcMessage, type JsonRpcRequest, type JsonRpcResponse, type ListPromptsResult, type ListResourcesResult, type ListToolsResult, type LoopEvent, MCP_PROTOCOL_VERSION, McpClient, type McpClientOptions, type McpContentBlock, type McpPrompt, type McpPromptArgument, type McpPromptMessage, type McpPromptResourceBlock, type McpResource, type McpResourceContents, type McpResourceContentsBlob, type McpResourceContentsText, type McpSpec, type McpTool, type McpToolSchema, type McpTransport, type ReadResourceResult, type ReadTranscriptResult, type ReasonixConfig, type ReconfigurableOptions, type RepairReport, type ReplayStats, type RetryInfo, type RetryOptions, type Role, type ScavengeOptions, type ScavengeResult, type SessionInfo, SessionStats, type SessionSummary, type SseMcpSpec, SseTransport, type SseTransportOptions, type StdioMcpSpec, StdioTransport, type StdioTransportOptions, StormBreaker, type StreamChunk, type ToolCall, ToolCallRepair, type ToolCallRepairOptions, type ToolDefinition, type ToolFunctionSpec, ToolRegistry, type ToolSpec, type TranscriptMeta, type TranscriptRecord, type TruncationRepairResult, type TurnPair, type TurnStats, type TypedPlanState, Usage, VERSION, VolatileScratch, aggregateBranchUsage, analyzeSchema, appendSessionMessage, applyEditBlock, applyEditBlocks, bridgeMcpTools, claudeEquivalentCost, codeSystemPrompt, computeReplayStats, costUsd, defaultConfigPath, defaultSelector, deleteSession, diffTranscripts, emptyPlanState, fetchWithRetry, flattenMcpResult, flattenSchema, formatLoopError, harvest, healLoadedMessages, isJsonRpcError, isPlanStateEmpty, isPlausibleKey, listSessions, loadApiKey, loadDotenv, loadSessionMessages, nestArguments, openTranscriptFile, parseEditBlocks, parseMcpSpec, parseTranscript, readConfig, readTranscript, recordFromLoopEvent, redactKey, renderMarkdown as renderDiffMarkdown, renderSummaryTable as renderDiffSummary, repairTruncatedJson, replayFromFile, restoreSnapshots, runBranches, sanitizeName as sanitizeSessionName, saveApiKey, scavengeToolCalls, sessionPath, sessionsDir, similarity, snapshotBeforeEdits, stripHallucinatedToolMarkup, truncateForModel, writeConfig, writeMeta, writeRecord };
|
|
1582
|
+
export { AppendOnlyLog, type ApplyResult, type ApplyStatus, type BranchOptions, type BranchProgress, type BranchResult, type BranchSample, type BranchSelector, type BranchSummary, type BridgeOptions, type BridgeResult, CODE_SYSTEM_PROMPT, CacheFirstLoop, type CacheFirstLoopOptions, type CallToolResult, type ChatMessage, type ChatResponse, DEFAULT_MAX_RESULT_CHARS, DeepSeekClient, type DeepSeekClientOptions, type RenderOptions as DiffRenderOptions, type DiffReport, type DiffSide, type EditBlock, type EditSnapshot, type EventRole, type FlattenDecision, type FlattenOptions, type GetPromptResult, type HarvestOptions, ImmutablePrefix, type ImmutablePrefixOptions, type InitializeResult, type InspectionReport, type JSONSchema, type JsonRpcMessage, type JsonRpcRequest, type JsonRpcResponse, type ListPromptsResult, type ListResourcesResult, type ListToolsResult, type LoopEvent, MCP_PROTOCOL_VERSION, McpClient, type McpClientOptions, type McpContentBlock, type McpPrompt, type McpPromptArgument, type McpPromptMessage, type McpPromptResourceBlock, type McpResource, type McpResourceContents, type McpResourceContentsBlob, type McpResourceContentsText, type McpSpec, type McpTool, type McpToolSchema, type McpTransport, type ReadResourceResult, type ReadTranscriptResult, type ReasonixConfig, type ReconfigurableOptions, type RepairReport, type ReplayStats, type RetryInfo, type RetryOptions, type Role, type ScavengeOptions, type ScavengeResult, type SectionResult, type SessionInfo, SessionStats, type SessionSummary, type SseMcpSpec, SseTransport, type SseTransportOptions, type StdioMcpSpec, StdioTransport, type StdioTransportOptions, StormBreaker, type StreamChunk, type ToolCall, ToolCallRepair, type ToolCallRepairOptions, type ToolDefinition, type ToolFunctionSpec, ToolRegistry, type ToolSpec, type TranscriptMeta, type TranscriptRecord, type TruncationRepairResult, type TurnPair, type TurnStats, type TypedPlanState, Usage, VERSION, VolatileScratch, aggregateBranchUsage, analyzeSchema, appendSessionMessage, applyEditBlock, applyEditBlocks, bridgeMcpTools, claudeEquivalentCost, codeSystemPrompt, computeReplayStats, costUsd, defaultConfigPath, defaultSelector, deleteSession, diffTranscripts, emptyPlanState, fetchWithRetry, flattenMcpResult, flattenSchema, formatLoopError, harvest, healLoadedMessages, inspectMcpServer, isJsonRpcError, isPlanStateEmpty, isPlausibleKey, listSessions, loadApiKey, loadDotenv, loadSessionMessages, nestArguments, openTranscriptFile, parseEditBlocks, parseMcpSpec, parseTranscript, readConfig, readTranscript, recordFromLoopEvent, redactKey, renderMarkdown as renderDiffMarkdown, renderSummaryTable as renderDiffSummary, repairTruncatedJson, replayFromFile, restoreSnapshots, runBranches, sanitizeName as sanitizeSessionName, saveApiKey, scavengeToolCalls, sessionPath, sessionsDir, similarity, snapshotBeforeEdits, stripHallucinatedToolMarkup, truncateForModel, writeConfig, writeMeta, writeRecord };
|
package/dist/index.js
CHANGED
|
@@ -2196,6 +2196,9 @@ var McpClient = class {
|
|
|
2196
2196
|
readerStarted = false;
|
|
2197
2197
|
initialized = false;
|
|
2198
2198
|
_serverCapabilities = {};
|
|
2199
|
+
_serverInfo = { name: "", version: "" };
|
|
2200
|
+
_protocolVersion = "";
|
|
2201
|
+
_instructions;
|
|
2199
2202
|
constructor(opts) {
|
|
2200
2203
|
this.transport = opts.transport;
|
|
2201
2204
|
this.clientInfo = opts.clientInfo ?? { name: "reasonix", version: "0.3.0-dev" };
|
|
@@ -2205,6 +2208,18 @@ var McpClient = class {
|
|
|
2205
2208
|
get serverCapabilities() {
|
|
2206
2209
|
return this._serverCapabilities;
|
|
2207
2210
|
}
|
|
2211
|
+
/** Server's self-reported name + version, available after initialize(). */
|
|
2212
|
+
get serverInfo() {
|
|
2213
|
+
return this._serverInfo;
|
|
2214
|
+
}
|
|
2215
|
+
/** Protocol version the server agreed to during the handshake. */
|
|
2216
|
+
get protocolVersion() {
|
|
2217
|
+
return this._protocolVersion;
|
|
2218
|
+
}
|
|
2219
|
+
/** Optional free-form instructions the server provides at handshake. */
|
|
2220
|
+
get serverInstructions() {
|
|
2221
|
+
return this._instructions;
|
|
2222
|
+
}
|
|
2208
2223
|
/**
|
|
2209
2224
|
* Complete the initialize → initialized handshake. Must be called
|
|
2210
2225
|
* before any other method (otherwise compliant servers reject).
|
|
@@ -2223,6 +2238,9 @@ var McpClient = class {
|
|
|
2223
2238
|
clientInfo: this.clientInfo
|
|
2224
2239
|
});
|
|
2225
2240
|
this._serverCapabilities = result.capabilities ?? {};
|
|
2241
|
+
this._serverInfo = result.serverInfo ?? { name: "", version: "" };
|
|
2242
|
+
this._protocolVersion = result.protocolVersion ?? "";
|
|
2243
|
+
this._instructions = result.instructions;
|
|
2226
2244
|
await this.transport.send({
|
|
2227
2245
|
jsonrpc: "2.0",
|
|
2228
2246
|
method: "notifications/initialized"
|
|
@@ -2670,6 +2688,36 @@ function parseMcpSpec(input) {
|
|
|
2670
2688
|
return { transport: "stdio", name, command, args };
|
|
2671
2689
|
}
|
|
2672
2690
|
|
|
2691
|
+
// src/mcp/inspect.ts
|
|
2692
|
+
async function inspectMcpServer(client) {
|
|
2693
|
+
const tools = await trySection(() => client.listTools().then((r) => r.tools));
|
|
2694
|
+
const resources = await trySection(
|
|
2695
|
+
() => client.listResources().then((r) => r.resources)
|
|
2696
|
+
);
|
|
2697
|
+
const prompts = await trySection(() => client.listPrompts().then((r) => r.prompts));
|
|
2698
|
+
return {
|
|
2699
|
+
protocolVersion: client.protocolVersion || "(unknown)",
|
|
2700
|
+
serverInfo: client.serverInfo,
|
|
2701
|
+
capabilities: client.serverCapabilities ?? {},
|
|
2702
|
+
instructions: client.serverInstructions,
|
|
2703
|
+
tools,
|
|
2704
|
+
resources,
|
|
2705
|
+
prompts
|
|
2706
|
+
};
|
|
2707
|
+
}
|
|
2708
|
+
async function trySection(load) {
|
|
2709
|
+
try {
|
|
2710
|
+
const items = await load();
|
|
2711
|
+
return { supported: true, items };
|
|
2712
|
+
} catch (err) {
|
|
2713
|
+
const msg = err.message ?? String(err);
|
|
2714
|
+
if (/-32601/.test(msg) || /method not found/i.test(msg)) {
|
|
2715
|
+
return { supported: false, reason: "method not found (-32601)" };
|
|
2716
|
+
}
|
|
2717
|
+
return { supported: false, reason: msg };
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2673
2721
|
// src/code/edit-blocks.ts
|
|
2674
2722
|
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync4, unlinkSync as unlinkSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
2675
2723
|
import { dirname as dirname2, resolve as resolve2 } from "path";
|
|
@@ -2953,6 +3001,7 @@ export {
|
|
|
2953
3001
|
formatLoopError,
|
|
2954
3002
|
harvest,
|
|
2955
3003
|
healLoadedMessages,
|
|
3004
|
+
inspectMcpServer,
|
|
2956
3005
|
isJsonRpcError,
|
|
2957
3006
|
isPlanStateEmpty,
|
|
2958
3007
|
isPlausibleKey,
|