Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f0f7823
chore: automated release pipeline + changeset tooling
agentiknet Jun 20, 2026
e38062b
fix(ci): replace changeset status with git diff check
agentiknet Jun 20, 2026
360b349
chore(ci): remove FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 — GitHub enforce…
agentiknet Jun 20, 2026
80d8db2
feat(ci): auto-generate changeset via Claude on PRs
agentiknet Jun 20, 2026
3630aca
chore: sync pnpm-lock.yaml after adding @changesets/cli
agentiknet Jun 20, 2026
07c1d4a
feat(driver): expose driver doctype via MCP create_driver verb
agentiknet Jun 20, 2026
6d901f8
feat(agent): validate extends-chain depth/cycles and enforce on load
agentiknet Jun 20, 2026
fbc2efc
feat(mcp-server): add self_inspect tool for agent introspection
agentiknet Jun 20, 2026
863f9f4
feat(manifest): add updateManifestSet for atomic multi-file writes
agentiknet Jun 20, 2026
2a088a0
test(mcp-server): e2e create_driver + self_inspect through MCP transport
agentiknet Jun 20, 2026
857d8bc
chore: sync lockfile — mastra downgrade @mastra/core 1.45.0→1.32.1
agentiknet Jun 20, 2026
42b7090
chore: sync lockfile — adapters/mastra @mastra/core 1.45.0→1.32.1
agentiknet Jun 20, 2026
b69816a
fix(runtime): add model? to AgentAdapterResolver.startSession type
agentiknet Jun 20, 2026
ac16060
fix(cli): define AgentCliCommand locally — not yet exported from driv…
agentiknet Jun 20, 2026
00c3563
fix(mcp-server): cast content to typed array + optional chain on tool…
agentiknet Jun 20, 2026
bb58f5f
fix(ci): auto-changeset runs only after build passes + remove as-cast
agentiknet Jun 20, 2026
f294afc
fix(mcp-server): narrow result.content through Array.isArray (noUnche…
agentiknet Jun 20, 2026
9d92f83
chore(ci): bump actions to node24 runtimes (checkout@v5, setup-node@v…
agentiknet Jun 20, 2026
44192c9
chore: replace incomplete changeset with complete self-construction c…
agentiknet Jun 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Release process

## How releases work

This repo uses [Changesets](https://github.com/changesets/changesets) for
automated versioning and npm publishing.

### Automated flow (CI)

1. **Feature branch** — develop and test your changes.
2. **Add a changeset** before opening a PR:
```bash
pnpm changeset
# pick affected packages, bump type (patch/minor/major), write a description
```
This creates a `.changeset/<random-slug>.md` file. Commit it with your code.
3. **Open a PR** — CI validates the changeset is present.
4. **Merge to `main`** — `release.yml` runs and does one of two things:
- **Pending changesets exist** → opens/updates a "Version Packages" PR that
bumps all affected package versions and updates CHANGELOGs.
- **No pending changesets** (i.e. the "Version Packages" PR was just merged)
→ publishes every changed package to npm and creates GitHub releases.

### Manual publish (emergency / first publish of a new package)

```bash
# Dry-run first
scripts/publish-packages.sh --dry-run

# Publish with NPM_TOKEN in env
NPM_TOKEN=<token> scripts/publish-packages.sh

# Or let it prompt for TOTP
scripts/publish-packages.sh
```

## Secrets required

| Secret | Where | Notes |
|---|---|---|
| `NPM_TOKEN` | GitHub repo → Settings → Secrets | Granular access token for the `@agentproto` npm org. See note below on auth options. |
| `GITHUB_TOKEN` | Automatic | Provided by GitHub Actions; needs `contents: write` + `pull-requests: write` (set in `release.yml`). |

### NPM auth options (pick one)

**A. OIDC Trusted Publishing** — zero secrets, best security. Requires `id-token: write` permission in
`release.yml` and manually configuring a "Trusted Publisher" on npm.com for each published package
(Package settings → Access → Trusted Publishers → add the GitHub repo + workflow name). Not practical
with 50+ packages unless you script the npm API.

**B. Granular access token with "Bypass 2FA"** — what `release.yml` uses by default. "Bypass 2FA" is
npm's official CI publishing feature (not a security bypass): it lets a token perform write operations
without an OTP code, which is required for any unattended publish job. Create the token at
[npmjs.com/settings/agentiknet/tokens](https://www.npmjs.com/settings/agentiknet/tokens): choose
"Granular Access Token" → select the `@agentproto` packages → check "Bypass 2FA" → expiry ≤ 1 year.

If you later move to OIDC, remove `NODE_AUTH_TOKEN` from `release.yml` and add
`id-token: write` to the `permissions` block — provenance attestation is automatic.

## Bump type guide

| Bump | When |
|---|---|
| `patch` | Bug fix, docs, internal refactor — no API change. |
| `minor` | New export, new field, new optional method — backward-compatible. |
| `major` | Breaking change: removed export, changed signature, renamed type. |

During `0.x.y-alpha` pre-release, `minor` is appropriate for most new features.

## Adding a new package

1. Create the package under `packages/<name>/` with standard `package.json` + `tsup.config.ts`.
2. Add it to the PACKAGES list in `scripts/publish-packages.sh` at the right dependency layer.
3. First publish is manual (`scripts/publish-packages.sh`) — changesets doesn't publish packages
that have never been on npm before.
4. Subsequent releases are fully automated via the changeset flow above.
13 changes: 13 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.4/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [
"@agentproto/tooling"
]
}
12 changes: 12 additions & 0 deletions .changeset/self-construction-features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@agentproto/agent": minor
"@agentproto/driver": minor
"@agentproto/manifest": minor
"@agentproto/mcp-server": minor
"@agentproto/cli": patch
"@agentproto/corpus": patch
"@agentproto/corpus-cli": patch
"@agentproto/runtime": patch
---

Add self_inspect MCP tool, extends-chain validation, driver MCP verb, and atomic manifest writes
112 changes: 99 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,127 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'

jobs:
build-and-test:
name: Build + test
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.4.1
uses: pnpm/action-setup@v6
# version read from packageManager field in package.json

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: 22
cache: pnpm

- name: Install dependencies
run: pnpm install --no-frozen-lockfile
run: pnpm install --frozen-lockfile

# Build first — `tsc --noEmit` resolves workspace package imports
# through their published `.d.ts` files in `dist/`, which only
# exist after `pnpm build`. Running `check-types` before `build`
# produced "Cannot find module '@agentproto/<pkg>'" cascades on
# every commit since the multi-package extraction.
- name: Build all packages
run: pnpm -r --filter "./packages/**" --filter "./adapters/**" build
run: pnpm build

- name: Type-check all packages
run: pnpm -r --filter "./packages/**" --filter "./adapters/**" check-types
run: pnpm check-types

- name: Run tests
run: pnpm -r --filter "./packages/**" --filter "./adapters/**" test
run: pnpm test

# On PRs: verify a changeset was added. Quick git-only check that
# runs in parallel with build-and-test to give fast feedback.
# If the changeset is missing, auto-changeset (below) will generate
# one after the build passes — a new CI run then makes this pass.
changeset-check:
name: Changeset present?
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Check for changeset
run: |
TITLE="${{ github.event.pull_request.title }}"
if [[ "$TITLE" == chore\(release\):* ]]; then
echo "Version Packages PR — no changeset required."
exit 0
fi
ADDED=$(git diff --diff-filter=A --name-only origin/main...HEAD -- '.changeset/*.md' \
| grep -v '^\.changeset/README\.md$' || true)
if [ -z "$ADDED" ]; then
echo "No changeset found. Run 'pnpm changeset' or wait for auto-changeset to generate one."
exit 1
fi
echo "✓ Changeset present: $ADDED"

# On PRs: auto-generate a changeset via Claude if one is missing.
# Only runs AFTER build-and-test passes — no point generating a
# changeset for a broken build, and avoids wasting API tokens.
# Commits the generated file back to the branch, which triggers a
# new CI run where changeset-check then passes.
auto-changeset:
name: Generate changeset
runs-on: ubuntu-latest
needs: [build-and-test]
if: |
github.event_name == 'pull_request' &&
!startsWith(github.event.pull_request.title, 'chore(release):')
permissions:
contents: write # push generated changeset back to the branch
steps:
- name: Checkout branch (with write token)
uses: actions/checkout@v5
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Check if changeset already exists
id: check
run: |
ADDED=$(git diff --diff-filter=A --name-only origin/main...HEAD -- '.changeset/*.md' \
| grep -v '^\.changeset/README\.md$' || true)
if [ -n "$ADDED" ]; then
echo "present=true" >> "$GITHUB_OUTPUT"
echo "✓ Changeset already present: $ADDED"
else
echo "present=false" >> "$GITHUB_OUTPUT"
echo "No changeset found — will auto-generate."
fi

- name: Setup Node.js
if: steps.check.outputs.present == 'false'
uses: actions/setup-node@v5
with:
node-version: 22

- name: Generate changeset via Claude
if: steps.check.outputs.present == 'false'
run: node scripts/auto-changeset.mjs
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}

- name: Commit generated changeset
if: steps.check.outputs.present == 'false'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add '.changeset/*.md'
if git diff --cached --quiet; then
echo "Nothing to commit (no packages changed, changeset not needed)."
else
git commit -m "chore: auto-generate changeset [skip ci]"
git push
fi
64 changes: 64 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Release

on:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false # never cancel a release in progress

permissions:
contents: write # create tags + GitHub releases
pull-requests: write # open "Version Packages" PR

jobs:
release:
name: Version or publish
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout (full history for changesets)
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v6
# version read from packageManager field in package.json

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build all packages
run: pnpm build

# changesets/action does one of two things depending on state:
#
# A) Pending changesets exist → opens (or updates) a "Version Packages"
# PR that bumps versions + regenerates CHANGELOGs.
#
# B) No pending changesets (i.e. the "Version Packages" PR was just
# merged) → publishes every package whose version isn't yet on npm
# and creates a GitHub release per package.
- name: Version or publish
uses: changesets/action@v1
with:
version: pnpm changeset version
publish: pnpm release:ci
commit: "chore(release): version packages"
title: "chore(release): version packages"
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_TOKEN must be a granular access token with "Bypass 2FA"
# scoped to the @agentproto org. Set it in the repo's Secrets.
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: 'true'
11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,18 @@
"clean": "pnpm -r --filter \"./packages/**\" --filter \"./adapters/**\" clean",
"scaffold-aip": "node scripts/scaffold-aip.mjs",
"sync-specs": "node scripts/sync-specs.mjs",
"sync-specs:check": "node scripts/sync-specs.mjs --check"
"sync-specs:check": "node scripts/sync-specs.mjs --check",
"changeset": "changeset",
"changeset:auto": "node scripts/auto-changeset.mjs",
"version": "changeset version",
"release": "scripts/release.sh",
"release:ci": "pnpm build && changeset publish",
"release:npm": "scripts/release.sh --npm-only",
"release:server": "scripts/release.sh --server-only",
"release:dry": "scripts/release.sh --dry-run"
},
"devDependencies": {
"@changesets/cli": "^2.31.0",
"gray-matter": "^4.0.3",
"json-schema-to-typescript": "^15.0.4",
"json-schema-to-zod": "^2.6.1",
Expand Down
Loading