gothos 0.2.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.
Files changed (89) hide show
  1. gothos-0.2.0/.dockerignore +10 -0
  2. gothos-0.2.0/.github/workflows/gothos-ci.yml +47 -0
  3. gothos-0.2.0/.github/workflows/publish.yml +68 -0
  4. gothos-0.2.0/.gitignore +15 -0
  5. gothos-0.2.0/.pre-commit-config.yaml +19 -0
  6. gothos-0.2.0/CONTRIBUTING.md +71 -0
  7. gothos-0.2.0/Dockerfile +30 -0
  8. gothos-0.2.0/LICENSE +21 -0
  9. gothos-0.2.0/Makefile +33 -0
  10. gothos-0.2.0/PKG-INFO +460 -0
  11. gothos-0.2.0/README.md +419 -0
  12. gothos-0.2.0/examples/agent_loop.py +138 -0
  13. gothos-0.2.0/examples/gothos_agent.py +54 -0
  14. gothos-0.2.0/examples/grounding_cascade.py +158 -0
  15. gothos-0.2.0/gothos/__init__.py +35 -0
  16. gothos-0.2.0/gothos/__main__.py +5 -0
  17. gothos-0.2.0/gothos/benchmark/__init__.py +14 -0
  18. gothos-0.2.0/gothos/benchmark/harness.py +237 -0
  19. gothos-0.2.0/gothos/benchmark/suites.py +205 -0
  20. gothos-0.2.0/gothos/cli.py +431 -0
  21. gothos-0.2.0/gothos/console/__init__.py +7 -0
  22. gothos-0.2.0/gothos/console/server.py +180 -0
  23. gothos-0.2.0/gothos/console/session_manager.py +218 -0
  24. gothos-0.2.0/gothos/console/static/index.html +573 -0
  25. gothos-0.2.0/gothos/core/__init__.py +29 -0
  26. gothos-0.2.0/gothos/core/agent.py +622 -0
  27. gothos-0.2.0/gothos/core/cache.py +130 -0
  28. gothos-0.2.0/gothos/core/compactor.py +182 -0
  29. gothos-0.2.0/gothos/core/config.py +114 -0
  30. gothos-0.2.0/gothos/core/retry.py +103 -0
  31. gothos-0.2.0/gothos/core/state.py +43 -0
  32. gothos-0.2.0/gothos/core/strategy.py +280 -0
  33. gothos-0.2.0/gothos/core/telemetry.py +211 -0
  34. gothos-0.2.0/gothos/device/__init__.py +26 -0
  35. gothos-0.2.0/gothos/device/actions.py +246 -0
  36. gothos-0.2.0/gothos/device/adb.py +217 -0
  37. gothos-0.2.0/gothos/device/screenshot.py +83 -0
  38. gothos-0.2.0/gothos/extract/__init__.py +13 -0
  39. gothos-0.2.0/gothos/extract/a11y_parser.py +229 -0
  40. gothos-0.2.0/gothos/extract/extractor.py +329 -0
  41. gothos-0.2.0/gothos/extract/mcp_tool.py +183 -0
  42. gothos-0.2.0/gothos/grounding/__init__.py +25 -0
  43. gothos-0.2.0/gothos/grounding/a11y_navigator.py +266 -0
  44. gothos-0.2.0/gothos/grounding/ocr_fallback.py +111 -0
  45. gothos-0.2.0/gothos/grounding/provider_agnostic.py +347 -0
  46. gothos-0.2.0/gothos/llm/__init__.py +9 -0
  47. gothos-0.2.0/gothos/llm/factory.py +81 -0
  48. gothos-0.2.0/gothos/mcp/__init__.py +32 -0
  49. gothos-0.2.0/gothos/mcp/models.py +182 -0
  50. gothos-0.2.0/gothos/mcp/server.py +222 -0
  51. gothos-0.2.0/gothos/mcp/tools.py +347 -0
  52. gothos-0.2.0/gothos/memory/__init__.py +15 -0
  53. gothos-0.2.0/gothos/memory/action_recorder.py +181 -0
  54. gothos-0.2.0/gothos/memory/app_navigator.py +188 -0
  55. gothos-0.2.0/gothos/memory/models.py +90 -0
  56. gothos-0.2.0/gothos/memory/retriever.py +181 -0
  57. gothos-0.2.0/gothos/memory/store.py +489 -0
  58. gothos-0.2.0/gothos/planner/__init__.py +7 -0
  59. gothos-0.2.0/gothos/planner/planner.py +329 -0
  60. gothos-0.2.0/gothos/planner/prompts.py +103 -0
  61. gothos-0.2.0/gothos/py.typed +0 -0
  62. gothos-0.2.0/gothos/safety/__init__.py +42 -0
  63. gothos-0.2.0/gothos/safety/action_classifier.py +359 -0
  64. gothos-0.2.0/gothos/safety/confirmation.py +382 -0
  65. gothos-0.2.0/gothos/safety/dialog_handler.py +424 -0
  66. gothos-0.2.0/gothos/safety/policies.py +242 -0
  67. gothos-0.2.0/gothos/screen/__init__.py +15 -0
  68. gothos-0.2.0/gothos/screen/analyzer.py +219 -0
  69. gothos-0.2.0/gothos/screen/models.py +49 -0
  70. gothos-0.2.0/pyproject.toml +84 -0
  71. gothos-0.2.0/start.bat +97 -0
  72. gothos-0.2.0/start.sh +160 -0
  73. gothos-0.2.0/tests/__init__.py +0 -0
  74. gothos-0.2.0/tests/test_benchmark.py +254 -0
  75. gothos-0.2.0/tests/test_cli.py +116 -0
  76. gothos-0.2.0/tests/test_compactor.py +137 -0
  77. gothos-0.2.0/tests/test_console.py +224 -0
  78. gothos-0.2.0/tests/test_core.py +176 -0
  79. gothos-0.2.0/tests/test_device.py +368 -0
  80. gothos-0.2.0/tests/test_extract.py +500 -0
  81. gothos-0.2.0/tests/test_grounding.py +455 -0
  82. gothos-0.2.0/tests/test_llm.py +109 -0
  83. gothos-0.2.0/tests/test_mcp.py +463 -0
  84. gothos-0.2.0/tests/test_memory.py +295 -0
  85. gothos-0.2.0/tests/test_planner.py +420 -0
  86. gothos-0.2.0/tests/test_production.py +439 -0
  87. gothos-0.2.0/tests/test_safety.py +424 -0
  88. gothos-0.2.0/tests/test_screen.py +347 -0
  89. gothos-0.2.0/tests/test_strategy.py +422 -0
