dint-cli 0.1.0__py3-none-any.whl
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.
- dint/__init__.py +7 -0
- dint/__main__.py +4 -0
- dint/cli.py +313 -0
- dint/engines/__init__.py +30 -0
- dint/engines/base.py +63 -0
- dint/engines/claude.py +83 -0
- dint/engines/codex.py +95 -0
- dint/engines/copilot.py +79 -0
- dint/engines/grok.py +76 -0
- dint/envfile.py +60 -0
- dint/jobs.py +316 -0
- dint/logbook/__init__.py +200 -0
- dint/logbook/mcp.py +149 -0
- dint/logbook/rest.py +85 -0
- dint/proc.py +113 -0
- dint/router.py +100 -0
- dint/runtime.py +197 -0
- dint/status.py +58 -0
- dint/types.py +59 -0
- dint_cli-0.1.0.dist-info/METADATA +155 -0
- dint_cli-0.1.0.dist-info/RECORD +25 -0
- dint_cli-0.1.0.dist-info/WHEEL +5 -0
- dint_cli-0.1.0.dist-info/entry_points.txt +2 -0
- dint_cli-0.1.0.dist-info/licenses/LICENSE +21 -0
- dint_cli-0.1.0.dist-info/top_level.txt +1 -0
dint/status.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import shutil
|
|
5
|
+
|
|
6
|
+
from dint.envfile import home_dir
|
|
7
|
+
from dint.logbook import LogbookError, default_logbook
|
|
8
|
+
from dint.logbook.rest import RestLogbook
|
|
9
|
+
from dint.router import ENGINES
|
|
10
|
+
from dint.runtime import jobs_url, pick_engine, serve_running
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def run_status() -> int:
|
|
14
|
+
url = os.environ.get("LOGBOOK_URL", "http://127.0.0.1:5100")
|
|
15
|
+
project = os.environ.get("LOGBOOK_PROJECT", "dint")
|
|
16
|
+
key = os.environ.get("LOGBOOK_API_KEY", "")
|
|
17
|
+
env_path = os.environ.get("DINT_ENV_FILE") or ""
|
|
18
|
+
print(f"home: {home_dir()}")
|
|
19
|
+
print(f"env file: {env_path or '(none)'}")
|
|
20
|
+
print(f"logbook: {url}")
|
|
21
|
+
print(f"project: {project}")
|
|
22
|
+
print(f"api key: {'set' if key else 'MISSING'}")
|
|
23
|
+
failed = 0
|
|
24
|
+
|
|
25
|
+
logbook = default_logbook()
|
|
26
|
+
rest = logbook if isinstance(logbook, RestLogbook) else RestLogbook(url, key)
|
|
27
|
+
try:
|
|
28
|
+
health = rest.health()
|
|
29
|
+
print(f"health: OK {health.get('status')} project={health.get('project')}")
|
|
30
|
+
except LogbookError as e:
|
|
31
|
+
print(f"health: FAIL {e}")
|
|
32
|
+
failed += 1
|
|
33
|
+
|
|
34
|
+
try:
|
|
35
|
+
rest.get_messages(length=1)
|
|
36
|
+
print("auth: OK")
|
|
37
|
+
except LogbookError as e:
|
|
38
|
+
print(f"auth: FAIL {e}")
|
|
39
|
+
failed += 1
|
|
40
|
+
|
|
41
|
+
hook = jobs_url()
|
|
42
|
+
if serve_running():
|
|
43
|
+
print(f"serve: OK {hook}")
|
|
44
|
+
else:
|
|
45
|
+
print(f"serve: down {hook} (started on first dint)")
|
|
46
|
+
|
|
47
|
+
engine = pick_engine()
|
|
48
|
+
print(f"default: {engine or 'NONE — install grok, claude, copilot, or codex'}")
|
|
49
|
+
|
|
50
|
+
missing: list[str] = []
|
|
51
|
+
for name in sorted(ENGINES):
|
|
52
|
+
path = shutil.which(name)
|
|
53
|
+
print(f"{name:10} {path or 'NOT ON PATH'}")
|
|
54
|
+
if path is None:
|
|
55
|
+
missing.append(name)
|
|
56
|
+
if missing:
|
|
57
|
+
print(f"note: missing CLIs (ok if unused): {', '.join(missing)}")
|
|
58
|
+
return 1 if failed else 0
|
dint/types.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Iterator
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import Literal, Protocol
|
|
6
|
+
|
|
7
|
+
EventType = Literal["session", "text", "tool", "need_approval", "done", "error"]
|
|
8
|
+
Role = Literal["header", "session", "user", "bot", "tool", "error"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True)
|
|
12
|
+
class Event:
|
|
13
|
+
"""Normalized stream from any engine CLI."""
|
|
14
|
+
|
|
15
|
+
type: EventType
|
|
16
|
+
text: str = ""
|
|
17
|
+
session_id: str | None = None
|
|
18
|
+
tool: str | None = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass
|
|
22
|
+
class Chat:
|
|
23
|
+
chat_id: str
|
|
24
|
+
engine: str
|
|
25
|
+
cwd: str
|
|
26
|
+
external_session_id: str | None = None
|
|
27
|
+
header_id: str | None = None
|
|
28
|
+
tail_id: str | None = None
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class Engine(Protocol):
|
|
32
|
+
"""One coding-agent CLI (Claude Code, Codex, Grok, …)."""
|
|
33
|
+
|
|
34
|
+
name: str
|
|
35
|
+
|
|
36
|
+
def send(self, prompt: str, *, cwd: str, session_id: str | None) -> Iterator[Event]:
|
|
37
|
+
"""Run one turn. Pass session_id to resume."""
|
|
38
|
+
|
|
39
|
+
def cancel(self) -> None:
|
|
40
|
+
"""Stop the in-flight turn, if any."""
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class Logbook(Protocol):
|
|
44
|
+
"""Codicent Logbook wire: PostMessage / GetMessages / GetMessageHistory."""
|
|
45
|
+
|
|
46
|
+
def post_message(self, message: str, parent_id: str | None = None) -> dict:
|
|
47
|
+
"""Post a message. parent_id chains it onto the conversation (Codicent ParentId)."""
|
|
48
|
+
|
|
49
|
+
def get_messages(
|
|
50
|
+
self,
|
|
51
|
+
search: str | None = None,
|
|
52
|
+
*,
|
|
53
|
+
start: int = 0,
|
|
54
|
+
length: int = 100,
|
|
55
|
+
) -> list[dict]:
|
|
56
|
+
"""List messages, optionally filtered (e.g. #chat-<id>)."""
|
|
57
|
+
|
|
58
|
+
def get_history(self, message_id: str) -> list[dict]:
|
|
59
|
+
"""Full conversation chain (GetMessageHistory / OriginalMessageId)."""
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dint-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: One local chat API over Claude, Codex, Grok, and Copilot. Codicent Logbook is the ledger.
|
|
5
|
+
Author-email: Johan Isaksson <johan@izaxon.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Johan Isaksson / Izaxon
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://izaxon.github.io/dint/
|
|
29
|
+
Project-URL: Repository, https://github.com/izaxon/dint
|
|
30
|
+
Project-URL: Issues, https://github.com/izaxon/dint/issues
|
|
31
|
+
Keywords: claude,codex,grok,copilot,logbook,codicent
|
|
32
|
+
Classifier: Development Status :: 3 - Alpha
|
|
33
|
+
Classifier: Environment :: Console
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Programming Language :: Python :: 3
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
38
|
+
Classifier: Topic :: Software Development
|
|
39
|
+
Requires-Python: >=3.11
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
License-File: LICENSE
|
|
42
|
+
Provides-Extra: dev
|
|
43
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
# dint
|
|
47
|
+
|
|
48
|
+
One local chat API. Engine CLIs do the work. [Codicent Logbook](https://logbook.codicent.ai) is the ledger.
|
|
49
|
+
|
|
50
|
+
Site: [izaxon.github.io/dint](https://izaxon.github.io/dint/)
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
Router.start_chat / send / cancel
|
|
54
|
+
│
|
|
55
|
+
├─ Engine Claude / Codex / Grok / Copilot CLI (resume via session id)
|
|
56
|
+
└─ Logbook post_message / get_messages / get_history
|
|
57
|
+
│
|
|
58
|
+
└─ ChatLog #user vs #bot, parentId chain, GetMessageHistory
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Coding agents already ship as official CLIs. Each one keeps its own sessions, transcripts, and resume ids. dint does not reimplement them. It starts a chat, streams a turn, and writes every message to Logbook as an append-only thread. A job is just a tagged Logbook message (`#job`); `dint serve` runs it.
|
|
62
|
+
|
|
63
|
+
v0: local, four engines, webhook jobs. Not a hosted product and not a desktop UI.
|
|
64
|
+
|
|
65
|
+
## Install
|
|
66
|
+
|
|
67
|
+
Python 3.11+ and [pipx](https://pipx.pypa.io/), at least one engine CLI on PATH (`grok`, `claude`, `codex`, or `copilot`), and [logbook-server](https://logbook.codicent.ai) on PATH.
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Windows
|
|
71
|
+
iwr https://logbook.codicent.ai/install.ps1 | iex
|
|
72
|
+
# Linux / macOS
|
|
73
|
+
curl -fsSL https://logbook.codicent.ai/install.sh | bash
|
|
74
|
+
|
|
75
|
+
pipx install dint-cli
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The PyPI name is `dint-cli` (`dint` is taken). From a checkout: `pipx install .` or `pip install -e ".[dev]"`.
|
|
79
|
+
|
|
80
|
+
Then, in any folder:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
dint
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
That starts logbook-server and a background `dint serve` if they are not running, then opens a chat in the current directory (same idea as running `grok` in a new folder). Config lives in `~/.dint`. `dint grok "Summarize this repo"` is a one-shot; `dint status` checks Logbook, serve, and engine CLIs.
|
|
87
|
+
|
|
88
|
+
## Chat
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
dint
|
|
92
|
+
dint grok "Summarize this repo"
|
|
93
|
+
dint start grok .
|
|
94
|
+
dint send <chat_id> "Summarize this repo"
|
|
95
|
+
dint chats
|
|
96
|
+
dint list <chat_id>
|
|
97
|
+
dint show <chat_id>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Bare `dint` resumes the latest chat for this folder, or starts one with the first engine CLI on PATH (`DINT_ENGINE` to pick). `/new` starts a fresh chat; `/quit` exits. Logbook and `dint serve` keep running in the background.
|
|
101
|
+
|
|
102
|
+
Python:
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from dint import Router
|
|
106
|
+
|
|
107
|
+
r = Router()
|
|
108
|
+
chat_id = r.start_chat("claude", cwd=".")
|
|
109
|
+
for ev in r.send(chat_id, "Summarize this repo"):
|
|
110
|
+
print(ev.type, ev.text)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Jobs
|
|
114
|
+
|
|
115
|
+
`dint` and `dint job` start a background `dint serve` if it is not running. Enqueue from the CLI or by posting a `#job` in Logbook. Run `dint serve` in the foreground if you want the webhook logs.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
dint serve
|
|
119
|
+
dint job grok "What can you do?"
|
|
120
|
+
# job <logbook-id>
|
|
121
|
+
# chat <chat_id>
|
|
122
|
+
dint list <chat_id>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
From Logbook:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
@test #job #claude
|
|
129
|
+
{"engine":"claude","cwd":"/src/myproj","prompt":"Summarize this repo"}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
or `@test #job #grok Summarize this repo`.
|
|
133
|
+
|
|
134
|
+
`dint serve` listens on `http://127.0.0.1:8787/webhook`. If register fails, start logbook-server with `LOGBOOK_WEBHOOK_URL=http://127.0.0.1:8787/webhook`. Completed turns are stored on `#chat-<id>` like a normal `send`. Ack is `#job-run` (not `#job`, so it does not loop).
|
|
135
|
+
|
|
136
|
+
Agents should use Logbook MCP (`post_message` / `get_messages`) rather than a dint MCP. The contract is in [`.grok/skills/dint-jobs/SKILL.md`](.grok/skills/dint-jobs/SKILL.md).
|
|
137
|
+
|
|
138
|
+
## Ledger
|
|
139
|
+
|
|
140
|
+
Each chat is a Codicent-style thread: the header is the root; every later message sets `parentId` to the previous one. User turns are tagged `#user`, engine replies `#bot`. `dint list` reads `#chat-<id>` (full body) and merges `GetMessageHistory` for the parent chain — history alone can truncate long bot JSON.
|
|
141
|
+
|
|
142
|
+
| Env | Default |
|
|
143
|
+
| --- | --- |
|
|
144
|
+
| `DINT_HOME` | `~/.dint` |
|
|
145
|
+
| `DINT_ENGINE` | first of grok, claude, copilot, codex on PATH |
|
|
146
|
+
| `LOGBOOK_URL` | `http://127.0.0.1:5100` |
|
|
147
|
+
| `LOGBOOK_API_KEY` | generated on first run |
|
|
148
|
+
| `LOGBOOK_PROJECT` | `dint` |
|
|
149
|
+
| `LOGBOOK_TRANSPORT` | `rest` |
|
|
150
|
+
| `DINT_JOBS_PORT` | `8787` |
|
|
151
|
+
| `LOGBOOK_WEBHOOK_SECRET` | _(optional HMAC)_ |
|
|
152
|
+
|
|
153
|
+
## License
|
|
154
|
+
|
|
155
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
dint/__init__.py,sha256=hPGWTzet7ZXd5Pe-3GPkfUeUyp7r0JYTO8O-2yvSLII,201
|
|
2
|
+
dint/__main__.py,sha256=51hCAqWHbZf91MMNY7z_LyMydSOm3vNr4MtT3Ib_lSI,83
|
|
3
|
+
dint/cli.py,sha256=rUvxRtIB2XCvjrKTV4ObEJTNM9yyD3g5wsumoBVHibc,10383
|
|
4
|
+
dint/envfile.py,sha256=ay-lxJzW1LNKH4u2R2kBklXGGYqAVw-sUPCKUCPtpsE,1692
|
|
5
|
+
dint/jobs.py,sha256=DHQKOtVr-FNoda1tNoTFw5bioNCiaKEyEBJa4qE27tA,11333
|
|
6
|
+
dint/proc.py,sha256=tyaOHFXN_Y4_1a6rNWzlE4SzWfjTdK_7TN6OkuJju9E,2784
|
|
7
|
+
dint/router.py,sha256=UrKErLoMPE9NlqC0t0z1UdvpUgxEu_O_c_yumqWnrdM,3559
|
|
8
|
+
dint/runtime.py,sha256=dKcCzBru-Z2Y9WLO7P4VD-Ok97tUVkJyGt4nlNAlhew,5719
|
|
9
|
+
dint/status.py,sha256=1RcOCj8xljc1SpOCT6qKeRw0zTfxqhKV0uJMVHLI3Is,1861
|
|
10
|
+
dint/types.py,sha256=0gaO2y6RZWAFoJdlbOzghbA4W2P7FcFpp4puyJQbDew,1632
|
|
11
|
+
dint/engines/__init__.py,sha256=WChUIOWOnsCkjkKGr6kZQdlE9Mzkb1WPEzBpILrhIcs,779
|
|
12
|
+
dint/engines/base.py,sha256=1v5oGJ-myBTBQnt34ISvuOmEP50fvi-U3HlQxP7puOo,2108
|
|
13
|
+
dint/engines/claude.py,sha256=HIIe75iUqANEb0uPidQs3oNgbb1K2a-0lAergE2c8vo,2728
|
|
14
|
+
dint/engines/codex.py,sha256=4v1wYYfjM-Hg01rPBt_t5EGqBmh0dAr7NUkRA8bSymI,3237
|
|
15
|
+
dint/engines/copilot.py,sha256=nk32KgRrE0NidPLWFtoQuCSaoHKSiKGq7dQVGHx24XU,2578
|
|
16
|
+
dint/engines/grok.py,sha256=7DBvteoK1X1QYhbvOnvjI0rtk0WtHoOhcF-3YqgxOqg,2254
|
|
17
|
+
dint/logbook/__init__.py,sha256=rgLiAFf7a1WSlH1hWmX3mw3s4jYiBUZqYUKR3IMInnY,6925
|
|
18
|
+
dint/logbook/mcp.py,sha256=C4OCQPjRPvgARFBi1S3dyji-3riorSMjz-CEREqIRCY,5616
|
|
19
|
+
dint/logbook/rest.py,sha256=p6DHA2uQVys4ivMMhwa-Do1KkjLRy_VzVgtbJx8OJRQ,3298
|
|
20
|
+
dint_cli-0.1.0.dist-info/licenses/LICENSE,sha256=6Q8j_FrgDqJUEo4gWhwAi3JQCzK-_Dq9L9DBDUzFIi4,1080
|
|
21
|
+
dint_cli-0.1.0.dist-info/METADATA,sha256=KsLLWYcvDz4Pt4YXB-UW0XGVsDbW29cpQB3p0IF1Q2g,6277
|
|
22
|
+
dint_cli-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
23
|
+
dint_cli-0.1.0.dist-info/entry_points.txt,sha256=xWyeT3LTlztM3IjSBJsuSspOR7s9ZZsQ_kPgkhqn35g,39
|
|
24
|
+
dint_cli-0.1.0.dist-info/top_level.txt,sha256=v8XVJjkf5uMJwIVro5wOc-zHuFA_4WnL3feXiZnSNgk,5
|
|
25
|
+
dint_cli-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Johan Isaksson / Izaxon
|
|
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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dint
|