agent-code 1.0.0__py3-none-any.whl

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.
@@ -0,0 +1,434 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-code
3
+ Version: 1.0.0
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/minecraftbefile-maker/Agent-code
9
+ Project-URL: Issues, https://github.com/minecraftbefile-maker/Agent-code/issues
10
+ Project-URL: Changelog, https://github.com/minecraftbefile-maker/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
+ ![Python](https://img.shields.io/badge/python-3.10%2B-blue)
38
+ ![License](https://img.shields.io/badge/license-MIT%20%2B%20GPL--3.0-green)
39
+ ![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey)
40
+
41
+ ---
42
+
43
+ ## What this is
44
+
45
+ Two programs on your machine, plus a registry server that's already hosted for you.
46
+
47
+ | File | Runs on | Job |
48
+ |---|---|---|
49
+ | **`agent.py`** | your machine | The agent. Chat GUI, headless browser, sandboxed shell, tool loop, skill toggles. |
50
+ | **`skill-manager.py`** | your machine | App-store GUI. Sign in, browse, install, publish skills. |
51
+ | **`skill-server.py`** | a server (hosted for you) | Registry + state sync. GPL-3.0. |
52
+
53
+ Skills are folders under `skills/`. Drop one in, restart the agent, its tools
54
+ appear in the LLM's tool list. No changes to `agent.py` required.
55
+
56
+ ---
57
+
58
+ ## About the server
59
+
60
+ You **don't need to run the server yourself.** A live instance is already
61
+ hosted and configured:
62
+
63
+ https://skills-manager.freesrv.com
64
+
65
+ Both `agent.py` and `skill-manager.py` point at it by default. The manager
66
+ tries the HTTPS domain first and automatically falls back to a raw IP
67
+ (`http://78.154.103.43:9074`) if the domain goes down.
68
+
69
+ If you'd rather run your own, the source is included under GPL-3.0 (see
70
+ [License](#license)). You can fork it, self-host it, extend the endpoints, or
71
+ replace the storage backend. See [self-hosting the server](#self-hosting-the-server).
72
+
73
+ The agent **never auto-installs skills**. You do that explicitly through the manager.
74
+
75
+ ---
76
+
77
+ ## Features
78
+
79
+ - **Headless Chromium** via DrissionPage — no popup window, real JS rendering
80
+ - **Sandboxed shell** — allowlist + workspace jail, no pipes or metachars
81
+ - **Plug-and-play skills** — each is a folder with `skill.py` + `skill.md`
82
+ - **Skill registry** — publish, browse, install (hosted, or self-host)
83
+ - **Stop / Continue** buttons — halt a run mid-turn, resume from last tool result
84
+ - **Local chat save** — `chats/current.json`, auto-saved every turn
85
+ - **Cloud sync** — optional, via the same registry (HTTPS + IP fallback)
86
+ - **Multi-key LLM** — rotate OpenAI-compatible API keys transparently
87
+ - **Custom base URL** — OpenAI, Together, Groq, DeepSeek, local vLLM, anything OpenAI-shaped
88
+ - **Dark tkinter GUI** — Settings, Skills, Help dialogs, plus skill-loaded `/commands`
89
+ - **Two-pane Help** — every skill gets its own help page, loaded from its `skill.md`
90
+
91
+ Bundled default skills: `filesystem`, `public_api`, `temp_mail`.
92
+
93
+ ---
94
+
95
+ ## Quick start
96
+
97
+ ### 1. Install dependencies
98
+
99
+ pip install DrissionPage openai
100
+
101
+ Windows: install WebView2 Runtime if the browser self-test fails.
102
+ Linux: `sudo apt install python3-tk`.
103
+
104
+ ### 2. Configure
105
+
106
+ Create `agent_config.json`:
107
+
108
+ {
109
+ "openai_api_keys": ["sk-your-key-here"],
110
+ "openai_base_url": "https://api.openai.com/v1",
111
+ "openai_model": "gpt-4o",
112
+ "cloud_sync": false
113
+ }
114
+
115
+ Or edit it from the GUI later via **Settings**.
116
+
117
+ ### 3. Run
118
+
119
+ python agent.py
120
+
121
+ Or on Windows, double-click `run.bat`.
122
+
123
+ ### 4. Talk to it
124
+
125
+ go to news.ycombinator.com and list the top 5 story titles
126
+ find a free API for cat facts and call it
127
+ create a snake game in a single HTML file
128
+
129
+ ---
130
+
131
+ ## The skill system
132
+
133
+ A skill is a folder:
134
+
135
+ skills/my_skill/
136
+ ├── skill.py ← code
137
+ └── skill.md ← metadata + docs
138
+
139
+ `skill.py` exports three things:
140
+
141
+ SKILL = {"name": "my_skill", "description": "What this does."}
142
+
143
+ def greet(name: str = "world") -> str:
144
+ return f"Hello, {name}!"
145
+
146
+ TOOL_SCHEMAS = [{
147
+ "type": "function",
148
+ "function": {
149
+ "name": "greet",
150
+ "description": "Return a greeting.",
151
+ "parameters": {
152
+ "type": "object",
153
+ "properties": {"name": {"type": "string"}},
154
+ },
155
+ },
156
+ }]
157
+
158
+ TOOL_CALLABLES = {"greet": greet}
159
+
160
+ That's it. Restart the agent, the LLM can call `greet()`.
161
+
162
+ Optional `COMMANDS` export adds user-facing slash commands:
163
+
164
+ def _handle_ping(args: list, log) -> None:
165
+ log(f"pong {' '.join(args)}", "dim")
166
+
167
+ COMMANDS = {
168
+ "ping": {"handler": _handle_ping, "description": "Reply pong"},
169
+ }
170
+
171
+ Optional `skill.md` frontmatter gives the skill a name, version, and author.
172
+ Anything after the closing `---` becomes the skill's help page, visible in
173
+ the Help dialog when the user clicks the skill.
174
+
175
+ Full developer guide: `docs/skills.html` — open in any browser.
176
+
177
+ ---
178
+
179
+ ## Skill registry
180
+
181
+ ### Use the hosted server (default)
182
+
183
+ No setup needed. Both clients already point at
184
+ `https://skills-manager.freesrv.com`. Just:
185
+
186
+ # Register a nickname (password is prompted)
187
+ python skill-manager.py register yourname
188
+
189
+ # Or launch the GUI
190
+ python skill-manager.py
191
+
192
+ The GUI lets you:
193
+
194
+ - Browse the store with search
195
+ - Install skills into `./skills/`
196
+ - Publish a folder as a skill
197
+ - See your published skills and download counts
198
+ - Delete skills you own
199
+
200
+ ### Self-hosting the server
201
+
202
+ Only needed if you want your own instance or to modify it. The server is
203
+ ~450 lines of stdlib Python — no framework, no external dependencies.
204
+
205
+ Deploy:
206
+
207
+ mkdir -p /opt/skill-server && cd /opt/skill-server
208
+ # copy skill-server.py here
209
+ python3 skill-server.py --host 0.0.0.0 --port 8000
210
+
211
+ It creates `skill_server.db` (SQLite) and `skill_storage/` on first run.
212
+
213
+ Put TLS in front with Caddy:
214
+
215
+ skills.example.com {
216
+ reverse_proxy 127.0.0.1:8000
217
+ }
218
+
219
+ Or nginx:
220
+
221
+ server {
222
+ listen 443 ssl;
223
+ server_name skills.example.com;
224
+
225
+ location /login {
226
+ limit_req zone=login burst=3 nodelay;
227
+ proxy_pass http://127.0.0.1:8000;
228
+ }
229
+ location / {
230
+ proxy_pass http://127.0.0.1:8000;
231
+ }
232
+ }
233
+
234
+ Point the clients at it by editing the constants at the top of both files:
235
+
236
+ SKILL_SERVER_PRIMARY = "https://skills.example.com"
237
+ SKILL_SERVER_FALLBACK = "http://1.2.3.4:8000"
238
+
239
+ ---
240
+
241
+ ## Architecture
242
+
243
+ [agent.py] [skill-manager.py]
244
+ │ │
245
+ │ reads token from │ signs in, gets token
246
+ │ ~/.skill-manager.json │
247
+ │ │
248
+ └──────── HTTP/HTTPS ─────────────────┘
249
+ │
250
+ ▼
251
+ https://skills-manager.freesrv.com (primary, hosted)
252
+ http://78.154.103.43:9074 (fallback IP)
253
+ │
254
+ ▼
255
+ [skill-server.py] (already deployed)
256
+ - /register /login /logout
257
+ - /me
258
+ - /skills GET / POST / DELETE
259
+ - /skills/<name>/download
260
+ - /state GET / POST
261
+
262
+ You can swap the server URL in both clients at any time.
263
+
264
+ ---
265
+
266
+ ## Command reference
267
+
268
+ ### Agent (in the chat box)
269
+
270
+ | Command | What it does |
271
+ |---|---|
272
+ | `/reset` | Clear conversation memory |
273
+ | `/history` | Print recent messages |
274
+ | `/skills` | List loaded + disabled skills + available commands |
275
+ | `/save` | Force save chat locally and to cloud |
276
+ | `/open <file>` | Open a file from the workspace |
277
+ | Skill commands | Whatever skills register, e.g. `/email`, `/providers` |
278
+
279
+ ### Agent buttons
280
+
281
+ | Button | Action |
282
+ |---|---|
283
+ | **Stop** | Halt the running agent loop |
284
+ | **Continue** | Resume from the last tool result |
285
+ | **Send** | Start a new task |
286
+ | **Save** | Save chat (local + cloud if enabled) |
287
+ | **Settings** | Edit API keys, base URL, model, cloud sync |
288
+ | **Skills** | Toggle installed skills on/off |
289
+ | **Help** | Two-pane help: sections + per-skill pages |
290
+
291
+ ### Skill manager
292
+
293
+ | Command | What it does |
294
+ |---|---|
295
+ | `register <nick>` | Create an account |
296
+ | `login <nick>` | Sign in |
297
+ | `logout` | Sign out |
298
+ | `whoami` | Show your account + published skills |
299
+ | `list [--search Q]` | Browse the store |
300
+ | `show <name>` | Full metadata for one skill |
301
+ | `install <name> [--force]` | Download + extract to `./skills/` |
302
+ | `uninstall <name>` | Remove from `./skills/` |
303
+ | `installed` | List locally installed skills |
304
+ | `publish <path> --name N --description D [--version V]` | Package and upload a folder |
305
+
306
+ ---
307
+
308
+ ## Configuration reference
309
+
310
+ ### `agent_config.json`
311
+
312
+ {
313
+ "openai_api_keys": ["sk-...", "sk-..."],
314
+ "openai_base_url": "https://api.openai.com/v1",
315
+ "openai_model": "gpt-4o",
316
+ "cloud_sync": false,
317
+ "disabled_skills": [],
318
+ "email_api": {
319
+ "provider": "resend",
320
+ "api_key": "re_...",
321
+ "from_addr": "onboarding@resend.dev",
322
+ "from_name": "Agent"
323
+ }
324
+ }
325
+
326
+ | Field | Notes |
327
+ |---|---|
328
+ | `openai_api_keys` | Multiple keys rotate per request |
329
+ | `openai_base_url` | Any OpenAI-compatible endpoint |
330
+ | `openai_model` | Depends on the provider |
331
+ | `cloud_sync` | Sync `chats/current.json` to the registry |
332
+ | `disabled_skills` | List of skill folder names to skip |
333
+ | `email_api` | Optional, used by the `temp_mail` skill |
334
+
335
+ ### `~/.skill-manager.json`
336
+
337
+ Managed automatically by `skill-manager.py`. Contains the auth token and
338
+ cached skill list. Never commit this.
339
+
340
+ ---
341
+
342
+ ## Security
343
+
344
+ The agent executes LLM-generated commands. That's the point, but it means
345
+ you need to be careful.
346
+
347
+ **Already sandboxed:**
348
+
349
+ - **Shell** — allowlist of commands, `shell=False`, `CWD=workspace/`, no
350
+ pipes / redirects / `;` / `&` / `&&`, no absolute paths outside the workspace
351
+ - **Filesystem skill** — every path resolved and validated against `workspace/`
352
+ - **Browser** — headless, in a throwaway profile
353
+ - **Server** — PBKDF2 password hashing, session tokens, ownership checks on
354
+ publish/delete, ZIP entry validation, upload size cap
355
+
356
+ **Not sandboxed:**
357
+
358
+ - **`python` is in the shell allowlist** — the agent can read arbitrary
359
+ files. If that matters, remove `python`, `python3`, `node` from `ALLOWED_CMDS`.
360
+ - **`curl` / `wget` are allowed** — the agent can POST local data to remote
361
+ servers. Remove them if that's a concern.
362
+ - **Skills are arbitrary Python** — installing a skill is trusting its author.
363
+ - **Prompt injection via web content** — a malicious page can steer the
364
+ agent. Mitigated by the sandbox, not eliminated.
365
+
366
+ For untrusted use, run the whole thing in Docker.
367
+
368
+ ---
369
+
370
+ ## Files at a glance
371
+
372
+ man-code/
373
+ ├── agent.py ← the agent
374
+ ├── skill-manager.py ← the client
375
+ ├── agent_config.json ← your keys (gitignored)
376
+ ├── agent_config.example.json
377
+ ├── run.bat ← Windows launcher for the agent
378
+ ├── store.bat ← Windows launcher for the manager
379
+ ├── README.md
380
+ ├── LICENSE ← MIT (client code)
381
+ ├── LICENSE-GPL ← GPL-3.0 (server code)
382
+ ├── .gitignore
383
+ ├── docs/
384
+ │ └── skills.html ← developer guide for writing skills
385
+ ├── chats/
386
+ │ └── current.json ← auto-saved conversation (gitignored)
387
+ ├── skills/
388
+ │ ├── loader.py ← loads every enabled skill
389
+ │ ├── filesystem/
390
+ │ ├── public_api/
391
+ │ └── temp_mail/
392
+ └── workspace/ ← agent's sandbox (gitignored)
393
+
394
+ `skill-server.py` is **not** in this tree. It lives on the server and is
395
+ maintained separately.
396
+
397
+ ---
398
+
399
+ ## Troubleshooting
400
+
401
+ | Symptom | Fix |
402
+ |---|---|
403
+ | `browser: FAILED` | Install WebView2 (Windows) or check Chromium. |
404
+ | `LLM ERROR: 401` | Wrong API key, or quotes around the value. |
405
+ | `LLM ERROR: 404` | Model name doesn't match the provider. |
406
+ | `BLOCKED: '<cmd>' not allowed` | Add the command to `ALLOWED_CMDS` in `agent.py`. |
407
+ | `NOT_FOUND: <selector>` | CSS selector didn't match. Run `browser_snapshot`. |
408
+ | `[loader] FAILED to load skill` | Run `python skills/<name>/skill.py` to see the error. |
409
+ | Registry times out | Fallback IP should kick in; check console for `[fallback]`. |
410
+ | `Cloudflare blocked` | Add a WAF skip rule for the API paths on your server. |
411
+
412
+ ---
413
+
414
+ ## License
415
+
416
+ This project uses a split license:
417
+
418
+ | Component | License |
419
+ |---|---|
420
+ | `agent.py`, `skill-manager.py`, `skills/**`, `docs/**`, `*.bat` | **MIT** — see `LICENSE` |
421
+ | `skill-server.py` | **GPL-3.0** — see `LICENSE-GPL` |
422
+
423
+ **Why the split?** The client code is meant to be embedded, forked, and
424
+ redistributed freely. The server is meant to stay open — if you host a
425
+ modified version, you must publish your changes.
426
+
427
+ Default skills use third-party services:
428
+
429
+ - **mail.tm** — receive-only temp inbox, no signup
430
+ - **Guerrilla Mail** — fallback inbox
431
+ - **Resend / Brevo / Mailjet** — email sending, free tiers
432
+ - **public-api-lists** — public API catalog (MIT)
433
+ - **DrissionPage** — browser automation (BSD-3)
434
+ - **OpenAI Python SDK** — LLM client (Apache-2.0)
@@ -0,0 +1,20 @@
1
+ agent_code/__init__.py,sha256=xHm961jj-3nHFyZG9q1eAifcSeuk8BoQ0QHd7oL17MI,105
2
+ agent_code/__main__.py,sha256=jvQ4_PO6ET29Drzyz3GD7ea0geXGW-OhUWTk49DkmdU,64
3
+ agent_code/agent.py,sha256=wHJ2hZYGlSdYIHJXeq8AEB9gQxCYy36VhRUm19TH7-w,60307
4
+ agent_code/cli.py,sha256=VH-DAqL08yGFYYG8lTOHmj92Mqi1mPa2CRDx--HVpTg,2179
5
+ agent_code/loader.py,sha256=2BuBUX-QZV1_P740nkAlwUlEFueAfnuZvWI5ll5TzhY,7530
6
+ agent_code/paths.py,sha256=QO6XkNEvtPu0Nzg4s6sV9iXpnOdli-ddBM6f5uchZDY,2042
7
+ agent_code/skill_manager.py,sha256=E1I2tZnajvpqJONbOnJIpFkKc-xIpZexlHrKm-rn4bg,45972
8
+ agent_code/data/skills/filesystem/skill.md,sha256=JfA6gWXefopoWamR6ZnbM6qruqxoaL9ZO_zeN4vm9HQ,2530
9
+ agent_code/data/skills/filesystem/skill.py,sha256=9anVlJwI6vKMB5uJ2WqZEMFTC8CbysqIPDw6omzEubA,5066
10
+ agent_code/data/skills/public_api/skill.md,sha256=HOcYAjTrdqWRJN67lUm4zBf3D2FIEBPexuVPJFO2PKw,1151
11
+ agent_code/data/skills/public_api/skill.py,sha256=9sg2o_10VnkxCJOHoqluYSHZ4qK_Dhg8V18-_22L4ns,3595
12
+ agent_code/data/skills/temp_mail/skill.md,sha256=Le_sVrZJ1br9_j_c-v3Suu382eA9kUiD4Kua80r3rpQ,1506
13
+ agent_code/data/skills/temp_mail/skill.py,sha256=LDMCYnJYgOJi4g7E_-MbyYEaWWZDNZIA_Bs8V6jvuBw,25259
14
+ agent_code-1.0.0.dist-info/licenses/LICENSE,sha256=TSPpYurzgqxPh-JpUNSq6HbpdtNoqdbwemJuShejiHA,1080
15
+ agent_code-1.0.0.dist-info/licenses/LICENSE-GPL,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
16
+ agent_code-1.0.0.dist-info/METADATA,sha256=YS90hs9Y59sJNK7MeVljkL7vFLbI9-cH0X4rWUyyZxE,14777
17
+ agent_code-1.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
18
+ agent_code-1.0.0.dist-info/entry_points.txt,sha256=2nugbsKHixU0g6sPSSi71mcV1_kf2AXBOZMogtz5eAI,51
19
+ agent_code-1.0.0.dist-info/top_level.txt,sha256=9baqvu54KZwJOjjmacmUyY8VGnHAC8eKh8o4Zw0wOfo,11
20
+ agent_code-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ agent-code = agent_code.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Abdo
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.