Skip to content

welshDog/HyperAgent-SDK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

66 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค– HyperAgent-SDK

Write Agents Once. Deploy Anywhere.

License: AGPL v3 npm Made by WelshDog Part of Hyperfocus Zone CLI

"The agent toolkit behind the Hyperfocus Zone โ€” plug in, vibe out."

HyperAgent-SDK is the orchestration layer for AI agents across the Hyperfocus Zone ecosystem. Build once, deploy across Discord bots, FastAPI backends, and course platforms. ๐Ÿงฉ

Built for ADHD brains. Fast feedback. Real tools. No fluff. ๐Ÿง โšก


โšก Install

# Validate an agent instantly (no install needed)
npx @w3lshdog/hyper-agent validate .agents/my-agent/

# Install as a dev dependency (for CI pipelines)
npm install -D @w3lshdog/hyper-agent

๐Ÿš€ Quick Start โ€” Build Your First Agent

1๏ธโƒฃ Scaffold from a starter template

# pick one: python | node | typescript | mcp
npx @w3lshdog/hyper-agent init my-agent --template python

This copies the template, renames manifest.name + package.json to match your dir, and prints the next steps.

2๏ธโƒฃ Edit your manifest.json

{
  "name": "my-broski-agent",
  "version": "0.1.0",
  "runtime": "python",
  "entrypoint": "main.py",
  "memory": "redis",
  "tools": [
    {
      "name": "code_gen",
      "description": "Generate code from a natural language prompt",
      "input_schema": {
        "type": "object",
        "properties": {
          "prompt": { "type": "string", "description": "What to build" }
        },
        "required": ["prompt"]
      }
    }
  ],
  "mcp_compatible": false
}

3๏ธโƒฃ Full workflow

# Validate (with friendly error hints โ€” kebab-case, semver, port range, etc.)
npx @w3lshdog/hyper-agent validate ./my-agent

# Strict mode (CI/production โ€” checks entrypoint exists, env vars, port conflicts)
npx @w3lshdog/hyper-agent validate ./my-agent --strict

# Check memory health
npx @w3lshdog/hyper-agent memory check ./my-agent

# Build registry then launch Studio
hyper-agent registry build .agents/
hyper-agent studio
# โ†’ http://localhost:4040 opens automatically ๐Ÿ–ฅ๏ธ

๐Ÿ” Token Sync (Course โ†’ V2.4) โ€” awardFromCourse()

The SDK ships a typed, server-only helper for the cross-repo token sync flow:

import { awardFromCourse } from '@w3lshdog/hyper-agent/client';

const result = await awardFromCourse({
  sourceId:  txn.id,                  // โ‰ค128 chars, idempotency key
  discordId: user.discord_id,         // โ‰ค32 chars
  tokens:    50,                      // integer 1..10000
  reason:    'Course module complete' // optional, โ‰ค255 chars
});
// โ†’ 200: { source_id, awarded, coins_balance, xp_balance, level }
// โ†’ 409: { source_id, duplicate: true, detail }   (idempotent replay โ€” no double award)
// โ†’ throws AwardFromCourseError                   (validation/timeout/4xx/5xx, with .code + .status)

Defaults: baseUrl = process.env.HYPERCODE_API_URL || 'http://localhost:8000', secret = process.env.COURSE_SYNC_SECRET, timeoutMs = 5000 (via AbortController).

Server-only by design โ€” refuses to run in a browser environment so COURSE_SYNC_SECRET can never leak into a client bundle.


โ›“๏ธ Web3 / dNFT Agents (spec v0.4.0+)

Agents that touch the chain โ€” minting, evolving, or reading dynamic NFTs (the BROskiPets pet-evolve model) โ€” declare an optional web3 block in their manifest:

