hani 0.2.2__tar.gz → 0.3.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.
- {hani-0.2.2 → hani-0.3.1}/CHANGELOG.md +66 -4
- hani-0.3.1/LICENSE +15 -0
- hani-0.3.1/PKG-INFO +417 -0
- hani-0.3.1/README.md +377 -0
- {hani-0.2.2 → hani-0.3.1}/pyproject.toml +16 -10
- {hani-0.2.2 → hani-0.3.1}/src/hani/app.py +182 -29
- hani-0.3.1/src/hani/auth.py +302 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/common.py +188 -88
- hani-0.3.1/src/hani/default_settings/env.json +39 -0
- hani-0.3.1/src/hani/default_settings/llm_settings.json +7 -0
- hani-0.3.1/src/hani/dual_auth.py +728 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/register.py +41 -59
- hani-0.3.1/src/hani/run.py +503 -0
- hani-0.3.1/src/hani/runapp.py +274 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/runregister.py +3 -12
- hani-0.3.1/src/hani/serve_dual.py +116 -0
- hani-0.3.1/src/hani/templates/basic_login.html +197 -0
- hani-0.3.1/src/hani.egg-info/PKG-INFO +417 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani.egg-info/SOURCES.txt +4 -0
- hani-0.3.1/src/hani.egg-info/entry_points.txt +7 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani.egg-info/requires.txt +2 -3
- hani-0.2.2/PKG-INFO +0 -373
- hani-0.2.2/README.md +0 -338
- hani-0.2.2/src/hani/auth.py +0 -269
- hani-0.2.2/src/hani/default_settings/env.json +0 -5
- hani-0.2.2/src/hani/run.py +0 -112
- hani-0.2.2/src/hani/runapp.py +0 -175
- hani-0.2.2/src/hani/templates/basic_login.html +0 -112
- hani-0.2.2/src/hani.egg-info/PKG-INFO +0 -373
- hani-0.2.2/src/hani.egg-info/entry_points.txt +0 -7
- {hani-0.2.2 → hani-0.3.1}/MANIFEST.in +0 -0
- {hani-0.2.2 → hani-0.3.1}/setup.cfg +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/__init__.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/announcements.md +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/color_palettes.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/config/default.yaml +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/default_settings/consent.md +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/default_settings/scenario_order.txt +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/event_analytics.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/event_tracking.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/events.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/experiment_selector.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/find_scenario_source.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/helpers/__init__.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/helpers/negotiators.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/helpers.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/images/hani.JPG +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/images/hani1.JPG +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/images/hani2.JPG +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/images/hani3.JPG +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/images/hani4.JPG +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/llm_service.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/make_scenarios.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/negotiator.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/runanalytics.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/runexperiment.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/runguest.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/sample_scenarios/Default/Grocery/Grocery.yml +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/sample_scenarios/Default/Grocery/_info.yaml +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/sample_scenarios/Default/Grocery/agent.yml +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/sample_scenarios/Default/Grocery/display.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/sample_scenarios/Default/Grocery/human.yml +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/sample_scenarios/Default/Island/Island.yml +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/sample_scenarios/Default/Island/_info.yaml +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/sample_scenarios/Default/Island/agent.yml +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/sample_scenarios/Default/Island/display.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/sample_scenarios/Default/Island/human.yml +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/sample_scenarios/Default/Trade/Buyer.yml +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/sample_scenarios/Default/Trade/Seller.yml +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/sample_scenarios/Default/Trade/Trade.yml +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/sample_scenarios/Default/Trade/_info.yaml +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/sample_scenarios/Default/Trade/display.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/scenario_makers.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/scenarios/__init__.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/scenarios/base.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/scenarios/common.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/scenarios/grocery.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/scenarios/island.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/scenarios/trade.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/static/theme.css +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/templates/logout.html +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/tools/__init__.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/tools/generator.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/tools/helpers/__init__.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/tools/histograms.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/tools/history.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/tools/outcome_plot.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/tools/preferences.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/tools/random.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/tools/results.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/tools/scenario_info.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/tools/tool.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/tools/urange.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani/tools/utility_plot2d.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani.egg-info/dependency_links.txt +0 -0
- {hani-0.2.2 → hani-0.3.1}/src/hani.egg-info/top_level.txt +0 -0
- {hani-0.2.2 → hani-0.3.1}/tests/test_auth.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/tests/test_event_tracking.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/tests/test_registration.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/tests/test_scenario_loading.py +0 -0
- {hani-0.2.2 → hani-0.3.1}/tests/test_tools.py +0 -0
|
@@ -5,6 +5,66 @@ All notable changes to the HANI (Human-Agent Negotiation Interface) project will
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.3.1] - 2026-05-18
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- Upgraded `negmas` to 0.15.5 (from 0.15.2)
|
|
12
|
+
- Upgraded `negmas-llm` to 0.4.3 (from 0.4.2)
|
|
13
|
+
- Renamed `run.sh`/`runreg.sh` development scripts to `_x` variants
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- `CLAUDE.md` for Claude Code users
|
|
17
|
+
|
|
18
|
+
## [0.3.0] - 2026-03-16
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- **New Configuration System**:
|
|
22
|
+
- Replace `.env` with `env.json` for JSON-based configuration
|
|
23
|
+
- Configuration loaded from `~/negmas/hani/settings/env.json` or package defaults
|
|
24
|
+
- Support for URLs, admin, auth, and OAuth settings in structured JSON format
|
|
25
|
+
|
|
26
|
+
- **New CLI Commands**:
|
|
27
|
+
- `hani setup` - Initialize settings directory with default configuration and scenarios
|
|
28
|
+
- `hani main` - Run only the main app (port 5006)
|
|
29
|
+
- `hani guest` - Run only the guest/playground app (port 5008)
|
|
30
|
+
- `hani auth` - Show OAuth setup instructions for GitHub and Google
|
|
31
|
+
- `hani --no-browser` - Start without auto-opening browser
|
|
32
|
+
|
|
33
|
+
- **Multi-Provider OAuth Support**:
|
|
34
|
+
- Support for multiple OAuth providers (GitHub, Google) configured in env.json
|
|
35
|
+
- Provider-specific routes: `/oauth/github`, `/oauth/google`
|
|
36
|
+
- Multiple OAuth buttons shown on login and registration pages
|
|
37
|
+
- Integrated registration endpoint at `/register` (removed separate registration server)
|
|
38
|
+
|
|
39
|
+
- **Smart Browser Launch**:
|
|
40
|
+
- Browser now waits for server readiness instead of fixed delay
|
|
41
|
+
- Polls server until it responds (up to 30 second timeout)
|
|
42
|
+
|
|
43
|
+
- **Conditional UI Links**:
|
|
44
|
+
- "Try without registration" link only shown if guest server is running
|
|
45
|
+
- Login/register links in guest mode only shown if main app is running
|
|
46
|
+
|
|
47
|
+
- **Settings Directory Enhancements**:
|
|
48
|
+
- Load announcements from `~/negmas/hani/settings/announcements.md` (falls back to app directory)
|
|
49
|
+
- Copy default scenarios to settings directory on `hani setup`
|
|
50
|
+
|
|
51
|
+
- **Documentation**:
|
|
52
|
+
- Full MkDocs documentation with Material theme
|
|
53
|
+
- GitHub Actions workflow for automatic documentation deployment
|
|
54
|
+
- Documentation pages: Installation, Quick Start, Authentication, Ollama setup, Tools, Offer Generators, Scenarios
|
|
55
|
+
- Added LICENSE file (AGPL-3.0)
|
|
56
|
+
- Added badges to README (PyPI, downloads, license, documentation)
|
|
57
|
+
|
|
58
|
+
### Changed
|
|
59
|
+
- Removed `python-dotenv` dependency (replaced by env.json)
|
|
60
|
+
- Removed `--no-reg` flag (registration integrated into main app)
|
|
61
|
+
- Removed separate registration server (`hani reg` command)
|
|
62
|
+
- Button labels: "End & Leave" renamed to "End", "Reject and counter" to "Reject & Counter"
|
|
63
|
+
- Action panel button styling improved (consistent widths, smaller font)
|
|
64
|
+
|
|
65
|
+
### Fixed
|
|
66
|
+
- Browser opening before server is ready
|
|
67
|
+
|
|
8
68
|
## [0.2.2] - 2026-03-16
|
|
9
69
|
|
|
10
70
|
### Added
|
|
@@ -190,7 +250,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
190
250
|
|
|
191
251
|
## Version History Summary
|
|
192
252
|
|
|
193
|
-
- **0.
|
|
253
|
+
- **0.3.0** (Current): New JSON config system, CLI commands, multi-provider OAuth, MkDocs documentation
|
|
254
|
+
- **0.2.2**: Action panel UX improvements, CLI service flags, agent group selection
|
|
255
|
+
- **0.2.0**: Command-line agent configuration, improved action panel UI, dependency updates
|
|
194
256
|
- **0.1.0**: Event tracking, LLM support, dual authentication, experiment management, comprehensive testing
|
|
195
257
|
- **0.0.1**: Initial HANI framework with basic negotiation interface
|
|
196
258
|
|
|
@@ -213,6 +275,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
213
275
|
---
|
|
214
276
|
|
|
215
277
|
## Links
|
|
216
|
-
- [Repository](https://github.com/
|
|
217
|
-
- [Documentation](https://github.
|
|
218
|
-
- [Issue Tracker](https://github.com/
|
|
278
|
+
- [Repository](https://github.com/yasserfarouk/hani)
|
|
279
|
+
- [Documentation](https://yasserfarouk.github.io/hani/)
|
|
280
|
+
- [Issue Tracker](https://github.com/yasserfarouk/hani/issues)
|
hani-0.3.1/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
HANI - Human-Agent Negotiation Interface
|
|
2
|
+
Copyright (C) 2024-2026 Yasser Mohammad
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as published
|
|
6
|
+
by the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
(at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
hani-0.3.1/PKG-INFO
ADDED
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hani
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: Run Human-Agent Negotiations
|
|
5
|
+
Author-email: Yasser Mohammad <yasserfarouk@gmail.com>
|
|
6
|
+
License-Expression: AGPL-3.0-or-later
|
|
7
|
+
Project-URL: Homepage, https://github.com/yasserfarouk/hani
|
|
8
|
+
Project-URL: Documentation, https://yasserfarouk.github.io/hani/
|
|
9
|
+
Project-URL: Repository, https://github.com/yasserfarouk/hani
|
|
10
|
+
Project-URL: Changelog, https://github.com/yasserfarouk/hani/blob/main/CHANGELOG.md
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
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 :: Implementation :: CPython
|
|
16
|
+
Requires-Python: >=3.13
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: cryptography>=44.0.2
|
|
20
|
+
Requires-Dist: hvplot>=0.11.2
|
|
21
|
+
Requires-Dist: negmas>=0.15.5
|
|
22
|
+
Requires-Dist: negmas-llm>=0.4.3
|
|
23
|
+
Requires-Dist: panel>=1.6.1
|
|
24
|
+
Requires-Dist: plotly>=6.0.0
|
|
25
|
+
Requires-Dist: rich>=13.0.0
|
|
26
|
+
Requires-Dist: sqlalchemy>=2.0.39
|
|
27
|
+
Requires-Dist: typer>=0.9.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: bumpversion>=0.6.0; extra == "dev"
|
|
30
|
+
Requires-Dist: watchfiles>=1.0.4; extra == "dev"
|
|
31
|
+
Provides-Extra: doc
|
|
32
|
+
Requires-Dist: mkdocs-gen-files>=0.5.0; extra == "doc"
|
|
33
|
+
Requires-Dist: mkdocs-include-markdown-plugin>=7.1.4; extra == "doc"
|
|
34
|
+
Requires-Dist: mkdocs-material>=9.6.5; extra == "doc"
|
|
35
|
+
Requires-Dist: mkdocs>=1.6.1; extra == "doc"
|
|
36
|
+
Requires-Dist: mkdocstrings-python>=1.16.1; extra == "doc"
|
|
37
|
+
Provides-Extra: docs
|
|
38
|
+
Requires-Dist: mkdocs-jupyter>=0.25.1; extra == "docs"
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
|
|
41
|
+
# Human-Agent Negotiation Interface (HANI)
|
|
42
|
+
|
|
43
|
+
[](https://pypi.python.org/pypi/hani)
|
|
44
|
+
[](https://pypi.python.org/pypi/hani)
|
|
45
|
+
[](https://pypi.python.org/pypi/hani)
|
|
46
|
+
[](https://pypi.python.org/pypi/hani)
|
|
47
|
+
[](https://yasserfarouk.github.io/hani/)
|
|
48
|
+
|
|
49
|
+

|
|
50
|
+
|
|
51
|
+
HANI is a web-based interface for conducting negotiations between humans and AI agents. It provides a rich set of tools for analyzing negotiation dynamics, making offers, and understanding your negotiation partner's behavior.
|
|
52
|
+
|
|
53
|
+
## Quick Start
|
|
54
|
+
|
|
55
|
+
### Installation
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install hani
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Initial Setup
|
|
62
|
+
|
|
63
|
+
Run the setup command to initialize your configuration:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
hani setup
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This creates the settings directory at `~/negmas/hani/settings/` with:
|
|
70
|
+
- `env.json` - Main configuration file
|
|
71
|
+
- `users.json` - User credentials
|
|
72
|
+
- `scenarios/` - Default negotiation scenarios
|
|
73
|
+
- Other configuration files
|
|
74
|
+
|
|
75
|
+
### Running the App
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
hani
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
This starts both the main app (port 5006) and guest/playground (port 5008).
|
|
82
|
+
|
|
83
|
+
Then open your browser to `http://localhost:5006` and log in:
|
|
84
|
+
- **Username:** `admin` or `user`
|
|
85
|
+
- **Password:** `adminpass` or `userpass` (defaults, change in env.json)
|
|
86
|
+
|
|
87
|
+
## CLI Commands
|
|
88
|
+
|
|
89
|
+
| Command | Description |
|
|
90
|
+
|---------|-------------|
|
|
91
|
+
| `hani` | Start all services (main app + guest playground) |
|
|
92
|
+
| `hani setup` | Initialize settings directory with default configuration |
|
|
93
|
+
| `hani main` | Start only the main app (port 5006) |
|
|
94
|
+
| `hani guest` | Start only the guest/playground app (port 5008) |
|
|
95
|
+
| `hani auth` | Show OAuth setup instructions |
|
|
96
|
+
| `hani --help` | Show all available commands and options |
|
|
97
|
+
|
|
98
|
+
### Command Options
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Start with specific agent types
|
|
102
|
+
hani --agents "AspirationNegotiator,helpers.AgentK"
|
|
103
|
+
|
|
104
|
+
# Start without opening browser
|
|
105
|
+
hani main --no-browser
|
|
106
|
+
|
|
107
|
+
# Run setup and overwrite existing files
|
|
108
|
+
hani setup --force
|
|
109
|
+
|
|
110
|
+
# Set custom admin password during setup
|
|
111
|
+
hani setup --admin-password "my-secure-password"
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Configuration
|
|
115
|
+
|
|
116
|
+
HANI uses a JSON configuration file located at `~/negmas/hani/settings/env.json`.
|
|
117
|
+
|
|
118
|
+
### Basic Configuration
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"urls": {
|
|
123
|
+
"app": "http://localhost:5006",
|
|
124
|
+
"playground": "http://localhost:5008"
|
|
125
|
+
},
|
|
126
|
+
"admin": {
|
|
127
|
+
"password": "adminpass",
|
|
128
|
+
"emails": []
|
|
129
|
+
},
|
|
130
|
+
"auth": {
|
|
131
|
+
"mode": "password",
|
|
132
|
+
"cookie_secret": "change-this-in-production"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Configuration Options
|
|
138
|
+
|
|
139
|
+
| Setting | Description | Default |
|
|
140
|
+
|---------|-------------|---------|
|
|
141
|
+
| `urls.app` | Main app URL | `http://localhost:5006` |
|
|
142
|
+
| `urls.playground` | Guest playground URL | `http://localhost:5008` |
|
|
143
|
+
| `admin.password` | Admin user password | `adminpass` |
|
|
144
|
+
| `admin.emails` | Admin emails for OAuth mode | `[]` |
|
|
145
|
+
| `auth.mode` | Auth mode: `password`, `dual`, `oauth`, `auto` | `password` |
|
|
146
|
+
| `auth.cookie_secret` | Session cookie secret | (default value) |
|
|
147
|
+
| `auth.enforce_consent` | Require consent form before negotiation | `false` |
|
|
148
|
+
|
|
149
|
+
## Features
|
|
150
|
+
|
|
151
|
+
### Negotiation Interface
|
|
152
|
+
|
|
153
|
+
- **Action Panel**: Make offers by setting values for each negotiation issue
|
|
154
|
+
- **History View**: See the full negotiation history with offers from both parties
|
|
155
|
+
- **Utility Display**: Real-time feedback on how good each offer is for you
|
|
156
|
+
|
|
157
|
+
### AI-Powered Tools
|
|
158
|
+
|
|
159
|
+
When configured with an LLM API key, HANI provides:
|
|
160
|
+
|
|
161
|
+
- **Text-to-Outcome Extraction**: Extract structured offers from natural language messages
|
|
162
|
+
- **Outcome-to-Text Generation**: Generate natural language descriptions of your offers
|
|
163
|
+
- **Response Generator**: Describe what you want to say and let AI generate both the message and offer
|
|
164
|
+
|
|
165
|
+
### Analysis Tools
|
|
166
|
+
|
|
167
|
+
- **Utility Plot**: Visualize utility over time
|
|
168
|
+
- **Outcome Plot**: See where offers fall in the outcome space
|
|
169
|
+
- **Preferences View**: Understand your preferences for the negotiation
|
|
170
|
+
- **Negotiation Trace**: Detailed log of all negotiation events
|
|
171
|
+
|
|
172
|
+
## Authentication
|
|
173
|
+
|
|
174
|
+
HANI supports multiple authentication modes configured via `auth.mode` in `env.json`.
|
|
175
|
+
|
|
176
|
+
### Password Authentication (Default)
|
|
177
|
+
|
|
178
|
+
Best for local development and small deployments.
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"auth": {
|
|
183
|
+
"mode": "password"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
- Users stored in `~/negmas/hani/settings/users.json`
|
|
189
|
+
- Default users: `admin`/`adminpass` and `user`/`userpass`
|
|
190
|
+
- New users can register via `/register` endpoint
|
|
191
|
+
|
|
192
|
+
### Dual Authentication (Password + OAuth)
|
|
193
|
+
|
|
194
|
+
Allows users to log in with either password or OAuth providers.
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"auth": {
|
|
199
|
+
"mode": "dual"
|
|
200
|
+
},
|
|
201
|
+
"oauth": {
|
|
202
|
+
"redirect_uri": "http://localhost:5006",
|
|
203
|
+
"providers": {
|
|
204
|
+
"github": {
|
|
205
|
+
"enabled": true,
|
|
206
|
+
"key": "your-github-client-id",
|
|
207
|
+
"secret": "your-github-client-secret"
|
|
208
|
+
},
|
|
209
|
+
"google": {
|
|
210
|
+
"enabled": true,
|
|
211
|
+
"key": "your-google-client-id",
|
|
212
|
+
"secret": "your-google-client-secret"
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Setting Up OAuth
|
|
220
|
+
|
|
221
|
+
Run `hani auth` to see detailed setup instructions. Here's a summary:
|
|
222
|
+
|
|
223
|
+
#### GitHub OAuth
|
|
224
|
+
|
|
225
|
+
1. Go to https://github.com/settings/developers
|
|
226
|
+
2. Create a new OAuth App
|
|
227
|
+
3. Set Homepage URL: `http://localhost:5006`
|
|
228
|
+
4. Set Authorization callback URL: `http://localhost:5006/oauth/callback`
|
|
229
|
+
5. Copy Client ID and Client Secret to `env.json`
|
|
230
|
+
|
|
231
|
+
#### Google OAuth
|
|
232
|
+
|
|
233
|
+
1. Go to https://console.cloud.google.com/apis/credentials
|
|
234
|
+
2. Create OAuth 2.0 Client ID (Web application)
|
|
235
|
+
3. Add authorized redirect URI: `http://localhost:5006/oauth/callback`
|
|
236
|
+
4. Copy Client ID and Client Secret to `env.json`
|
|
237
|
+
|
|
238
|
+
### OAuth Admin Access
|
|
239
|
+
|
|
240
|
+
In OAuth/dual mode, admin access is granted to users whose email is in the `admin.emails` list:
|
|
241
|
+
|
|
242
|
+
```json
|
|
243
|
+
{
|
|
244
|
+
"admin": {
|
|
245
|
+
"emails": ["admin@example.com", "another-admin@example.com"]
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Auto Mode
|
|
251
|
+
|
|
252
|
+
When `auth.mode` is `auto`:
|
|
253
|
+
- Uses OAuth if OAuth credentials are configured
|
|
254
|
+
- Falls back to password authentication otherwise
|
|
255
|
+
|
|
256
|
+
## Configuring Agent/Negotiator Types
|
|
257
|
+
|
|
258
|
+
HANI allows you to specify which negotiator types the AI opponent can use.
|
|
259
|
+
|
|
260
|
+
### Command-Line Argument (Recommended)
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# Use specific NegMAS negotiators
|
|
264
|
+
hani --agents "AspirationNegotiator,BoulwareTBNegotiator,ConcederTBNegotiator"
|
|
265
|
+
|
|
266
|
+
# Mix of different negotiator types
|
|
267
|
+
hani --agents "AspirationNegotiator,helpers.AgentK,helpers.Atlas3,LLMHybridNegotiator"
|
|
268
|
+
|
|
269
|
+
# Use only HANI custom negotiators
|
|
270
|
+
hani --agents "helpers.AgentK,helpers.HardHeaded,helpers.AverageTitForTat"
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Agent Groups
|
|
274
|
+
|
|
275
|
+
Use group syntax to select categories of agents:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# All LLM-based negotiators
|
|
279
|
+
hani --agents ":llm"
|
|
280
|
+
|
|
281
|
+
# All template-based negotiators
|
|
282
|
+
hani --agents ":template"
|
|
283
|
+
|
|
284
|
+
# All NegMAS negotiators
|
|
285
|
+
hani --agents ":negmas"
|
|
286
|
+
|
|
287
|
+
# Combine groups
|
|
288
|
+
hani --agents ":llm,:template"
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Supported Negotiator Namespaces
|
|
292
|
+
|
|
293
|
+
#### NegMAS Negotiators (default namespace)
|
|
294
|
+
```bash
|
|
295
|
+
hani --agents "AspirationNegotiator,BoulwareTBNegotiator,NaiveTitForTatNegotiator"
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
#### HANI Helper Negotiators
|
|
299
|
+
```bash
|
|
300
|
+
hani --agents "helpers.AgentK,helpers.Atlas3,helpers.CUHKAgent,helpers.HardHeaded"
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
#### Genius Negotiators
|
|
304
|
+
```bash
|
|
305
|
+
hani --agents "genius.Atlas3,genius.AgentK,genius.HardHeaded"
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
#### LLM-based Negotiators
|
|
309
|
+
```bash
|
|
310
|
+
hani --agents "LLMHybridNegotiator,LLMBoulwareTBNegotiator,LLMConcederTBNegotiator"
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
#### Custom Negotiators from Files
|
|
314
|
+
```bash
|
|
315
|
+
# Load from a Python file
|
|
316
|
+
hani --agents "file:mynegotiator.MyNegotiator"
|
|
317
|
+
|
|
318
|
+
# With path
|
|
319
|
+
hani --agents "file:agents/custom/myneg.MyNegotiator"
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
## Customization
|
|
323
|
+
|
|
324
|
+
### Announcements
|
|
325
|
+
|
|
326
|
+
Create `~/negmas/hani/settings/announcements.md` to display custom announcements on the welcome screen.
|
|
327
|
+
|
|
328
|
+
### Scenarios
|
|
329
|
+
|
|
330
|
+
Custom scenarios can be placed in `~/negmas/hani/settings/scenarios/`. Run `hani setup` to copy the default scenarios as examples.
|
|
331
|
+
|
|
332
|
+
### Consent Form
|
|
333
|
+
|
|
334
|
+
Edit `~/negmas/hani/settings/consent.md` to customize the consent form. Enable it with:
|
|
335
|
+
|
|
336
|
+
```json
|
|
337
|
+
{
|
|
338
|
+
"auth": {
|
|
339
|
+
"enforce_consent": true
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
## How It Works
|
|
345
|
+
|
|
346
|
+
1. **Scenario Loading**: A negotiation scenario is loaded with defined issues (e.g., price, quantity) and preferences for each party.
|
|
347
|
+
|
|
348
|
+
2. **Turn-Based Negotiation**: You and the AI agent take turns making offers. Each offer specifies values for all issues.
|
|
349
|
+
|
|
350
|
+
3. **Decision Making**: On each turn, you can:
|
|
351
|
+
- **Send an offer**: Propose specific values for each issue
|
|
352
|
+
- **Accept**: Accept the current offer from your partner
|
|
353
|
+
- **End Negotiation**: Terminate without agreement
|
|
354
|
+
|
|
355
|
+
4. **Text Messages**: Optionally include natural language messages with your offers to communicate intent.
|
|
356
|
+
|
|
357
|
+
5. **Analysis**: Use the built-in tools to understand the negotiation dynamics and make informed decisions.
|
|
358
|
+
|
|
359
|
+
## LLM Configuration (Admin)
|
|
360
|
+
|
|
361
|
+
Administrators can configure LLM settings in the sidebar under "LLM Settings":
|
|
362
|
+
|
|
363
|
+
- **Provider**: OpenAI or Anthropic
|
|
364
|
+
- **Model**: The model to use (e.g., `gpt-4o-mini`, `claude-3-haiku`)
|
|
365
|
+
- **Temperature**: Controls response randomness (0.0-2.0)
|
|
366
|
+
- **Prompts**: Customize extraction and generation prompts
|
|
367
|
+
|
|
368
|
+
LLM API keys can be set in `~/negmas/hani/settings/llm_settings.json` or via environment variables (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`).
|
|
369
|
+
|
|
370
|
+
## Development
|
|
371
|
+
|
|
372
|
+
### Contributing
|
|
373
|
+
|
|
374
|
+
To contribute, clone this repo and install development dependencies:
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
git clone https://github.com/yasserfarouk/hani.git
|
|
378
|
+
cd hani
|
|
379
|
+
pip install -e ".[dev]"
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### Running in Development Mode
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
hani dev
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
This enables auto-reload when files change.
|
|
389
|
+
|
|
390
|
+
### Project Structure
|
|
391
|
+
|
|
392
|
+
```
|
|
393
|
+
src/hani/
|
|
394
|
+
├── app.py # Main application
|
|
395
|
+
├── auth.py # Authentication utilities
|
|
396
|
+
├── common.py # Shared configuration
|
|
397
|
+
├── dual_auth.py # OAuth and dual auth handlers
|
|
398
|
+
├── llm_service.py # LLM integration
|
|
399
|
+
├── run.py # CLI entry point
|
|
400
|
+
├── tools/ # Analysis tools
|
|
401
|
+
│ ├── generator.py # Response generator tool
|
|
402
|
+
│ ├── preferences.py # Preferences viewer
|
|
403
|
+
│ └── ...
|
|
404
|
+
├── scenarios/ # Built-in negotiation scenarios
|
|
405
|
+
├── sample_scenarios/ # Default scenarios copied on setup
|
|
406
|
+
└── default_settings/ # Default configuration files
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
## License
|
|
410
|
+
|
|
411
|
+
This project is licensed under the [GNU Affero General Public License v3.0 (AGPL-3.0)](https://www.gnu.org/licenses/agpl-3.0.en.html).
|
|
412
|
+
|
|
413
|
+
See the [LICENSE](LICENSE) file for details.
|
|
414
|
+
|
|
415
|
+
## Author
|
|
416
|
+
|
|
417
|
+
Yasser Mohammad (yasserfarouk@gmail.com)
|