zettcode-ask-user 0.4.1__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.
- zettcode_ask_user-0.4.1/.gitignore +37 -0
- zettcode_ask_user-0.4.1/PKG-INFO +19 -0
- zettcode_ask_user-0.4.1/pyproject.toml +50 -0
- zettcode_ask_user-0.4.1/src/zettcode/ask_user/__init__.py +12 -0
- zettcode_ask_user-0.4.1/src/zettcode/ask_user/plugin.py +33 -0
- zettcode_ask_user-0.4.1/src/zettcode/ask_user/py.typed +0 -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,19 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: zettcode-ask-user
|
|
3
|
+
Version: 0.4.1
|
|
4
|
+
Summary: The ask_user tool of ZettCode, as a part of the agent that lives apart from it
|
|
5
|
+
Project-URL: Repository, https://github.com/Chang-LeHung/zettcode
|
|
6
|
+
Author: Chang-LeHung
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Keywords: agent,ask-user,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: zett-agent<0.3,>=0.2.7
|
|
19
|
+
Requires-Dist: zettcode-engine
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "zettcode-ask-user"
|
|
3
|
+
description = "The ask_user tool of ZettCode, as a part of the agent that lives apart from it"
|
|
4
|
+
requires-python = ">=3.10"
|
|
5
|
+
dynamic = ["version"]
|
|
6
|
+
license = "MIT"
|
|
7
|
+
authors = [{name = "Chang-LeHung"}]
|
|
8
|
+
keywords = ["zettcode", "ask-user", "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
|
+
# The plugin base classes and the switch the runtime provides.
|
|
21
|
+
"zettcode-engine",
|
|
22
|
+
# The extension the factory builds.
|
|
23
|
+
"zett-agent>=0.2.7,<0.3",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
# A part of the program, not a plugin: the `[tool.zettcode] plugin = true` marker is what the plugin release line looks for. It is
|
|
27
|
+
# activated with the agent's other parts and `[ask_user] enabled` is what turns it off.
|
|
28
|
+
[project.entry-points."zettcode.plugin"]
|
|
29
|
+
ask-user = "zettcode.ask_user.plugin:AskUser"
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Repository = "https://github.com/Chang-LeHung/zettcode"
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["hatchling"]
|
|
36
|
+
build-backend = "hatchling.build"
|
|
37
|
+
|
|
38
|
+
[tool.hatch.version]
|
|
39
|
+
# One version for the whole repository: the engine ships the file.
|
|
40
|
+
path = "../zettcode-engine/src/zettcode/version.py"
|
|
41
|
+
|
|
42
|
+
[tool.hatch.build.targets.wheel]
|
|
43
|
+
packages = ["src/zettcode"]
|
|
44
|
+
|
|
45
|
+
[tool.hatch.build.targets.sdist]
|
|
46
|
+
include = ["/src", "/pyproject.toml"]
|
|
47
|
+
|
|
48
|
+
[tool.pytest.ini_options]
|
|
49
|
+
testpaths = ["tests"]
|
|
50
|
+
asyncio_mode = "auto"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""The ``ask_user`` tool of ZettCode: the plugin that hands it to the agent.
|
|
2
|
+
|
|
3
|
+
A part of the program that lives in a distribution of its own, found through the ``zettcode.plugin`` entry point.
|
|
4
|
+
``[ask_user] enabled`` in the configuration is what turns it off. The extension is imported by the factory, so a launch
|
|
5
|
+
that never builds an agent does not pay for it.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from .plugin import AskUser
|
|
11
|
+
|
|
12
|
+
__all__ = ["AskUser"]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""The plugin that hands the agent the ``ask_user`` tool."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING
|
|
6
|
+
|
|
7
|
+
from zettcode.engine.plugins.context import PluginContext
|
|
8
|
+
from zettcode.engine.plugins.plugin import Plugin, PluginSetting
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING: # pragma: no cover - annotations only
|
|
11
|
+
from zett_agent.extensions.base import AgentExtension
|
|
12
|
+
|
|
13
|
+
from zettcode.engine.plugins.state import AgentBuild
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class AskUser(Plugin[PluginContext]):
|
|
17
|
+
"""The ``ask_user`` tool: how the model puts a question to the reader instead of guessing."""
|
|
18
|
+
|
|
19
|
+
name = "ask-user"
|
|
20
|
+
description = "The ask_user tool"
|
|
21
|
+
setting = PluginSetting("ask_user_enabled", "ask_user")
|
|
22
|
+
|
|
23
|
+
def activate(self, ctx: PluginContext) -> None:
|
|
24
|
+
"""Hand the agent the tool, unless the configuration turned it off."""
|
|
25
|
+
if not ctx.config.ask_user_enabled:
|
|
26
|
+
return
|
|
27
|
+
|
|
28
|
+
def build(_: AgentBuild) -> AgentExtension:
|
|
29
|
+
from zett_agent.extensions.ask_user import AskUserExtension
|
|
30
|
+
|
|
31
|
+
return AskUserExtension()
|
|
32
|
+
|
|
33
|
+
ctx.agent.register_extension_factory("AskUserExtension", build)
|
|
File without changes
|