{
  "name": "pet-mint-agent",
  "version": "0.1.0",
  "runtime": "node",
  "entrypoint": "index.js",
  "tools": [
    { "name": "mint_pet", "description": "Mint a BROskiPet dNFT", "input_schema": {} }
  ],
  "mcp_compatible": false,
  "web3": {
    "chain": "base-sepolia",
    "token_standard": "ERC-721",
    "dnft": true,
    "contract_address": "0xabc1230000000000000000000000000000000000",
    "capabilities": ["mint", "evolve", "read-metadata"],
    "signer_env_var": "PET_SIGNER_KEY"
  }
}
Field Notes
chain base ยท base-sepolia ยท ethereum ยท ethereum-sepolia โ€” required
capabilities one or more of mint evolve transfer burn read-metadata read-balance โ€” required
token_standard ERC-721 (default) ยท ERC-1155 ยท ERC-20
dnft true = on-chain metadata mutates over the token lifecycle
contract_address 0x + 40 hex chars
signer_env_var env var name only โ€” keys live in Docker secrets, never the manifest

The block is optional and additive โ€” existing manifests stay valid. Any agent with a web3 block earns the โ›“๏ธ web3-enabled registry badge; dnft: true also earns ๐Ÿ›‚ dnft.


๐Ÿ–ฅ๏ธ HyperAgent Studio

A zero-dependency visual GUI for your agent ecosystem. No build step. No npm install. Opens in 1 second.

# 1. Build your registry
hyper-agent registry build .agents/

# 2. Launch Studio
hyper-agent studio
# โ†’ Opens http://localhost:4040 automatically

# Custom port or headless/CI mode
hyper-agent studio --port 8080 --no-open

๐ŸŽฏ Studio Features

Feature Details
๐Ÿƒด Agent cards Name, version, runtime chips, badges, MCP port, memory backend
๐Ÿ” Live search / focuses search โ€” filters across name, description, tags, author
๐ŸŽจ Filter sidebar Runtime, memory, badge, level (L1โ€“L5), tags โ€” all combinable
๐Ÿ“„ Detail pane Full metadata, tool schemas with types, auto-generated markdown docs, copy button
๐Ÿ“Š Memory footer Live Redis/Postgres dot indicators, auto-refresh every 30s
๐Ÿงฉ Cluster builder Click โŠ• on cards or drag to drop zone โ†’ auto-generates cluster.json
โฌ‡๏ธ Download One-click cluster.json download with port map + memory backends
โŒจ๏ธ Keyboard / to search, Escape to deselect

๐Ÿ–ฅ๏ธ How it works

hyper-agent studio
    โ”‚
    โ”œโ”€โ”€ GET /              โ†’ serves studio/index.html (35KB, single file)
    โ”œโ”€โ”€ GET /api/registry  โ†’ reads registry.json live (no restart needed)
    โ””โ”€โ”€ GET /api/memory    โ†’ TCP pings Redis/Postgres, returns health per-agent

cluster.json output

The Cluster Builder exports cluster.json โ€” a portable deployment config:

{
  "cluster": "my-hyper-cluster",
  "agents": [
    {
      "name": "code-agent",
      "manifest_path": ".agents/code-agent/manifest.json",
      "port": 3201,
      "memory": "redis"
    },
    {
      "name": "data-agent",
      "manifest_path": ".agents/data-agent/manifest.json",
      "port": 3301,
      "memory": "postgres"
    }
  ]
}

๐Ÿ’ก Phase 4: cluster.json feeds directly into hyper-agent graduate build โ€” reads manifest paths, port map, and memory backends instead of scanning individual manifests.


๐Ÿ›ก๏ธ --strict Validation Mode

Run --strict for production-grade checks. Errors exit with code 1 (CI catches them automatically).

Check Level What it does
โœ… Entrypoint exists ERROR manifest.entrypoint file must be on disk
๐Ÿ”ง Runtime sanity WARN node โ†’ package.json ยท python โ†’ requirements.txt ยท deno โ†’ deno.json
๐Ÿ” env_vars simulation WARN Each declared env_var checked against process.env + .env file
๐Ÿ›ฐ๏ธ MCP port conflicts ERROR Scans all agents in a batch, flags duplicate ports

