@martinloop/mcp 0.2.0 → 0.2.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/README.md +118 -182
- package/dist/discovery-metadata.d.ts +21 -0
- package/dist/discovery-metadata.js +152 -0
- package/dist/discovery-support.d.ts +62 -0
- package/dist/discovery-support.js +224 -0
- package/dist/package-version.d.ts +1 -0
- package/dist/package-version.js +3 -0
- package/dist/prompts.d.ts +13 -3
- package/dist/prompts.js +537 -74
- package/dist/resources.d.ts +35 -5
- package/dist/resources.js +788 -71
- package/dist/server-validation.d.ts +2 -3
- package/dist/server-validation.js +375 -119
- package/dist/server.d.ts +76 -7
- package/dist/server.js +1478 -394
- package/dist/tools/doctor.d.ts +2 -0
- package/dist/tools/doctor.js +18 -6
- package/dist/tools/eval.d.ts +24 -0
- package/dist/tools/eval.js +65 -0
- package/dist/tools/get-attempt.d.ts +13 -6
- package/dist/tools/get-attempt.js +14 -5
- package/dist/tools/get-run.d.ts +19 -12
- package/dist/tools/get-run.js +20 -11
- package/dist/tools/get-status.d.ts +19 -0
- package/dist/tools/get-status.js +30 -2
- package/dist/tools/get-verification-results.d.ts +10 -7
- package/dist/tools/get-verification-results.js +11 -6
- package/dist/tools/inspect-loop.d.ts +9 -0
- package/dist/tools/inspect-loop.js +11 -2
- package/dist/tools/list-runs.d.ts +25 -5
- package/dist/tools/list-runs.js +21 -4
- package/dist/tools/logs.d.ts +25 -0
- package/dist/tools/logs.js +49 -0
- package/dist/tools/plan.d.ts +20 -0
- package/dist/tools/plan.js +10 -0
- package/dist/tools/pr-tools.d.ts +31 -0
- package/dist/tools/pr-tools.js +111 -0
- package/dist/tools/preflight.d.ts +10 -0
- package/dist/tools/preflight.js +18 -4
- package/dist/tools/run-controls.d.ts +36 -0
- package/dist/tools/run-controls.js +88 -0
- package/dist/tools/run-dossier.d.ts +51 -4
- package/dist/tools/run-dossier.js +100 -5
- package/dist/tools/run-loop.d.ts +19 -0
- package/dist/tools/run-loop.js +61 -4
- package/dist/tools/run-store.d.ts +57 -3
- package/dist/tools/run-store.js +404 -53
- package/dist/tools/tool-errors.d.ts +37 -0
- package/dist/tools/tool-errors.js +170 -0
- package/dist/tools/tool-response.d.ts +16 -0
- package/dist/tools/tool-response.js +34 -0
- package/dist/tools/tool-support.d.ts +92 -2
- package/dist/tools/tool-support.js +385 -63
- package/dist/tools/triage-runs.d.ts +33 -0
- package/dist/tools/triage-runs.js +138 -0
- package/dist/tools/workflow-governance.d.ts +133 -0
- package/dist/tools/workflow-governance.js +581 -0
- package/dist/vendor/adapters/claude-cli.js +0 -1
- package/dist/vendor/adapters/cli-bridge.d.ts +5 -0
- package/dist/vendor/adapters/cli-bridge.js +16 -9
- package/dist/vendor/adapters/direct-provider.js +0 -1
- package/dist/vendor/adapters/index.d.ts +2 -1
- package/dist/vendor/adapters/index.js +2 -1
- package/dist/vendor/adapters/openai-compatible.d.ts +47 -0
- package/dist/vendor/adapters/openai-compatible.js +242 -0
- package/dist/vendor/adapters/runtime-support.js +0 -1
- package/dist/vendor/adapters/stub-agent-cli.js +0 -1
- package/dist/vendor/adapters/stub-direct-provider.js +0 -1
- package/dist/vendor/adapters/verifier-only.js +0 -1
- package/dist/vendor/contracts/governance.js +0 -1
- package/dist/vendor/contracts/index.d.ts +2 -0
- package/dist/vendor/contracts/index.js +1 -1
- package/dist/vendor/contracts/operator.d.ts +19 -0
- package/dist/vendor/contracts/operator.js +11 -0
- package/dist/vendor/core/compiler.js +0 -1
- package/dist/vendor/core/context-integrity.js +0 -1
- package/dist/vendor/core/grounding.js +0 -1
- package/dist/vendor/core/index.js +1 -2
- package/dist/vendor/core/leash.js +19 -12
- package/dist/vendor/core/persistence/compiler.js +0 -1
- package/dist/vendor/core/persistence/index.js +0 -1
- package/dist/vendor/core/persistence/ledger.js +0 -1
- package/dist/vendor/core/persistence/runs-reader.js +0 -1
- package/dist/vendor/core/persistence/store.js +0 -1
- package/dist/vendor/core/policy.js +0 -1
- package/dist/vendor/core/red-blue/red-phase.d.ts +64 -0
- package/dist/vendor/core/red-blue/red-phase.js +135 -0
- package/dist/vendor/core/red-blue/risk-tiers.d.ts +22 -0
- package/dist/vendor/core/red-blue/risk-tiers.js +32 -0
- package/dist/vendor/core/rollback.js +2 -3
- package/dist/workflow-state.d.ts +25 -0
- package/dist/workflow-state.js +102 -0
- package/package.json +12 -7
- package/server.json +2 -2
- package/dist/tools/cockpit-support.d.ts +0 -69
- package/dist/tools/cockpit-support.js +0 -108
package/README.md
CHANGED
|
@@ -1,43 +1,26 @@
|
|
|
1
1
|
# @martinloop/mcp
|
|
2
2
|
|
|
3
|
-
Governed MCP server for AI coding agents
|
|
3
|
+
Governed MCP server for AI coding agents with budgets, receipts, and review-ready evidence.
|
|
4
4
|
|
|
5
|
-
`@martinloop/mcp
|
|
5
|
+
`@martinloop/mcp` is the standalone MartinLoop server for MCP hosts. It stays local-first and stdio-first, and it gives hosts one clear execution path: check readiness, plan the work, preflight the contract, run it, and inspect the result with enough evidence to decide what happens next.
|
|
6
6
|
|
|
7
|
-
- `
|
|
8
|
-
- `martin_preflight`
|
|
9
|
-
- `martin_run`
|
|
10
|
-
- `martin_inspect`
|
|
11
|
-
- `martin_status`
|
|
12
|
-
- `martin_list_runs`
|
|
13
|
-
- `martin_get_run`
|
|
14
|
-
- `martin_get_attempt`
|
|
15
|
-
- `martin_get_verification_results`
|
|
16
|
-
- `martin_run_dossier`
|
|
17
|
-
|
|
18
|
-
Recommended flow:
|
|
19
|
-
|
|
20
|
-
1. `martin_doctor`
|
|
21
|
-
2. `martin_preflight`
|
|
22
|
-
3. `martin_run`
|
|
23
|
-
4. `martin_list_runs`, `martin_run_dossier`, `martin_inspect`, or `martin_status`
|
|
24
|
-
|
|
25
|
-
## What This Server Is For
|
|
7
|
+
The root `martin-loop` package and the standalone `@martinloop/mcp` package move on separate version lines. For the current root release, see [MartinLoop 0.2.8 release notes](../../docs/release/OSS-0.2.8-RELEASE-NOTES.md).
|
|
26
8
|
|
|
27
|
-
|
|
9
|
+
## What is new in 0.2.7
|
|
28
10
|
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
- verifier commands (`verificationPlan`)
|
|
33
|
-
- allowed and denied file globs
|
|
34
|
-
- persisted run records you can inspect afterward
|
|
11
|
+
- better onboarding inside MCP, including guide resources for command mapping, IDE setup, and operating rules
|
|
12
|
+
- a stricter governed run sequence, so `martin_run` refuses to start until matching `martin_doctor`, `martin_plan`, and `martin_preflight` receipts exist for the same task
|
|
13
|
+
- cleaner review and handoff surfaces, especially around dossier, eval, and publish-readiness guidance
|
|
35
14
|
|
|
36
|
-
|
|
15
|
+
If you are installing MartinLoop for the first time, start with the root CLI first:
|
|
37
16
|
|
|
38
|
-
|
|
17
|
+
```sh
|
|
18
|
+
npx martin-loop start
|
|
19
|
+
npx martin-loop tour
|
|
20
|
+
npx martin-loop doctor
|
|
21
|
+
```
|
|
39
22
|
|
|
40
|
-
##
|
|
23
|
+
## Install
|
|
41
24
|
|
|
42
25
|
Run the packaged server directly:
|
|
43
26
|
|
|
@@ -54,176 +37,136 @@ codex mcp add martin-loop -- npx -y @martinloop/mcp
|
|
|
54
37
|
Add it to Claude Code:
|
|
55
38
|
|
|
56
39
|
```sh
|
|
57
|
-
# macOS/Linux
|
|
58
40
|
claude mcp add --transport stdio --scope user martin-loop -- npx -y @martinloop/mcp
|
|
59
|
-
|
|
60
|
-
# Windows PowerShell/cmd
|
|
61
41
|
claude mcp add --transport stdio --scope user martin-loop -- cmd /c npx -y @martinloop/mcp
|
|
62
42
|
```
|
|
63
43
|
|
|
64
|
-
|
|
44
|
+
Generate host config from the root CLI:
|
|
65
45
|
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Codex host configuration in `~/.codex/config.toml`:
|
|
75
|
-
|
|
76
|
-
```toml
|
|
77
|
-
[mcp_servers.martin-loop]
|
|
78
|
-
command = "npx"
|
|
79
|
-
args = ["-y", "@martinloop/mcp"]
|
|
46
|
+
```sh
|
|
47
|
+
npx martin-loop mcp print-config --host codex --transport stdio --profile minimal
|
|
48
|
+
npx martin-loop mcp print-config --host claude --transport stdio --profile diagnostic
|
|
49
|
+
npx martin-loop mcp print-config --host gemini --transport stdio --profile full-local
|
|
50
|
+
npx martin-loop mcp print-config --host generic --transport stdio --profile github-review
|
|
80
51
|
```
|
|
81
52
|
|
|
82
|
-
|
|
53
|
+
Registry/server identifier: `io.github.Keesan12/martin-loop`
|
|
83
54
|
|
|
84
|
-
|
|
85
|
-
- For live `martin_run` usage, either the `claude` CLI or the `codex` CLI must be available on `PATH`
|
|
86
|
-
- For stub or smoke flows, set `MARTIN_LIVE=false`
|
|
55
|
+
## Recommended Flow
|
|
87
56
|
|
|
88
|
-
|
|
57
|
+
1. `martin_doctor`
|
|
58
|
+
2. `martin_plan`
|
|
59
|
+
3. `martin_preflight`
|
|
60
|
+
4. `martin_run`
|
|
61
|
+
5. `martin_status` or `martin_logs`
|
|
62
|
+
6. `martin_dossier` or the `martin_get_*` tools
|
|
63
|
+
7. `martin_eval`
|
|
64
|
+
8. `martin_pr_summary` or `martin_review_pr` when a host is preparing GitHub review output
|
|
89
65
|
|
|
90
|
-
|
|
91
|
-
MARTIN_LIVE=false npx -y @martinloop/mcp
|
|
92
|
-
```
|
|
66
|
+
`martin_run` is the primary coding execution entrypoint. In `0.2.7`, it hard-blocks until the matching readiness, planning, and preflight receipts exist for the same task. That keeps the default flow honest for both humans and agents.
|
|
93
67
|
|
|
94
|
-
##
|
|
68
|
+
## Profiles
|
|
95
69
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
| `martin_inspect` | Read a saved run record or run folder | none | `file`, `runsDir` | `file` may point to a `loop-record.json`, legacy `.jsonl`, or a run directory under the runs root. |
|
|
102
|
-
| `martin_status` | Report budget pressure and stop conditions | exactly one of `loopJson`, `file`, `loopId`, or `latest` | `runsDir` | `latest` must be `true` when used. |
|
|
103
|
-
| `martin_list_runs` | List recent run summaries | none | `runsDir`, `limit` | Read-only cockpit view over local run records. |
|
|
104
|
-
| `martin_get_run` | Load a run dossier | exactly one of `loopId` or `latest` | `runsDir` | Read-only task, budget, cost, and attempt details. |
|
|
105
|
-
| `martin_get_attempt` | Load one attempt | `loopId`, `attemptIndex` | `runsDir` | Read-only attempt evidence. |
|
|
106
|
-
| `martin_get_verification_results` | Extract verifier events | exactly one of `loopId` or `latest` | `runsDir` | Read-only verifier completion summaries. |
|
|
107
|
-
| `martin_run_dossier` | Build a compact review dossier | exactly one of `loopId` or `latest` | `runsDir` | Summary, budget, attempts, and verification evidence. |
|
|
70
|
+
- `minimal`: read-heavy default for safe host setup
|
|
71
|
+
- `diagnostic`: deeper inspection and evaluator support
|
|
72
|
+
- `full-local`: includes execution and run-control helpers for local workflows
|
|
73
|
+
- `github-review`: adds PR review helpers for GitHub-oriented hosts
|
|
74
|
+
- `starter` and `full`: compatibility aliases that map onto the same discovery surface
|
|
108
75
|
|
|
109
|
-
##
|
|
76
|
+
## Tools
|
|
110
77
|
|
|
111
|
-
`
|
|
78
|
+
- `martin_doctor`
|
|
79
|
+
- `martin_plan`
|
|
80
|
+
- `martin_preflight`
|
|
81
|
+
- `martin_run`
|
|
82
|
+
- `martin_inspect`
|
|
83
|
+
- `martin_status`
|
|
84
|
+
- `martin_logs`
|
|
85
|
+
- `martin_pause`
|
|
86
|
+
- `martin_cancel`
|
|
87
|
+
- `martin_continue`
|
|
88
|
+
- `martin_list_runs`
|
|
89
|
+
- `martin_triage_runs`
|
|
90
|
+
- `martin_get_run`
|
|
91
|
+
- `martin_get_attempt`
|
|
92
|
+
- `martin_get_verification_results`
|
|
93
|
+
- `martin_run_dossier`
|
|
94
|
+
- `martin_dossier`
|
|
95
|
+
- `martin_eval`
|
|
96
|
+
- `martin_pr_summary`
|
|
97
|
+
- `martin_create_pr`
|
|
98
|
+
- `martin_review_pr`
|
|
112
99
|
|
|
113
|
-
Resources
|
|
100
|
+
## Resources
|
|
114
101
|
|
|
115
|
-
- `martin://
|
|
102
|
+
- `martin://server/health`
|
|
103
|
+
- `martin://runs/recent`
|
|
104
|
+
- `martin://runs/triage`
|
|
116
105
|
- `martin://runs/latest`
|
|
117
|
-
|
|
118
|
-
|
|
106
|
+
- `martin://runs/latest/summary`
|
|
107
|
+
- `martin://runs/latest/proof-card`
|
|
108
|
+
- `martin://runs/latest/budget-status`
|
|
109
|
+
- `martin://runs/latest/verifier-evidence`
|
|
110
|
+
- `martin://runs/latest/rollback-evidence`
|
|
111
|
+
- `martin://policies/current`
|
|
112
|
+
- `martin://repo/risk-map`
|
|
113
|
+
- `martin://verifiers/results`
|
|
114
|
+
- `martin://agent/next-step`
|
|
115
|
+
- `martin://guides/mcp-usage`
|
|
116
|
+
- `martin://guides/agent-start`
|
|
117
|
+
- `martin://guides/command-map`
|
|
118
|
+
- `martin://guides/ide-onboarding`
|
|
119
|
+
- `martin://guides/operating-rules`
|
|
120
|
+
- `martin://guides/publish-readiness`
|
|
121
|
+
|
|
122
|
+
## Resource Templates
|
|
119
123
|
|
|
120
124
|
- `martin://runs/{loopId}`
|
|
125
|
+
- `martin://runs/{loopId}/dossier`
|
|
121
126
|
- `martin://runs/{loopId}/attempts/{attemptIndex}`
|
|
122
127
|
- `martin://runs/{loopId}/verification`
|
|
123
128
|
|
|
124
|
-
Prompts
|
|
129
|
+
## Prompts
|
|
125
130
|
|
|
126
|
-
- `
|
|
127
|
-
- `
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
- `
|
|
134
|
-
|
|
135
|
-
- `
|
|
136
|
-
|
|
137
|
-
- `
|
|
138
|
-
|
|
139
|
-
- `
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
"workingDirectory": ".",
|
|
157
|
-
"allowedPaths": ["src/**", "tests/**"],
|
|
158
|
-
"deniedPaths": [".env*", "secrets/**"]
|
|
159
|
-
}
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
### `martin_inspect`
|
|
163
|
-
|
|
164
|
-
Inspect the default runs root:
|
|
165
|
-
|
|
166
|
-
```json
|
|
167
|
-
{}
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
Inspect a specific saved loop record under the runs root:
|
|
171
|
-
|
|
172
|
-
```json
|
|
173
|
-
{
|
|
174
|
-
"file": "loop-123/loop-record.json"
|
|
175
|
-
}
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
Inspect a subdirectory under the configured runs root:
|
|
179
|
-
|
|
180
|
-
```json
|
|
181
|
-
{
|
|
182
|
-
"runsDir": "team-a"
|
|
183
|
-
}
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
### `martin_status`
|
|
187
|
-
|
|
188
|
-
Status for the latest saved run:
|
|
189
|
-
|
|
190
|
-
```json
|
|
191
|
-
{
|
|
192
|
-
"latest": true
|
|
193
|
-
}
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
Status for a specific persisted loop:
|
|
197
|
-
|
|
198
|
-
```json
|
|
199
|
-
{
|
|
200
|
-
"loopId": "loop-123"
|
|
201
|
-
}
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
Status from inline JSON:
|
|
131
|
+
- `martin_start`
|
|
132
|
+
- `martin_preflight`
|
|
133
|
+
- `martin_triage`
|
|
134
|
+
- `martin_resume`
|
|
135
|
+
- `martin_prove`
|
|
136
|
+
- `martin_release_check`
|
|
137
|
+
- `martin_governed_coding_kickoff`
|
|
138
|
+
- `martin_debug_failed_run`
|
|
139
|
+
- `martin_publish_readiness_review`
|
|
140
|
+
- `martin_triage_run_store`
|
|
141
|
+
- `safe_bug_fix`
|
|
142
|
+
- `write_tests_first`
|
|
143
|
+
- `small_refactor`
|
|
144
|
+
- `security_review`
|
|
145
|
+
- `pr_review`
|
|
146
|
+
- `release_check`
|
|
147
|
+
|
|
148
|
+
## Runtime Model
|
|
149
|
+
|
|
150
|
+
- `martin_run` is the primary coding execution entrypoint.
|
|
151
|
+
- `martin_run` now blocks until the same task has matching `martin_doctor`, `martin_plan`, and `martin_preflight` receipts.
|
|
152
|
+
- `martin_plan`, `martin_doctor`, `martin_preflight`, `martin_status`, `martin_logs`, `martin_dossier`, `martin_eval`, and the `martin_get_*` family are planning or inspection surfaces.
|
|
153
|
+
- `martin_pause`, `martin_cancel`, `martin_continue`, and `martin_create_pr` are explicit follow-on control helpers and stay out of the default `minimal` profile.
|
|
154
|
+
- Live runs require `claude` or `codex` on `PATH`.
|
|
155
|
+
- Stub or smoke flows use `MARTIN_LIVE=false`.
|
|
156
|
+
- Paths stay bounded to the configured workspace root and runs root.
|
|
157
|
+
|
|
158
|
+
## Debugging
|
|
159
|
+
|
|
160
|
+
Use the live handshake inspector before you blame a host config:
|
|
205
161
|
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
"loopJson": "{\"loopId\":\"loop-123\",\"status\":\"completed\",\"lifecycleState\":\"completed\",\"attempts\":[],\"budget\":{\"maxUsd\":5,\"softLimitUsd\":3,\"maxIterations\":2,\"maxTokens\":1000},\"cost\":{\"actualUsd\":1.25,\"avoidedUsd\":0,\"tokensIn\":20,\"tokensOut\":10}}"
|
|
209
|
-
}
|
|
162
|
+
```sh
|
|
163
|
+
pnpm --filter @martinloop/mcp inspect:live
|
|
210
164
|
```
|
|
211
165
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
The registry manifest artifact for this package is `server.json`. In this repository, that manifest is authored at `packages/mcp/server.json`.
|
|
215
|
-
|
|
216
|
-
Current metadata:
|
|
217
|
-
|
|
218
|
-
- npm package: `@martinloop/mcp`
|
|
219
|
-
- registry server name: `io.github.Keesan12/martin-loop`
|
|
220
|
-
- manifest artifact name: `server.json`
|
|
221
|
-
|
|
222
|
-
Official MCP Registry publication is separate from npm publication. After publishing the package to npm, run the publisher from `packages/mcp`:
|
|
166
|
+
If you want the official MCP Inspector UI, point it at the same stdio launch command:
|
|
223
167
|
|
|
224
168
|
```sh
|
|
225
|
-
|
|
226
|
-
mcp-publisher publish
|
|
169
|
+
npx @modelcontextprotocol/inspector --command npx --args "-y,@martinloop/mcp"
|
|
227
170
|
```
|
|
228
171
|
|
|
229
172
|
## Verification
|
|
@@ -237,14 +180,7 @@ pnpm --filter @martinloop/mcp build
|
|
|
237
180
|
pnpm --filter @martinloop/mcp smoke:pack
|
|
238
181
|
pnpm --filter @martinloop/mcp smoke:published:pack
|
|
239
182
|
pnpm --filter @martinloop/mcp verify:release
|
|
240
|
-
pnpm --filter @
|
|
183
|
+
pnpm --filter @martin/cli verify:hosts:live
|
|
241
184
|
```
|
|
242
185
|
|
|
243
|
-
|
|
244
|
-
- `smoke:published:pack` verifies install-and-run behavior from a freshly packed local tarball before npm publish
|
|
245
|
-
- `verify:release` checks metadata parity, release-note presence, and public MCP doc accuracy for the current package version
|
|
246
|
-
- `smoke:published` verifies the npm-installed artifact through `npm install` plus live MCP tool calls
|
|
247
|
-
|
|
248
|
-
## Version Notes
|
|
249
|
-
|
|
250
|
-
The root `CHANGELOG.md` is repo-wide and includes non-MCP changes. For the `@martinloop/mcp` surface, prefer this README and `server.json`.
|
|
186
|
+
See [MCP setup](../../docs/getting-started/mcp.md), [MCP tool reference](../../docs/reference/mcp-tools.md), and [MCP compatibility](../../docs/reference/mcp-compatibility.md).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const MARTIN_TOOL_NAMES: readonly ["martin_run", "martin_inspect", "martin_status", "martin_doctor", "martin_plan", "martin_preflight", "martin_logs", "martin_pause", "martin_cancel", "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
|
+
export declare const MARTIN_STARTER_TOOL_NAMES: readonly ["martin_doctor", "martin_plan", "martin_preflight", "martin_run", "martin_triage_runs", "martin_dossier"];
|
|
3
|
+
export declare const MARTIN_MINIMAL_TOOL_NAMES: readonly ["martin_doctor", "martin_plan", "martin_preflight", "martin_list_runs", "martin_triage_runs", "martin_dossier"];
|
|
4
|
+
export declare const MARTIN_DIAGNOSTIC_TOOL_NAMES: readonly ["martin_doctor", "martin_plan", "martin_preflight", "martin_logs", "martin_list_runs", "martin_triage_runs", "martin_get_run", "martin_get_attempt", "martin_get_verification_results", "martin_dossier", "martin_eval"];
|
|
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
|
+
export declare const MARTIN_PAID_REMOTE_TOOL_NAMES: readonly ["martin_doctor", "martin_plan", "martin_preflight", "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://guides/mcp-usage", "martin://guides/agent-start", "martin://guides/command-map", "martin://guides/ide-onboarding", "martin://guides/operating-rules", "martin://guides/publish-readiness"];
|
|
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
|
+
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
|
+
export interface MartinDiscoveryMetadata {
|
|
11
|
+
serverVersion: string;
|
|
12
|
+
discoveryRevision: string;
|
|
13
|
+
generatedAt: string;
|
|
14
|
+
toolCount: number;
|
|
15
|
+
resourceCount: number;
|
|
16
|
+
resourceTemplateCount: number;
|
|
17
|
+
promptCount: number;
|
|
18
|
+
starterTools: string[];
|
|
19
|
+
profiles: Record<string, string[]>;
|
|
20
|
+
}
|
|
21
|
+
export declare function buildMartinDiscoveryMetadata(serverVersion: string): MartinDiscoveryMetadata;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
export const MARTIN_TOOL_NAMES = [
|
|
3
|
+
"martin_run",
|
|
4
|
+
"martin_inspect",
|
|
5
|
+
"martin_status",
|
|
6
|
+
"martin_doctor",
|
|
7
|
+
"martin_plan",
|
|
8
|
+
"martin_preflight",
|
|
9
|
+
"martin_logs",
|
|
10
|
+
"martin_pause",
|
|
11
|
+
"martin_cancel",
|
|
12
|
+
"martin_continue",
|
|
13
|
+
"martin_list_runs",
|
|
14
|
+
"martin_triage_runs",
|
|
15
|
+
"martin_get_run",
|
|
16
|
+
"martin_get_attempt",
|
|
17
|
+
"martin_get_verification_results",
|
|
18
|
+
"martin_run_dossier",
|
|
19
|
+
"martin_dossier",
|
|
20
|
+
"martin_eval",
|
|
21
|
+
"martin_pr_summary",
|
|
22
|
+
"martin_create_pr",
|
|
23
|
+
"martin_review_pr"
|
|
24
|
+
];
|
|
25
|
+
export const MARTIN_STARTER_TOOL_NAMES = [
|
|
26
|
+
"martin_doctor",
|
|
27
|
+
"martin_plan",
|
|
28
|
+
"martin_preflight",
|
|
29
|
+
"martin_run",
|
|
30
|
+
"martin_triage_runs",
|
|
31
|
+
"martin_dossier"
|
|
32
|
+
];
|
|
33
|
+
export const MARTIN_MINIMAL_TOOL_NAMES = [
|
|
34
|
+
"martin_doctor",
|
|
35
|
+
"martin_plan",
|
|
36
|
+
"martin_preflight",
|
|
37
|
+
"martin_list_runs",
|
|
38
|
+
"martin_triage_runs",
|
|
39
|
+
"martin_dossier"
|
|
40
|
+
];
|
|
41
|
+
export const MARTIN_DIAGNOSTIC_TOOL_NAMES = [
|
|
42
|
+
"martin_doctor",
|
|
43
|
+
"martin_plan",
|
|
44
|
+
"martin_preflight",
|
|
45
|
+
"martin_logs",
|
|
46
|
+
"martin_list_runs",
|
|
47
|
+
"martin_triage_runs",
|
|
48
|
+
"martin_get_run",
|
|
49
|
+
"martin_get_attempt",
|
|
50
|
+
"martin_get_verification_results",
|
|
51
|
+
"martin_dossier",
|
|
52
|
+
"martin_eval"
|
|
53
|
+
];
|
|
54
|
+
export const MARTIN_GITHUB_REVIEW_TOOL_NAMES = [
|
|
55
|
+
"martin_doctor",
|
|
56
|
+
"martin_plan",
|
|
57
|
+
"martin_preflight",
|
|
58
|
+
"martin_dossier",
|
|
59
|
+
"martin_eval",
|
|
60
|
+
"martin_pr_summary",
|
|
61
|
+
"martin_create_pr",
|
|
62
|
+
"martin_review_pr"
|
|
63
|
+
];
|
|
64
|
+
export const MARTIN_PAID_REMOTE_TOOL_NAMES = [
|
|
65
|
+
"martin_doctor",
|
|
66
|
+
"martin_plan",
|
|
67
|
+
"martin_preflight",
|
|
68
|
+
"martin_run",
|
|
69
|
+
"martin_list_runs",
|
|
70
|
+
"martin_triage_runs",
|
|
71
|
+
"martin_get_run",
|
|
72
|
+
"martin_get_verification_results",
|
|
73
|
+
"martin_dossier",
|
|
74
|
+
"martin_eval"
|
|
75
|
+
];
|
|
76
|
+
export const MARTIN_RESOURCE_URIS = [
|
|
77
|
+
"martin://server/health",
|
|
78
|
+
"martin://runs/recent",
|
|
79
|
+
"martin://runs/triage",
|
|
80
|
+
"martin://runs/latest",
|
|
81
|
+
"martin://runs/latest/summary",
|
|
82
|
+
"martin://runs/latest/proof-card",
|
|
83
|
+
"martin://runs/latest/budget-status",
|
|
84
|
+
"martin://runs/latest/verifier-evidence",
|
|
85
|
+
"martin://runs/latest/rollback-evidence",
|
|
86
|
+
"martin://policies/current",
|
|
87
|
+
"martin://repo/risk-map",
|
|
88
|
+
"martin://verifiers/results",
|
|
89
|
+
"martin://agent/next-step",
|
|
90
|
+
"martin://guides/mcp-usage",
|
|
91
|
+
"martin://guides/agent-start",
|
|
92
|
+
"martin://guides/command-map",
|
|
93
|
+
"martin://guides/ide-onboarding",
|
|
94
|
+
"martin://guides/operating-rules",
|
|
95
|
+
"martin://guides/publish-readiness"
|
|
96
|
+
];
|
|
97
|
+
export const MARTIN_RESOURCE_TEMPLATE_URIS = [
|
|
98
|
+
"martin://runs/{loopId}",
|
|
99
|
+
"martin://runs/{loopId}/dossier",
|
|
100
|
+
"martin://runs/{loopId}/attempts/{attemptIndex}",
|
|
101
|
+
"martin://runs/{loopId}/verification"
|
|
102
|
+
];
|
|
103
|
+
export const MARTIN_PROMPT_NAMES = [
|
|
104
|
+
"martin_start",
|
|
105
|
+
"martin_preflight",
|
|
106
|
+
"martin_triage",
|
|
107
|
+
"martin_resume",
|
|
108
|
+
"martin_prove",
|
|
109
|
+
"martin_release_check",
|
|
110
|
+
"martin_governed_coding_kickoff",
|
|
111
|
+
"martin_debug_failed_run",
|
|
112
|
+
"martin_publish_readiness_review",
|
|
113
|
+
"martin_triage_run_store",
|
|
114
|
+
"safe_bug_fix",
|
|
115
|
+
"write_tests_first",
|
|
116
|
+
"small_refactor",
|
|
117
|
+
"security_review",
|
|
118
|
+
"pr_review",
|
|
119
|
+
"release_check"
|
|
120
|
+
];
|
|
121
|
+
export function buildMartinDiscoveryMetadata(serverVersion) {
|
|
122
|
+
const surface = {
|
|
123
|
+
tools: [...MARTIN_TOOL_NAMES],
|
|
124
|
+
resources: [...MARTIN_RESOURCE_URIS],
|
|
125
|
+
resourceTemplates: [...MARTIN_RESOURCE_TEMPLATE_URIS],
|
|
126
|
+
prompts: [...MARTIN_PROMPT_NAMES],
|
|
127
|
+
starterTools: [...MARTIN_STARTER_TOOL_NAMES],
|
|
128
|
+
profiles: {
|
|
129
|
+
minimal: [...MARTIN_MINIMAL_TOOL_NAMES],
|
|
130
|
+
diagnostic: [...MARTIN_DIAGNOSTIC_TOOL_NAMES],
|
|
131
|
+
"github-review": [...MARTIN_GITHUB_REVIEW_TOOL_NAMES],
|
|
132
|
+
"full-local": [...MARTIN_TOOL_NAMES],
|
|
133
|
+
starter: [...MARTIN_STARTER_TOOL_NAMES],
|
|
134
|
+
full: [...MARTIN_TOOL_NAMES]
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const discoveryRevision = createHash("sha256")
|
|
138
|
+
.update(JSON.stringify({ serverVersion, surface }))
|
|
139
|
+
.digest("hex")
|
|
140
|
+
.slice(0, 12);
|
|
141
|
+
return {
|
|
142
|
+
serverVersion,
|
|
143
|
+
discoveryRevision,
|
|
144
|
+
generatedAt: new Date().toISOString(),
|
|
145
|
+
toolCount: surface.tools.length,
|
|
146
|
+
resourceCount: surface.resources.length,
|
|
147
|
+
resourceTemplateCount: surface.resourceTemplates.length,
|
|
148
|
+
promptCount: surface.prompts.length,
|
|
149
|
+
starterTools: [...surface.starterTools],
|
|
150
|
+
profiles: surface.profiles
|
|
151
|
+
};
|
|
152
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type LedgerEvent, type LoopAttemptRecord, type LoopRunRecord } from "./vendor/core/index.js";
|
|
2
|
+
import type { LoopArtifact, LoopAttempt, LoopEvent, LoopTask } from "./vendor/contracts/index.js";
|
|
3
|
+
import { type LoopPreview, type MartinEngine } from "./tools/tool-support.js";
|
|
4
|
+
type PersistedLoopTask = LoopRunRecord["task"] & Partial<Pick<LoopTask, "verificationPlan" | "verificationStack" | "repoRoot" | "allowedPaths" | "deniedPaths" | "acceptanceCriteria" | "mutationMode" | "executionProfile" | "allowedNetworkDomains" | "approvalPolicy">>;
|
|
5
|
+
export type PersistedLoopAttemptRecord = LoopAttemptRecord & Partial<Pick<LoopAttempt, "attemptId" | "summary">>;
|
|
6
|
+
export interface PersistedLoopRecord extends LoopRunRecord {
|
|
7
|
+
workspaceId?: string;
|
|
8
|
+
projectId?: string;
|
|
9
|
+
teamId?: string;
|
|
10
|
+
task: PersistedLoopTask;
|
|
11
|
+
attempts: PersistedLoopAttemptRecord[];
|
|
12
|
+
artifacts?: LoopArtifact[];
|
|
13
|
+
events?: LoopEvent[];
|
|
14
|
+
metadata?: Record<string, string>;
|
|
15
|
+
}
|
|
16
|
+
export interface MartinDiscoveryContext {
|
|
17
|
+
runsRoot: string;
|
|
18
|
+
workingDirectory: string;
|
|
19
|
+
engine?: MartinEngine;
|
|
20
|
+
}
|
|
21
|
+
export interface MartinVerificationSnapshot {
|
|
22
|
+
attemptId?: string;
|
|
23
|
+
attemptIndex?: number;
|
|
24
|
+
timestamp: string;
|
|
25
|
+
lifecycleState: string;
|
|
26
|
+
passed?: boolean;
|
|
27
|
+
summary?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface MartinAttemptSnapshot {
|
|
30
|
+
loopId: string;
|
|
31
|
+
attemptIndex: number;
|
|
32
|
+
loop: LoopPreview;
|
|
33
|
+
attempt: PersistedLoopAttemptRecord;
|
|
34
|
+
verification?: MartinVerificationSnapshot;
|
|
35
|
+
warnings: string[];
|
|
36
|
+
}
|
|
37
|
+
export interface MartinVerificationHistorySnapshot {
|
|
38
|
+
loopId: string;
|
|
39
|
+
loop: LoopPreview;
|
|
40
|
+
verificationCount: number;
|
|
41
|
+
latestVerification?: MartinVerificationSnapshot;
|
|
42
|
+
verificationHistory: MartinVerificationSnapshot[];
|
|
43
|
+
warnings: string[];
|
|
44
|
+
}
|
|
45
|
+
export declare function resolveMartinDiscoveryContext(input?: {
|
|
46
|
+
runsDir?: string;
|
|
47
|
+
workingDirectory?: string;
|
|
48
|
+
engine?: MartinEngine;
|
|
49
|
+
}): MartinDiscoveryContext;
|
|
50
|
+
export declare function loadPersistedLoopRecord(input: {
|
|
51
|
+
loopId: string;
|
|
52
|
+
runsDir?: string;
|
|
53
|
+
}): Promise<{
|
|
54
|
+
source: string;
|
|
55
|
+
loop: PersistedLoopRecord;
|
|
56
|
+
}>;
|
|
57
|
+
export declare function buildAttemptSnapshot(loop: PersistedLoopRecord, requestedAttemptIndex?: number, ledgerEvents?: LedgerEvent[]): MartinAttemptSnapshot;
|
|
58
|
+
export declare function buildVerificationHistorySnapshot(loop: PersistedLoopRecord, ledgerEvents?: LedgerEvent[]): MartinVerificationHistorySnapshot;
|
|
59
|
+
export declare function buildPersistedLoopPreview(loop: PersistedLoopRecord): LoopPreview;
|
|
60
|
+
export declare function parseAttemptIndex(value: string): number;
|
|
61
|
+
export declare function toPrettyJson(value: unknown): string;
|
|
62
|
+
export {};
|