zettcode-server 0.1.0__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.
@@ -0,0 +1,30 @@
1
+ **/.venv/
2
+ **/__pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ build/
6
+ dist/
7
+ .smoke/
8
+ .coverage
9
+ **/.pytest_cache/
10
+ **/.ruff_cache/
11
+ .zett-tool-output/
12
+ .env
13
+ .DS_Store
14
+
15
+ # viztracer writes its trace here by default.
16
+ /result.json
17
+
18
+ # The docs site: dependencies, build output, and VitePress' cache.
19
+ node_modules/
20
+ docs/.vitepress/dist/
21
+ docs/.vitepress/cache/
22
+ docs/.vitepress/.temp/
23
+
24
+ # The TypeScript client is built from its sources; only dist/ is published.
25
+ clients/typescript/dist/
26
+
27
+ # The palette gallery is generated by `make palettes`: every widget painted in
28
+ # every palette, written by docs/scripts/palette_gallery.py. Regenerate it
29
+ # rather than committing a 2 MB copy that goes stale the moment a colour moves.
30
+ docs/internal/palettes.html
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.5
2
+ Name: zettcode-server
3
+ Version: 0.1.0
4
+ Summary: The ZettCode coding agent behind an HTTP API: prompts, streaming, sessions and models
5
+ Project-URL: Repository, https://github.com/Chang-LeHung/zettcode
6
+ Project-URL: Issues, https://github.com/Chang-LeHung/zettcode/issues
7
+ Author: Chang-LeHung
8
+ License-Expression: MIT
9
+ Keywords: agent,api,coding-agent,http,llm
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Web Environment
12
+ Classifier: Framework :: FastAPI
13
+ Classifier: Operating System :: MacOS
14
+ Classifier: Operating System :: Microsoft :: Windows :: Windows 10
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: fastapi<1,>=0.115
24
+ Requires-Dist: httpx<1,>=0.27
25
+ Requires-Dist: uvicorn<1,>=0.35
26
+ Requires-Dist: zettcode>=0.1.8
27
+ Description-Content-Type: text/markdown
28
+
29
+ # zettcode-server
30
+
31
+ The ZettCode coding agent behind an HTTP API, in the same repository as the terminal program and its SDK.
32
+
33
+ One process serves one workspace. Every endpoint drives the released `zettcode` SDK — the same tools, plugins, MCP
34
+ servers, skills, project instructions and session store as the terminal — so a conversation begun here can be reopened
35
+ in `zettcode`, and the other way round. The package holds no agent of its own.
36
+
37
+ ```bash
38
+ uv tool install zettcode-server
39
+ zettcode-server --workspace ~/projects/api
40
+ ```
41
+
42
+ ```text
43
+ zettcode-server 0.1.0 (zettcode 0.1.8) · http://127.0.0.1:3290 · workspace /home/you/projects/api · permission deny · token off
44
+ ```
45
+
46
+ It binds loopback on port **3290**, denies shell commands by default, and asks for a bearer token only when one is
47
+ configured (`--token`, `$ZETTCODE_SERVER_TOKEN`).
48
+
49
+ A machine with no model configured is still served: `/health` says `ready: false` and `POST /models` writes the
50
+ `[[models]]` entry (the same one `/config add` writes) and builds the agent, so an editor can set ZettCode up without
51
+ touching a file by hand.
52
+
53
+ ```bash
54
+ curl http://127.0.0.1:3290/health
55
+ curl -N -X POST http://127.0.0.1:3290/prompts \
56
+ -H 'content-type: application/json' \
57
+ -d '{"text": "summarize the README", "approvals": {"mode": "deny"}}'
58
+ ```
59
+
60
+ The stream carries the run's events and ends with its result. A run that needs an answer — a shell command, a
61
+ question — is suspended and answered through `POST /runs/approvals` or `POST /runs/questions`, so a client stays in
62
+ the conversation instead of guessing.
63
+
64
+ - [The guide](https://chang-lehung.github.io/zettcode/server/): install, endpoints, event stream
65
+ - [TypeScript client](../clients/typescript): `npm install zettcode-client`
66
+ - [Python SDK](https://chang-lehung.github.io/zettcode/sdk/): the same agent from Python
@@ -0,0 +1,38 @@
1
+ # zettcode-server
2
+
3
+ The ZettCode coding agent behind an HTTP API, in the same repository as the terminal program and its SDK.
4
+
5
+ One process serves one workspace. Every endpoint drives the released `zettcode` SDK — the same tools, plugins, MCP
6
+ servers, skills, project instructions and session store as the terminal — so a conversation begun here can be reopened
7
+ in `zettcode`, and the other way round. The package holds no agent of its own.
8
+
9
+ ```bash
10
+ uv tool install zettcode-server
11
+ zettcode-server --workspace ~/projects/api
12
+ ```
13
+
14
+ ```text
15
+ zettcode-server 0.1.0 (zettcode 0.1.8) · http://127.0.0.1:3290 · workspace /home/you/projects/api · permission deny · token off
16
+ ```
17
+
18
+ It binds loopback on port **3290**, denies shell commands by default, and asks for a bearer token only when one is
19
+ configured (`--token`, `$ZETTCODE_SERVER_TOKEN`).
20
+
21
+ A machine with no model configured is still served: `/health` says `ready: false` and `POST /models` writes the
22
+ `[[models]]` entry (the same one `/config add` writes) and builds the agent, so an editor can set ZettCode up without
23
+ touching a file by hand.
24
+
25
+ ```bash
26
+ curl http://127.0.0.1:3290/health
27
+ curl -N -X POST http://127.0.0.1:3290/prompts \
28
+ -H 'content-type: application/json' \
29
+ -d '{"text": "summarize the README", "approvals": {"mode": "deny"}}'
30
+ ```
31
+
32
+ The stream carries the run's events and ends with its result. A run that needs an answer — a shell command, a
33
+ question — is suspended and answered through `POST /runs/approvals` or `POST /runs/questions`, so a client stays in
34
+ the conversation instead of guessing.
35
+
36
+ - [The guide](https://chang-lehung.github.io/zettcode/server/): install, endpoints, event stream
37
+ - [TypeScript client](../clients/typescript): `npm install zettcode-client`
38
+ - [Python SDK](https://chang-lehung.github.io/zettcode/sdk/): the same agent from Python
@@ -0,0 +1,58 @@
1
+ [project]
2
+ name = "zettcode-server"
3
+ description = "The ZettCode coding agent behind an HTTP API: prompts, streaming, sessions and models"
4
+ readme = "README.md"
5
+ requires-python = ">=3.10"
6
+ dynamic = ["version"]
7
+ license = "MIT"
8
+ authors = [{name = "Chang-LeHung"}]
9
+ keywords = ["agent", "llm", "http", "api", "coding-agent"]
10
+ classifiers = [
11
+ "Development Status :: 3 - Alpha",
12
+ "Environment :: Web Environment",
13
+ "Framework :: FastAPI",
14
+ "Operating System :: MacOS",
15
+ "Operating System :: Microsoft :: Windows :: Windows 10",
16
+ "Operating System :: POSIX :: Linux",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Programming Language :: Python :: 3.14",
22
+ "Typing :: Typed",
23
+ ]
24
+ dependencies = [
25
+ # The agent, as a released package: the server drives it through its SDK and
26
+ # carries no copy of the model loop, the tools, or the session store.
27
+ "zettcode>=0.1.8",
28
+ "fastapi>=0.115,<1",
29
+ "uvicorn>=0.35,<1",
30
+ # Returned by every endpoint and read back by the tests; the SDK's own runs
31
+ # speak to the provider with it.
32
+ "httpx>=0.27,<1",
33
+ ]
34
+
35
+ [project.scripts]
36
+ zettcode-server = "zettcode_server.cli:main"
37
+
38
+ [project.urls]
39
+ Repository = "https://github.com/Chang-LeHung/zettcode"
40
+ Issues = "https://github.com/Chang-LeHung/zettcode/issues"
41
+
42
+ [build-system]
43
+ requires = ["hatchling"]
44
+ build-backend = "hatchling.build"
45
+
46
+ [tool.hatch.version]
47
+ # Single source of truth: the version is written once, in the package.
48
+ path = "src/zettcode_server/__init__.py"
49
+
50
+ [tool.hatch.build.targets.wheel]
51
+ packages = ["src/zettcode_server"]
52
+
53
+ [tool.hatch.build.targets.sdist]
54
+ include = ["/src", "/README.md", "/pyproject.toml"]
55
+
56
+ [tool.pytest.ini_options]
57
+ testpaths = ["tests"]
58
+ asyncio_mode = "auto"
@@ -0,0 +1,33 @@
1
+ """ZettCode behind an HTTP API: the coding agent, driven by `zettcode.sdk`, one workspace per process.
2
+
3
+ The server is a thin layer: an endpoint says what to ask the agent and how to let a run answer for itself, and the
4
+ SDK does the work. It owns no model loop, no tools, and no session format, so a session begun here is one the
5
+ terminal can open afterwards, and the other way round.
6
+
7
+ The application is built by :func:`create_app`, and served by the ``zettcode-server`` program.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ from typing import TYPE_CHECKING, Any
13
+
14
+ __version__ = "0.1.0"
15
+
16
+ if TYPE_CHECKING: # pragma: no cover - annotations only; importing the app costs FastAPI
17
+ from .app import create_app
18
+ from .settings import Settings
19
+
20
+ __all__ = ["Settings", "__version__", "create_app"]
21
+
22
+
23
+ def __getattr__(name: str) -> Any:
24
+ """Load the application on first use, so ``--version`` does not import FastAPI."""
25
+ if name == "create_app":
26
+ from .app import create_app
27
+
28
+ return create_app
29
+ if name == "Settings":
30
+ from .settings import Settings
31
+
32
+ return Settings
33
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")