suzent-acp 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,131 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[oc]
4
+ *$py.class
5
+ build/
6
+ dist/
7
+ wheels/
8
+ *.egg-info
9
+ .eggs/
10
+ .python-version
11
+ .mypy_cache/
12
+ .pytest_cache/
13
+ .dmypy.json
14
+ .coverage
15
+ .coverage.*
16
+ htmlcov/
17
+ .tox/
18
+ .nox/
19
+ pytest-debug.log
20
+ /.tmp-*/
21
+ /.pre-commit-cache/
22
+ /.uv-cache-service/
23
+
24
+ # Virtual environments
25
+ .venv
26
+ .env
27
+ venv/
28
+
29
+ # Logs
30
+ logs/
31
+ *.log
32
+
33
+ # IDE / editor
34
+ .vscode/
35
+ .idea/
36
+ .claude/
37
+
38
+ # Node.js
39
+ node_modules/
40
+ npm-debug.log*
41
+ yarn-debug.log*
42
+ yarn-error.log*
43
+
44
+ # Frontend
45
+ frontend/dist
46
+ frontend/.dist
47
+ frontend/vite-cache
48
+ *.tsbuildinfo
49
+
50
+ # Tauri
51
+ src-tauri/target/
52
+ src-tauri/binaries/
53
+ # Ignore bundled resources but keep the tracked CLI shim placeholders
54
+ src-tauri/resources/
55
+ !src-tauri/resources/suzent
56
+ !src-tauri/resources/suzent.cmd
57
+ src-tauri/browsers/
58
+ src-tauri/gen/
59
+
60
+ # Rust apps
61
+ apps/*/target/
62
+ apps/*/gen/
63
+
64
+ # Database
65
+ *.db
66
+ *.sqlite
67
+ *.sqlite3
68
+
69
+ # Config & data
70
+ config/default.yaml
71
+ config/permissions.yaml
72
+ config/providers.user.json
73
+ config/skills.json
74
+ config/social.json
75
+ data/
76
+ .suzent/
77
+ # Per-machine bootstrap marker written by the installers (setup.sh/.ps1 and the
78
+ # Rust installer). Local install state — must not be committed.
79
+ .suzent-bootstrap-complete
80
+
81
+ # Docker
82
+ *.override.yml
83
+
84
+ # Skills (generated)
85
+ skills/docx
86
+ skills/pdf
87
+ skills/xlsx
88
+ skills/pptx
89
+
90
+ # OS
91
+ .DS_Store
92
+ Thumbs.db
93
+
94
+ # Pre-built UI binary
95
+ bin/
96
+ /suzent.exe
97
+
98
+ # Browser store exports; source artwork and renderers remain tracked.
99
+ /store-upload/
100
+ /docs/assets/browser-store/en/
101
+ /docs/assets/browser-store/zh-CN/
102
+ /docs/assets/browser-store/logos/
103
+ /docs/assets/browser-store/promo-*.png
104
+ /docs/assets/browser-store/index.html
105
+ /docs/assets/browser-store/privacy-policy.md
106
+ /docs/assets/browser-store/privacy-policy-draft.md
107
+ /frontend/browser-store-preview.html
108
+ /frontend/browser-store-preview.tsx
109
+
110
+ # Native mobile build outputs
111
+ .build/
112
+ .swiftpm/
113
+ apps/ios/Generated/
114
+ apps/ios/*.xcodeproj/
115
+ apps/ios/DerivedData/
116
+ apps/android/.gradle/
117
+ apps/android/local.properties
118
+ apps/android/.kotlin/
119
+ *.xcuserstate
120
+
121
+ # Built web UI staged into the package by scripts/build_webui.py
122
+ src/suzent/webui/
123
+ src/suzent/webui.staging/
124
+ src/suzent/webui.previous/
125
+
126
+ # Private mobile signing credentials
127
+ *.jks
128
+ *.keystore
129
+ *.p12
130
+ *.p8
131
+ *.mobileprovision
@@ -0,0 +1,38 @@
1
+ Metadata-Version: 2.5
2
+ Name: suzent-acp
3
+ Version: 0.1.0
4
+ Summary: Use the Suzent installed on this computer as an Agent Client Protocol agent
5
+ Project-URL: Homepage, https://suzent.com
6
+ Project-URL: Repository, https://github.com/cyzus/suzent
7
+ Project-URL: Documentation, https://suzent.com/docs
8
+ License-Expression: Apache-2.0
9
+ Classifier: Environment :: Console
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+
15
+ # suzent-acp
16
+
17
+ Use [Suzent](https://suzent.com) from editors that support the
18
+ [Agent Client Protocol](https://agentclientprotocol.com/), such as Zed or
19
+ JetBrains IDEs.
20
+
21
+ Suzent must be installed and running on the same computer. This package is a
22
+ small launcher: it finds that installation and starts its built-in ACP agent,
23
+ so every session is a real Suzent conversation with your memory, skills,
24
+ models and permission rules.
25
+
26
+ ```sh
27
+ uvx suzent-acp
28
+ ```
29
+
30
+ Your editor runs this command for you. When it asks you to sign in, choose
31
+ **Pair with Suzent** and approve the request in Suzent under
32
+ **Settings → ACP Agents → Editor connections**.
33
+
34
+ Suzent is found in this order: the `SUZENT_DIR` folder, the folder chosen in
35
+ the Suzent installer, `~/suzent`, then `suzent` on `PATH`. Options are passed
36
+ through to `suzent acp`, for example `uvx suzent-acp --permission-mode full_access`.
37
+
38
+ See [Use Suzent from your editor](https://suzent.com/docs/features/nodes#use-suzent-from-your-editor-acp).
@@ -0,0 +1,24 @@
1
+ # suzent-acp
2
+
3
+ Use [Suzent](https://suzent.com) from editors that support the
4
+ [Agent Client Protocol](https://agentclientprotocol.com/), such as Zed or
5
+ JetBrains IDEs.
6
+
7
+ Suzent must be installed and running on the same computer. This package is a
8
+ small launcher: it finds that installation and starts its built-in ACP agent,
9
+ so every session is a real Suzent conversation with your memory, skills,
10
+ models and permission rules.
11
+
12
+ ```sh
13
+ uvx suzent-acp
14
+ ```
15
+
16
+ Your editor runs this command for you. When it asks you to sign in, choose
17
+ **Pair with Suzent** and approve the request in Suzent under
18
+ **Settings → ACP Agents → Editor connections**.
19
+
20
+ Suzent is found in this order: the `SUZENT_DIR` folder, the folder chosen in
21
+ the Suzent installer, `~/suzent`, then `suzent` on `PATH`. Options are passed
22
+ through to `suzent acp`, for example `uvx suzent-acp --permission-mode full_access`.
23
+
24
+ See [Use Suzent from your editor](https://suzent.com/docs/features/nodes#use-suzent-from-your-editor-acp).
@@ -0,0 +1,28 @@
1
+ [project]
2
+ name = "suzent-acp"
3
+ version = "0.1.0"
4
+ description = "Use the Suzent installed on this computer as an Agent Client Protocol agent"
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ requires-python = ">=3.10"
8
+ dependencies = []
9
+ classifiers = [
10
+ "Environment :: Console",
11
+ "Operating System :: OS Independent",
12
+ "Programming Language :: Python :: 3",
13
+ ]
14
+
15
+ [project.urls]
16
+ Homepage = "https://suzent.com"
17
+ Repository = "https://github.com/cyzus/suzent"
18
+ Documentation = "https://suzent.com/docs"
19
+
20
+ [project.scripts]
21
+ suzent-acp = "suzent_acp.launcher:main"
22
+
23
+ [build-system]
24
+ requires = ["hatchling"]
25
+ build-backend = "hatchling.build"
26
+
27
+ [tool.hatch.build.targets.wheel]
28
+ packages = ["src/suzent_acp"]
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "suzent",
3
+ "name": "Suzent",
4
+ "version": "0.1.0",
5
+ "description": "Personal AI agent with long-term memory, skills and your own models. Requires the Suzent app running on the same computer.",
6
+ "repository": "https://github.com/cyzus/suzent",
7
+ "website": "https://suzent.com/docs/features/nodes#use-suzent-from-your-editor-acp",
8
+ "authors": ["Suzent"],
9
+ "license": "Apache-2.0",
10
+ "license_url": "https://github.com/cyzus/suzent/blob/main/LICENSE",
11
+ "distribution": {
12
+ "uvx": {
13
+ "package": "suzent-acp==0.1.0"
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
2
+ <path fill="currentColor" fill-rule="evenodd" d="M3 0h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V3a3 3 0 0 1 3-3zM4.25 5.25a1 1 0 0 0-1 1v1.5a1 1 0 0 0 1 1h1.5a1 1 0 0 0 1-1v-1.5a1 1 0 0 0-1-1zM10.25 5.25a1 1 0 0 0-1 1v1.5a1 1 0 0 0 1 1h1.5a1 1 0 0 0 1-1v-1.5a1 1 0 0 0-1-1z"/>
3
+ </svg>
@@ -0,0 +1,17 @@
1
+ """Launch the locally installed Suzent as an Agent Client Protocol agent.
2
+
3
+ The ACP bridge talks to the Suzent backend over its private loopback API, so it
4
+ must ship with the backend it talks to. This package therefore carries no
5
+ bridge of its own: it finds the installed Suzent and hands the editor's pipes to
6
+ ``suzent acp``. When Suzent is not installed it still answers the ACP handshake,
7
+ so an editor can show the sign-in choices and a clear install message.
8
+ """
9
+
10
+ from importlib.metadata import PackageNotFoundError, version
11
+
12
+
13
+ def package_version() -> str:
14
+ try:
15
+ return version("suzent-acp")
16
+ except PackageNotFoundError:
17
+ return "0"
@@ -0,0 +1,3 @@
1
+ from suzent_acp.launcher import main
2
+
3
+ main()
@@ -0,0 +1,141 @@
1
+ """A minimal ACP agent for computers where Suzent is not installed.
2
+
3
+ It answers ``initialize`` with the same sign-in methods the real agent offers,
4
+ so an editor's agent list and the ACP Registry's checks see a well-formed
5
+ agent, and turns every other request into an install instruction.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import json
11
+ import sys
12
+ from collections.abc import Callable
13
+ from typing import Any
14
+
15
+ from suzent_acp import package_version
16
+
17
+ PROTOCOL_VERSION = 1
18
+ METHOD_NOT_FOUND = -32601
19
+ INTERNAL_ERROR = -32603
20
+ TERMINAL_AUTH_ID = "suzent-terminal"
21
+ AGENT_AUTH_ID = "suzent-pair"
22
+ NOT_INSTALLED = (
23
+ "Suzent is not installed on this computer. Install it from "
24
+ "https://suzent.com, start it, then reconnect your editor."
25
+ )
26
+
27
+
28
+ def _client_name(params: dict[str, Any]) -> str:
29
+ info = params.get("clientInfo")
30
+ name = info.get("name") if isinstance(info, dict) else None
31
+ if isinstance(name, str):
32
+ name = " ".join(name.split())
33
+ if 0 < len(name) <= 100:
34
+ return name
35
+ return "ACP client"
36
+
37
+
38
+ def initialize_result(params: dict[str, Any]) -> dict[str, Any]:
39
+ """The handshake reply, mirroring the installed agent's sign-in methods."""
40
+ capabilities = params.get("clientCapabilities")
41
+ auth = capabilities.get("auth") if isinstance(capabilities, dict) else None
42
+ methods: list[dict[str, Any]] = []
43
+ if isinstance(auth, dict) and auth.get("terminal") is True:
44
+ methods.append(
45
+ {
46
+ "id": TERMINAL_AUTH_ID,
47
+ "type": "terminal",
48
+ "name": "Pair with Suzent",
49
+ "description": "Approve this editor in the local Suzent settings",
50
+ "args": ["--login", "--client-name", _client_name(params)],
51
+ }
52
+ )
53
+ methods.append(
54
+ {
55
+ "id": AGENT_AUTH_ID,
56
+ "name": "Approve in Suzent settings",
57
+ "description": "Open Settings → ACP Agents → Editor connections; compare the code in the agent log and approve the pending request.",
58
+ }
59
+ )
60
+ return {
61
+ "protocolVersion": PROTOCOL_VERSION,
62
+ "agentCapabilities": {
63
+ "loadSession": False,
64
+ "promptCapabilities": {
65
+ "image": False,
66
+ "audio": False,
67
+ "embeddedContext": True,
68
+ },
69
+ },
70
+ "authMethods": methods,
71
+ "agentInfo": {"name": "suzent", "version": package_version()},
72
+ }
73
+
74
+
75
+ def respond(message: Any) -> dict[str, Any] | None:
76
+ """The reply to one decoded JSON-RPC message; notifications get none."""
77
+ if not isinstance(message, dict) or "id" not in message:
78
+ return None
79
+ method = message.get("method")
80
+ if method is None:
81
+ return None
82
+ params = message.get("params")
83
+ params = params if isinstance(params, dict) else {}
84
+ reply: dict[str, Any] = {"jsonrpc": "2.0", "id": message["id"]}
85
+ if method == "initialize":
86
+ reply["result"] = initialize_result(params)
87
+ elif method in {
88
+ "authenticate",
89
+ "session/new",
90
+ "session/load",
91
+ "session/prompt",
92
+ }:
93
+ reply["error"] = {"code": INTERNAL_ERROR, "message": NOT_INSTALLED}
94
+ else:
95
+ reply["error"] = {
96
+ "code": METHOD_NOT_FOUND,
97
+ "message": f"unknown method '{method}'",
98
+ }
99
+ return reply
100
+
101
+
102
+ def serve(readline: Callable[[], str], write: Callable[[str], None]) -> None:
103
+ """Answer newline-delimited JSON-RPC until the client closes the pipe."""
104
+ while line := readline():
105
+ line = line.strip()
106
+ if not line:
107
+ continue
108
+ try:
109
+ message = json.loads(line)
110
+ except ValueError:
111
+ continue
112
+ reply = respond(message)
113
+ if reply is not None:
114
+ write(json.dumps(reply, ensure_ascii=False, separators=(",", ":")) + "\n")
115
+
116
+
117
+ def serve_not_installed(argv: list[str]) -> int:
118
+ if "--login" in argv:
119
+ print(NOT_INSTALLED, file=sys.stderr)
120
+ return 1
121
+ if "--help" in argv or "-h" in argv:
122
+ print(
123
+ "Usage: suzent-acp [suzent acp options]\n\n"
124
+ "Run by an ACP client. Starts the Suzent installed on this computer "
125
+ "as its agent.\n\n" + NOT_INSTALLED,
126
+ file=sys.stderr,
127
+ )
128
+ return 0
129
+ print(NOT_INSTALLED, file=sys.stderr)
130
+
131
+ # ACP frames are UTF-8 whatever the locale; a Windows code page stdout
132
+ # cannot encode the "→" in the sign-in description.
133
+ def readline() -> str:
134
+ return sys.stdin.buffer.readline().decode("utf-8", "replace")
135
+
136
+ def write(text: str) -> None:
137
+ sys.stdout.buffer.write(text.encode("utf-8"))
138
+ sys.stdout.buffer.flush()
139
+
140
+ serve(readline, write)
141
+ return 0
@@ -0,0 +1,86 @@
1
+ """Find the installed Suzent CLI and run ``suzent acp`` with the editor's pipes."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ import shutil
7
+ import subprocess
8
+ import sys
9
+ from collections.abc import Mapping
10
+ from pathlib import Path
11
+
12
+
13
+ def _data_dir(env: Mapping[str, str], home: Path) -> Path:
14
+ override = env.get("SUZENT_DATA_DIR", "").strip()
15
+ return Path(override) if override else home / ".suzent"
16
+
17
+
18
+ def _saved_workspace(marker: Path) -> Path | None:
19
+ try:
20
+ text = marker.read_text(encoding="utf-8").strip()
21
+ except OSError:
22
+ return None
23
+ # Older Windows installers saved the `\\?\C:\...` form of the path.
24
+ if text.startswith("\\\\?\\") and text[5:6] == ":":
25
+ text = text[4:]
26
+ path = Path(text)
27
+ return path if path.is_absolute() else None
28
+
29
+
30
+ def workspace_candidates(env: Mapping[str, str], home: Path) -> list[Path]:
31
+ """Install workspaces in the order the desktop app itself resolves them."""
32
+ candidates: list[Path] = []
33
+ if override := env.get("SUZENT_DIR", "").strip():
34
+ candidates.append(Path(override))
35
+ if saved := _saved_workspace(_data_dir(env, home) / "install-dir.txt"):
36
+ candidates.append(saved)
37
+ candidates.append(home / "suzent")
38
+ return candidates
39
+
40
+
41
+ def _venv_cli(workspace: Path, windows: bool) -> Path:
42
+ if windows:
43
+ return workspace / ".venv" / "Scripts" / "suzent.exe"
44
+ return workspace / ".venv" / "bin" / "suzent"
45
+
46
+
47
+ def find_suzent(
48
+ env: Mapping[str, str] | None = None,
49
+ home: Path | None = None,
50
+ windows: bool | None = None,
51
+ ) -> str | None:
52
+ """Return the Suzent CLI to run, or ``None`` when Suzent is not installed.
53
+
54
+ Editors often start agents with a minimal PATH, so the install workspace's
55
+ own virtualenv is checked before PATH.
56
+ """
57
+ env = os.environ if env is None else env
58
+ home = Path.home() if home is None else home
59
+ windows = os.name == "nt" if windows is None else windows
60
+ for workspace in workspace_candidates(env, home):
61
+ cli = _venv_cli(workspace, windows)
62
+ if cli.is_file():
63
+ return str(cli)
64
+ return shutil.which("suzent", path=env.get("PATH"))
65
+
66
+
67
+ def run(argv: list[str]) -> int:
68
+ """Run ``suzent acp`` with ``argv``, or answer the handshake without it."""
69
+ cli = find_suzent()
70
+ if cli is None:
71
+ from suzent_acp.fallback import serve_not_installed
72
+
73
+ return serve_not_installed(argv)
74
+ command = [cli, "acp", *argv]
75
+ if os.name != "nt":
76
+ # Replacing the process keeps the editor's pipes and signals pointed at
77
+ # the real agent, with nothing in between.
78
+ os.execv(cli, command)
79
+ try:
80
+ return subprocess.call(command)
81
+ except KeyboardInterrupt:
82
+ return 130
83
+
84
+
85
+ def main() -> None:
86
+ sys.exit(run(sys.argv[1:]))