Skip to content

Commit 74e1131

Browse files
authored
Merge pull request #1 from multiagentcoordinationprotocol/initial-runtime
The basic runtime for MACP
2 parents 5dfb760 + dbcedcd commit 74e1131

30 files changed

Lines changed: 4124 additions & 0 deletions

.githooks/pre-commit

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
echo "Running cargo fmt check..."
5+
cargo fmt --all -- --check
6+
if [ $? -ne 0 ]; then
7+
echo ""
8+
echo "Commit rejected: code is not formatted."
9+
echo "Run 'cargo fmt --all' to fix formatting, then try again."
10+
exit 1
11+
fi
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
name: Bug Report
3+
description: Report a problem with the MACP runtime
4+
title: "[BUG] "
5+
labels: ["bug"]
6+
body:
7+
- type: textarea
8+
id: description
9+
attributes:
10+
label: Description
11+
description: Describe the issue clearly.
12+
validations:
13+
required: true
14+
15+
- type: textarea
16+
id: reproduction
17+
attributes:
18+
label: Reproduction Steps
19+
description: Steps or example envelope/client code that demonstrates the issue.
20+
21+
- type: textarea
22+
id: expected
23+
attributes:
24+
label: Expected Behavior
25+
description: What should happen according to the protocol?
26+
27+
- type: textarea
28+
id: environment
29+
attributes:
30+
label: Environment
31+
description: Rust version, OS, protoc version, etc.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
name: RFC / Enhancement Proposal
3+
description: Propose a change or extension to the MACP runtime
4+
title: "[RFC] "
5+
labels: ["enhancement"]
6+
body:
7+
- type: textarea
8+
id: summary
9+
attributes:
10+
label: Summary
11+
description: High-level overview of the proposal.
12+
validations:
13+
required: true
14+
15+
- type: textarea
16+
id: motivation
17+
attributes:
18+
label: Motivation
19+
description: Why is this needed?
20+
21+
- type: textarea
22+
id: specification
23+
attributes:
24+
label: Proposed Changes
25+
description: Detailed specification changes.
26+
27+
- type: textarea
28+
id: compatibility
29+
attributes:
30+
label: Backward Compatibility
31+
description: Does this introduce breaking changes?

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
## Summary
3+
4+
Describe the changes introduced by this pull request.
5+
6+
## Type of Change
7+
8+
- [ ] New feature
9+
- [ ] Bug fix
10+
- [ ] Refactoring
11+
- [ ] New mode implementation
12+
- [ ] Proto schema change
13+
- [ ] Documentation improvement
14+
- [ ] CI / tooling change
15+
16+
## Checklist
17+
18+
- [ ] `cargo test` passes
19+
- [ ] `cargo clippy` has no warnings
20+
- [ ] `cargo fmt` has been run
21+
- [ ] Protobuf definitions compile successfully
22+
- [ ] New modes implement the `Mode` trait correctly (if applicable)
23+
- [ ] Error variants added to `MacpError` (if applicable)
24+
- [ ] This change preserves MACP Core invariants

