Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changes outside entries/ need a maintainer review.
* @agentiknet
/entries/ @agentiknet
52 changes: 52 additions & 0 deletions .github/workflows/catalog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish catalog

# main: regenerate catalog/v1/apps.json from entries/ and commit it when it
# changed. https://agentproto.sh/catalog/v1/apps.json relays this file
# (raw.githubusercontent.com, cached 5 min), so a merged entry is live within
# minutes, no site deploy needed.

on:
push:
branches: [main]
paths: ["entries/**"]
workflow_dispatch:

concurrency:
group: publish-catalog
cancel-in-progress: false

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v5

- uses: actions/setup-node@v5
with:
node-version: 22

- name: Install agentproto CLI
run: npm install -g "@agentproto/cli@${{ vars.AGENTPROTO_CLI_VERSION || 'latest' }}"

- name: Build
id: build
run: |
if agentproto catalog build entries --out catalog/v1/apps.json --check; then
echo "catalog up to date"; echo "changed=false" >> "$GITHUB_OUTPUT"
else
agentproto catalog build entries --out catalog/v1/apps.json
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Commit
if: steps.build.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add catalog/v1/apps.json
git commit -m "chore(catalog): regenerate catalog/v1/apps.json"
git push
56 changes: 56 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Validate entries

# Every PR: policy (scripts/check-pr.mjs, taken from the BASE branch so a PR
# cannot rewrite its own rules), then bundle integrity of each added or
# changed entry (`agentproto catalog verify`: download, size, sha256, unpack,
# manifest validation, appId/version match, no ui.build), then a full
# catalog build so the merged set is known to be valid.

on:
pull_request:
branches: [main]

permissions:
contents: read

jobs:
validate:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0

- uses: actions/setup-node@v5
with:
node-version: 22

- name: Policy
env:
BASE_REF: origin/${{ github.base_ref }}
AUTHOR: ${{ github.event.pull_request.user.login }}
run: |
if git cat-file -e "$BASE_REF:scripts/check-pr.mjs" 2>/dev/null; then
git show "$BASE_REF:scripts/check-pr.mjs" > "$RUNNER_TEMP/check-pr.mjs"
else
echo "::warning::no check-pr.mjs on $BASE_REF yet, using the PR copy (bootstrap PR)"
cp scripts/check-pr.mjs "$RUNNER_TEMP/check-pr.mjs"
fi
node "$RUNNER_TEMP/check-pr.mjs" --author "$AUTHOR" --base "$BASE_REF"

- name: Install agentproto CLI
run: npm install -g "@agentproto/cli@${{ vars.AGENTPROTO_CLI_VERSION || 'latest' }}"

- name: Verify changed entries
env:
BASE_REF: origin/${{ github.base_ref }}
run: |
mapfile -t changed < <(git diff --name-only --diff-filter=AM "$BASE_REF...HEAD" -- entries/ | grep '\.json$' || true)
if [ "${#changed[@]}" -eq 0 ]; then echo "no entry added or changed"; exit 0; fi
agentproto catalog verify "${changed[@]}"

- name: Build the catalog
run: |
agentproto catalog build entries --out "$RUNNER_TEMP/apps.json"
echo "catalog builds: $(node -p "require('$RUNNER_TEMP/apps.json').entries.length") entries"
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
agentiknet
100 changes: 100 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# agentproto/apps

