dint-cli 0.1.2__tar.gz → 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 (39) hide show
  1. {dint_cli-0.1.2/src/dint_cli.egg-info → dint_cli-0.2.0}/PKG-INFO +15 -8
  2. {dint_cli-0.1.2 → dint_cli-0.2.0}/README.md +117 -110
  3. {dint_cli-0.1.2 → dint_cli-0.2.0}/pyproject.toml +41 -41
  4. dint_cli-0.2.0/src/dint/__init__.py +8 -0
  5. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/cli.py +623 -436
  6. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/envfile.py +70 -60
  7. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/jobs.py +371 -316
  8. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/logbook/mcp.py +157 -149
  9. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/logbook/rest.py +92 -85
  10. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/router.py +105 -100
  11. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/runtime.py +354 -318
  12. {dint_cli-0.1.2 → dint_cli-0.2.0/src/dint_cli.egg-info}/PKG-INFO +15 -8
  13. dint_cli-0.2.0/tests/test_cli.py +357 -0
  14. {dint_cli-0.1.2 → dint_cli-0.2.0}/tests/test_envfile.py +62 -38
  15. {dint_cli-0.1.2 → dint_cli-0.2.0}/tests/test_jobs.py +265 -196
  16. {dint_cli-0.1.2 → dint_cli-0.2.0}/tests/test_router.py +132 -123
  17. {dint_cli-0.1.2 → dint_cli-0.2.0}/tests/test_runtime.py +185 -180
  18. dint_cli-0.1.2/src/dint/__init__.py +0 -7
  19. dint_cli-0.1.2/tests/test_cli.py +0 -185
  20. {dint_cli-0.1.2 → dint_cli-0.2.0}/LICENSE +0 -0
  21. {dint_cli-0.1.2 → dint_cli-0.2.0}/setup.cfg +0 -0
  22. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/__main__.py +0 -0
  23. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/engines/__init__.py +0 -0
  24. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/engines/base.py +0 -0
  25. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/engines/claude.py +0 -0
  26. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/engines/codex.py +0 -0
  27. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/engines/copilot.py +0 -0
  28. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/engines/grok.py +0 -0
  29. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/logbook/__init__.py +0 -0
  30. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/proc.py +0 -0
  31. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/status.py +0 -0
  32. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint/types.py +0 -0
  33. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint_cli.egg-info/SOURCES.txt +0 -0
  34. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint_cli.egg-info/dependency_links.txt +0 -0
  35. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint_cli.egg-info/entry_points.txt +0 -0
  36. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint_cli.egg-info/requires.txt +0 -0
  37. {dint_cli-0.1.2 → dint_cli-0.2.0}/src/dint_cli.egg-info/top_level.txt +0 -0
  38. {dint_cli-0.1.2 → dint_cli-0.2.0}/tests/test_engines.py +0 -0
  39. {dint_cli-0.1.2 → dint_cli-0.2.0}/tests/test_logbook.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dint-cli
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: One local chat API over Claude, Codex, Grok, and Copilot. Codicent Logbook is the ledger.
5
5
  Author-email: Johan Isaksson <johan@izaxon.com>
6
6
  License: MIT License
@@ -91,13 +91,16 @@ That starts logbook-server and a background `dint serve` if they are not running
91
91
  dint
92
92
  dint grok "Summarize this repo"
93
93
  dint start grok .
94
- dint send <chat_id> "Summarize this repo"
94
+ dint send <chat> "Summarize this repo"
95
+ dint last # latest reply, in full
96
+ dint list <chat> --full # every turn in full (--json for scripts)
95
97
  dint chats
96
- dint list <chat_id>
97
- dint show <chat_id>
98
+ dint show <chat>
98
99
  ```
99
100
 
100
- Bare `dint` opens a chat in this folder (starts logbook + serve). Inside: `/engine`, `/job`, `/chats`, `/new`, `/help`. `DINT_ENGINE` picks the default CLI. Logbook and `dint serve` keep running in the background.
101
+ Bare `dint` opens a chat in this folder (starts logbook + serve). Inside: `/engine`, `/job`, `/chats`, `/new`, `/help`. Any other `/line` (say `/login`) goes to the engine; `//help` sends a literal `/help`. A pasted block is one prompt; end a typed line with `\` to continue it. `DINT_ENGINE` picks the default CLI. Logbook and `dint serve` keep running in the background.
102
+
103
+ `<chat>` is a chat id, a unique prefix of one, or `last` (the newest chat, and the default for `last`, `list`, and `show`).
101
104
 
102
105
  Python:
103
106
 
@@ -119,7 +122,9 @@ dint serve
119
122
  dint job grok "What can you do?"
120
123
  # job <logbook-id>
121
124
  # chat <chat_id>