.github/workflows/ci.yml

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
name: MACP Runtime CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [ main ]
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
check:
13+
name: Check
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Install Rust toolchain
21+
uses: dtolnay/rust-toolchain@stable
22+
23+
- name: Cache cargo registry and build
24+
uses: actions/cache@v4
25+
with:
26+
path: |
27+
~/.cargo/registry
28+
~/.cargo/git
29+
target
30+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
31+
restore-keys: ${{ runner.os }}-cargo-
32+
33+
- name: Install protoc
34+
run: |
35+
sudo apt-get update
36+
sudo apt-get install -y protobuf-compiler
37+
38+
- name: Cargo check
39+
run: cargo check --all-targets
40+
41+
fmt:
42+
name: Format
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- name: Checkout repository
47+
uses: actions/checkout@v4
48+
49+
- name: Install Rust toolchain
50+
uses: dtolnay/rust-toolchain@stable
51+
with:
52+
components: rustfmt
53+
54+
- name: Check formatting
55+
run: cargo fmt --all -- --check
56+
57+
clippy:
58+
name: Clippy
59+
runs-on: ubuntu-latest
60+
61+
steps:
62+
- name: Checkout repository
63+
uses: actions/checkout@v4
64+
65+
- name: Install Rust toolchain
66+
uses: dtolnay/rust-toolchain@stable
67+
with:
68+
components: clippy
69+
70+
- name: Cache cargo registry and build
71+
uses: actions/cache@v4
72+
with:
73+
path: |
74+
~/.cargo/registry
75+
~/.cargo/git
76+
target
77+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
78+
restore-keys: ${{ runner.os }}-cargo-
79+
80+
- name: Install protoc
81+
run: |
82+
sudo apt-get update
83+
sudo apt-get install -y protobuf-compiler
84+
85+
- name: Run clippy
86+
run: cargo clippy --all-targets -- -D warnings
87+
88+
test:
89+
name: Test
90+
runs-on: ubuntu-latest
91+
92+
steps:
93+
- name: Checkout repository
94+
uses: actions/checkout@v4
95+
96+
- name: Install Rust toolchain
97+
uses: dtolnay/rust-toolchain@stable
98+
99+
- name: Cache cargo registry and build
100+
uses: actions/cache@v4
101+
with:
102+
path: |
103+
~/.cargo/registry
104+
~/.cargo/git
105+
target
106+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
107+
restore-keys: ${{ runner.os }}-cargo-
108+
109+
- name: Install protoc
110+
run: |
111+
sudo apt-get update
112+
sudo apt-get install -y protobuf-compiler
113+
114+
- name: Run tests
115+
run: cargo test --all-targets
116+
117+
build:
118+
name: Build
119+
runs-on: ubuntu-latest
120+
121+
steps:
122+
- name: Checkout repository
123+
uses: actions/checkout@v4
124+
125+
- name: Install Rust toolchain
126+
uses: dtolnay/rust-toolchain@stable
127+
128+
- name: Cache cargo registry and build
129+
uses: actions/cache@v4
130+
with:
131+
path: |
132+
~/.cargo/registry
133+
~/.cargo/git
134+
target
135+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
136+
restore-keys: ${{ runner.os }}-cargo-
137+
138+
- name: Install protoc
139+
run: |
140+
sudo apt-get update
141+
sudo apt-get install -y protobuf-compiler
142+
143+
- name: Build release
144+
run: cargo build --release
145+
146+
lint-protobuf:
147+
name: Lint Protocol Buffers
148+
runs-on: ubuntu-latest
149+
150+
steps:
151+
- name: Checkout repository
152+
uses: actions/checkout@v4
153+
154+
- name: Install buf
155+
uses: bufbuild/buf-setup-action@v1
156+
with:
157+
github_token: ${{ secrets.GITHUB_TOKEN }}
158+
159+
- name: Lint protobuf with buf
160+
run: buf lint proto
161+
162+
- name: Check for breaking changes
163+
if: github.event_name == 'pull_request'
164+
run: |
165+
git fetch origin main
166+
# Skip if main branch doesn't have a buf module yet
167+
if git show origin/main:proto/buf.yaml > /dev/null 2>&1; then
168+
buf breaking proto --against '.git#branch=origin/main,subdir=proto'
169+
else
170+
echo "No buf module found on main branch, skipping breaking change check"
171+
fi
172+
173+
ci-pass:
174+
name: All Checks Passed
175+
runs-on: ubuntu-latest
176+
needs: [check, fmt, clippy, test, build, lint-protobuf]
177+
178+
steps:
179+
- name: Summary
180+
run: |
181+
echo "All checks passed successfully"
182+
echo " - cargo check"
183+
echo " - cargo fmt"
184+
echo " - cargo clippy"
185+
echo " - cargo test"
186+
echo " - cargo build --release"
187+
echo " - protobuf lint"

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Rust
2+
/target/
3+
**/*.rs.bk
4+
*.pdb
5+
Cargo.lock
6+
7+
# Build artifacts
8+
/out/
9+
10+
# IDE / Editor
11+
.vscode/
12+
.idea/
13+
*.swp
14+
*.swo
15+
*~
16+
17+
# Claude Code
18+
.claude/
19+
CLAUDE.md
20+
/plans/
21+
/tmp/
22+
/temp/
23+
24+
# OS
25+
.DS_Store
26+
Thumbs.db

Cargo.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[package]
2+
name = "macp-runtime"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
tokio = { version = "1", features = ["full"] }
8+
tonic = "0.11"
9+
prost = "0.12"
10+
prost-types = "0.12"
11+
uuid = { version = "1", features = ["v4"] }
12+
thiserror = "1"
13+
chrono = "0.4"
14+
serde = { version = "1", features = ["derive"] }
15+
serde_json = "1"
16+
17+
[build-dependencies]
18+
tonic-build = "0.11"

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.PHONY: setup build test fmt clippy check
2+
3+
## First-time setup: configure git hooks
4+
setup:
5+
git config core.hooksPath .githooks
6+
@echo "Git hooks configured."
7+
8+
build:
9+
cargo build
10+
11+
test:
12+
cargo test
13+
14+
fmt:
15+
cargo fmt --all
16+
17+
clippy:
18+
cargo clippy --all-targets -- -D warnings
19+
20+
check: fmt clippy test

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# macp-runtime v0.1
2+
3+
Minimal Coordination Runtime (MCR)
4+
5+
## Run
6+
7+
Install protoc first.
8+
9+
Then:
10+
11+
cargo build
12+
cargo run
13+
14+
Server runs on 127.0.0.1:50051
15+
16+
Send SessionStart, then Message.
17+
If payload == "resolve", session transitions to RESOLVED.

build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fn main() -> Result<(), Box<dyn std::error::Error>> {
2+
tonic_build::configure()
3+
.build_server(true)
4+
.compile(&["macp/v1/macp.proto"], &["proto"])?;
5+
Ok(())
6+
}

0 commit comments

Comments
 (0)