The public catalog of [agentproto](https://agentproto.sh) apps.

This repo is an **index**, not a code repo: each app is one JSON entry pointing
at a compiled `.agentapp` bundle hosted somewhere public. The app's source code
lives wherever its publisher keeps it.

- `entries/<appId>.json`: one entry per app (e.g. `entries/@acme/notes.json`).
- `catalog/v1/apps.json`: generated from `entries/` on every merge to `main`.
Never edit it by hand.
- Releases of this repo host the bundles of first-party apps (tag
`<slug>@<version>`, asset `<slug>-<version>.agentapp`).

Every agentproto daemon reads the catalog at
**https://agentproto.sh/catalog/v1/apps.json**, which relays
`catalog/v1/apps.json` from this repo (cached for 5 minutes). It is what the
`/store` panel, `app_catalog` and `agentproto app catalog` list.

## Install an app

```bash
agentproto app install https://github.com/agentproto/apps/releases/download/<slug>%40<version>/<slug>-<version>.agentapp --sha256 <sha256>
```

or from the Store: open `/store` on your daemon and click Install. The daemon
refuses a bundle whose digest differs from the catalog entry.

## Entry format

An entry is an `app-catalog/v1` entry (`AppCatalogEntry` in
`@agentproto/runtime`) plus `owners`:

```json
{
"appId": "@acme/notes",
"name": "Notes",
"description": "Take notes with your agents.",
"category": "productivity",
"version": "1.2.0",
"tier": "bundle",
"publisher": "Acme",
"license": { "kind": "free" },
"source": {
"kind": "agentapp",
"url": "https://github.com/acme/notes/releases/download/v1.2.0/notes-1.2.0.agentapp",
"sha256": "<manifest sha256 printed by agentproto app pack>",
"version": "1.2.0",
"size": 183204
},
"owners": ["acme-bot", "alice"]
}
```

- `source.kind` must be `agentapp`: the public catalog only lists compiled
bundles, never git sources (installing from git can run a build command).
- `owners` are GitHub logins allowed to change or remove the entry. They are
not published in `catalog/v1/apps.json`.
- `@agentproto/*` app ids are reserved to the maintainers.

## Publish your app

1. Build a release bundle and its entry:

```bash
agentproto app pack ./my-app --release --entry \
--asset-url https://github.com/<you>/<repo>/releases/download/v1.2.0/notes-1.2.0.agentapp
```

`--release` builds the UI, drops sources and the build step, and writes
`notes-1.2.0.agentapp` plus `notes-1.2.0.entry.json`.
2. Upload the `.agentapp` to the URL you passed (a GitHub Release of your repo
works well). The URL must be public and must never change content: publish
a new version instead.
3. Check it like CI will:

```bash
agentproto catalog verify notes-1.2.0.entry.json
```

4. Copy the entry to `entries/<appId>.json`, add `"owners": ["<your-login>"]`,
and open a pull request.

CI then checks the policy (paths, owners, reserved ids), downloads your bundle,
and verifies its size, digest and manifest (`agentproto catalog verify`). A
maintainer reviews and merges; the catalog updates within minutes.

To ship an update, open a PR changing `version` and `source` in your entry. To
withdraw an app, open a PR deleting it.

## First-party apps

Published from the agentik-studio monorepo: a tag `app/<slug>@<version>` builds
the app, uploads `<slug>-<version>.agentapp` to the release `<slug>@<version>`
of this repo, and opens a PR updating `entries/<appId>.json`.

## Maintainers

Listed in `MAINTAINERS`. Changes outside `entries/` need a maintainer
(`.github/CODEOWNERS`).
5 changes: 5 additions & 0 deletions catalog/v1/apps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"schema": "app-catalog/v1",
"generatedAt": "1970-01-01T00:00:00.000Z",
"entries": []
}
Empty file added entries/.gitkeep
Empty file.
119 changes: 119 additions & 0 deletions scripts/check-pr.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!/usr/bin/env node
// Policy check of a pull request on agentproto/apps. Run by
// .github/workflows/validate.yml from the BASE branch copy of this file, so a
// PR cannot weaken the rules it is checked against. Bundle integrity (download,
// sha256, size, unpack, manifest, no ui.build) is `agentproto catalog verify`,
// run next by the same workflow.
//
// Usage: node check-pr.mjs --author <login> --base <ref> [--root <dir>]
// Changed files are `git diff --name-status <base>...HEAD`.
//
// Rules:
// 1. Non-maintainers (MAINTAINERS, base branch) may only touch entries/**.
// catalog/v1/apps.json is generated on main: only a maintainer may
// touch it in a PR (bootstrap, repair).
// 2. An entry lives at entries/<appId>.json (e.g. entries/@acme/notes.json)
// and its `appId` matches that path.
// 3. `@agentproto/*` app ids are reserved to maintainers.
// 4. `owners` (GitHub logins, kept in the entry file, stripped from the
// published catalog) protects an app id: adding an entry requires the
// author in its `owners`; changing or deleting one requires the author
// in the BASE version's `owners`. Maintainers may do both.

