Skip to content

Commit e222f48

Browse files
committed
feat: initial HyperAgent — sandboxed JS execution agent with plugin system
- Copilot SDK agent with Hyperlight micro-VM sandboxed JavaScript execution - Plugin infrastructure with audit/approve/enable lifecycle - Anti-prompt-injection sanitization for plugin audits (esbuild minify + string redaction) - Static scanner for dangerous patterns (child_process, eval, fs, network access) - Plugins: fetch (HTTP with domain allowlisting), fs-read, fs-write (jailed I/O) - Session transcripts (.log with ANSI, .txt stripped clean) - Command suggestions with fuzzy matching - Resource stats in tool results (CPU/wall utilisation tracking) - 629 tests, all green
0 parents  commit e222f48

38 files changed

Lines changed: 24589 additions & 0 deletions

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Dependencies
2+
node_modules/
3+
deps/
4+
5+
# TypeScript build output
6+
dist/
7+
8+
# Log files generated by --show-code / --show-timing
9+
hyperagent-code-*.log
10+
hyperagent-timing-*.jsonl
11+
12+
# OS files
13+
.DS_Store
14+
Thumbs.db

Justfile

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# ── HyperAgent Justfile ───────────────────────────────────────────────
2+
#
3+
# Build, test, lint, and run the HyperAgent standalone project.
4+
#
5+
# Prerequisites:
6+
# - Node.js >= 18
7+
# - npm
8+
# - Rust toolchain (for building the native hyperlight-js addon)
9+
# - KVM support (for running the Hyperlight micro-VM)
10+
#
11+
# First-time setup:
12+
# just setup # clones + builds hyperlight-js, installs npm deps
13+
#
14+
# ─────────────────────────────────────────────────────────────────────
15+
16+
# The hyperlight-js repo URL and ref to build against
17+
hyperlight-repo := "git@github.com:deislabs/hyperlight-js.git"
18+
hyperlight-ref := "copilot-sdk-example"
19+
hyperlight-dir := justfile_dir() / "deps" / "hyperlight-js"
20+
21+
# Clone (or update) the hyperlight-js dependency at the pinned ref
22+
[private]
23+
fetch-hyperlight:
24+
#!/usr/bin/env bash
25+
set -euo pipefail
26+
if [ ! -d "{{hyperlight-dir}}" ]; then
27+
echo "⬇ Cloning hyperlight-js ({{hyperlight-ref}})…"
28+
git clone --branch "{{hyperlight-ref}}" --single-branch --depth 1 \
29+
"{{hyperlight-repo}}" "{{hyperlight-dir}}"
30+
else
31+
echo "↻ Updating hyperlight-js to {{hyperlight-ref}}…"
32+
cd "{{hyperlight-dir}}"
33+
git fetch origin "{{hyperlight-ref}}" --depth 1
34+
git checkout FETCH_HEAD
35+
fi
36+
37+
# Build the native hyperlight-js NAPI addon
38+
[private]
39+
build-hyperlight: fetch-hyperlight
40+
cd "{{hyperlight-dir}}" && just build
41+
42+
# Install npm deps (links hyperlight-js from deps/)
43+
[private]
44+
install: build-hyperlight
45+
npm install
46+
47+
# ── First-time setup ─────────────────────────────────────────────────
48+
49+
# Clone hyperlight-js, build native addon, install npm deps
50+
setup: install
51+
@echo "✅ Setup complete — run 'just start' to launch the agent"
52+
53+
# ── Development ──────────────────────────────────────────────────────
54+
55+
# Build/rebuild the native hyperlight-js addon and install deps
56+
build: install
57+
@echo "✅ Build complete — run 'just start' to launch the agent"
58+
59+
# Run the agent (tsx transpiles on the fly — no build step needed)
60+
start *ARGS: install
61+
npx tsx agent.ts {{ARGS}}
62+
63+
# Run tests
64+
test: install
65+
npm test
66+
67+
# Type-check (may have pre-existing SDK type drift errors)
68+
typecheck: install
69+
npm run typecheck
70+
71+
# Format code
72+
fmt: install
73+
npm run fmt
74+
75+
# Check formatting
76+
fmt-check: install
77+
npm run fmt:check
78+
79+
# Clean build artifacts (keeps deps/)
80+
clean:
81+
rm -rf dist node_modules
82+
83+
# Clean everything including the hyperlight-js clone
84+
clean-all: clean
85+
rm -rf deps

0 commit comments

Comments
 (0)