optio-grok 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.
Files changed (47) hide show
  1. optio_grok-0.1.0/PKG-INFO +68 -0
  2. optio_grok-0.1.0/README.md +37 -0
  3. optio_grok-0.1.0/pyproject.toml +52 -0
  4. optio_grok-0.1.0/setup.cfg +4 -0
  5. optio_grok-0.1.0/src/optio_grok/__init__.py +60 -0
  6. optio_grok-0.1.0/src/optio_grok/conversation.py +468 -0
  7. optio_grok-0.1.0/src/optio_grok/conversation_listener.py +321 -0
  8. optio_grok-0.1.0/src/optio_grok/cred_watcher.py +124 -0
  9. optio_grok-0.1.0/src/optio_grok/fs_allowlist.py +86 -0
  10. optio_grok-0.1.0/src/optio_grok/host_actions.py +1111 -0
  11. optio_grok-0.1.0/src/optio_grok/models.py +144 -0
  12. optio_grok-0.1.0/src/optio_grok/prompt.py +195 -0
  13. optio_grok-0.1.0/src/optio_grok/seed_manifest.py +80 -0
  14. optio_grok-0.1.0/src/optio_grok/session.py +739 -0
  15. optio_grok-0.1.0/src/optio_grok/snapshots.py +100 -0
  16. optio_grok-0.1.0/src/optio_grok/types.py +307 -0
  17. optio_grok-0.1.0/src/optio_grok/verify.py +257 -0
  18. optio_grok-0.1.0/src/optio_grok.egg-info/PKG-INFO +68 -0
  19. optio_grok-0.1.0/src/optio_grok.egg-info/SOURCES.txt +45 -0
  20. optio_grok-0.1.0/src/optio_grok.egg-info/dependency_links.txt +1 -0
  21. optio_grok-0.1.0/src/optio_grok.egg-info/requires.txt +9 -0
  22. optio_grok-0.1.0/src/optio_grok.egg-info/top_level.txt +1 -0
  23. optio_grok-0.1.0/tests/test_config.py +10 -0
  24. optio_grok-0.1.0/tests/test_conversation.py +394 -0
  25. optio_grok-0.1.0/tests/test_conversation_listener.py +201 -0
  26. optio_grok-0.1.0/tests/test_conversation_sandbox_enforce.py +140 -0
  27. optio_grok-0.1.0/tests/test_conversation_teardown.py +91 -0
  28. optio_grok-0.1.0/tests/test_cred_watcher.py +202 -0
  29. optio_grok-0.1.0/tests/test_file_download.py +180 -0
  30. optio_grok-0.1.0/tests/test_file_upload.py +126 -0
  31. optio_grok-0.1.0/tests/test_fs_allowlist.py +71 -0
  32. optio_grok-0.1.0/tests/test_grok_cache.py +200 -0
  33. optio_grok-0.1.0/tests/test_host_actions.py +111 -0
  34. optio_grok-0.1.0/tests/test_import.py +4 -0
  35. optio_grok-0.1.0/tests/test_models.py +150 -0
  36. optio_grok-0.1.0/tests/test_prompt.py +27 -0
  37. optio_grok-0.1.0/tests/test_sandbox_enforce.py +205 -0
  38. optio_grok-0.1.0/tests/test_seed_manifest.py +41 -0
  39. optio_grok-0.1.0/tests/test_session_conversation.py +234 -0
  40. optio_grok-0.1.0/tests/test_session_lease.py +142 -0
  41. optio_grok-0.1.0/tests/test_session_local.py +66 -0
  42. optio_grok-0.1.0/tests/test_session_remote.py +123 -0
  43. optio_grok-0.1.0/tests/test_session_resume.py +138 -0
  44. optio_grok-0.1.0/tests/test_session_sandbox.py +91 -0
  45. optio_grok-0.1.0/tests/test_session_seed.py +118 -0
  46. optio_grok-0.1.0/tests/test_snapshots.py +80 -0
  47. optio_grok-0.1.0/tests/test_verify.py +188 -0
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.4
2
+ Name: optio-grok
3
+ Version: 0.1.0
4
+ Summary: Run Grok Build (xAI) as an optio task; local subprocess or remote via SSH; ttyd-served TUI iframe.
5
+ Author-email: Kristof Csillag <kristof.csillag@deai-labs.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/deai-network/optio
8
+ Project-URL: Repository, https://github.com/deai-network/optio
9
+ Project-URL: Issues, https://github.com/deai-network/optio/issues
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Classifier: Topic :: Software Development :: Code Generators
20
+ Classifier: Framework :: AsyncIO
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ Requires-Dist: optio-core<0.4,>=0.3
24
+ Requires-Dist: optio-host<0.3,>=0.2
25
+ Requires-Dist: optio-agents<0.4,>=0.3
26
+ Requires-Dist: asyncssh>=2.14
27
+ Requires-Dist: aiohttp>=3.9
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=8.0; extra == "dev"
30
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
31
+
32
+ # optio-grok
33
+
34
+ Run Grok Build (xAI) as an `optio` task — either as a local subprocess
35
+ or on a remote host over SSH — with the interactive TUI embedded in the
36
+ optio dashboard via an iframe widget served by `ttyd`.
37
+
38
+ ## Install
39
+
40
+ ```bash
41
+ pip install optio-grok
42
+ ```
43
+
44
+ Requires Python 3.11+. Pulls `optio-core`, `optio-host`, `optio-agents`,
45
+ `asyncssh`, and `aiohttp`.
46
+
47
+ ## What it does
48
+
49
+ Grok Build is a near-twin of Claude Code. optio-grok adapts the
50
+ `optio-claudecode` machinery: it launches `grok` inside a detached tmux
51
+ session, serves the TUI over `ttyd`, and coordinates with the host
52
+ harness through the `optio.log` keyword channel (STATUS / DELIVERABLE /
53
+ DONE / ERROR). The agent reads its task from an `AGENTS.md` file planted
54
+ in the workdir.
55
+
56
+ ### Isolation
57
+
58
+ Each task runs under an isolated `HOME` (`<workdir>/home`) with
59
+ `GROK_HOME` pointing at `<workdir>/home/.grok`. Grok ships a
60
+ claude-compat layer, so `CLAUDE_CONFIG_DIR` is pinned at
61
+ `<workdir>/home/.claude` to keep the operator's real `~/.claude`
62
+ configuration, hooks, and instructions from leaking into the task.
63
+ `--no-leader` is always passed so tasks never share a grok backend.
64
+
65
+ ## Status
66
+
67
+ Stage 0 (MVP): iframe/ttyd mode, local host. Resume, seeds,
68
+ conversation mode, and filesystem isolation arrive in later stages.
@@ -0,0 +1,37 @@
1
+ # optio-grok
2
+
3
+ Run Grok Build (xAI) as an `optio` task — either as a local subprocess
4
+ or on a remote host over SSH — with the interactive TUI embedded in the
5
+ optio dashboard via an iframe widget served by `ttyd`.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install optio-grok
11
+ ```
12
+
13
+ Requires Python 3.11+. Pulls `optio-core`, `optio-host`, `optio-agents`,
14
+ `asyncssh`, and `aiohttp`.
15
+
16
+ ## What it does
17
+
18
+ Grok Build is a near-twin of Claude Code. optio-grok adapts the
19
+ `optio-claudecode` machinery: it launches `grok` inside a detached tmux
20
+ session, serves the TUI over `ttyd`, and coordinates with the host
21
+ harness through the `optio.log` keyword channel (STATUS / DELIVERABLE /
22
+ DONE / ERROR). The agent reads its task from an `AGENTS.md` file planted
23
+ in the workdir.
24
+
25
+ ### Isolation
26
+
27
+ Each task runs under an isolated `HOME` (`<workdir>/home`) with
28
+ `GROK_HOME` pointing at `<workdir>/home/.grok`. Grok ships a
29
+ claude-compat layer, so `CLAUDE_CONFIG_DIR` is pinned at
30
+ `<workdir>/home/.claude` to keep the operator's real `~/.claude`
31
+ configuration, hooks, and instructions from leaking into the task.
32
+ `--no-leader` is always passed so tasks never share a grok backend.
33
+
34
+ ## Status
35
+
36
+ Stage 0 (MVP): iframe/ttyd mode, local host. Resume, seeds,
37
+ conversation mode, and filesystem isolation arrive in later stages.
@@ -0,0 +1,52 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "optio-grok"
7
+ version = "0.1.0"
8
+ description = "Run Grok Build (xAI) as an optio task; local subprocess or remote via SSH; ttyd-served TUI iframe."
9
+ readme = "README.md"
10
+ license = "Apache-2.0"
11
+ requires-python = ">=3.11"
12
+ authors = [
13
+ { name = "Kristof Csillag", email = "kristof.csillag@deai-labs.com" },
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Operating System :: POSIX :: Linux",
22
+ "Operating System :: MacOS",
23
+ "Topic :: Software Development :: Libraries :: Python Modules",
24
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
25
+ "Topic :: Software Development :: Code Generators",
26
+ "Framework :: AsyncIO",
27
+ ]
28
+ dependencies = [
29
+ "optio-core>=0.3,<0.4",
30
+ "optio-host>=0.2,<0.3",
31
+ "optio-agents>=0.3,<0.4",
32
+ "asyncssh>=2.14",
33
+ "aiohttp>=3.9",
34
+ ]
35
+
36
+ [project.optional-dependencies]
37
+ dev = [
38
+ "pytest>=8.0",
39
+ "pytest-asyncio>=0.23",
40
+ ]
41
+
42
+ [project.urls]
43
+ Homepage = "https://github.com/deai-network/optio"
44
+ Repository = "https://github.com/deai-network/optio"
45
+ Issues = "https://github.com/deai-network/optio/issues"
46
+
47
+ [tool.setuptools.packages.find]
48
+ where = ["src"]
49
+
50
+ [tool.pytest.ini_options]
51
+ asyncio_mode = "auto"
52
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,60 @@
1
+ """optio-grok — run Grok Build (xAI) as an optio task."""
2
+
3
+ import logging as _logging
4
+
5
+ from optio_agents import HookContext, HookContextProtocol
6
+ from optio_host import (
7
+ HostCommandError,
8
+ RunResult,
9
+ SSHConfig,
10
+ )
11
+
12
+ from optio_grok.seed_manifest import (
13
+ GROK_CRED_MANIFEST,
14
+ GROK_SEED_MANIFEST,
15
+ GROK_SEED_SUFFIX,
16
+ delete_seed,
17
+ list_seeds,
18
+ purge_seed,
19
+ )
20
+ from optio_grok.session import create_grok_task, run_grok_session
21
+ from optio_grok.verify import verify_and_refresh_seed
22
+ from optio_grok.types import (
23
+ AllowedDir,
24
+ DeliverableCallback,
25
+ GrokTaskConfig,
26
+ HookCallback,
27
+ PermissionMode,
28
+ SeedProvider,
29
+ SeedUnavailableError,
30
+ )
31
+
32
+
33
+ # asyncssh emits per-connection INFO lines that flood worker stdout
34
+ # once an SSH-backed session starts. Quiet by default.
35
+ _logging.getLogger("asyncssh").setLevel(_logging.WARNING)
36
+
37
+
38
+ __all__ = [
39
+ "create_grok_task",
40
+ "run_grok_session",
41
+ "GrokTaskConfig",
42
+ "DeliverableCallback",
43
+ "HookCallback",
44
+ "PermissionMode",
45
+ "SSHConfig",
46
+ "HookContext",
47
+ "HookContextProtocol",
48
+ "HostCommandError",
49
+ "RunResult",
50
+ "GROK_SEED_MANIFEST",
51
+ "GROK_CRED_MANIFEST",
52
+ "GROK_SEED_SUFFIX",
53
+ "delete_seed",
54
+ "list_seeds",
55
+ "purge_seed",
56
+ "verify_and_refresh_seed",
57
+ "SeedProvider",
58
+ "SeedUnavailableError",
59
+ "AllowedDir",
60
+ ]