@inneranimalmedia/agentsam-sdk 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DEVELOPMENT.md +58 -0
- package/LICENSE +21 -0
- package/README.md +202 -0
- package/docs/CLI_SHELL.md +90 -0
- package/examples/gorilla-shell/App.tsx +540 -0
- package/examples/gorilla-shell/README.md +22 -0
- package/examples/gorilla-shell/index.html +15 -0
- package/examples/gorilla-shell/main.jsx +9 -0
- package/examples/gorilla-shell/package.json +19 -0
- package/examples/gorilla-shell/vite.config.js +10 -0
- package/package.json +24 -3
- package/src/AgentSam.js +67 -0
- package/src/cli.js +232 -56
- package/src/index.js +16 -4
- package/src/lib/responses.js +21 -0
- package/src/lib/router.js +51 -0
- package/src/lib/scaffold.js +208 -110
- package/src/lib/sessions.js +53 -0
- package/src/lib/slash-commands.js +40 -0
- package/src/lib/tools.js +38 -0
- package/src/schemas/config.js +2 -0
- package/test/smoke.mjs +42 -0
package/DEVELOPMENT.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Developing agentsam-sdk with Inner Animal Media
|
|
2
|
+
|
|
3
|
+
## Local smoke test
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
cd agentsam-sdk
|
|
7
|
+
npm test
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Link into a scaffolded project
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
cd agentsam-sdk && npm link
|
|
14
|
+
cd /path/to/your-project && npm link @inneranimalmedia/agentsam-sdk
|
|
15
|
+
npm run dev
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Link into inneranimalmedia (monorepo-style)
|
|
19
|
+
|
|
20
|
+
From the platform repo:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
cd inneranimalmedia
|
|
24
|
+
npm link ../agentsam-sdk
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Then in any Worker or script:
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import { AgentSam } from '@inneranimalmedia/agentsam-sdk';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Non-interactive init (CI / smoke)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx agentsam init \
|
|
37
|
+
--name my-agent \
|
|
38
|
+
--lane fullstack \
|
|
39
|
+
--provider cloudflare \
|
|
40
|
+
--agent orchestrator \
|
|
41
|
+
--yes
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Publish checklist
|
|
45
|
+
|
|
46
|
+
1. `npm test` passes
|
|
47
|
+
2. Bump version in `package.json`
|
|
48
|
+
3. `npm publish --access public`
|
|
49
|
+
4. Tag: `git tag v1.1.1 && git push origin v1.1.1`
|
|
50
|
+
|
|
51
|
+
## Known gaps (roadmap)
|
|
52
|
+
|
|
53
|
+
- `agentsam deploy`, `status`, `logs` — not implemented yet
|
|
54
|
+
- Gorilla Shell Phase 1 — PTY WebSocket bridge to ExecOS
|
|
55
|
+
- CMS lane in README — CLI has 5 lanes (Full Stack, CMS, Data, CRM, Creative)
|
|
56
|
+
- Published API route may differ; stub mode works without `AGENTSAM_API_KEY`
|
|
57
|
+
|
|
58
|
+
See [docs/CLI_SHELL.md](./docs/CLI_SHELL.md) for the game-feel terminal UX path.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Inner Animal Media
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# Agent Sam SDK
|
|
2
|
+
|
|
3
|
+
> The AI agent layer for developers who need more than a chatbot.
|
|
4
|
+
|
|
5
|
+
Agent Sam is a full-stack autonomous agent SDK built on Cloudflare Workers, D1, Supabase, Durable Objects, and MCP — designed to converse, plan, and execute real work across your entire stack. CMS websites, full-stack applications, data pipelines, creative workflows, terminal execution, deployments, and multi-step agentic pipelines — all through one unified agent interface.
|
|
6
|
+
|
|
7
|
+
**Repo:** [github.com/SamPrimeaux/agentsam-sdk](https://github.com/SamPrimeaux/agentsam-sdk) · **npm:** `@inneranimalmedia/agentsam-sdk`
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## What is Agent Sam?
|
|
12
|
+
|
|
13
|
+
Agent Sam is a platform operator AI. It sits on top of your infrastructure and can:
|
|
14
|
+
|
|
15
|
+
- **Understand intent** — natural language in, real actions out
|
|
16
|
+
- **Execute across surfaces** — terminal, database, browser, CAD, deploy, MCP tools
|
|
17
|
+
- **Route intelligently** — local machine, cloud VM, or sandboxed environment based on context
|
|
18
|
+
- **Gate high-risk actions** — approval flows before anything destructive runs
|
|
19
|
+
- **Leave an audit trail** — every tool call, command run, and decision is logged
|
|
20
|
+
|
|
21
|
+
It is not a wrapper around a chat API. It is a command fabric with a conversation interface.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Quickstart
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx @inneranimalmedia/agentsam-sdk init
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Non-interactive (CI / scripts):
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx @inneranimalmedia/agentsam-sdk init \
|
|
35
|
+
--name my-agent \
|
|
36
|
+
--lane fullstack \
|
|
37
|
+
--provider cloudflare \
|
|
38
|
+
--agent orchestrator \
|
|
39
|
+
--yes
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Scaffolded workers expose `GET /health` and `POST /chat` immediately (stub mode without an API key).
|
|
43
|
+
|
|
44
|
+
See [DEVELOPMENT.md](./DEVELOPMENT.md) for linking the SDK into Inner Animal Media locally.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## CLI Shell Experience (Gorilla)
|
|
49
|
+
|
|
50
|
+
The SDK ships a **game-feel terminal UX** alongside the scaffold CLI — consolidated from the Gorilla Mode experiment:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx @inneranimalmedia/agentsam-sdk shell
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
| Piece | Location |
|
|
57
|
+
|-------|----------|
|
|
58
|
+
| Slash command registry | `src/lib/slash-commands.js` |
|
|
59
|
+
| Phase 0 visual prototype | `examples/gorilla-shell/` |
|
|
60
|
+
| Architecture + phases | [docs/CLI_SHELL.md](./docs/CLI_SHELL.md) |
|
|
61
|
+
|
|
62
|
+
Run the prototype:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
cd examples/gorilla-shell && npm install && npm run dev
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm install @inneranimalmedia/agentsam-sdk
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Lanes
|
|
79
|
+
|
|
80
|
+
| Lane | Best For |
|
|
81
|
+
|------|----------|
|
|
82
|
+
| **Full Stack** | End-to-end apps — agent chat, terminal, deploy, D1, R2, Durable Objects, KV |
|
|
83
|
+
| **CMS** | Content-managed websites — pages, assets, themes, navigation, live edit |
|
|
84
|
+
| **Data Solutions** | Database ops, migrations, queries, Supabase pgvector, Hyperdrive pipelines |
|
|
85
|
+
| **Customer Management** | CRM, contacts, billing, client workflows, multi-tenant isolation |
|
|
86
|
+
| **Creative & Design** | CAD, 3D, media generation, content pipelines |
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Agents
|
|
91
|
+
|
|
92
|
+
| Agent | Role |
|
|
93
|
+
|-------|------|
|
|
94
|
+
| **Orchestrator** | General purpose — routes across all lanes and tools |
|
|
95
|
+
| **CMS Agent** | Pages, sections, assets, themes, publishing workflows |
|
|
96
|
+
| **Data Agent** | D1, Supabase, Hyperdrive, migrations, vector search |
|
|
97
|
+
| **CRM Agent** | Customer records, contacts, billing, client isolation |
|
|
98
|
+
| **Creative Agent** | Design commands, 3D generation, CAD, media pipelines |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## How It Works
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
User Intent (chat or CLI)
|
|
106
|
+
↓
|
|
107
|
+
Agent Sam — intent classification + command match
|
|
108
|
+
↓
|
|
109
|
+
Tool Catalog (D1) — policy check + approval gate
|
|
110
|
+
↓
|
|
111
|
+
Execution — terminal / D1 / Supabase / R2 / KV / DO / browser / deploy / MCP
|
|
112
|
+
↓
|
|
113
|
+
Telemetry — every action logged, measured, improvable
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Capabilities are data-driven — new tools are added via D1, not Worker redeployments. The same tool catalog powers the dashboard, the CLI, and any MCP-connected client like Cursor or Claude Desktop.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Infrastructure
|
|
121
|
+
|
|
122
|
+
Agent Sam scaffolds and operates across the full Cloudflare + Supabase stack:
|
|
123
|
+
|
|
124
|
+
| Layer | Technology | Role |
|
|
125
|
+
|-------|------------|------|
|
|
126
|
+
| **Compute** | Cloudflare Workers | Edge runtime, API, agent dispatch |
|
|
127
|
+
| **Relational DB** | D1 (SQLite) | Tool catalog, sessions, telemetry, CMS, auth |
|
|
128
|
+
| **Vector DB** | Supabase pgvector via Hyperdrive | RAG, semantic search, agent memory |
|
|
129
|
+
| **Object Storage** | R2 | Assets, media, bundles, CMS content |
|
|
130
|
+
| **Key-Value** | Workers KV | Cache, CMS drafts, feature flags |
|
|
131
|
+
| **Stateful Sessions** | Durable Objects | Terminal sessions, collab, real-time state |
|
|
132
|
+
| **Terminal** | ExecOS over cloudflared tunnel | Shell execution, deploy, git, wrangler |
|
|
133
|
+
| **AI Router** | Anthropic + OpenAI | Adaptive Thompson sampling across models |
|
|
134
|
+
| **Protocol** | MCP (Model Context Protocol) | External agent surface for Cursor, Claude, etc. |
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Execution Lanes
|
|
139
|
+
|
|
140
|
+
Agent Sam routes work to the right environment automatically:
|
|
141
|
+
|
|
142
|
+
| Lane | Environment | When |
|
|
143
|
+
|------|-------------|------|
|
|
144
|
+
| Local | Your machine | Fastest dev loop |
|
|
145
|
+
| Cloud | Always-on VM via tunnel | Machine asleep or offsite |
|
|
146
|
+
| Sandbox | Isolated workspace | Safe experiments, tenant isolation |
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## What Gets Scaffolded
|
|
151
|
+
|
|
152
|
+
Running `agentsam init` generates a production-ready project for your lane:
|
|
153
|
+
|
|
154
|
+
**All lanes include:**
|
|
155
|
+
- `agentsam.config.js` — project config, lane, provider, agent
|
|
156
|
+
- `wrangler.toml` — Worker, D1, R2, KV, Durable Object bindings
|
|
157
|
+
- `.env.example` — all required secrets pre-listed
|
|
158
|
+
- `src/index.js` — Worker entry point wired to your agent
|
|
159
|
+
- `README.md` — setup and deploy instructions
|
|
160
|
+
|
|
161
|
+
**CMS lane adds:** page/section/asset schema migrations and CMS worker scaffold.
|
|
162
|
+
|
|
163
|
+
**Data lane adds:** D1 + Hyperdrive config and migration templates.
|
|
164
|
+
|
|
165
|
+
**Full Stack adds:** Durable Object session scaffold, auth tables, full agent chat loop.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Multi-Tenant & Client Policy
|
|
170
|
+
|
|
171
|
+
- Each user or client gets a scoped workspace
|
|
172
|
+
- Terminal execution is path-isolated — no cross-tenant access
|
|
173
|
+
- AI usage is policy-gated — BYOK, managed, or disabled per client
|
|
174
|
+
- D1 and R2 are scoped per tenant at the binding level
|
|
175
|
+
- Every action produces an audit trail
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Roadmap
|
|
180
|
+
|
|
181
|
+
- [x] `agentsam shell` — shell UX info + slash command registry
|
|
182
|
+
- [x] Gorilla Shell Phase 0 prototype in `examples/gorilla-shell/`
|
|
183
|
+
- [ ] `agentsam deploy` — push your project from CLI
|
|
184
|
+
- [ ] `agentsam status` — live agent and infrastructure health
|
|
185
|
+
- [ ] `agentsam logs` — tail tool call and command logs
|
|
186
|
+
- [ ] PTY bridge (Phase 1) — ExecOS WebSocket in shell
|
|
187
|
+
- [ ] Kit marketplace — CMS, ecommerce, nonprofit, SaaS starters
|
|
188
|
+
- [ ] BYOK AI key support per project
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Built By
|
|
193
|
+
|
|
194
|
+
[Inner Animal Media](https://inneranimalmedia.com) — Agent Sam is the operator brain behind the platform. The SDK is how we productize that infrastructure for other developers.
|
|
195
|
+
|
|
196
|
+
**Legacy:** [InnerAnimal/gorilla-mode](https://github.com/InnerAnimal/gorilla-mode) → consolidated here.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
MIT
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Agent Sam SDK — CLI Shell Experience
|
|
2
|
+
|
|
3
|
+
The SDK ships two complementary surfaces:
|
|
4
|
+
|
|
5
|
+
1. **`agentsam init`** — scaffold Workers + D1 + agent loop (resell/scale path)
|
|
6
|
+
2. **Gorilla Shell** (`examples/gorilla-shell/`) — game-feel terminal UX layer (unique install experience)
|
|
7
|
+
|
|
8
|
+
Gorilla Mode was consolidated from the standalone [InnerAnimal/gorilla-mode](https://github.com/InnerAnimal/gorilla-mode) experiment into this repo. **Do not start new work in gorilla-mode** — extend here.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Why a game shell?
|
|
13
|
+
|
|
14
|
+
Developers installing `@inneranimalmedia/agentsam-sdk` get:
|
|
15
|
+
|
|
16
|
+
- Efficient tooling (`init`, future `deploy` / `status` / `logs`)
|
|
17
|
+
- A **memorable CLI identity** — pixel HUD, slash commands, themed moods, deploy reactions
|
|
18
|
+
|
|
19
|
+
The shell is not a toy terminal emulator. It is a **presentation layer** on real PTY + MCP + D1 tool execution — the same stack IAM runs in production.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Architecture
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
User
|
|
27
|
+
└─ agentsam shell (CLI) or embedded <AgentSamShell />
|
|
28
|
+
└─ Gorilla HUD (themes, sprite, quest log)
|
|
29
|
+
└─ xterm.js ↔ ExecOS / iam-pty WebSocket
|
|
30
|
+
└─ Slash commands → SDK router → MCP / wrangler / D1
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
| Layer | Location in SDK |
|
|
34
|
+
|-------|-----------------|
|
|
35
|
+
| Slash command registry | `src/lib/slash-commands.js` |
|
|
36
|
+
| Phase 0 visual prototype | `examples/gorilla-shell/App.tsx` |
|
|
37
|
+
| Scaffold + Worker agent | `src/lib/scaffold.js`, `src/AgentSam.js` |
|
|
38
|
+
| Future PTY bridge | `src/lib/shell/` (Phase 1) |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Phases
|
|
43
|
+
|
|
44
|
+
See `SHELL_PHASES` in `src/lib/slash-commands.js`. Current status:
|
|
45
|
+
|
|
46
|
+
| Phase | Status |
|
|
47
|
+
|-------|--------|
|
|
48
|
+
| 0 — Visual prototype | **Complete** (demo scenarios, themes, sprite) |
|
|
49
|
+
| 1 — Real PTY | **Next** — wire to ExecOS / `terminal.inneranimalmedia.com` |
|
|
50
|
+
| 2 — HUD (quest log, tool gate, XP) | Planned |
|
|
51
|
+
| 3 — Buddy (`/buddy`, MCP stream) | Planned |
|
|
52
|
+
| 4 — Dashboard embed | Planned |
|
|
53
|
+
| 5 — Standalone PWA as SDK default | Planned |
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Run the prototype
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
cd examples/gorilla-shell
|
|
61
|
+
npm install
|
|
62
|
+
npm run dev
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Deploy preview (Cloudflare Pages):
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm run build
|
|
69
|
+
npx wrangler pages deploy dist
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Platform linkage (IAM)
|
|
75
|
+
|
|
76
|
+
| Shell feature | IAM SSOT |
|
|
77
|
+
|---------------|----------|
|
|
78
|
+
| PTY sessions | `terminal_connections` + ExecOS |
|
|
79
|
+
| Tool execution | `agentsam_tools` → catalog executor |
|
|
80
|
+
| Buddy / MCP | `mcp.inneranimalmedia.com` |
|
|
81
|
+
| XP (future) | `gorilla_xp` D1 table |
|
|
82
|
+
| Themes (future) | user preferences / `cms_themes` pattern |
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Repo history
|
|
87
|
+
|
|
88
|
+
- **Before:** `InnerAnimal/gorilla-mode` (Phase 0 only, single-file React artifact)
|
|
89
|
+
- **Now:** `SamPrimeaux/agentsam-sdk/examples/gorilla-shell`
|
|
90
|
+
- **D1 project:** `proj_agentsam_sdk` (replaces `proj_gorilla_mode` on the IAM projects grid)
|