122
- dint list <chat_id>
125
+ dint last <chat_id>
126
+
127
+ dint job --wait grok "What can you do?" # follow the job, print the reply
123
128
  ```
124
129
 
125
130
  From Logbook:
@@ -131,7 +136,9 @@ From Logbook:
131
136
 
132
137
  or `@test #job #grok Summarize this repo`.
133
138
 
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).
139
+ `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` and `LOGBOOK_WEBHOOK_SECRET` from `~/.dint/.env`. Completed turns are stored on `#chat-<id>` like a normal `send`. Ack is `#job-run` (not `#job`, so it does not loop).
140
+
141
+ Serve only runs webhooks signed with `LOGBOOK_WEBHOOK_SECRET` (generated on first run). It reads the job back from Logbook by message id and never trusts a body sent in the request, and it turns away browser requests (an `Origin` header, a non-JSON body, or a foreign `Host`). After upgrading from 0.1.x, stop the old `dint serve`; `dint` warns while it is still running.
135
142
 
136
143
  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
144
 
@@ -148,7 +155,7 @@ Each chat is a Codicent-style thread: the header is the root; every later messag
148
155
  | `LOGBOOK_PROJECT` | `dint` |
149
156
  | `LOGBOOK_TRANSPORT` | `rest` |
150
157
  | `DINT_JOBS_PORT` | `8787` |
151
- | `LOGBOOK_WEBHOOK_SECRET` | _(optional HMAC)_ |
158
+ | `LOGBOOK_WEBHOOK_SECRET` | generated on first run (HMAC for `#job` webhooks) |
152
159
 
153
160
  ## License
154
161
 