Strict errors fail the build. Warnings inform but don't block deploy.


๐Ÿง  Smart Memory Check

Ping your Redis or Postgres backend before deploy. Get instant health status and copy-paste docker run fixes if anything's offline.

hyper-agent memory check .agents/my-agent/     # single agent
hyper-agent memory check templates/ --all       # all agents
hyper-agent memory check . --redis-host 192.168.1.10 --pg-host db.myserver.com
Backend Port What it does
๐Ÿ”ด Redis 6379 TCP ping + docker run tip if offline
๐Ÿ˜ Postgres 5432 TCP ping + docker run tip if offline
โ€” None โ€” Reports stateless, no action needed

Exit code 1 if any backend offline โ€” CI pipelines catch this automatically.


๐ŸŒ Agent Registry

hyper-agent registry build templates/ --out registry.json [--strict]
hyper-agent registry search --tags starter --runtime node --badge mcp-ready --level 3
hyper-agent registry show my-node-agent

๐Ÿ… Auto-Computed Badges

Badge Meaning
โšก MCP Ready Agent declares MCP port
๐Ÿง  Memory Enabled Redis or Postgres memory configured
๐Ÿ”ง Multi-Tool 2+ tools declared in manifest
๐Ÿ” Env Declared env_vars present in manifest
๐Ÿš€ HyperCoder Level 4+ agent
๐Ÿ‘‘ Elite Level 5 BROski agent
๐Ÿ’š Health Checked Passed runtime validation
โœ… Verified Built with --strict flag

๐Ÿง  What It Does

  • ๐Ÿค– Agent Swarms โ€” Multiple agents working in parallel missions
  • ๐Ÿ”Œ Tool Plugins โ€” Attach any tool (code gen, web search, DB access)
  • ๐ŸŒ Multi-Deploy โ€” Run in Discord, FastAPI, or standalone
  • ๐Ÿงฉ HyperCode Native โ€” Plug directly into V2.4's Hyper-Agents-Box
  • ๐ŸŽฎ Course-Gated Levels โ€” Agents unlock as students level up
  • ๐Ÿ“‹ Spec-Validated โ€” hyper-agent-spec.json ensures consistency
  • ๐ŸŒ Agent Registry โ€” Discover, search, inspect agents by tag, badge & level
  • ๐Ÿ›ก๏ธ Strict Mode CI โ€” Production-grade validation with exit codes
  • ๐Ÿง  Smart Memory Check โ€” Ping Redis/Postgres health, instant docker tips
  • ๐Ÿ–ฅ๏ธ HyperAgent Studio โ€” Visual GUI, cluster builder, live memory health

๐ŸŽฎ Course Levels โ€” Agent Unlock System

Level Title Can Build
1 HyperNewbie Starter templates
2 Vibe Coder Custom tools, Supabase agents
3 Agent Builder Multi-tool, memory agents
4 HyperCoder MCP-compatible, V2.4 deploy
5 BROski Elite ๐Ÿ”ฅ Core contributions + Studio clusters

๐Ÿ—บ๏ธ Roadmap

โœ… Shipped (v3 + Phase 6)

  • cli/index.js โ€” router entrypoint, clean help output
  • cli/validate.js โ€” --strict mode with 4 runtime checks
  • cli/registry.js โ€” build, search, show + 8 auto-badges
  • cli/memory.js โ€” Smart Memory Check (Redis + Postgres + docker tips)
  • cli/studio.js โ€” zero-dependency Node server on port 4040
  • studio/index.html โ€” 35KB single-file GUI, no build step ๐Ÿ–ฅ๏ธ
  • Cluster builder โ†’ cluster.json export
  • Live memory health indicators (auto-refresh 30s)
  • hyper-agent-spec.json โ€” author-declared badges array
  • hyper-agent status โ€” HyperCode V2.4 health check (all services)
  • hyper-agent logs โ€” live log tail from HyperCode V2.4
  • hyper-agent tokens award โ€” award BROski$ to a student by Discord ID
  • hyper-agent agents list โ€” agent heartbeats + online status
  • hyper-agent graduate โ€” build a V2.4 deployment bundle or trigger graduation for a student

