nini-acp-bridge 0.4.7__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,56 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .venv/
6
+ .pytest_cache/
7
+ .ruff_cache/
8
+ build/
9
+ dist/
10
+
11
+ # Node
12
+ node_modules/
13
+ .pnpm-store/
14
+
15
+ # Vite
16
+ apps/web/dist/
17
+
18
+ # Tauri / Rust
19
+ apps/desktop/src-tauri/target/
20
+
21
+ # Expo
22
+ .expo/
23
+ .expo-shared/
24
+ *.jks
25
+ *.p8
26
+ *.p12
27
+ *.mobileprovision
28
+
29
+ # Local env (never commit secrets)
30
+ .env
31
+ .env.*
32
+ !.env.example
33
+ data/
34
+
35
+ # Local databases
36
+ *.db
37
+ *.sqlite
38
+ *.sqlite3
39
+
40
+ # OS / editors
41
+ .DS_Store
42
+ .idea/
43
+ .vscode/
44
+ *.swp
45
+
46
+ # Logs
47
+ *.log
48
+
49
+ # Local bootstrap scratch files (generated by the orchestrator, never committed)
50
+ .bootstrap_tasks.py
51
+ .bootstrap_deps.py
52
+ .nini-task-ids.json
53
+
54
+ # Expo prebuild artifacts (generated)
55
+ apps/mobile/ios/
56
+ apps/mobile/android/
@@ -0,0 +1,38 @@
1
+ Metadata-Version: 2.5
2
+ Name: nini-acp-bridge
3
+ Version: 0.4.7
4
+ Summary: Bridge the Nini Runtime Adapter contract (§25) onto the Agent Client Protocol (ACP)
5
+ License: MIT
6
+ Requires-Python: >=3.12
7
+ Requires-Dist: nini-adapter
8
+ Requires-Dist: nini-protocol
9
+ Description-Content-Type: text/markdown
10
+
11
+ # nini-acp-bridge
12
+
13
+ Expose an [Agent Client Protocol](https://agentclientprotocol.com) agent (for
14
+ example `opencode acp`) to Nini as a built-in Personal Agent.
15
+
16
+ The bridge is a Nini *adapter* (contract §25): the daemon drives it over
17
+ newline-delimited JSON-RPC 2.0, and the bridge translates every call into ACP
18
+ frames on the agent's stdio. Sessions, messages, events and approvals all land
19
+ back in Nini, so all five clients drive the ACP agent like any other runtime.
20
+
21
+ ```bash
22
+ # from the repo root (workspace member)
23
+ uv run python -m nini_acp_bridge --acp-command "opencode acp"
24
+ ```
25
+
26
+ Point `~/.nini/config.toml` at it:
27
+
28
+ ```toml
29
+ [runtime]
30
+ kind = "adapter"
31
+
32
+ [[runtime.agents]]
33
+ id = "opencode"
34
+ name = "OpenCode"
35
+ command = ["nini-acp-bridge", "--acp-command", "opencode acp", "--model", "deepseek-mainland/deepseek-flash"]
36
+ ```
37
+
38
+ Docs: [`docs/ACP-BRIDGE.md`](../../docs/ACP-BRIDGE.md). License: MIT.
@@ -0,0 +1,28 @@
1
+ # nini-acp-bridge
2
+
3
+ Expose an [Agent Client Protocol](https://agentclientprotocol.com) agent (for
4
+ example `opencode acp`) to Nini as a built-in Personal Agent.
5
+
6
+ The bridge is a Nini *adapter* (contract §25): the daemon drives it over
7
+ newline-delimited JSON-RPC 2.0, and the bridge translates every call into ACP
8
+ frames on the agent's stdio. Sessions, messages, events and approvals all land
9
+ back in Nini, so all five clients drive the ACP agent like any other runtime.
10
+
11
+ ```bash
12
+ # from the repo root (workspace member)
13
+ uv run python -m nini_acp_bridge --acp-command "opencode acp"
14
+ ```
15
+
16
+ Point `~/.nini/config.toml` at it:
17
+
18
+ ```toml
19
+ [runtime]
20
+ kind = "adapter"
21
+
22
+ [[runtime.agents]]
23
+ id = "opencode"
24
+ name = "OpenCode"
25
+ command = ["nini-acp-bridge", "--acp-command", "opencode acp", "--model", "deepseek-mainland/deepseek-flash"]
26
+ ```
27
+
28
+ Docs: [`docs/ACP-BRIDGE.md`](../../docs/ACP-BRIDGE.md). License: MIT.
@@ -0,0 +1,20 @@
1
+ """Public surface of the ACP ↔ Nini bridge."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from .bridge import AcpBridge
6
+ from .supervisor import AcpSupervisor
7
+ from .transport import AcpError, AcpProcessExited, AcpTimeout, AcpTransport, AcpUnavailable
8
+
9
+ __version__ = "0.4.7"
10
+
11
+ __all__ = [
12
+ "AcpBridge",
13
+ "AcpError",
14
+ "AcpProcessExited",
15
+ "AcpSupervisor",
16
+ "AcpTimeout",
17
+ "AcpTransport",
18
+ "AcpUnavailable",
19
+ "__version__",
20
+ ]
@@ -0,0 +1,114 @@
1
+ """``python -m nini_acp_bridge --acp-command "opencode acp"``.
2
+
3
+ stdout carries the Nini adapter frames (contract §25); the ACP agent's own stdout
4
+ is a private pipe. Logs go to stderr only, so one stray ``print`` can never poison
5
+ the host connection.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import argparse
11
+ import asyncio
12
+ import logging
13
+ import sys
14
+
15
+ from . import __version__
16
+ from .bridge import (
17
+ DEFAULT_ABORT_TIMEOUT,
18
+ DEFAULT_PERMISSION_TIMEOUT,
19
+ DEFAULT_REQUEST_TIMEOUT,
20
+ AcpBridge,
21
+ )
22
+
23
+
24
+ def build_parser() -> argparse.ArgumentParser:
25
+ parser = argparse.ArgumentParser(
26
+ prog="nini-acp-bridge",
27
+ description="Drive an ACP agent (e.g. `opencode acp`) as a Nini Personal Agent",
28
+ )
29
+ parser.add_argument(
30
+ "--acp-command",
31
+ default="opencode acp",
32
+ help="command that starts the ACP agent on stdio (default: 'opencode acp')",
33
+ )
34
+ parser.add_argument("--cwd", default=None, help="default workspace for new sessions")
35
+ parser.add_argument(
36
+ "--model",
37
+ default=None,
38
+ help="default ACP model id applied to new sessions (e.g. provider/model)",
39
+ )
40
+ parser.add_argument(
41
+ "--state-dir",
42
+ default=None,
43
+ help="where seq.json lives (default: ~/.nini/acp-bridge)",
44
+ )
45
+ parser.add_argument("--seq-path", default=None, help="override the durable seq file")
46
+ parser.add_argument(
47
+ "--request-timeout",
48
+ type=float,
49
+ default=DEFAULT_REQUEST_TIMEOUT,
50
+ help="seconds to wait for one ACP request (default: 30)",
51
+ )
52
+ parser.add_argument(
53
+ "--permission-timeout",
54
+ type=float,
55
+ default=DEFAULT_PERMISSION_TIMEOUT,
56
+ help="seconds before an unanswered approval is denied (default: 120)",
57
+ )
58
+ parser.add_argument(
59
+ "--abort-timeout",
60
+ type=float,
61
+ default=DEFAULT_ABORT_TIMEOUT,
62
+ help="seconds to wait for ACP to honour session/cancel (default: 10)",
63
+ )
64
+ parser.add_argument(
65
+ "--max-restarts", type=int, default=3, help="restarts allowed per window (default: 3)"
66
+ )
67
+ parser.add_argument(
68
+ "--restart-window",
69
+ type=float,
70
+ default=300.0,
71
+ help="restart budget window in seconds (default: 300)",
72
+ )
73
+ parser.add_argument(
74
+ "--allow-fs",
75
+ action="store_true",
76
+ help="advertise and serve ACP fs/read_text_file + fs/write_text_file (default: off)",
77
+ )
78
+ parser.add_argument("--name", default="OpenCode (ACP)", help="adapter name reported to Nini")
79
+ parser.add_argument("--version", dest="adapter_version", default=__version__)
80
+ parser.add_argument("--verbose", "-v", action="store_true", help="debug logging on stderr")
81
+ return parser
82
+
83
+
84
+ def main(argv: list[str] | None = None) -> int:
85
+ args = build_parser().parse_args(argv)
86
+ logging.basicConfig(
87
+ level=logging.DEBUG if args.verbose else logging.INFO,
88
+ stream=sys.stderr,
89
+ format="%(asctime)s %(levelname)s %(name)s: %(message)s",
90
+ )
91
+ bridge = AcpBridge(
92
+ command=args.acp_command,
93
+ cwd=args.cwd,
94
+ state_dir=args.state_dir,
95
+ seq_path=args.seq_path,
96
+ name=args.name,
97
+ version=args.adapter_version,
98
+ request_timeout=args.request_timeout,
99
+ permission_timeout=args.permission_timeout,
100
+ abort_timeout=args.abort_timeout,
101
+ default_model=args.model,
102
+ allow_fs=args.allow_fs,
103
+ max_restarts=args.max_restarts,
104
+ restart_window=args.restart_window,
105
+ )
106
+ try:
107
+ asyncio.run(bridge.run_stdio())
108
+ except KeyboardInterrupt: # pragma: no cover - operator Ctrl-C
109
+ return 130
110
+ return 0
111
+
112
+
113
+ if __name__ == "__main__": # pragma: no cover - module entry
114
+ raise SystemExit(main())