import { execFileSync } from "node:child_process"
import { readFileSync, existsSync } from "node:fs"
import { join } from "node:path"
import { parseArgs } from "node:util"

const { values } = parseArgs({
options: {
author: { type: "string" },
base: { type: "string" },
root: { type: "string", default: "." },
},
})
const author = (values.author ?? "").toLowerCase()
const base = values.base
const root = values.root
if (!author || !base) {
console.error("usage: check-pr.mjs --author <login> --base <ref> [--root <dir>]")
process.exit(2)
}

const git = (...args) => execFileSync("git", ["-C", root, ...args], { encoding: "utf8" })
const showBase = (path) => {
try {
return git("show", `${base}:${path}`)
} catch {
return undefined
}
}
const parseJson = (text, where) => {
try {
return JSON.parse(text)
} catch (err) {
errors.push(`${where}: invalid JSON (${err.message})`)
return undefined
}
}

const errors = []
const maintainers = new Set(
(showBase("MAINTAINERS") ?? "")
.split("\n")
.map((l) => l.trim().toLowerCase())
.filter((l) => l && !l.startsWith("#")),
)
const isMaintainer = maintainers.has(author)

const changes = git("diff", "--name-status", "--no-renames", `${base}...HEAD`)
.split("\n")
.filter(Boolean)
.map((line) => {
const [status, path] = line.split("\t")
return { status, path }
})

const owners = (entry) =>
Array.isArray(entry?.owners) ? entry.owners.map((o) => String(o).toLowerCase()) : []

for (const { status, path } of changes) {
if (path === "catalog/v1/apps.json") {
if (!isMaintainer) errors.push(`${path}: generated on main by the catalog workflow, do not edit it in a PR`)
continue
}
if (!path.startsWith("entries/")) {
if (!isMaintainer) errors.push(`${path}: only maintainers may change files outside entries/`)
continue
}
if (path === "entries/.gitkeep") continue
const m = /^entries\/(@[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9._-]*)\.json$/.exec(path)
if (!m) {
errors.push(`${path}: entries must be entries/@<scope>/<name>.json (lowercase)`)
continue
}
const appId = m[1]
if (appId.startsWith("@agentproto/") && !isMaintainer) {
errors.push(`${path}: @agentproto/* app ids are reserved to maintainers`)
}
const before = status === "A" ? undefined : parseJson(showBase(path) ?? "null", `${path} (base)`)
if (status !== "A" && !isMaintainer && !owners(before).includes(author)) {
errors.push(`${path}: ${author} is not in the owners of ${appId}`)
}
if (status === "D") continue
const file = join(root, path)
if (!existsSync(file)) continue
const entry = parseJson(readFileSync(file, "utf8"), path)
if (!entry) continue
if (entry.appId !== appId) errors.push(`${path}: appId is ${JSON.stringify(entry.appId)}, expected "${appId}"`)
if (owners(entry).length === 0) errors.push(`${path}: owners must list at least one GitHub login`)
if (status === "A" && !isMaintainer && !owners(entry).includes(author)) {
errors.push(`${path}: a new entry must list its author (${author}) in owners`)
}
}

if (errors.length > 0) {
for (const e of errors) console.error(`check-pr: ${e}`)
process.exit(1)
}
console.log(`check-pr: ok (${changes.length} changed file(s), author ${author}${isMaintainer ? ", maintainer" : ""})`)
Loading