@martinloop/mcp 0.3.5 → 0.3.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/README.md +10 -2
- package/dist/discovery-metadata.d.ts +1 -1
- package/dist/discovery-metadata.js +2 -0
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/prompts.js +19 -1
- package/dist/resources.d.ts +2 -0
- package/dist/resources.js +202 -148
- package/dist/server-validation.d.ts +1 -1
- package/dist/server-validation.js +17 -0
- package/dist/server.d.ts +23 -0
- package/dist/server.js +161 -5
- package/dist/tools/doctor.js +6 -0
- package/dist/tools/tool-support.d.ts +1 -1
- package/dist/tools/tool-support.js +1 -1
- package/dist/vendor/adapters/claude-cli.d.ts +2 -2
- package/dist/vendor/adapters/claude-cli.js +22 -7
- package/dist/vendor/adapters/cli-bridge.d.ts +7 -0
- package/dist/vendor/adapters/cli-bridge.js +94 -8
- package/dist/vendor/adapters/codex-launcher.js +18 -7
- package/dist/vendor/adapters/openai-compatible.js +90 -57
- package/dist/vendor/contracts/index.d.ts +1 -1
- package/dist/vendor/contracts/index.js +1 -0
- package/dist/vendor/core/index.d.ts +10 -2
- package/dist/vendor/core/index.js +31 -3
- package/dist/vendor/core/persistence/memory-store.d.ts +63 -0
- package/dist/vendor/core/persistence/memory-store.js +115 -0
- package/dist/vendor/core/persistence/trace-store.d.ts +85 -0
- package/dist/vendor/core/persistence/trace-store.js +125 -0
- package/dist/vendor/core/repo-analyzer.d.ts +53 -0
- package/dist/vendor/core/repo-analyzer.js +263 -0
- package/dist/vendor/core/routing.d.ts +42 -0
- package/dist/vendor/core/routing.js +156 -5
- package/dist/vendor/core/test-integrity.d.ts +64 -0
- package/dist/vendor/core/test-integrity.js +197 -0
- package/dist/workflow-state.d.ts +1 -1
- package/dist/workflow-state.js +12 -4
- package/package.json +76 -76
- package/server.json +21 -21
package/README.md
CHANGED
|
@@ -60,6 +60,14 @@ gemini mcp add martin-loop -- npx -y @martinloop/mcp
|
|
|
60
60
|
npx -y @martinloop/mcp
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
+
### Optional HTTP Endpoint
|
|
64
|
+
|
|
65
|
+
If you need a local HTTP endpoint for a bridge or proxy, start the server in HTTP mode:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
npx -y @martinloop/mcp --http --port 3033
|
|
69
|
+
```
|
|
70
|
+
|
|
63
71
|
## How a Governed Run Works
|
|
64
72
|
|
|
65
73
|
```
|
|
@@ -87,11 +95,11 @@ Every attempt runs your verifier. Every dollar is tracked. If the agent drifts o
|
|
|
87
95
|
**Ship the work:**
|
|
88
96
|
`martin_pr_summary` `martin_create_pr` `martin_review_pr`
|
|
89
97
|
|
|
90
|
-
###
|
|
98
|
+
### Key Read-Only Resources
|
|
91
99
|
|
|
92
100
|
Your agent can pull context without side effects:
|
|
93
101
|
|
|
94
|
-
`martin://runs/latest` · `martin://runs/latest/proof-card` · `martin://runs/latest/budget-status` · `martin://runs/latest/verifier-evidence` · `martin://runs/recent` · `martin://server/health` · `martin://policies/current` · `martin://agent/next-step` · `martin://guides/mcp-usage` · `martin://guides/agent-start` · `martin://repo/risk-map`
|
|
102
|
+
`martin://runs/latest` · `martin://runs/latest/proof-card` · `martin://runs/latest/budget-status` · `martin://runs/latest/verifier-evidence` · `martin://runs/recent` · `martin://server/health` · `martin://policies/current` · `martin://agent/next-step` · `martin://agent/governance-status` · `martin://agent/mode-status` · `martin://agent/memory-summary` · `martin://guides/mcp-usage` · `martin://guides/agent-start` · `martin://repo/risk-map`
|
|
95
103
|
|
|
96
104
|
### Configuration Profiles
|
|
97
105
|
|
|
@@ -4,7 +4,7 @@ export declare const MARTIN_MINIMAL_TOOL_NAMES: readonly ["martin_doctor", "mart
|
|
|
4
4
|
export declare const MARTIN_DIAGNOSTIC_TOOL_NAMES: readonly ["martin_doctor", "martin_plan", "martin_preflight", "martin_estimate", "martin_logs", "martin_list_runs", "martin_triage_runs", "martin_get_run", "martin_get_attempt", "martin_get_verification_results", "martin_dossier", "martin_eval"];
|
|
5
5
|
export declare const MARTIN_GITHUB_REVIEW_TOOL_NAMES: readonly ["martin_doctor", "martin_plan", "martin_preflight", "martin_dossier", "martin_eval", "martin_pr_summary", "martin_create_pr", "martin_review_pr"];
|
|
6
6
|
export declare const MARTIN_PAID_REMOTE_TOOL_NAMES: readonly ["martin_doctor", "martin_plan", "martin_preflight", "martin_estimate", "martin_run", "martin_list_runs", "martin_triage_runs", "martin_get_run", "martin_get_verification_results", "martin_dossier", "martin_eval"];
|
|
7
|
-
export declare const MARTIN_RESOURCE_URIS: readonly ["martin://server/health", "martin://runs/recent", "martin://runs/triage", "martin://runs/latest", "martin://runs/latest/summary", "martin://runs/latest/proof-card", "martin://runs/latest/budget-status", "martin://runs/latest/verifier-evidence", "martin://runs/latest/rollback-evidence", "martin://policies/current", "martin://repo/risk-map", "martin://verifiers/results", "martin://agent/next-step", "martin://agent/governance-status", "martin://guides/mcp-usage", "martin://guides/agent-start", "martin://guides/command-map", "martin://guides/ide-onboarding", "martin://guides/operating-rules", "martin://guides/publish-readiness"];
|
|
7
|
+
export declare const MARTIN_RESOURCE_URIS: readonly ["martin://server/health", "martin://runs/recent", "martin://runs/triage", "martin://runs/latest", "martin://runs/latest/summary", "martin://runs/latest/proof-card", "martin://runs/latest/budget-status", "martin://runs/latest/verifier-evidence", "martin://runs/latest/rollback-evidence", "martin://policies/current", "martin://repo/risk-map", "martin://verifiers/results", "martin://agent/next-step", "martin://agent/governance-status", "martin://agent/mode-status", "martin://agent/memory-summary", "martin://guides/mcp-usage", "martin://guides/agent-start", "martin://guides/command-map", "martin://guides/ide-onboarding", "martin://guides/operating-rules", "martin://guides/publish-readiness"];
|
|
8
8
|
export declare const MARTIN_RESOURCE_TEMPLATE_URIS: readonly ["martin://runs/{loopId}", "martin://runs/{loopId}/dossier", "martin://runs/{loopId}/attempts/{attemptIndex}", "martin://runs/{loopId}/verification"];
|
|
9
9
|
export declare const MARTIN_PROMPT_NAMES: readonly ["martin_start", "martin_preflight", "martin_triage", "martin_resume", "martin_prove", "martin_release_check", "martin_governed_coding_kickoff", "martin_debug_failed_run", "martin_publish_readiness_review", "martin_triage_run_store", "safe_bug_fix", "write_tests_first", "small_refactor", "security_review", "pr_review", "release_check"];
|
|
10
10
|
export interface MartinDiscoveryMetadata {
|
|
@@ -93,6 +93,8 @@ export const MARTIN_RESOURCE_URIS = [
|
|
|
93
93
|
"martin://verifiers/results",
|
|
94
94
|
"martin://agent/next-step",
|
|
95
95
|
"martin://agent/governance-status",
|
|
96
|
+
"martin://agent/mode-status",
|
|
97
|
+
"martin://agent/memory-summary",
|
|
96
98
|
"martin://guides/mcp-usage",
|
|
97
99
|
"martin://guides/agent-start",
|
|
98
100
|
"martin://guides/command-map",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MARTIN_MCP_PACKAGE_VERSION = "0.3.
|
|
1
|
+
export declare const MARTIN_MCP_PACKAGE_VERSION = "0.3.6";
|
package/dist/package-version.js
CHANGED
package/dist/prompts.js
CHANGED
|
@@ -247,7 +247,25 @@ async function buildKickoffPrompt(input) {
|
|
|
247
247
|
return {
|
|
248
248
|
description: appendPromptMetadata("Kick off a Martin-governed coding session with explicit scope, budgets, and verification expectations."),
|
|
249
249
|
messages: [
|
|
250
|
-
textMessage("assistant",
|
|
250
|
+
textMessage("assistant", [
|
|
251
|
+
"You are operating under MartinLoop governance. All coding work MUST follow the governed sequence. This is not optional.",
|
|
252
|
+
"",
|
|
253
|
+
"REQUIRED before any code changes:",
|
|
254
|
+
"1. Read martin://agent/governance-status — check if this session is governed",
|
|
255
|
+
"2. Call martin_doctor — confirm environment readiness",
|
|
256
|
+
"3. Call martin_estimate — preview cost and recommended route BEFORE spending",
|
|
257
|
+
"4. Call martin_plan — scope the bounded approach",
|
|
258
|
+
"5. Call martin_preflight — validate the run contract",
|
|
259
|
+
"6. Only then call martin_run",
|
|
260
|
+
"7. Call martin_dossier — inspect what happened and generate receipt",
|
|
261
|
+
"",
|
|
262
|
+
"RULES:",
|
|
263
|
+
"- Never skip governance steps. Never claim success without verifier-backed evidence.",
|
|
264
|
+
"- Never generate fake tests. All tests must exercise real code paths with real assertions.",
|
|
265
|
+
"- Match the existing repo's code style (naming, formatting, test framework, module system).",
|
|
266
|
+
"- Budget caps are hard limits. If the estimate exceeds budget, ask the user before proceeding.",
|
|
267
|
+
"- Every run produces a receipt. No silent failures."
|
|
268
|
+
].join("\n")),
|
|
251
269
|
embeddedResourceMessage("assistant", firstResourceContent(usageGuide)),
|
|
252
270
|
embeddedResourceMessage("assistant", firstResourceContent(commandMapGuide)),
|
|
253
271
|
embeddedResourceMessage("assistant", firstResourceContent(operatingRulesGuide)),
|
package/dist/resources.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export declare const MARTIN_STATIC_RESOURCE_URIS: {
|
|
|
21
21
|
readonly operatingRulesGuide: "martin://guides/operating-rules";
|
|
22
22
|
readonly publishReadinessGuide: "martin://guides/publish-readiness";
|
|
23
23
|
readonly governanceStatus: "martin://agent/governance-status";
|
|
24
|
+
readonly modeStatus: "martin://agent/mode-status";
|
|
25
|
+
readonly memorySummary: "martin://agent/memory-summary";
|
|
24
26
|
};
|
|
25
27
|
export declare const MARTIN_RESOURCE_TEMPLATES: ResourceTemplate[];
|
|
26
28
|
export declare const MARTIN_STATIC_RESOURCES: Resource[];
|
package/dist/resources.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
1
4
|
import { buildMartinDiscoveryMetadata } from "./discovery-metadata.js";
|
|
2
5
|
import { MARTIN_MCP_PACKAGE_VERSION } from "./package-version.js";
|
|
3
6
|
import { inspectLoopTool } from "./tools/inspect-loop.js";
|
|
@@ -6,6 +9,7 @@ import { martinTriageRunsTool } from "./tools/triage-runs.js";
|
|
|
6
9
|
import { martinRunDossierTool } from "./tools/run-dossier.js";
|
|
7
10
|
import { inspectRepoSignals, buildPolicyPackDefinition, buildRepoRiskMap } from "./tools/workflow-governance.js";
|
|
8
11
|
import { readWorkflowState } from "./workflow-state.js";
|
|
12
|
+
import { readMemoryEntries, buildMemorySummary } from "./vendor/core/index.js";
|
|
9
13
|
import { buildAttemptSnapshot, buildPersistedLoopPreview, buildVerificationHistorySnapshot, parseAttemptIndex, resolveMartinDiscoveryContext, toPrettyJson } from "./discovery-support.js";
|
|
10
14
|
import { loadDetailedLoopRecord, readLedgerEvents } from "./tools/run-store.js";
|
|
11
15
|
import { invalidArgumentsError, MartinToolError } from "./tools/tool-errors.js";
|
|
@@ -29,7 +33,9 @@ export const MARTIN_STATIC_RESOURCE_URIS = {
|
|
|
29
33
|
ideOnboardingGuide: "martin://guides/ide-onboarding",
|
|
30
34
|
operatingRulesGuide: "martin://guides/operating-rules",
|
|
31
35
|
publishReadinessGuide: "martin://guides/publish-readiness",
|
|
32
|
-
governanceStatus: "martin://agent/governance-status"
|
|
36
|
+
governanceStatus: "martin://agent/governance-status",
|
|
37
|
+
modeStatus: "martin://agent/mode-status",
|
|
38
|
+
memorySummary: "martin://agent/memory-summary"
|
|
33
39
|
};
|
|
34
40
|
export const MARTIN_RESOURCE_TEMPLATES = [
|
|
35
41
|
{
|
|
@@ -197,6 +203,20 @@ export const MARTIN_STATIC_RESOURCES = [
|
|
|
197
203
|
title: "Martin Governance Status",
|
|
198
204
|
description: "Proactive governance status: whether work is governed, budget remaining, unreceipted runs, and recommended next action. Read this before starting agent work.",
|
|
199
205
|
mimeType: "application/json"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
uri: MARTIN_STATIC_RESOURCE_URIS.modeStatus,
|
|
209
|
+
name: "martin_mode_status",
|
|
210
|
+
title: "Martin Mode Status",
|
|
211
|
+
description: "Current MartinLoop working mode, whether it is inherited or explicitly configured, and how to switch it.",
|
|
212
|
+
mimeType: "application/json"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
uri: MARTIN_STATIC_RESOURCE_URIS.memorySummary,
|
|
216
|
+
name: "martin_memory_summary",
|
|
217
|
+
title: "Martin Memory Summary",
|
|
218
|
+
description: "MartinLoop persistent memory: user preferences, consent signals, budget patterns, and behavioral observations aggregated over time. Read at session start to personalize recommendations.",
|
|
219
|
+
mimeType: "application/json"
|
|
200
220
|
}
|
|
201
221
|
];
|
|
202
222
|
export function listMartinResources() {
|
|
@@ -246,8 +266,15 @@ export async function readMartinResource(input) {
|
|
|
246
266
|
return jsonResource(input.uri, withDiscoveryMetadata(buildRepoRiskMap(inspectRepoSignals(context.workingDirectory)), context.runsRoot));
|
|
247
267
|
case MARTIN_STATIC_RESOURCE_URIS.verifierResults:
|
|
248
268
|
return jsonResource(input.uri, withDiscoveryMetadata(await buildLatestVerifierEvidenceResource(context.runsRoot), context.runsRoot));
|
|
269
|
+
case MARTIN_STATIC_RESOURCE_URIS.memorySummary: {
|
|
270
|
+
const entries = await readMemoryEntries(context.runsRoot);
|
|
271
|
+
const summary = buildMemorySummary(entries);
|
|
272
|
+
return jsonResource(input.uri, withDiscoveryMetadata(summary, context.runsRoot));
|
|
273
|
+
}
|
|
249
274
|
case MARTIN_STATIC_RESOURCE_URIS.governanceStatus:
|
|
250
275
|
return jsonResource(input.uri, withDiscoveryMetadata(await buildGovernanceStatusResource(context.runsRoot, context.workingDirectory), context.runsRoot));
|
|
276
|
+
case MARTIN_STATIC_RESOURCE_URIS.modeStatus:
|
|
277
|
+
return jsonResource(input.uri, withDiscoveryMetadata(await buildModeStatusResource(context.workingDirectory), context.runsRoot));
|
|
251
278
|
case MARTIN_STATIC_RESOURCE_URIS.agentNextStep:
|
|
252
279
|
return jsonResource(input.uri, withDiscoveryMetadata(await buildAgentNextStepResource(context.runsRoot), context.runsRoot));
|
|
253
280
|
case MARTIN_STATIC_RESOURCE_URIS.mcpUsageGuide:
|
|
@@ -627,6 +654,33 @@ async function buildGovernanceStatusResource(runsRoot, workingDirectory) {
|
|
|
627
654
|
warning: governed ? undefined : "This session is NOT governed. Complete the required sequence before making changes."
|
|
628
655
|
};
|
|
629
656
|
}
|
|
657
|
+
async function buildModeStatusResource(workingDirectory) {
|
|
658
|
+
const configPath = join(homedir(), ".martin", "config.json");
|
|
659
|
+
let config = {};
|
|
660
|
+
try {
|
|
661
|
+
config = JSON.parse(await readFile(configPath, "utf8"));
|
|
662
|
+
}
|
|
663
|
+
catch {
|
|
664
|
+
// Fresh config means the implicit auto default is in effect.
|
|
665
|
+
}
|
|
666
|
+
const projectMode = config.projectOverrides?.[workingDirectory];
|
|
667
|
+
const defaultMode = config.defaultMode ?? "auto";
|
|
668
|
+
const effectiveMode = projectMode ?? defaultMode;
|
|
669
|
+
return {
|
|
670
|
+
kind: "mode-status",
|
|
671
|
+
effectiveMode,
|
|
672
|
+
defaultMode,
|
|
673
|
+
scope: projectMode ? "project" : config.defaultMode ? "global" : "implicit_default",
|
|
674
|
+
configured: Boolean(projectMode || config.defaultMode),
|
|
675
|
+
projectOverride: projectMode ?? null,
|
|
676
|
+
workingDirectory,
|
|
677
|
+
switchCommands: {
|
|
678
|
+
auto: "martin mode auto",
|
|
679
|
+
plan: "martin mode plan",
|
|
680
|
+
edits: "martin mode edits"
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
}
|
|
630
684
|
function buildCurrentPoliciesResource(workingDirectory) {
|
|
631
685
|
const signals = inspectRepoSignals(workingDirectory);
|
|
632
686
|
const recommended = buildPolicyPackDefinition(undefined, signals);
|
|
@@ -688,173 +742,173 @@ function inferAgentNextStep(loop, verification) {
|
|
|
688
742
|
}
|
|
689
743
|
function buildMcpUsageGuide(runsRoot) {
|
|
690
744
|
const metadata = buildMartinDiscoveryMetadata(MARTIN_MCP_PACKAGE_VERSION);
|
|
691
|
-
return `# Martin Loop MCP Usage
|
|
692
|
-
|
|
693
|
-
Discovery revision: \`${metadata.discoveryRevision}\`
|
|
694
|
-
Server version: \`${metadata.serverVersion}\`
|
|
695
|
-
Runs root: \`${runsRoot}\`
|
|
696
|
-
|
|
697
|
-
Martin Loop exposes governed coding workflows over MCP. Use the server health and run-store views to decide when to preflight, execute, inspect, or escalate.
|
|
698
|
-
|
|
699
|
-
## Recommended Flow
|
|
700
|
-
|
|
701
|
-
1. Read \`${MARTIN_STATIC_RESOURCE_URIS.serverHealth}\` or call \`martin_doctor\` to confirm the environment and run-store visibility.
|
|
702
|
-
2. Use the \`martin_governed_coding_kickoff\` prompt to frame a governed coding request.
|
|
703
|
-
3. Call \`martin_preflight\` before \`martin_run\` when the task or safety envelope is non-trivial.
|
|
704
|
-
4. After execution, inspect \`${MARTIN_STATIC_RESOURCE_URIS.recentRuns}\`, \`martin://runs/{loopId}\`, and \`martin://runs/{loopId}/verification\`.
|
|
705
|
-
5. For low-context agents, read \`${MARTIN_STATIC_RESOURCE_URIS.agentNextStep}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestSummary}\`, or \`${MARTIN_STATIC_RESOURCE_URIS.latestProofCard}\` before asking for full JSON.
|
|
706
|
-
6. Read \`${MARTIN_STATIC_RESOURCE_URIS.triage}\` or call \`martin_triage_runs\` to prioritize which run needs attention first.
|
|
707
|
-
7. Use \`martin_debug_failed_run\` when a loop exits failed, budget-bound, or escalated.
|
|
708
|
-
|
|
709
|
-
## Current Martin MCP Surface
|
|
710
|
-
|
|
711
|
-
- Tools: \`martin_run\`, \`martin_inspect\`, \`martin_status\`, \`martin_doctor\`, \`martin_preflight\`, \`martin_list_runs\`, \`martin_triage_runs\`, \`martin_get_run\`, \`martin_get_attempt\`, \`martin_get_verification_results\`, \`martin_run_dossier\`
|
|
712
|
-
- Static resources: \`${MARTIN_STATIC_RESOURCE_URIS.serverHealth}\`, \`${MARTIN_STATIC_RESOURCE_URIS.recentRuns}\`, \`${MARTIN_STATIC_RESOURCE_URIS.triage}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestSummary}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestProofCard}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestBudgetStatus}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestVerifierEvidence}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestRollbackEvidence}\`, \`${MARTIN_STATIC_RESOURCE_URIS.agentNextStep}\`, \`${MARTIN_STATIC_RESOURCE_URIS.mcpUsageGuide}\`, \`${MARTIN_STATIC_RESOURCE_URIS.agentStartGuide}\`, \`${MARTIN_STATIC_RESOURCE_URIS.publishReadinessGuide}\`
|
|
713
|
-
- Resource templates: \`martin://runs/{loopId}\`, \`martin://runs/{loopId}/attempts/{attemptIndex}\`, \`martin://runs/{loopId}/verification\`
|
|
714
|
-
- Prompts: \`martin_start\`, \`martin_preflight\`, \`martin_triage\`, \`martin_resume\`, \`martin_prove\`, \`martin_release_check\`, \`martin_governed_coding_kickoff\`, \`martin_debug_failed_run\`, \`martin_publish_readiness_review\`, \`martin_triage_run_store\`
|
|
715
|
-
|
|
716
|
-
## Notes
|
|
717
|
-
|
|
718
|
-
- Discovery helpers read the existing Martin run-store; they do not create new schema.
|
|
719
|
-
- Verification history is derived from persisted \`verification.completed\` evidence in loop records and ledgers.
|
|
720
|
-
- Attempt inspection stays aligned with the same loop selectors used by \`martin_status\` and \`martin_inspect\`.
|
|
745
|
+
return `# Martin Loop MCP Usage
|
|
746
|
+
|
|
747
|
+
Discovery revision: \`${metadata.discoveryRevision}\`
|
|
748
|
+
Server version: \`${metadata.serverVersion}\`
|
|
749
|
+
Runs root: \`${runsRoot}\`
|
|
750
|
+
|
|
751
|
+
Martin Loop exposes governed coding workflows over MCP. Use the server health and run-store views to decide when to preflight, execute, inspect, or escalate.
|
|
752
|
+
|
|
753
|
+
## Recommended Flow
|
|
754
|
+
|
|
755
|
+
1. Read \`${MARTIN_STATIC_RESOURCE_URIS.serverHealth}\` or call \`martin_doctor\` to confirm the environment and run-store visibility.
|
|
756
|
+
2. Use the \`martin_governed_coding_kickoff\` prompt to frame a governed coding request.
|
|
757
|
+
3. Call \`martin_preflight\` before \`martin_run\` when the task or safety envelope is non-trivial.
|
|
758
|
+
4. After execution, inspect \`${MARTIN_STATIC_RESOURCE_URIS.recentRuns}\`, \`martin://runs/{loopId}\`, and \`martin://runs/{loopId}/verification\`.
|
|
759
|
+
5. For low-context agents, read \`${MARTIN_STATIC_RESOURCE_URIS.agentNextStep}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestSummary}\`, or \`${MARTIN_STATIC_RESOURCE_URIS.latestProofCard}\` before asking for full JSON.
|
|
760
|
+
6. Read \`${MARTIN_STATIC_RESOURCE_URIS.triage}\` or call \`martin_triage_runs\` to prioritize which run needs attention first.
|
|
761
|
+
7. Use \`martin_debug_failed_run\` when a loop exits failed, budget-bound, or escalated.
|
|
762
|
+
|
|
763
|
+
## Current Martin MCP Surface
|
|
764
|
+
|
|
765
|
+
- Tools: \`martin_run\`, \`martin_inspect\`, \`martin_status\`, \`martin_doctor\`, \`martin_preflight\`, \`martin_list_runs\`, \`martin_triage_runs\`, \`martin_get_run\`, \`martin_get_attempt\`, \`martin_get_verification_results\`, \`martin_run_dossier\`
|
|
766
|
+
- Static resources: \`${MARTIN_STATIC_RESOURCE_URIS.serverHealth}\`, \`${MARTIN_STATIC_RESOURCE_URIS.recentRuns}\`, \`${MARTIN_STATIC_RESOURCE_URIS.triage}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestSummary}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestProofCard}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestBudgetStatus}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestVerifierEvidence}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestRollbackEvidence}\`, \`${MARTIN_STATIC_RESOURCE_URIS.agentNextStep}\`, \`${MARTIN_STATIC_RESOURCE_URIS.governanceStatus}\`, \`${MARTIN_STATIC_RESOURCE_URIS.modeStatus}\`, \`${MARTIN_STATIC_RESOURCE_URIS.memorySummary}\`, \`${MARTIN_STATIC_RESOURCE_URIS.mcpUsageGuide}\`, \`${MARTIN_STATIC_RESOURCE_URIS.agentStartGuide}\`, \`${MARTIN_STATIC_RESOURCE_URIS.publishReadinessGuide}\`
|
|
767
|
+
- Resource templates: \`martin://runs/{loopId}\`, \`martin://runs/{loopId}/attempts/{attemptIndex}\`, \`martin://runs/{loopId}/verification\`
|
|
768
|
+
- Prompts: \`martin_start\`, \`martin_preflight\`, \`martin_triage\`, \`martin_resume\`, \`martin_prove\`, \`martin_release_check\`, \`martin_governed_coding_kickoff\`, \`martin_debug_failed_run\`, \`martin_publish_readiness_review\`, \`martin_triage_run_store\`
|
|
769
|
+
|
|
770
|
+
## Notes
|
|
771
|
+
|
|
772
|
+
- Discovery helpers read the existing Martin run-store; they do not create new schema.
|
|
773
|
+
- Verification history is derived from persisted \`verification.completed\` evidence in loop records and ledgers.
|
|
774
|
+
- Attempt inspection stays aligned with the same loop selectors used by \`martin_status\` and \`martin_inspect\`.
|
|
721
775
|
`;
|
|
722
776
|
}
|
|
723
777
|
function buildAgentStartGuide(runsRoot) {
|
|
724
778
|
const metadata = buildMartinDiscoveryMetadata(MARTIN_MCP_PACKAGE_VERSION);
|
|
725
|
-
return `# Agent Start Here
|
|
726
|
-
|
|
727
|
-
Discovery revision: \`${metadata.discoveryRevision}\`
|
|
728
|
-
Server version: \`${metadata.serverVersion}\`
|
|
729
|
-
Runs root: \`${runsRoot}\`
|
|
730
|
-
|
|
731
|
-
Use Martin Loop as the local governor before you spend agent tokens or retry a failed coding loop.
|
|
732
|
-
|
|
733
|
-
## Cheap Default Flow
|
|
734
|
-
|
|
735
|
-
1. Read \`${MARTIN_STATIC_RESOURCE_URIS.agentNextStep}\` first. It is the smallest "what should I do now?" payload.
|
|
736
|
-
2. If no runs exist, call \`martin_doctor\`, then \`martin_preflight\`.
|
|
737
|
-
3. If a run exists, read \`${MARTIN_STATIC_RESOURCE_URIS.latestSummary}\` before reading full run JSON.
|
|
738
|
-
4. If the verifier failed, use prompt \`martin_debug_failed_run\` or \`martin_triage\`.
|
|
739
|
-
5. If you need a shareable receipt, read \`${MARTIN_STATIC_RESOURCE_URIS.latestProofCard}\`.
|
|
740
|
-
|
|
741
|
-
## Install Profiles
|
|
742
|
-
|
|
743
|
-
- \`minimal\` (default): doctor, preflight, list, triage, dossier. Good for low tool bloat.
|
|
744
|
-
- \`diagnostic\`: read-only inspection tools for debugging without execution.
|
|
745
|
-
- \`full-local\`: all local tools, including \`martin_run\`.
|
|
746
|
-
- \`github-review\`: review-oriented local profile for PR drafting and reviewer evidence.
|
|
747
|
-
- \`starter\` and \`full\`: compatibility aliases.
|
|
748
|
-
|
|
749
|
-
## Copy-Paste Agent Rule
|
|
750
|
-
|
|
751
|
-
Before running or retrying an autonomous coding task, call Martin. Prefer compact resources first, then full dossiers only when the compact receipt says more evidence is needed. Never claim success unless Martin shows verifier-backed completion or a clear blocked reason.
|
|
779
|
+
return `# Agent Start Here
|
|
780
|
+
|
|
781
|
+
Discovery revision: \`${metadata.discoveryRevision}\`
|
|
782
|
+
Server version: \`${metadata.serverVersion}\`
|
|
783
|
+
Runs root: \`${runsRoot}\`
|
|
784
|
+
|
|
785
|
+
Use Martin Loop as the local governor before you spend agent tokens or retry a failed coding loop.
|
|
786
|
+
|
|
787
|
+
## Cheap Default Flow
|
|
788
|
+
|
|
789
|
+
1. Read \`${MARTIN_STATIC_RESOURCE_URIS.agentNextStep}\` first. It is the smallest "what should I do now?" payload.
|
|
790
|
+
2. If no runs exist, call \`martin_doctor\`, then \`martin_preflight\`.
|
|
791
|
+
3. If a run exists, read \`${MARTIN_STATIC_RESOURCE_URIS.latestSummary}\` before reading full run JSON.
|
|
792
|
+
4. If the verifier failed, use prompt \`martin_debug_failed_run\` or \`martin_triage\`.
|
|
793
|
+
5. If you need a shareable receipt, read \`${MARTIN_STATIC_RESOURCE_URIS.latestProofCard}\`.
|
|
794
|
+
|
|
795
|
+
## Install Profiles
|
|
796
|
+
|
|
797
|
+
- \`minimal\` (default): doctor, preflight, list, triage, dossier. Good for low tool bloat.
|
|
798
|
+
- \`diagnostic\`: read-only inspection tools for debugging without execution.
|
|
799
|
+
- \`full-local\`: all local tools, including \`martin_run\`.
|
|
800
|
+
- \`github-review\`: review-oriented local profile for PR drafting and reviewer evidence.
|
|
801
|
+
- \`starter\` and \`full\`: compatibility aliases.
|
|
802
|
+
|
|
803
|
+
## Copy-Paste Agent Rule
|
|
804
|
+
|
|
805
|
+
Before running or retrying an autonomous coding task, call Martin. Prefer compact resources first, then full dossiers only when the compact receipt says more evidence is needed. Never claim success unless Martin shows verifier-backed completion or a clear blocked reason.
|
|
752
806
|
`;
|
|
753
807
|
}
|
|
754
808
|
function buildCommandMapGuide(runsRoot) {
|
|
755
809
|
const metadata = buildMartinDiscoveryMetadata(MARTIN_MCP_PACKAGE_VERSION);
|
|
756
|
-
return `# Martin Command Map
|
|
757
|
-
|
|
758
|
-
Discovery revision: \`${metadata.discoveryRevision}\`
|
|
759
|
-
Server version: \`${metadata.serverVersion}\`
|
|
760
|
-
Runs root: \`${runsRoot}\`
|
|
761
|
-
|
|
762
|
-
Use this guide when an IDE or agent needs to know which Martin surface to call next.
|
|
763
|
-
|
|
764
|
-
## Default Governed Sequence
|
|
765
|
-
|
|
766
|
-
1. \`martin_doctor\` — confirm environment and visibility.
|
|
767
|
-
2. \`martin_plan\` — propose the bounded approach without spending a run.
|
|
768
|
-
3. \`martin_preflight\` — turn the plan into an explicit contract.
|
|
769
|
-
4. \`martin_run\` — execute only after the contract is safe.
|
|
770
|
-
5. \`martin_dossier\` — inspect what happened and what Martin prevented.
|
|
771
|
-
6. \`martin_eval\` — convert the result into review posture when needed.
|
|
772
|
-
|
|
773
|
-
## When To Use Which Surface
|
|
774
|
-
|
|
775
|
-
- Need the smallest next action: \`${MARTIN_STATIC_RESOURCE_URIS.agentNextStep}\`
|
|
776
|
-
- Need a quick receipt: \`${MARTIN_STATIC_RESOURCE_URIS.latestSummary}\`
|
|
777
|
-
- Need a shareable proof object: \`${MARTIN_STATIC_RESOURCE_URIS.latestProofCard}\`
|
|
778
|
-
- Need a full run review: \`martin_dossier\`
|
|
779
|
-
- Need to decide whether to retry: \`martin_triage_runs\`
|
|
780
|
-
- Need IDE setup guidance: \`${MARTIN_STATIC_RESOURCE_URIS.ideOnboardingGuide}\`
|
|
810
|
+
return `# Martin Command Map
|
|
811
|
+
|
|
812
|
+
Discovery revision: \`${metadata.discoveryRevision}\`
|
|
813
|
+
Server version: \`${metadata.serverVersion}\`
|
|
814
|
+
Runs root: \`${runsRoot}\`
|
|
815
|
+
|
|
816
|
+
Use this guide when an IDE or agent needs to know which Martin surface to call next.
|
|
817
|
+
|
|
818
|
+
## Default Governed Sequence
|
|
819
|
+
|
|
820
|
+
1. \`martin_doctor\` — confirm environment and visibility.
|
|
821
|
+
2. \`martin_plan\` — propose the bounded approach without spending a run.
|
|
822
|
+
3. \`martin_preflight\` — turn the plan into an explicit contract.
|
|
823
|
+
4. \`martin_run\` — execute only after the contract is safe.
|
|
824
|
+
5. \`martin_dossier\` — inspect what happened and what Martin prevented.
|
|
825
|
+
6. \`martin_eval\` — convert the result into review posture when needed.
|
|
826
|
+
|
|
827
|
+
## When To Use Which Surface
|
|
828
|
+
|
|
829
|
+
- Need the smallest next action: \`${MARTIN_STATIC_RESOURCE_URIS.agentNextStep}\`
|
|
830
|
+
- Need a quick receipt: \`${MARTIN_STATIC_RESOURCE_URIS.latestSummary}\`
|
|
831
|
+
- Need a shareable proof object: \`${MARTIN_STATIC_RESOURCE_URIS.latestProofCard}\`
|
|
832
|
+
- Need a full run review: \`martin_dossier\`
|
|
833
|
+
- Need to decide whether to retry: \`martin_triage_runs\`
|
|
834
|
+
- Need IDE setup guidance: \`${MARTIN_STATIC_RESOURCE_URIS.ideOnboardingGuide}\`
|
|
781
835
|
`;
|
|
782
836
|
}
|
|
783
837
|
function buildIdeOnboardingGuide(runsRoot) {
|
|
784
838
|
const metadata = buildMartinDiscoveryMetadata(MARTIN_MCP_PACKAGE_VERSION);
|
|
785
|
-
return `# Martin IDE Onboarding
|
|
786
|
-
|
|
787
|
-
Discovery revision: \`${metadata.discoveryRevision}\`
|
|
788
|
-
Server version: \`${metadata.serverVersion}\`
|
|
789
|
-
Runs root: \`${runsRoot}\`
|
|
790
|
-
|
|
791
|
-
Use this guide after the MCP server is installed so the host naturally uses MartinLoop during real work.
|
|
792
|
-
|
|
793
|
-
## IDE Default Flow
|
|
794
|
-
|
|
795
|
-
1. Read \`${MARTIN_STATIC_RESOURCE_URIS.agentStartGuide}\`
|
|
796
|
-
2. Read \`${MARTIN_STATIC_RESOURCE_URIS.operatingRulesGuide}\`
|
|
797
|
-
3. Use prompt \`martin_start\` or \`martin_governed_coding_kickoff\`
|
|
798
|
-
4. Call \`martin_doctor\`
|
|
799
|
-
5. Call \`martin_plan\`
|
|
800
|
-
6. Call \`martin_preflight\`
|
|
801
|
-
7. Only then call \`martin_run\`
|
|
802
|
-
|
|
803
|
-
## Goal
|
|
804
|
-
|
|
805
|
-
MartinLoop should become the normal path for coding work in the host, not a manual extra step the human has to remember.
|
|
839
|
+
return `# Martin IDE Onboarding
|
|
840
|
+
|
|
841
|
+
Discovery revision: \`${metadata.discoveryRevision}\`
|
|
842
|
+
Server version: \`${metadata.serverVersion}\`
|
|
843
|
+
Runs root: \`${runsRoot}\`
|
|
844
|
+
|
|
845
|
+
Use this guide after the MCP server is installed so the host naturally uses MartinLoop during real work.
|
|
846
|
+
|
|
847
|
+
## IDE Default Flow
|
|
848
|
+
|
|
849
|
+
1. Read \`${MARTIN_STATIC_RESOURCE_URIS.agentStartGuide}\`
|
|
850
|
+
2. Read \`${MARTIN_STATIC_RESOURCE_URIS.operatingRulesGuide}\`
|
|
851
|
+
3. Use prompt \`martin_start\` or \`martin_governed_coding_kickoff\`
|
|
852
|
+
4. Call \`martin_doctor\`
|
|
853
|
+
5. Call \`martin_plan\`
|
|
854
|
+
6. Call \`martin_preflight\`
|
|
855
|
+
7. Only then call \`martin_run\`
|
|
856
|
+
|
|
857
|
+
## Goal
|
|
858
|
+
|
|
859
|
+
MartinLoop should become the normal path for coding work in the host, not a manual extra step the human has to remember.
|
|
806
860
|
`;
|
|
807
861
|
}
|
|
808
862
|
function buildOperatingRulesGuide(runsRoot) {
|
|
809
863
|
const metadata = buildMartinDiscoveryMetadata(MARTIN_MCP_PACKAGE_VERSION);
|
|
810
|
-
return `# Martin Operating Rules
|
|
811
|
-
|
|
812
|
-
Discovery revision: \`${metadata.discoveryRevision}\`
|
|
813
|
-
Server version: \`${metadata.serverVersion}\`
|
|
814
|
-
Runs root: \`${runsRoot}\`
|
|
815
|
-
|
|
816
|
-
Use these rules inside the IDE or MCP host as the default MartinLoop operating posture.
|
|
817
|
-
|
|
818
|
-
## Required Sequence Before Real Work
|
|
819
|
-
|
|
820
|
-
1. \`martin_doctor\`
|
|
821
|
-
2. \`martin_plan\`
|
|
822
|
-
3. \`martin_preflight\`
|
|
823
|
-
4. \`martin_run\`
|
|
824
|
-
5. \`martin_dossier\`
|
|
825
|
-
|
|
826
|
-
## Enforcement Rule
|
|
827
|
-
|
|
828
|
-
Do not execute real coding work through MartinLoop until doctor and preflight have both been used for the current task.
|
|
829
|
-
|
|
830
|
-
## Completion Rule
|
|
831
|
-
|
|
832
|
-
Do not claim success until MartinLoop shows verifier-backed completion or an explicit blocked reason backed by evidence.
|
|
864
|
+
return `# Martin Operating Rules
|
|
865
|
+
|
|
866
|
+
Discovery revision: \`${metadata.discoveryRevision}\`
|
|
867
|
+
Server version: \`${metadata.serverVersion}\`
|
|
868
|
+
Runs root: \`${runsRoot}\`
|
|
869
|
+
|
|
870
|
+
Use these rules inside the IDE or MCP host as the default MartinLoop operating posture.
|
|
871
|
+
|
|
872
|
+
## Required Sequence Before Real Work
|
|
873
|
+
|
|
874
|
+
1. \`martin_doctor\`
|
|
875
|
+
2. \`martin_plan\`
|
|
876
|
+
3. \`martin_preflight\`
|
|
877
|
+
4. \`martin_run\`
|
|
878
|
+
5. \`martin_dossier\`
|
|
879
|
+
|
|
880
|
+
## Enforcement Rule
|
|
881
|
+
|
|
882
|
+
Do not execute real coding work through MartinLoop until doctor and preflight have both been used for the current task.
|
|
883
|
+
|
|
884
|
+
## Completion Rule
|
|
885
|
+
|
|
886
|
+
Do not claim success until MartinLoop shows verifier-backed completion or an explicit blocked reason backed by evidence.
|
|
833
887
|
`;
|
|
834
888
|
}
|
|
835
889
|
function buildPublishReadinessGuide(runsRoot) {
|
|
836
890
|
const metadata = buildMartinDiscoveryMetadata(MARTIN_MCP_PACKAGE_VERSION);
|
|
837
|
-
return `# Martin MCP Publish Readiness
|
|
838
|
-
|
|
839
|
-
Discovery revision: \`${metadata.discoveryRevision}\`
|
|
840
|
-
Server version: \`${metadata.serverVersion}\`
|
|
841
|
-
Runs root: \`${runsRoot}\`
|
|
842
|
-
|
|
843
|
-
Use this guide when reviewing whether the public MCP package is ready to publish, promote, or hand off for registry submission.
|
|
844
|
-
|
|
845
|
-
## Review Areas
|
|
846
|
-
|
|
847
|
-
1. Environment health: confirm \`${MARTIN_STATIC_RESOURCE_URIS.serverHealth}\` shows a sane working directory, runs root, and engine availability for the target mode.
|
|
848
|
-
2. Discovery surface: verify tools, prompts, static resources, and resource templates are all discoverable and named consistently.
|
|
849
|
-
3. Run evidence: inspect \`${MARTIN_STATIC_RESOURCE_URIS.recentRuns}\` and, when relevant, \`martin://runs/{loopId}/verification\` to confirm verification outcomes are explainable from persisted data.
|
|
850
|
-
4. Packaging lane: run the MCP package test, build, and smoke-pack commands before calling the package publish-ready.
|
|
851
|
-
5. Findings-first reporting: call out missing schema, integration gaps, triage-critical runs, and verification blockers before summarizing strengths.
|
|
852
|
-
|
|
853
|
-
## Evidence Expectations
|
|
854
|
-
|
|
855
|
-
- Prefer concrete run IDs, attempt indices, and verification summaries over vague statements.
|
|
856
|
-
- Distinguish local package validation from live registry readiness.
|
|
857
|
-
- If a discovery helper exists but is not yet wired into the server, report that as an integration gap instead of treating the capability as fully shipped.
|
|
891
|
+
return `# Martin MCP Publish Readiness
|
|
892
|
+
|
|
893
|
+
Discovery revision: \`${metadata.discoveryRevision}\`
|
|
894
|
+
Server version: \`${metadata.serverVersion}\`
|
|
895
|
+
Runs root: \`${runsRoot}\`
|
|
896
|
+
|
|
897
|
+
Use this guide when reviewing whether the public MCP package is ready to publish, promote, or hand off for registry submission.
|
|
898
|
+
|
|
899
|
+
## Review Areas
|
|
900
|
+
|
|
901
|
+
1. Environment health: confirm \`${MARTIN_STATIC_RESOURCE_URIS.serverHealth}\` shows a sane working directory, runs root, and engine availability for the target mode.
|
|
902
|
+
2. Discovery surface: verify tools, prompts, static resources, and resource templates are all discoverable and named consistently.
|
|
903
|
+
3. Run evidence: inspect \`${MARTIN_STATIC_RESOURCE_URIS.recentRuns}\` and, when relevant, \`martin://runs/{loopId}/verification\` to confirm verification outcomes are explainable from persisted data.
|
|
904
|
+
4. Packaging lane: run the MCP package test, build, and smoke-pack commands before calling the package publish-ready.
|
|
905
|
+
5. Findings-first reporting: call out missing schema, integration gaps, triage-critical runs, and verification blockers before summarizing strengths.
|
|
906
|
+
|
|
907
|
+
## Evidence Expectations
|
|
908
|
+
|
|
909
|
+
- Prefer concrete run IDs, attempt indices, and verification summaries over vague statements.
|
|
910
|
+
- Distinguish local package validation from live registry readiness.
|
|
911
|
+
- If a discovery helper exists but is not yet wired into the server, report that as an integration gap instead of treating the capability as fully shipped.
|
|
858
912
|
`;
|
|
859
913
|
}
|
|
860
914
|
function withDiscoveryMetadata(value, runsRoot) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type ToolName = "martin_run" | "martin_inspect" | "martin_status" | "martin_doctor" | "martin_plan" | "martin_preflight" | "martin_logs" | "martin_cancel" | "martin_pause" | "martin_continue" | "martin_list_runs" | "martin_triage_runs" | "martin_get_run" | "martin_get_attempt" | "martin_get_verification_results" | "martin_run_dossier" | "martin_dossier" | "martin_eval" | "martin_pr_summary" | "martin_create_pr" | "martin_review_pr";
|
|
1
|
+
type ToolName = "martin_run" | "martin_inspect" | "martin_status" | "martin_doctor" | "martin_plan" | "martin_preflight" | "martin_estimate" | "martin_logs" | "martin_cancel" | "martin_pause" | "martin_continue" | "martin_list_runs" | "martin_triage_runs" | "martin_get_run" | "martin_get_attempt" | "martin_get_verification_results" | "martin_run_dossier" | "martin_dossier" | "martin_eval" | "martin_pr_summary" | "martin_create_pr" | "martin_review_pr";
|
|
2
2
|
export { sanitizeToolErrorMessage } from "./tools/tool-errors.js";
|
|
3
3
|
export declare function validateToolInput(name: ToolName, args: unknown): unknown;
|
|
4
4
|
export declare function resolveSafeRepoRoot(repoRoot?: string, workspaceRoot?: string): string;
|
|
@@ -18,6 +18,8 @@ export function validateToolInput(name, args) {
|
|
|
18
18
|
return validatePlanInput(args);
|
|
19
19
|
case "martin_preflight":
|
|
20
20
|
return validatePreflightInput(args);
|
|
21
|
+
case "martin_estimate":
|
|
22
|
+
return validateEstimateInput(args);
|
|
21
23
|
case "martin_logs":
|
|
22
24
|
return validateLogsInput(args);
|
|
23
25
|
case "martin_cancel":
|
|
@@ -258,6 +260,21 @@ function validatePreflightInput(args) {
|
|
|
258
260
|
function validatePlanInput(args) {
|
|
259
261
|
return validateRunInput(args);
|
|
260
262
|
}
|
|
263
|
+
function validateEstimateInput(args) {
|
|
264
|
+
const record = requireObject(args);
|
|
265
|
+
assertAllowedKeys(record, ["objective", "engine", "budgetUsd", "fileScope", "workingDirectory"]);
|
|
266
|
+
const engine = optionalEnum(record.engine, "engine", MARTIN_ENGINE_VALUES);
|
|
267
|
+
const fileScope = normalizeSafePathPatterns(record.fileScope, "fileScope");
|
|
268
|
+
return {
|
|
269
|
+
objective: requireString(record.objective, "objective"),
|
|
270
|
+
...(engine ? { engine } : {}),
|
|
271
|
+
...optionalPositiveNumber(record.budgetUsd, "budgetUsd"),
|
|
272
|
+
...(fileScope ? { fileScope } : {}),
|
|
273
|
+
...(record.workingDirectory !== undefined
|
|
274
|
+
? { workingDirectory: resolveSafeRepoRoot(requireString(record.workingDirectory, "workingDirectory")) }
|
|
275
|
+
: {})
|
|
276
|
+
};
|
|
277
|
+
}
|
|
261
278
|
function validateLogsInput(args) {
|
|
262
279
|
const record = requireObject(args);
|
|
263
280
|
assertAllowedKeys(record, ["file", "loopId", "runsDir", "latest", "limit"]);
|
package/dist/server.d.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* Manual start:
|
|
17
17
|
* node dist/server.js
|
|
18
18
|
*/
|
|
19
|
+
import { type Server as NodeHttpServer } from "node:http";
|
|
19
20
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
20
21
|
export declare function createMartinMcpServer(serverInfo?: {
|
|
21
22
|
name?: string;
|
|
@@ -88,4 +89,26 @@ export declare function connectMartinMcpStdioServer(): Promise<Server<{
|
|
|
88
89
|
} | undefined;
|
|
89
90
|
} | undefined;
|
|
90
91
|
}>>;
|
|
92
|
+
export interface MartinMcpHttpServerOptions {
|
|
93
|
+
host?: string;
|
|
94
|
+
port?: number;
|
|
95
|
+
path?: string;
|
|
96
|
+
}
|
|
97
|
+
export interface MartinMcpHttpServerHandle {
|
|
98
|
+
server: NodeHttpServer;
|
|
99
|
+
host: string;
|
|
100
|
+
port: number;
|
|
101
|
+
path: string;
|
|
102
|
+
endpoint: string;
|
|
103
|
+
close: () => Promise<void>;
|
|
104
|
+
}
|
|
105
|
+
export declare function parseMartinMcpServerArgs(argv: string[]): {
|
|
106
|
+
transport: "stdio";
|
|
107
|
+
} | {
|
|
108
|
+
transport: "http";
|
|
109
|
+
host: string;
|
|
110
|
+
port: number;
|
|
111
|
+
path: string;
|
|
112
|
+
};
|
|
113
|
+
export declare function connectMartinMcpHttpServer(options?: MartinMcpHttpServerOptions): Promise<MartinMcpHttpServerHandle>;
|
|
91
114
|
export declare function isDirectExecutionEntry(entryPath: string | undefined, moduleUrl?: string): boolean;
|