๐Ÿ”œ Next Up

  • ๐ŸŒ Community Registry โ€” public discovery via GitHub Discussions + JSON feed
  • ๐Ÿ‘๏ธ --watch mode โ€” live re-validation on file change during dev
  • ๐Ÿš€ One-click deploy โ€” Studio โ†’ deploy cluster to HyperCode V2.4
  • ๐Ÿ’ณ hyper-agent stripe โ€” CLI hook for live Stripe Checkout API

๐Ÿ“ Repo Structure

HyperAgent-SDK/
โ”œโ”€โ”€ cli/
โ”‚   โ”œโ”€โ”€ index.js          # Router โ€” dispatches all subcommands
โ”‚   โ”œโ”€โ”€ validate.js       # Validation (standard + --strict)
โ”‚   โ”œโ”€โ”€ registry.js       # Registry build / search / show
โ”‚   โ”œโ”€โ”€ memory.js         # Smart Memory Check (Redis + Postgres)
โ”‚   โ”œโ”€โ”€ studio.js         # ๐Ÿ–ฅ๏ธ HyperAgent Studio server (port 4040)
โ”‚   โ””โ”€โ”€ commands/
โ”‚       โ”œโ”€โ”€ status.js     # HyperCode V2.4 health check
โ”‚       โ”œโ”€โ”€ logs.js       # Live log tail
โ”‚       โ”œโ”€โ”€ tokens.js     # Award BROski$ by Discord ID
โ”‚       โ”œโ”€โ”€ agents.js     # Agent heartbeats + online status
โ”‚       โ””โ”€โ”€ graduate.js   # Trigger graduation for a student
โ”œโ”€โ”€ studio/
โ”‚   โ””โ”€โ”€ index.html        # 35KB single-file GUI (no build step!)
โ”œโ”€โ”€ docs/                 # Full SDK documentation
โ”œโ”€โ”€ templates/            # Agent starter templates
โ”œโ”€โ”€ hyper-agent-spec.json # The agent manifest schema
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ README.md

๐Ÿ”— Used In

Project How
๐Ÿง  HyperCode V2.4 Core agent orchestration engine
๐ŸŽ“ Hyper-Vibe-Coding-Course Powers BROski AI tutor agents
๐Ÿค– BROski-Bot Discord bot agent layer

๐Ÿ—๏ธ Ecosystem Architecture

HyperAgent-SDK  โ†  YOU ARE HERE
โ†“ powers
HyperCode V2.4 (FastAPI backend)
โ†“ syncs with
Supabase (DB + Edge Functions)
โ†“ serves
Hyper-Vibe-Coding-Course (Next.js)
โ†“ visualised by
HyperAgent Studio ๐Ÿ–ฅ๏ธ (localhost:4040)

๐Ÿค Contributing

We welcome contributions from everyone โ€” especially neurodivergent devs! ๐Ÿง โšก


๐Ÿ›ก๏ธ License

AGPL-3.0 โ€” Open source forever. Built with โค๏ธ in Wales ๐Ÿด๓ ง๓ ข๓ ท๓ ฌ๓ ณ๓ ฟ


Built for ADHD brains. Fast feedback. Real tools. No fluff. ๐Ÿง โšก

by @welshDog โ€” Lyndz Williams

A BROski is ride or die. We build this together. ๐Ÿถโ™พ๏ธ๐Ÿ”ฅ

About

๐Ÿค– Shared agent interface standard for HyperCode V2.4 + Hyper-Vibe-Coding-Course. Write agents once, deploy anywhere in the Hyperfocus Zone ecosystem.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages