agent-code 1.0.0__tar.gz → 1.0.2__tar.gz

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.
Files changed (33) hide show
  1. agent_code-1.0.2/PKG-INFO +498 -0
  2. agent_code-1.0.2/README.md +467 -0
  3. {agent_code-1.0.0 → agent_code-1.0.2}/pyproject.toml +54 -54
  4. {agent_code-1.0.0 → agent_code-1.0.2}/src/agent_code/__init__.py +2 -2
  5. agent_code-1.0.2/src/agent_code/agent.py +2331 -0
  6. agent_code-1.0.2/src/agent_code/data/skills/browser/skill.md +30 -0
  7. agent_code-1.0.2/src/agent_code/data/skills/browser/skill.py +165 -0
  8. agent_code-1.0.2/src/agent_code/data/skills/filesystem/skill.md +10 -0
  9. {agent_code-1.0.0 → agent_code-1.0.2}/src/agent_code/data/skills/public_api/skill.md +6 -2
  10. {agent_code-1.0.0 → agent_code-1.0.2}/src/agent_code/data/skills/temp_mail/skill.md +6 -2
  11. {agent_code-1.0.0 → agent_code-1.0.2}/src/agent_code/skill_manager.py +348 -93
  12. agent_code-1.0.2/src/agent_code.egg-info/PKG-INFO +498 -0
  13. {agent_code-1.0.0 → agent_code-1.0.2}/src/agent_code.egg-info/SOURCES.txt +2 -0
  14. agent_code-1.0.0/PKG-INFO +0 -434
  15. agent_code-1.0.0/README.md +0 -403
  16. agent_code-1.0.0/src/agent_code/agent.py +0 -1542
  17. agent_code-1.0.0/src/agent_code/data/skills/filesystem/skill.md +0 -0
  18. agent_code-1.0.0/src/agent_code.egg-info/PKG-INFO +0 -434
  19. {agent_code-1.0.0 → agent_code-1.0.2}/LICENSE +0 -0
  20. {agent_code-1.0.0 → agent_code-1.0.2}/LICENSE-GPL +0 -0
  21. {agent_code-1.0.0 → agent_code-1.0.2}/MANIFEST.in +0 -0
  22. {agent_code-1.0.0 → agent_code-1.0.2}/setup.cfg +0 -0
  23. {agent_code-1.0.0 → agent_code-1.0.2}/src/agent_code/__main__.py +0 -0
  24. {agent_code-1.0.0 → agent_code-1.0.2}/src/agent_code/cli.py +0 -0
  25. {agent_code-1.0.0 → agent_code-1.0.2}/src/agent_code/data/skills/filesystem/skill.py +0 -0
  26. {agent_code-1.0.0 → agent_code-1.0.2}/src/agent_code/data/skills/public_api/skill.py +0 -0
  27. {agent_code-1.0.0 → agent_code-1.0.2}/src/agent_code/data/skills/temp_mail/skill.py +0 -0
  28. {agent_code-1.0.0 → agent_code-1.0.2}/src/agent_code/loader.py +0 -0
  29. {agent_code-1.0.0 → agent_code-1.0.2}/src/agent_code/paths.py +0 -0
  30. {agent_code-1.0.0 → agent_code-1.0.2}/src/agent_code.egg-info/dependency_links.txt +0 -0
  31. {agent_code-1.0.0 → agent_code-1.0.2}/src/agent_code.egg-info/entry_points.txt +0 -0
  32. {agent_code-1.0.0 → agent_code-1.0.2}/src/agent_code.egg-info/requires.txt +0 -0
  33. {agent_code-1.0.0 → agent_code-1.0.2}/src/agent_code.egg-info/top_level.txt +0 -0
@@ -0,0 +1,498 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-code
3
+ Version: 1.0.2
4
+ Summary: Local AI agent with headless browser, sandboxed shell, and plug-and-play skills
5
+ Author: minecraftbefile-maker
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://agent-code.freesrv.com
8
+ Project-URL: Repository, https://github.com/Agent-code-dev/Agent-code
9
+ Project-URL: Issues, https://github.com/Agent-code-dev/Agent-code/issues
10
+ Project-URL: Changelog, https://github.com/Agent-code-dev/Agent-code/releases
11
+ Keywords: ai,agent,llm,browser,automation,skills,openai
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ License-File: LICENSE-GPL
24
+ Requires-Dist: DrissionPage>=4.0.0
25
+ Requires-Dist: openai>=1.0.0
26
+ Provides-Extra: email
27
+ Requires-Dist: requests>=2.31.0; extra == "email"
28
+ Provides-Extra: all
29
+ Requires-Dist: requests>=2.31.0; extra == "all"
30
+ Dynamic: license-file
31
+
32
+ # Agent + Skill Store
33
+
34
+ A local AI agent with a headless browser, sandboxed shell, chat GUI, and a
35
+ plug-and-play skill system backed by a hosted skill registry.
36
+
37
+ [![PyPI](https://img.shields.io/pypi/v/agent-code)](https://pypi.org/project/agent-code/)
38
+ [![Python](https://img.shields.io/badge/python-3.10%2B-blue)](https://pypi.org/project/agent-code/)
39
+ [![License](https://img.shields.io/badge/license-MIT%20%2B%20GPL--3.0-green)](#license)
40
+ [![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey)](#platform-support)
41
+
42
+ **Live site:** https://agent-code.freesrv.com · **Install:** `pip install agent-code`
43
+
44
+ ---
45
+
46
+ ## What this is
47
+
48
+ One command install. Two GUIs. A hosted skill registry.
49
+
50
+ | Command | What it opens |
51
+ |---|---|
52
+ | `agent-code` | The agent — chat GUI, headless browser, sandboxed shell |
53
+ | `agent-code manage` | The skill store — browse, install, publish skills |
54
+ | `agent-code skills list` | List bundled skills |
55
+ | `agent-code skills install` | Copy bundled skills into `./skills/` |
56
+
57
+ Skills are folders under `./skills/`. Drop one in, restart the agent, its tools
58
+ appear in the LLM's tool list. No changes to the agent required.
59
+
60
+ ---
61
+
62
+ ## Install
63
+
64
+ ```bash
65
+ pip install agent-code
66
+ ```
67
+
68
+ That's it. No clone, no config file, no build step.
69
+
70
+ Then:
71
+
72
+ ```bash
73
+ agent-code # run the agent
74
+ agent-code manage # open the skill store
75
+ agent-code skills # list bundled skills
76
+ agent-code skills install # copy them into ./skills/
77
+ ```
78
+
79
+ ### First run
80
+
81
+ The agent needs an API key. On first launch:
82
+
83
+ 1. Click **Settings** in the top-right of the agent window
84
+ 2. Paste your API key
85
+ 3. Optionally change the base URL and model
86
+ 4. Save
87
+
88
+ Or create `agent_config.json` in the folder where you run the agent:
89
+
90
+ ```json
91
+ {
92
+ "openai_api_keys": ["sk-your-key-here"],
93
+ "openai_base_url": "https://api.openai.com/v1",
94
+ "openai_model": "gpt-4o",
95
+ "cloud_sync": false
96
+ }
97
+ ```
98
+
99
+ The config file wins if both exist. The Settings dialog writes to it.
100
+
101
+ ### Talk to it
102
+
103
+ ```
104
+ go to news.ycombinator.com and list the top 5 story titles
105
+ find a free API for cat facts and call it
106
+ create a snake game in a single HTML file
107
+ ```
108
+
109
+ ---
110
+
111
+ ## Platform support
112
+
113
+ | Platform | CLI (`skills list`, `skills install`) | GUI (`run`, `manage`) |
114
+ |---|---|---|
115
+ | **Windows 10/11** | ✓ | ✓ (WebView2 required) |
116
+ | **macOS 12+** | ✓ | ✓ |
117
+ | **Ubuntu / Debian / Kali / Mint** | ✓ | needs `python3-tk` |
118
+ | **Fedora / RHEL** | ✓ | needs `python3-tkinter` |
119
+ | **Arch / Manjaro** | ✓ | needs `tk` |
120
+ | **Headless server / Cloud Shell / WSL** | ✓ | ✗ (no display) |
121
+
122
+ ### Linux setup
123
+
124
+ One line per distro — installs tkinter (GUI) and Chromium (browser):
125
+
126
+ ```bash
127
+ # Ubuntu / Debian / Kali / Mint / Pop!_OS
128
+ sudo apt install python3-tk chromium
129
+
130
+ # Fedora / RHEL / CentOS Stream
131
+ sudo dnf install python3-tkinter chromium
132
+
133
+ # Arch / Manjaro
134
+ sudo pacman -S tk chromium
135
+ ```
136
+
137
+ If `agent-code` isn't found after install, add pip's user bin to PATH:
138
+
139
+ ```bash
140
+ export PATH="$HOME/.local/bin:$PATH"
141
+ ```
142
+
143
+ Or use the module form which never needs PATH:
144
+
145
+ ```bash
146
+ python3 -m agent_code --version
147
+ python3 -m agent_code run
148
+ ```
149
+
150
+ ### Windows setup
151
+
152
+ `pip install agent-code` handles the Python side. If `agent-code run` shows
153
+ `browser: FAILED`, install the [WebView2 Runtime](https://developer.microsoft.com/microsoft-edge/webview2/)
154
+ from Microsoft. It's preinstalled on Windows 11 and most up-to-date Windows 10.
155
+
156
+ ---
157
+
158
+ ## The skill system
159
+
160
+ A skill is a folder:
161
+
162
+ ```
163
+ skills/my_skill/
164
+ ├── skill.py ← code
165
+ └── skill.md ← metadata + docs
166
+ ```
167
+
168
+ `skill.py` exports three things:
169
+
170
+ ```python
171
+ SKILL = {"name": "my_skill", "description": "What this does."}
172
+
173
+ def greet(name: str = "world") -> str:
174
+ return f"Hello, {name}!"
175
+
176
+ TOOL_SCHEMAS = [{
177
+ "type": "function",
178
+ "function": {
179
+ "name": "greet",
180
+ "description": "Return a greeting.",
181
+ "parameters": {
182
+ "type": "object",
183
+ "properties": {"name": {"type": "string"}},
184
+ },
185
+ },
186
+ }]
187
+
188
+ TOOL_CALLABLES = {"greet": greet}
189
+ ```
190
+
191
+ Restart the agent. The LLM can now call `greet()`.
192
+
193
+ Optional `COMMANDS` export adds user-facing slash commands:
194
+
195
+ ```python
196
+ def _handle_ping(args: list, log) -> None:
197
+ log(f"pong {' '.join(args)}", "dim")
198
+
199
+ COMMANDS = {
200
+ "ping": {"handler": _handle_ping, "description": "Reply pong"},
201
+ }
202
+ ```
203
+
204
+ Optional `skill.md` frontmatter gives the skill a name, version, and author.
205
+ Anything after the closing `---` becomes the skill's help page, visible in
206
+ the Help dialog when the user clicks the skill.
207
+
208
+ Full developer guide: [`docs/skills.html`](docs/skills.html).
209
+
210
+ ---
211
+
212
+ ## Bundled skills
213
+
214
+ `pip install agent-code` ships three skills. Run `agent-code skills install`
215
+ to copy them into your current folder's `skills/`:
216
+
217
+ | Skill | What it does |
218
+ |---|---|
219
+ | **filesystem** | Read, write, append, list files inside the sandbox workspace |
220
+ | **public_api** | Search 700+ free public APIs and call them |
221
+ | **temp_mail** | Temp inbox (mail.tm / Guerrilla) + email sending (Resend / Brevo / Mailjet) |
222
+
223
+ Installed skills appear under `./skills/<name>/` with `skill.py` and `skill.md`.
224
+ Toggle them on/off in the Skills dialog.
225
+
226
+ ---
227
+
228
+ ## Skill registry
229
+
230
+ The registry lets you publish skills and install them anywhere.
231
+
232
+ ### Use the hosted registry (default)
233
+
234
+ A live instance is already running at `https://skills-manager.freesrv.com`.
235
+ Both the manager and the agent use it by default. If the domain is down,
236
+ they auto-fall-back to a raw IP.
237
+
238
+ ```bash
239
+ agent-code manage
240
+ ```
241
+
242
+ Sign in with any nickname — the account is created automatically. Then:
243
+
244
+ - Browse and search the store
245
+ - Install skills into `./skills/`
246
+ - Publish a folder as a skill
247
+ - Delete skills you own
248
+
249
+ ### Self-hosting the registry
250
+
251
+ The server is GPL-3.0 and lives in this repo as `skill-server.py`. See
252
+ [Server setup](#server-setup) below.
253
+
254
+ ---
255
+
256
+ ## Command reference
257
+
258
+ ### CLI
259
+
260
+ | Command | What it does |
261
+ |---|---|
262
+ | `agent-code` | Run the agent (same as `agent-code run`) |
263
+ | `agent-code run` | Run the agent GUI |
264
+ | `agent-code manage` | Open the skill store GUI |
265
+ | `agent-code skills list` | Show bundled skill names |
266
+ | `agent-code skills install` | Copy bundled skills to `./skills/` |
267
+ | `agent-code --version` | Print version |
268
+ | `agent-code --help` | Show all subcommands |
269
+
270
+ ### Agent (in the chat box)
271
+
272
+ | Command | What it does |
273
+ |---|---|
274
+ | `/reset` | Clear conversation memory |
275
+ | `/history` | Print recent messages |
276
+ | `/skills` | List loaded + disabled skills + commands |
277
+ | `/save` | Force save chat locally and to cloud |
278
+ | `/open <file>` | Open a file from the workspace |
279
+ | Skill commands | Whatever skills register, e.g. `/email`, `/providers` |
280
+
281
+ ### Agent buttons
282
+
283
+ | Button | Action |
284
+ |---|---|
285
+ | **Stop** | Halt the running agent loop |
286
+ | **Continue** | Resume from the last tool result |
287
+ | **Send** | Start a new task |
288
+ | **Save** | Save chat (local + cloud if enabled) |
289
+ | **Settings** | Edit API keys, base URL, model, cloud sync |
290
+ | **Skills** | Toggle installed skills on/off |
291
+ | **Help** | Two-pane help: sections + per-skill pages |
292
+
293
+ ---
294
+
295
+ ## Configuration reference
296
+
297
+ ### `agent_config.json`
298
+
299
+ Placed in the folder where you run `agent-code`, or in the platform config dir
300
+ if no local file exists:
301
+
302
+ - **Windows:** `%APPDATA%\agent-code\agent_config.json`
303
+ - **Linux/macOS:** `~/.config/agent-code/agent_config.json`
304
+
305
+ ```json
306
+ {
307
+ "openai_api_keys": ["sk-...", "sk-..."],
308
+ "openai_base_url": "https://api.openai.com/v1",
309
+ "openai_model": "gpt-4o",
310
+ "cloud_sync": false,
311
+ "disabled_skills": [],
312
+ "email_api": {
313
+ "provider": "resend",
314
+ "api_key": "re_...",
315
+ "from_addr": "onboarding@resend.dev",
316
+ "from_name": "Agent"
317
+ }
318
+ }
319
+ ```
320
+
321
+ | Field | Notes |
322
+ |---|---|
323
+ | `openai_api_keys` | Multiple keys rotate per request |
324
+ | `openai_base_url` | Any OpenAI-compatible endpoint |
325
+ | `openai_model` | Depends on the provider |
326
+ | `cloud_sync` | Sync `chats/current.json` to the registry |
327
+ | `disabled_skills` | List of skill folder names to skip |
328
+ | `email_api` | Optional, used by the `temp_mail` skill |
329
+
330
+ ### Where files go
331
+
332
+ When you run `agent-code` from a folder, it creates:
333
+
334
+ ```
335
+ <your-folder>/
336
+ ├── skills/ ← installed + bundled skills
337
+ ├── workspace/ ← sandbox for shell and file tools
338
+ ├── chats/ ← auto-saved conversation
339
+ └── agent_config.json (if you created one here)
340
+ ```
341
+
342
+ Whichever folder you launch from is the "project" for that session. Run
343
+ `agent-code` from different folders to keep separate projects.
344
+
345
+ ---
346
+
347
+ ## Server setup
348
+
349
+ Only needed if you want your own registry instance. The client works with
350
+ the hosted one out of the box.
351
+
352
+ ```bash
353
+ mkdir -p /opt/skill-server && cd /opt/skill-server
354
+ # copy skill-server.py here
355
+ python3 skill-server.py --host 0.0.0.0 --port 8000
356
+ ```
357
+
358
+ Then point the clients at it by editing `SKILL_SERVER_PRIMARY` and
359
+ `SKILL_SERVER_FALLBACK` in the source, or by setting them in `agent_config.json`.
360
+
361
+ ---
362
+
363
+ ## Security
364
+
365
+ The agent executes LLM-generated commands. That's the point, but it means
366
+ you need to be careful.
367
+
368
+ **Already sandboxed:**
369
+
370
+ - **Shell** — allowlist of commands, `shell=False`, `CWD=workspace/`, no
371
+ pipes / redirects / `;` / `&` / `&&`, no absolute paths outside the workspace
372
+ - **Filesystem skill** — every path resolved and validated against `workspace/`
373
+ - **Browser** — headless, in a throwaway profile
374
+ - **Registry server** — PBKDF2 password hashing, session tokens, ownership
375
+ checks on publish/delete, ZIP entry validation, upload size cap
376
+
377
+ **Not sandboxed:**
378
+
379
+ - **`python` is in the shell allowlist** — the agent can read arbitrary
380
+ files. Remove `python`, `python3`, `node` from `ALLOWED_CMDS` if that matters.
381
+ - **`curl` / `wget` are allowed** — the agent can POST local data to remote
382
+ servers.
383
+ - **Skills are arbitrary Python** — installing a skill is trusting its author.
384
+ - **Prompt injection via web content** — a malicious page can steer the agent.
385
+
386
+ For untrusted use, run the agent inside Docker.
387
+
388
+ ---
389
+
390
+ ## Files at a glance
391
+
392
+ ### Installed package
393
+
394
+ ```
395
+ site-packages/agent_code/
396
+ ├── __init__.py
397
+ ├── __main__.py
398
+ ├── cli.py
399
+ ├── paths.py
400
+ ├── agent.py
401
+ ├── skill_manager.py
402
+ ├── loader.py
403
+ └── data/
404
+ └── skills/
405
+ ├── filesystem/{skill.py,skill.md}
406
+ ├── public_api/{skill.py,skill.md}
407
+ └── temp_mail/{skill.py,skill.md}
408
+ ```
409
+
410
+ ### Your project folder (created on first run)
411
+
412
+ ```
413
+ your-folder/
414
+ ├── skills/
415
+ ├── workspace/
416
+ ├── chats/
417
+ └── agent_config.json (optional)
418
+ ```
419
+
420
+ ### This repository
421
+
422
+ ```
423
+ Agent-code/
424
+ ├── pyproject.toml ← PyPI metadata
425
+ ├── src/agent_code/ ← the package source
426
+ ├── docs/skills.html ← developer guide
427
+ ├── README.md
428
+ ├── LICENSE ← MIT
429
+ ├── LICENSE-GPL ← GPL-3.0
430
+ └── .gitignore
431
+ ```
432
+
433
+ `skill-server.py` (the registry backend, GPL-3.0) is deployed separately on a VPS.
434
+
435
+ ---
436
+
437
+ ## Troubleshooting
438
+
439
+ | Symptom | Fix |
440
+ |---|---|
441
+ | `agent-code: command not found` | Add `~/.local/bin` to PATH, or use `python3 -m agent_code` |
442
+ | `browser: FAILED` (Windows) | Install WebView2 Runtime from Microsoft |
443
+ | `browser: FAILED` (Linux) | `sudo apt install chromium` (or `dnf` / `pacman` equivalent) |
444
+ | `_tkinter.TclError` | Install `python3-tk` (Debian-family) or `python3-tkinter` (Fedora) |
445
+ | `no display name and no $DISPLAY` | You're on a headless machine — GUI won't work there |
446
+ | `LLM ERROR: 401` | Wrong API key, or stray quotes around it in `agent_config.json` |
447
+ | `LLM ERROR: 404` | Model name doesn't match the provider |
448
+ | `BLOCKED: '<cmd>' not allowed` | Add it to `ALLOWED_CMDS`, or use a different approach |
449
+ | `[loader] FAILED to load skill` | Run `python skills/<name>/skill.py` to see the import error |
450
+ | `externally-managed-environment` (Linux) | Use `pipx install agent-code` or a virtualenv |
451
+
452
+ ---
453
+
454
+ ## Development
455
+
456
+ Clone the repo, install in editable mode:
457
+
458
+ ```bash
459
+ git clone https://github.com/minecraftbefile-maker/Agent-code.git
460
+ cd Agent-code
461
+ pip install -e .
462
+ ```
463
+
464
+ Run the agent, manager, and site server directly:
465
+
466
+ ```bash
467
+ agent-code run
468
+ agent-code manage
469
+ python -m agent_code.landing --port 8080 # if you kept the site server
470
+ ```
471
+
472
+ The skill loader is ~200 lines: `src/agent_code/loader.py`. Read it alongside
473
+ `docs/skills.html` — between the two you'll know everything the agent does
474
+ with a skill.
475
+
476
+ ---
477
+
478
+ ## License
479
+
480
+ Split license:
481
+
482
+ | Component | License |
483
+ |---|---|
484
+ | `agent_code/` package, `docs/**`, README | **MIT** — see [`LICENSE`](LICENSE) |
485
+ | `skill-server.py` | **GPL-3.0** — see [`LICENSE-GPL`](LICENSE-GPL) |
486
+
487
+ **Why the split?** The client code is meant to be embedded, forked, and
488
+ redistributed freely. The server is meant to stay open — if you host a
489
+ modified version, you must publish your changes.
490
+
491
+ Default skills use third-party services:
492
+
493
+ - **mail.tm** — receive-only temp inbox, no signup
494
+ - **Guerrilla Mail** — fallback inbox
495
+ - **Resend / Brevo / Mailjet** — email sending, free tiers
496
+ - **public-api-lists** — public API catalog (MIT)
497
+ - **DrissionPage** — browser automation (BSD-3)
498
+ - **OpenAI Python SDK** — LLM client (Apache-2.0)