zettcode-sdk 0.3.4__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 (30) hide show
  1. zettcode_sdk-0.3.4/.gitignore +37 -0
  2. zettcode_sdk-0.3.4/PKG-INFO +21 -0
  3. zettcode_sdk-0.3.4/pyproject.toml +45 -0
  4. zettcode_sdk-0.3.4/src/zettcode/daemon/__init__.py +17 -0
  5. zettcode_sdk-0.3.4/src/zettcode/daemon/__main__.py +10 -0
  6. zettcode_sdk-0.3.4/src/zettcode/daemon/cli.py +693 -0
  7. zettcode_sdk-0.3.4/src/zettcode/daemon/companions.py +63 -0
  8. zettcode_sdk-0.3.4/src/zettcode/daemon/process.py +559 -0
  9. zettcode_sdk-0.3.4/src/zettcode/daemon/run.py +678 -0
  10. zettcode_sdk-0.3.4/src/zettcode/daemon/state.py +356 -0
  11. zettcode_sdk-0.3.4/src/zettcode/doctor.py +167 -0
  12. zettcode_sdk-0.3.4/src/zettcode/mentions.py +320 -0
  13. zettcode_sdk-0.3.4/src/zettcode/sdk/__init__.py +195 -0
  14. zettcode_sdk-0.3.4/src/zettcode/sdk/builtins.py +608 -0
  15. zettcode_sdk-0.3.4/src/zettcode/sdk/client.py +1810 -0
  16. zettcode_sdk-0.3.4/src/zettcode/sdk/commands.py +9 -0
  17. zettcode_sdk-0.3.4/src/zettcode/sdk/daemons.py +244 -0
  18. zettcode_sdk-0.3.4/src/zettcode/sdk/errors.py +132 -0
  19. zettcode_sdk-0.3.4/src/zettcode/sdk/events.py +434 -0
  20. zettcode_sdk-0.3.4/src/zettcode/sdk/extensions/__init__.py +6 -0
  21. zettcode_sdk-0.3.4/src/zettcode/sdk/extensions/mcp.py +276 -0
  22. zettcode_sdk-0.3.4/src/zettcode/sdk/extensions/messaging.py +281 -0
  23. zettcode_sdk-0.3.4/src/zettcode/sdk/handlers.py +126 -0
  24. zettcode_sdk-0.3.4/src/zettcode/sdk/messenger.py +299 -0
  25. zettcode_sdk-0.3.4/src/zettcode/sdk/models.py +156 -0
  26. zettcode_sdk-0.3.4/src/zettcode/sdk/py.typed +0 -0
  27. zettcode_sdk-0.3.4/src/zettcode/sdk/session.py +1212 -0
  28. zettcode_sdk-0.3.4/src/zettcode/sdk/translation.py +384 -0
  29. zettcode_sdk-0.3.4/src/zettcode/sdk/types.py +907 -0
  30. zettcode_sdk-0.3.4/src/zettcode/table.py +95 -0
@@ -0,0 +1,37 @@
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 gateway's page is built from clients/gateway into the package when a distribution is made (`make gateway-ui`);
28
+ # the build output is not kept in the repository. pyproject's `artifacts` puts it in the wheel all the same.
29
+ packages/zettcode-gateway/src/zettcode/gateway/static/
30
+
31
+ # The palette gallery is generated by `make palettes`: every widget painted in
32
+ # every palette, written by docs/scripts/palette_gallery.py. Regenerate it
33
+ # rather than committing a 2 MB copy that goes stale the moment a colour moves.
34
+ docs/internal/palettes.html
35
+
36
+ # The release order is generated from the pyproject.toml files (`make order`); it is not kept in git.
37
+ packages/order.txt
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.5
2
+ Name: zettcode-sdk
3
+ Version: 0.3.4
4
+ Summary: The documented, stable Python surface over ZettCode: sessions, runs, models, daemons
5
+ Project-URL: Repository, https://github.com/Chang-LeHung/zettcode
6
+ Author: Chang-LeHung
7
+ License-Expression: MIT
8
+ Keywords: agent,sdk,zettcode
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Programming Language :: Python :: 3.15
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: >=3.10
18
+ Requires-Dist: httpx<1,>=0.27
19
+ Requires-Dist: zett-agent<0.3,>=0.2.7
20
+ Requires-Dist: zettcode-broker
21
+ Requires-Dist: zettcode-engine
@@ -0,0 +1,45 @@
1
+ [project]
2
+ name = "zettcode-sdk"
3
+ description = "The documented, stable Python surface over ZettCode: sessions, runs, models, daemons"
4
+ requires-python = ">=3.10"
5
+ dynamic = ["version"]
6
+ license = "MIT"
7
+ authors = [{name = "Chang-LeHung"}]
8
+ keywords = ["zettcode", "sdk", "agent"]
9
+ classifiers = [
10
+ "Development Status :: 5 - Production/Stable",
11
+ "Programming Language :: Python :: 3.10",
12
+ "Programming Language :: Python :: 3.11",
13
+ "Programming Language :: Python :: 3.12",
14
+ "Programming Language :: Python :: 3.13",
15
+ "Programming Language :: Python :: 3.14",
16
+ "Programming Language :: Python :: 3.15",
17
+ "Typing :: Typed",
18
+ ]
19
+ dependencies = [
20
+ "zettcode-engine",
21
+ "zettcode-broker",
22
+ "zett-agent>=0.2.7,<0.3",
23
+ "httpx>=0.27,<1",
24
+ ]
25
+
26
+ [project.urls]
27
+ Repository = "https://github.com/Chang-LeHung/zettcode"
28
+
29
+ [build-system]
30
+ requires = ["hatchling"]
31
+ build-backend = "hatchling.build"
32
+
33
+ [tool.hatch.version]
34
+ # One version for the whole repository: the engine ships the file.
35
+ path = "../zettcode-engine/src/zettcode/version.py"
36
+
37
+ [tool.hatch.build.targets.wheel]
38
+ packages = ["src/zettcode"]
39
+
40
+ [tool.hatch.build.targets.sdist]
41
+ include = ["/src", "/pyproject.toml"]
42
+
43
+ [tool.pytest.ini_options]
44
+ testpaths = ["tests"]
45
+ asyncio_mode = "auto"
@@ -0,0 +1,17 @@
1
+ """Background agents: a session with nobody at the keyboard, which other sessions reach with ``send_message``.
2
+
3
+ zettcode daemon spawn # start one; it prints the session id it is messaged by
4
+ zettcode daemon list # every daemon on this machine, alive or dead
5
+ zettcode daemon kill <id> # stop one, and remove its record; the session stays
6
+
7
+ A daemon is an ordinary session — stored where every session is, resumable in the terminal afterwards — plus a
8
+ record of its process under ``~/.zettcode/daemon/<workspace>/<session-id>/`` (:mod:`.state`) and the loop that
9
+ answers messages (:mod:`.run`). :mod:`.process` starts it detached and stops it; :mod:`.cli` is the command.
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ #: The shell levels a daemon can be given. There is no ``ask``: nobody is there to answer it.
15
+ PERMISSIONS = ("deny", "safe", "full")
16
+
17
+ __all__ = ["PERMISSIONS", "cli", "process", "run", "state"]
@@ -0,0 +1,10 @@
1
+ """``python -m zettcode.daemon``: what ``daemon spawn`` starts, and nothing a reader calls by hand."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+
7
+ from .cli import daemon_program
8
+
9
+ if __name__ == "__main__":
10
+ raise SystemExit(daemon_program(sys.argv[1:]))