@@ -1,110 +1,117 @@
1
- # dint
2
-
3
- One local chat API. Engine CLIs do the work. [Codicent Logbook](https://logbook.codicent.ai) is the ledger.
4
-
5
- Site: [izaxon.github.io/dint](https://izaxon.github.io/dint/)
6
-
7
- ```
8
- Router.start_chat / send / cancel
9
- │
10
- ├─ Engine Claude / Codex / Grok / Copilot CLI (resume via session id)
11
- └─ Logbook post_message / get_messages / get_history
12
- │
13
- └─ ChatLog #user vs #bot, parentId chain, GetMessageHistory
14
- ```
15
-
16
- 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.
17
-
18
- v0: local, four engines, webhook jobs. Not a hosted product and not a desktop UI.
19
-
20
- ## Install
21
-
22
- 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.
23
-
24
- ```bash
25
- # Windows
26
- iwr https://logbook.codicent.ai/install.ps1 | iex
27
- # Linux / macOS
28
- curl -fsSL https://logbook.codicent.ai/install.sh | bash
29
-
30
- pipx install dint-cli
31
- ```
32
-
33
- The PyPI name is `dint-cli` (`dint` is taken). From a checkout: `pipx install .` or `pip install -e ".[dev]"`.
34
-
35
- Then, in any folder:
36
-
37
- ```bash
38
- dint
39
- ```
40
-
41
- 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). One logbook covers every folder on the machine — chats store `cwd`; you do not get a server per repo. Config lives in `~/.dint`. If port 5100 already has someone else's logbook, dint picks the next free port and writes it to `~/.dint/.env`. `dint grok "Summarize this repo"` is a one-shot; `dint status` checks Logbook, serve, and engine CLIs.
42
-
43
- ## Chat
44
-
45
- ```bash
46
- dint
47
- dint grok "Summarize this repo"
48
- dint start grok .
49
- dint send <chat_id> "Summarize this repo"
50
- dint chats
51
- dint list <chat_id>
52
- dint show <chat_id>
53
- ```
54
-
55
- Bare `dint` opens a chat in this folder (starts logbook + serve). Inside: `/engine`, `/job`, `/chats`, `/new`, `/help`. `DINT_ENGINE` picks the default CLI. Logbook and `dint serve` keep running in the background.
56
-
57
- Python:
58
-
59
- ```python
60
- from dint import Router
61
-
62
- r = Router()
63
- chat_id = r.start_chat("claude", cwd=".")
64
- for ev in r.send(chat_id, "Summarize this repo"):
65
- print(ev.type, ev.text)
66
- ```
67
-
68
- ## Jobs
69
-
70
- `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.
71
-
72
- ```bash
73
- dint serve
74
- dint job grok "What can you do?"
75
- # job <logbook-id>
76
- # chat <chat_id>
77
- dint list <chat_id>
78
- ```
79
-
80
- From Logbook:
81
-
82
- ```
83
- @test #job #claude
84
- {"engine":"claude","cwd":"/src/myproj","prompt":"Summarize this repo"}
85
- ```
86
-
87
- or `@test #job #grok Summarize this repo`.
88
-
89
- `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).
90
-
91
- 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).
92
-
93
- ## Ledger
94
-
95
- 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.
96
-
97
- | Env | Default |
98
- | --- | --- |
99
- | `DINT_HOME` | `~/.dint` |
100
- | `DINT_ENGINE` | first of grok, claude, copilot, codex on PATH |
101
- | `LOGBOOK_URL` | `http://127.0.0.1:5100` |
102
- | `LOGBOOK_API_KEY` | generated on first run |
103
- | `LOGBOOK_PROJECT` | `dint` |
104
- | `LOGBOOK_TRANSPORT` | `rest` |
105
- | `DINT_JOBS_PORT` | `8787` |
106
- | `LOGBOOK_WEBHOOK_SECRET` | _(optional HMAC)_ |
107
-
108
- ## License
109
-
110
- MIT. See [LICENSE](LICENSE).
1
+ # dint
2
+
3
+ One local chat API. Engine CLIs do the work. [Codicent Logbook](https://logbook.codicent.ai) is the ledger.
4
+
5
+ Site: [izaxon.github.io/dint](https://izaxon.github.io/dint/)
6
+
7
+ ```
8
+ Router.start_chat / send / cancel
9
+ │
10
+ ├─ Engine Claude / Codex / Grok / Copilot CLI (resume via session id)
11
+ └─ Logbook post_message / get_messages / get_history
12
+ │
13
+ └─ ChatLog #user vs #bot, parentId chain, GetMessageHistory
14
+ ```
15
+
16
+ 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.
17
+
18
+ v0: local, four engines, webhook jobs. Not a hosted product and not a desktop UI.
19
+
20
+ ## Install
21
+
22
+ 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.
23
+
24
+ ```bash
25
+ # Windows
26
+ iwr https://logbook.codicent.ai/install.ps1 | iex
27
+ # Linux / macOS
28
+ curl -fsSL https://logbook.codicent.ai/install.sh | bash
29
+
30
+ pipx install dint-cli
31
+ ```
32
+
33
+ The PyPI name is `dint-cli` (`dint` is taken). From a checkout: `pipx install .` or `pip install -e ".[dev]"`.
34
+
35
+ Then, in any folder:
36
+
37
+ ```bash
38
+ dint
39
+ ```
40
+
41
+ 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). One logbook covers every folder on the machine — chats store `cwd`; you do not get a server per repo. Config lives in `~/.dint`. If port 5100 already has someone else's logbook, dint picks the next free port and writes it to `~/.dint/.env`. `dint grok "Summarize this repo"` is a one-shot; `dint status` checks Logbook, serve, and engine CLIs.
42
+
43
+ ## Chat
44
+
45
+ ```bash
46
+ dint
47
+ dint grok "Summarize this repo"
48
+ dint start grok .
49
+ dint send <chat> "Summarize this repo"
50
+ dint last # latest reply, in full
51
+ dint list <chat> --full # every turn in full (--json for scripts)
52
+ dint chats
53
+ dint show <chat>
54
+ ```
55
+
56
+ Bare `dint` opens a chat in this folder (starts logbook + serve). Inside: `/engine`, `/job`, `/chats`, `/new`, `/help`. Any other `/line` (say `/login`) goes to the engine; `//help` sends a literal `/help`. A pasted block is one prompt; end a typed line with `\` to continue it. `DINT_ENGINE` picks the default CLI. Logbook and `dint serve` keep running in the background.
57
+
58
+ `<chat>` is a chat id, a unique prefix of one, or `last` (the newest chat, and the default for `last`, `list`, and `show`).
59
+
60
+ Python:
61
+
62
+ ```python
63
+ from dint import Router
64
+
65
+ r = Router()
66
+ chat_id = r.start_chat("claude", cwd=".")
67
+ for ev in r.send(chat_id, "Summarize this repo"):
68
+ print(ev.type, ev.text)
69
+ ```
70
+
71
+ ## Jobs
72
+
73
+ `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.
74
+
75
+ ```bash
76
+ dint serve
77
+ dint job grok "What can you do?"
78
+ # job <logbook-id>
79
+ # chat <chat_id>
80
+ dint last <chat_id>
81
+
82
+ dint job --wait grok "What can you do?" # follow the job, print the reply
83
+ ```
84
+
85
+ From Logbook:
86
+
87
+ ```
88
+ @test #job #claude
89
+ {"engine":"claude","cwd":"/src/myproj","prompt":"Summarize this repo"}
90
+ ```
91
+
92
+ or `@test #job #grok Summarize this repo`.
93
+
94
+ `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` and `LOGBOOK_WEBHOOK_SECRET` from `~/.dint/.env`. Completed turns are stored on `#chat-<id>` like a normal `send`. Ack is `#job-run` (not `#job`, so it does not loop).
95
+
96
+ Serve only runs webhooks signed with `LOGBOOK_WEBHOOK_SECRET` (generated on first run). It reads the job back from Logbook by message id and never trusts a body sent in the request, and it turns away browser requests (an `Origin` header, a non-JSON body, or a foreign `Host`). After upgrading from 0.1.x, stop the old `dint serve`; `dint` warns while it is still running.
97
+
98
+ 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).
99
+
100
+ ## Ledger
101
+
102
+ 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.
103
+
104
+ | Env | Default |
105
+ | --- | --- |
106
+ | `DINT_HOME` | `~/.dint` |
107
+ | `DINT_ENGINE` | first of grok, claude, copilot, codex on PATH |
108
+ | `LOGBOOK_URL` | `http://127.0.0.1:5100` |
109
+ | `LOGBOOK_API_KEY` | generated on first run |
110
+ | `LOGBOOK_PROJECT` | `dint` |
111
+ | `LOGBOOK_TRANSPORT` | `rest` |
112
+ | `DINT_JOBS_PORT` | `8787` |
113
+ | `LOGBOOK_WEBHOOK_SECRET` | generated on first run (HMAC for `#job` webhooks) |
114
+
115
+ ## License
116
+
117
+ MIT. See [LICENSE](LICENSE).
@@ -1,41 +1,41 @@
1
- [project]
2
- name = "dint-cli"
3
- version = "0.1.2"
4
- description = "One local chat API over Claude, Codex, Grok, and Copilot. Codicent Logbook is the ledger."
5
- readme = "README.md"
6
- license = { file = "LICENSE" }
7
- requires-python = ">=3.11"
8
- authors = [{ name = "Johan Isaksson", email = "johan@izaxon.com" }]
9
- keywords = ["claude", "codex", "grok", "copilot", "logbook", "codicent"]
10
- classifiers = [
11
- "Development Status :: 3 - Alpha",
12
- "Environment :: Console",
13
- "License :: OSI Approved :: MIT License",
14
- "Programming Language :: Python :: 3",
15
- "Programming Language :: Python :: 3.11",
16
- "Programming Language :: Python :: 3.12",
17
- "Topic :: Software Development",
18
- ]
19
- dependencies = []
20
-
21
- [project.urls]
22
- Homepage = "https://izaxon.github.io/dint/"
23
- Repository = "https://github.com/izaxon/dint"
24
- Issues = "https://github.com/izaxon/dint/issues"
25
-
26
- [project.optional-dependencies]
27
- dev = ["pytest>=8.0"]
28
-
29
- [project.scripts]
30
- dint = "dint.cli:main"
31
-
32
- [build-system]
33
- requires = ["setuptools>=68"]
34
- build-backend = "setuptools.build_meta"
35
-
36
- [tool.setuptools.packages.find]
37
- where = ["src"]
38
-
39
- [tool.pytest.ini_options]
40
- pythonpath = ["src"]
41
- testpaths = ["tests"]
1
+ [project]
2
+ name = "dint-cli"
3
+ version = "0.2.0"
4
+ description = "One local chat API over Claude, Codex, Grok, and Copilot. Codicent Logbook is the ledger."
5
+ readme = "README.md"
6
+ license = { file = "LICENSE" }
7
+ requires-python = ">=3.11"
8
+ authors = [{ name = "Johan Isaksson", email = "johan@izaxon.com" }]
9
+ keywords = ["claude", "codex", "grok", "copilot", "logbook", "codicent"]
10
+ classifiers = [
11
+ "Development Status :: 3 - Alpha",
12
+ "Environment :: Console",
13
+ "License :: OSI Approved :: MIT License",
14
+ "Programming Language :: Python :: 3",
15
+ "Programming Language :: Python :: 3.11",
16
+ "Programming Language :: Python :: 3.12",
17
+ "Topic :: Software Development",
18
+ ]
19
+ dependencies = []
20
+
21
+ [project.urls]
22
+ Homepage = "https://izaxon.github.io/dint/"
23
+ Repository = "https://github.com/izaxon/dint"
24
+ Issues = "https://github.com/izaxon/dint/issues"
25
+
26
+ [project.optional-dependencies]
27
+ dev = ["pytest>=8.0"]
28
+
29
+ [project.scripts]
30
+ dint = "dint.cli:main"
31
+
32
+ [build-system]
33
+ requires = ["setuptools>=68"]
34
+ build-backend = "setuptools.build_meta"
35
+
36
+ [tool.setuptools.packages.find]
37
+ where = ["src"]
38
+
39
+ [tool.pytest.ini_options]
40
+ pythonpath = ["src"]
41
+ testpaths = ["tests"]
@@ -0,0 +1,8 @@
1
+ """dint — one local chat API over Claude, Codex, Grok, and Copilot."""
2
+
3
+ __version__ = "0.2.0"
4
+
5
+ from dint.router import Router # noqa: E402
6
+ from dint.types import Chat, Event # noqa: E402
7
+
8
+ __all__ = ["Chat", "Event", "Router"]