@@ -0,0 +1,10 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .git/
5
+ .pytest_cache/
6
+ .mypy_cache/
7
+ .ruff_cache/
8
+ *.egg-info/
9
+ dist/
10
+ build/
@@ -0,0 +1,47 @@
1
+ name: GothOS CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.12", "3.13"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: pip install -e ".[dev]"
26
+
27
+ - name: Lint with ruff
28
+ run: ruff check .
29
+
30
+ - name: Run tests
31
+ run: pytest -v
32
+
33
+ typecheck:
34
+ runs-on: ubuntu-latest
35
+ steps:
36
+ - uses: actions/checkout@v4
37
+
38
+ - name: Set up Python 3.12
39
+ uses: actions/setup-python@v5
40
+ with:
41
+ python-version: "3.12"
42
+
43
+ - name: Install dependencies
44
+ run: pip install -e ".[dev]"
45
+
46
+ - name: Type check with mypy
47
+ run: mypy gothos --ignore-missing-imports
@@ -0,0 +1,68 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+ id-token: write
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.12"
21
+
22
+ - name: Install build tools
23
+ run: pip install build
24
+
25
+ - name: Build package
26
+ run: python -m build
27
+
28
+ - name: Verify package
29
+ run: |
30
+ pip install dist/*.whl
31
+ python -c "import gothos; print(f'gothos {gothos.__version__}')"
32
+
33
+ - uses: actions/upload-artifact@v4
34
+ with:
35
+ name: dist
36
+ path: dist/
37
+
38
+ publish-pypi:
39
+ needs: build
40
+ runs-on: ubuntu-latest
41
+ environment: pypi
42
+ permissions:
43
+ id-token: write
44
+ steps:
45
+ - uses: actions/download-artifact@v4
46
+ with:
47
+ name: dist
48
+ path: dist/
49
+
50
+ - name: Publish to PyPI
51
+ uses: pypa/gh-action-pypi-publish@release/v1
52
+
53
+ publish-testpypi:
54
+ needs: build
55
+ runs-on: ubuntu-latest
56
+ environment: testpypi
57
+ permissions:
58
+ id-token: write
59
+ steps:
60
+ - uses: actions/download-artifact@v4
61
+ with:
62
+ name: dist
63
+ path: dist/
64
+
65
+ - name: Publish to TestPyPI
66
+ uses: pypa/gh-action-pypi-publish@release/v1
67
+ with:
68
+ repository-url: https://test.pypi.org/legacy/
@@ -0,0 +1,15 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+ .mypy_cache/
10
+ .pytest_cache/
11
+ .ruff_cache/
12
+ *.db
13
+ .venv/
14
+ venv/
15
+ .env
@@ -0,0 +1,19 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.8.6
4
+ hooks:
5
+ - id: ruff
6
+ args: [--fix, --exit-non-zero-on-fix]
7
+ - id: ruff-format
8
+
9
+ - repo: https://github.com/pre-commit/pre-commit-hooks
10
+ rev: v5.0.0
11
+ hooks:
12
+ - id: trailing-whitespace
13
+ - id: end-of-file-fixer
14
+ - id: check-yaml
15
+ - id: check-toml
16
+ - id: check-added-large-files
17
+ args: [--maxkb=500]
18
+ - id: check-merge-conflict
19
+ - id: debug-statements
@@ -0,0 +1,71 @@
1
+ # Contributing to gothos
2
+
3
+ ## Prerequisites
4
+
5
+ - Python 3.12 or later
6
+ - Git
7
+
8
+ ## Setup
9
+
10
+ ```bash
11
+ git clone https://github.com/GouthamRajam/Accounting-erp-.git
12
+ cd Accounting-erp-/gothos
13
+ pip install -e ".[dev]"
14
+
15
+ # Optional: install pre-commit hooks
16
+ pip install pre-commit
17
+ pre-commit install
18
+ ```
19
+
20
+ ## Running checks
21
+
22
+ ```bash
23
+ # Tests
24
+ pytest -v
25
+
26
+ # Lint
27
+ ruff check .
28
+
29
+ # Type check (strict mode with pydantic plugin)
30
+ mypy gothos --ignore-missing-imports
31
+ ```
32
+
33
+ All three must pass before submitting a PR. CI runs them automatically
34
+ on Python 3.12 and 3.13.
35
+
36
+ ## Code style
37
+
38
+ - **Formatter**: ruff handles all formatting — no manual style decisions needed.
39
+ - **Line length**: 100 characters.
40
+ - **Type annotations**: required on all public APIs. The project uses `strict = true` mypy.
41
+ - **Comments**: only when the *why* is non-obvious. Don't explain what the code does.
42
+ - **Imports**: sorted by ruff (isort-compatible).
43
+
44
+ ## Making changes
45
+
46
+ 1. Branch from `main`.
47
+ 2. Write tests for new functionality or bug fixes.
48
+ 3. Run all three checks (tests, lint, types) locally.
49
+ 4. Open a PR targeting `main`.
50
+
51
+ ## Project structure
52
+
53
+ ```
54
+ gothos/
55
+ core/ — LangGraph agent orchestrator (plan → execute → observe loop)
56
+ device/ — async ADB bridge, action executor, screenshot/UI capture
57
+ planner/ — LLM-based task decomposition into action steps
58
+ screen/ — UI hierarchy parsing, screen state analysis, diff
59
+ safety/ — action classification, confirmation gates, dialog handling
60
+ memory/ — SQLite-backed task/action/screen memory, navigation graphs
61
+ grounding/ — a11y-tree element finder, OCR fallback, provider-agnostic LLM grounding
62
+ extract/ — LLM-powered screen data extraction, MCP tool
63
+ llm/ — shared provider-agnostic LLM factory
64
+ tests/ — mirrors module structure
65
+ examples/ — integration demos
66
+ ```
67
+
68
+ ## License
69
+
70
+ By contributing you agree that your contributions will be licensed under
71
+ the Apache 2.0 License.
@@ -0,0 +1,30 @@
1
+ FROM python:3.12-slim
2
+
3
+ LABEL maintainer="GouthamRajam"
4
+ LABEL description="GothOS — provider-agnostic Android AI agent"
5
+
6
+ # System dependencies
7
+ RUN apt-get update -qq \
8
+ && apt-get install -y -qq --no-install-recommends \
9
+ android-tools-adb \
10
+ ffmpeg \
11
+ git \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ WORKDIR /app
15
+
16
+ # Install Python dependencies first (layer caching)
17
+ COPY pyproject.toml ./
18
+ RUN pip install --no-cache-dir --upgrade pip \
19
+ && pip install --no-cache-dir -e ".[dev]" || true
20
+
21
+ # Copy source
22
+ COPY . .
23
+ RUN pip install --no-cache-dir -e .
24
+
25
+ # Expose MCP server port (if running in HTTP mode)
26
+ EXPOSE 8000
27
+
28
+ # Default: start the MCP server
29
+ ENTRYPOINT ["gothos"]
30
+ CMD ["serve"]
gothos-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GouthamRajam
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
gothos-0.2.0/Makefile ADDED
@@ -0,0 +1,33 @@
1
+ .PHONY: install dev test lint typecheck fmt clean serve docker
2
+
3
+ install:
4
+ pip install -e .
5
+
6
+ dev:
7
+ pip install -e ".[dev]"
8
+
9
+ test:
10
+ pytest -v
11
+
12
+ lint:
13
+ ruff check .
14
+
15
+ typecheck:
16
+ mypy gothos --ignore-missing-imports
17
+
18
+ fmt:
19
+ ruff format .
20
+ ruff check --fix .
21
+
22
+ clean:
23
+ find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
24
+ find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
25
+ rm -rf .pytest_cache .mypy_cache .ruff_cache dist build
26
+
27
+ serve:
28
+ gothos serve
29
+
30
+ docker:
31
+ docker build -t gothos .
32
+
33
+ all: fmt lint typecheck test