https://github.com/xtrape-com/xtrape-capsule-demo
Demo Capsule Services for testing and learning Xtrape Capsule Opstage integration.
https://github.com/xtrape-com/xtrape-capsule-demo
Last synced: 29 days ago
JSON representation
Demo Capsule Services for testing and learning Xtrape Capsule Opstage integration.
- Host: GitHub
- URL: https://github.com/xtrape-com/xtrape-capsule-demo
- Owner: xtrape-com
- Created: 2026-05-07T07:25:46.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-05-14T18:11:02.000Z (about 2 months ago)
- Last Synced: 2026-05-14T20:16:59.638Z (about 2 months ago)
- Language: TypeScript
- Size: 49.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# xtrape-capsule-demo
> Reference Capsule Service for testing and learning Xtrape Capsule Opstage integration.
[](./LICENSE)
[](https://xtrape-com.github.io/xtrape-capsule-site/)
[](https://xtrape-com.github.io/xtrape-capsule-site/agents/node-embedded-agent)
This repository demonstrates two v0.3 modes:
- **Embedded Agent mode**: Single Capsule Service that connects directly to Opstage CE
- **OpHub-managed adapter mode**: Local HTTP adapter endpoints for OpHub to discover and manage
> **Package status:** Xtrape Capsule is currently in **Public Review** before
> the `v0.1.0 Public Preview` release. This package is published under the
> `public-review` dist-tag. APIs, contracts, deployment instructions, and SDK
> interfaces may still change.
## Install
During Public Review, install the prerelease package with:
```bash
pnpm add @xtrape/capsule-agent-node@public-review
```
The current Public Review version may change before `v0.1.0`.
For this repository itself:
```bash
pnpm install
pnpm build
```
## Embedded Agent Mode
This is the default mode. The demo service connects directly to Opstage CE using
`@xtrape/capsule-agent-node`.
Configure `.env`:
```env
DEMO_MODE=embedded
OPSTAGE_BACKEND_URL=http://localhost:8080
OPSTAGE_REGISTRATION_TOKEN=opstage_reg_...
```
Run:
```bash
pnpm dev
```
## OpHub-managed Adapter Mode
In this mode, the demo exposes local HTTP adapter endpoints that OpHub can
discover and manage. The demo does not connect directly to Opstage CE.
Configure `.env`:
```env
DEMO_MODE=adapter
DEMO_HTTP_PORT=3101
```
Run:
```bash
pnpm dev
```
The demo will expose these local endpoints for OpHub:
- `GET /capsule/manifest`
- `GET /capsule/health`
- `GET /capsule/configs`
- `GET /capsule/actions`
- `POST /capsule/actions/:name/prepare`
- `POST /capsule/actions/:name/execute`
OpHub discovers these endpoints and reports the service to Opstage CE with
`mode: "ophub"`.
## Verify In Opstage
### Embedded Mode
1. Open **Agents**.
2. Confirm `demo-worker` is `ONLINE` and has mode `embedded`.
3. Open the agent drawer and confirm it lists one service: `demo-worker`.
### OpHub-managed Mode
1. Start OpHub configured to discover this demo service.
2. Open **Agents**.
3. Confirm your OpHub agent is `ONLINE` and has mode `ophub`.
4. Open the agent drawer and confirm it lists `demo-worker` as a managed service.
## Troubleshooting
### Registration token rejected
Create a fresh registration token in Opstage and remove the old token file:
```bash
rm -f ./data/agent-token.txt
```
### OpHub cannot discover adapter endpoints
Confirm the demo is running in adapter mode and the HTTP port is accessible
from OpHub's network context.
## Related Repositories
- Opstage CE: https://github.com/xtrape-com/xtrape-capsule-ce
- Documentation: https://github.com/xtrape-com/xtrape-capsule-site
- Node.js Embedded Agent SDK: https://github.com/xtrape-com/xtrape-capsule-agent-node
- Contracts: https://github.com/xtrape-com/xtrape-capsule-contracts-node
## License
Apache-2.0