deskc 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.
- deskc-0.1.0/.gitignore +42 -0
- deskc-0.1.0/CHANGELOG.md +12 -0
- deskc-0.1.0/LICENSE +21 -0
- deskc-0.1.0/PKG-INFO +132 -0
- deskc-0.1.0/README.md +101 -0
- deskc-0.1.0/pyproject.toml +113 -0
- deskc-0.1.0/src/deskc/__init__.py +3 -0
- deskc-0.1.0/src/deskc/cli.py +32 -0
- deskc-0.1.0/src/deskc/mcp_server.py +102 -0
- deskc-0.1.0/src/deskc/py.typed +0 -0
- deskc-0.1.0/src/deskc/server.py +161 -0
- deskc-0.1.0/src/deskc/static/index.html +384 -0
- deskc-0.1.0/src/deskc/store.py +256 -0
- deskc-0.1.0/tests/test_import.py +5 -0
- deskc-0.1.0/tests/test_mcp.py +48 -0
- deskc-0.1.0/tests/test_server.py +42 -0
- deskc-0.1.0/tests/test_store.py +77 -0
deskc-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.eggs/
|
|
6
|
+
|
|
7
|
+
# Build artifacts
|
|
8
|
+
/dist/
|
|
9
|
+
/build/
|
|
10
|
+
/site/
|
|
11
|
+
/public/
|
|
12
|
+
|
|
13
|
+
# uv / venv
|
|
14
|
+
.venv/
|
|
15
|
+
uv.lock.bak
|
|
16
|
+
|
|
17
|
+
# Tool caches
|
|
18
|
+
.pytest_cache/
|
|
19
|
+
.ruff_cache/
|
|
20
|
+
.pyright/
|
|
21
|
+
.mypy_cache/
|
|
22
|
+
.moon/cache/
|
|
23
|
+
|
|
24
|
+
# Editor
|
|
25
|
+
.vscode/
|
|
26
|
+
.idea/
|
|
27
|
+
*.swp
|
|
28
|
+
|
|
29
|
+
# Local session logs
|
|
30
|
+
logs/
|
|
31
|
+
|
|
32
|
+
# Personal, machine-specific agent overrides (AGENTS.md is tracked)
|
|
33
|
+
AGENTS.local.md
|
|
34
|
+
CLAUDE.local.md
|
|
35
|
+
|
|
36
|
+
# Claude Code: per-machine local settings + worktrees are local; .claude/settings.json IS tracked.
|
|
37
|
+
.claude/settings.local.json
|
|
38
|
+
.claude/worktrees/
|
|
39
|
+
|
|
40
|
+
# Local agent wiring: names cabildo-issues-mcp, which is not a dependency of this
|
|
41
|
+
# package. docs/issues/ IS tracked — the register is plain markdown anyone can read.
|
|
42
|
+
.mcp.json
|
deskc-0.1.0/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Initial release.
|
deskc-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jorge Cardona
|
|
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.
|
deskc-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: deskc
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local live board where an agent proposes design options and documents and people choose and move them
|
|
5
|
+
Project-URL: Homepage, https://gitlab.com/cardona-oss/deskc
|
|
6
|
+
Project-URL: Repository, https://gitlab.com/cardona-oss/deskc
|
|
7
|
+
Project-URL: Documentation, https://cardona-oss.gitlab.io/deskc/
|
|
8
|
+
Project-URL: Changelog, https://gitlab.com/cardona-oss/deskc/-/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Issues, https://gitlab.com/cardona-oss/deskc/-/issues
|
|
10
|
+
Author-email: Jorge Cardona <jorgeecardona@gmail.com>
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: agent,canvas,design,live,mcp,whiteboard
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Python: >=3.12
|
|
22
|
+
Requires-Dist: markdown>=3.6
|
|
23
|
+
Requires-Dist: mcp<3,>=2
|
|
24
|
+
Requires-Dist: pyyaml>=6
|
|
25
|
+
Provides-Extra: docs
|
|
26
|
+
Requires-Dist: mkdocs-llmstxt>=0.5; extra == 'docs'
|
|
27
|
+
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
|
|
28
|
+
Requires-Dist: mkdocs>=1.6; extra == 'docs'
|
|
29
|
+
Requires-Dist: mkdocstrings[python]>=0.27; extra == 'docs'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
<h1 align="center">deskc</h1>
|
|
33
|
+
|
|
34
|
+
<p align="center"><strong>Open a local board, ask your agent for design options, then choose and move them yourself.</strong></p>
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
<a href="https://pypi.org/project/deskc/"><img alt="PyPI" src="https://img.shields.io/pypi/v/deskc?style=flat-square"></a>
|
|
38
|
+
<a href="https://pypi.org/project/deskc/"><img alt="Python versions" src="https://img.shields.io/pypi/pyversions/deskc?style=flat-square"></a>
|
|
39
|
+
<a href="https://cardona-oss.gitlab.io/deskc/"><img alt="Docs" src="https://img.shields.io/badge/docs-cardona--oss.gitlab.io%2Fdeskc-blue?style=flat-square"></a>
|
|
40
|
+
<a href="https://gitlab.com/cardona-oss/deskc/-/pipelines"><img alt="Pipeline" src="https://img.shields.io/gitlab/pipeline-status/cardona-oss%2Fdeskc?branch=main&style=flat-square"></a>
|
|
41
|
+
<a href="https://gitlab.com/cardona-oss/deskc/-/blob/main/LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-blue?style=flat-square"></a>
|
|
42
|
+
</p>
|
|
43
|
+
|
|
44
|
+
<p align="center">
|
|
45
|
+
<a href="https://cardona-oss.gitlab.io/deskc/">Docs</a> ·
|
|
46
|
+
<a href="https://gitlab.com/cardona-oss/deskc/-/blob/main/CHANGELOG.md">Changelog</a>
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Overview
|
|
52
|
+
|
|
53
|
+
deskc shows design options and documents on one canvas in your browser. The files are the source of
|
|
54
|
+
truth: an agent writes them (through an MCP server or by editing files), and every open page
|
|
55
|
+
updates at once. You drag cards, zoom, and pick an option. Your pick is saved in the file.
|
|
56
|
+
|
|
57
|
+
Use it to compare alternative pages or visual designs side by side while an agent works.
|
|
58
|
+
|
|
59
|
+
Status: alpha. Design options and markdown documents work. Sheets and decks are not built.
|
|
60
|
+
|
|
61
|
+
## Install
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
uv tool install deskc
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Python 3.12 or later. Linux, macOS, Windows (not tested on the last two).
|
|
68
|
+
|
|
69
|
+
## Quickstart
|
|
70
|
+
|
|
71
|
+
1. From a clone of this repo, copy the sample into a folder and serve it:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
cp -r examples/product ./product
|
|
75
|
+
deskc serve
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
2. Open http://127.0.0.1:8765. Drag a card by its header. Double-click a page to interact with it.
|
|
79
|
+
3. Give your agent the MCP server. Put this in `.mcp.json`:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{"mcpServers": {"deskc": {"command": "deskc", "args": ["mcp"]}}}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
4. Ask the agent for a new option. It calls `propose_option` and the card appears on the page.
|
|
86
|
+
|
|
87
|
+
## Files
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
product/designs/<design>.yaml view, title, chosen, options (id, file, note, state, x, y)
|
|
91
|
+
product/designs/<design>/<id>.html one full HTML page per option
|
|
92
|
+
product/docs/<document>.md markdown, optional front matter: title, x, y
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`--root DIR` sets the folder that holds `product/` (default: the current folder).
|
|
96
|
+
|
|
97
|
+
## Agent tools
|
|
98
|
+
|
|
99
|
+
- `list_artifacts`: the designs, their options and the documents.
|
|
100
|
+
- `get_choices`: what a person chose, and the state of every option.
|
|
101
|
+
- `propose_option`: add or replace one option as a full HTML page.
|
|
102
|
+
- `read_document`, `write_document`: markdown documents.
|
|
103
|
+
|
|
104
|
+
There is no tool to choose an option. Only a person chooses.
|
|
105
|
+
|
|
106
|
+
## Key features
|
|
107
|
+
|
|
108
|
+
- Live updates: a changed file reaches every open page in under half a second.
|
|
109
|
+
- Live cursors and drags between people on the same server.
|
|
110
|
+
- Pan, zoom, fit, and a sandboxed frame for each page.
|
|
111
|
+
- Writes are atomic and names are checked, so an agent cannot write outside `product/`.
|
|
112
|
+
|
|
113
|
+
## Limits
|
|
114
|
+
|
|
115
|
+
- One server on `127.0.0.1`. Remote collaborators need a tunnel. There is no login.
|
|
116
|
+
- Saving a design rewrites its YAML file and drops its comments.
|
|
117
|
+
- Last write wins. No undo.
|
|
118
|
+
- Many live pages on screen at a low zoom can be slow.
|
|
119
|
+
|
|
120
|
+
## Links
|
|
121
|
+
|
|
122
|
+
- Docs: https://cardona-oss.gitlab.io/deskc/
|
|
123
|
+
- Source: https://gitlab.com/cardona-oss/deskc
|
|
124
|
+
- Changelog: https://gitlab.com/cardona-oss/deskc/-/blob/main/CHANGELOG.md
|
|
125
|
+
|
|
126
|
+
## Contributing
|
|
127
|
+
|
|
128
|
+
`uv sync && make install-hooks`, then `make check`. See [CONTRIBUTING.md](https://gitlab.com/cardona-oss/deskc/-/blob/main/CONTRIBUTING.md).
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
MIT © 2026 Jorge Cardona (see [LICENSE](https://gitlab.com/cardona-oss/deskc/-/blob/main/LICENSE)).
|
deskc-0.1.0/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<h1 align="center">deskc</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center"><strong>Open a local board, ask your agent for design options, then choose and move them yourself.</strong></p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://pypi.org/project/deskc/"><img alt="PyPI" src="https://img.shields.io/pypi/v/deskc?style=flat-square"></a>
|
|
7
|
+
<a href="https://pypi.org/project/deskc/"><img alt="Python versions" src="https://img.shields.io/pypi/pyversions/deskc?style=flat-square"></a>
|
|
8
|
+
<a href="https://cardona-oss.gitlab.io/deskc/"><img alt="Docs" src="https://img.shields.io/badge/docs-cardona--oss.gitlab.io%2Fdeskc-blue?style=flat-square"></a>
|
|
9
|
+
<a href="https://gitlab.com/cardona-oss/deskc/-/pipelines"><img alt="Pipeline" src="https://img.shields.io/gitlab/pipeline-status/cardona-oss%2Fdeskc?branch=main&style=flat-square"></a>
|
|
10
|
+
<a href="https://gitlab.com/cardona-oss/deskc/-/blob/main/LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-blue?style=flat-square"></a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<a href="https://cardona-oss.gitlab.io/deskc/">Docs</a> ·
|
|
15
|
+
<a href="https://gitlab.com/cardona-oss/deskc/-/blob/main/CHANGELOG.md">Changelog</a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Overview
|
|
21
|
+
|
|
22
|
+
deskc shows design options and documents on one canvas in your browser. The files are the source of
|
|
23
|
+
truth: an agent writes them (through an MCP server or by editing files), and every open page
|
|
24
|
+
updates at once. You drag cards, zoom, and pick an option. Your pick is saved in the file.
|
|
25
|
+
|
|
26
|
+
Use it to compare alternative pages or visual designs side by side while an agent works.
|
|
27
|
+
|
|
28
|
+
Status: alpha. Design options and markdown documents work. Sheets and decks are not built.
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
uv tool install deskc
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Python 3.12 or later. Linux, macOS, Windows (not tested on the last two).
|
|
37
|
+
|
|
38
|
+
## Quickstart
|
|
39
|
+
|
|
40
|
+
1. From a clone of this repo, copy the sample into a folder and serve it:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
cp -r examples/product ./product
|
|
44
|
+
deskc serve
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
2. Open http://127.0.0.1:8765. Drag a card by its header. Double-click a page to interact with it.
|
|
48
|
+
3. Give your agent the MCP server. Put this in `.mcp.json`:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{"mcpServers": {"deskc": {"command": "deskc", "args": ["mcp"]}}}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
4. Ask the agent for a new option. It calls `propose_option` and the card appears on the page.
|
|
55
|
+
|
|
56
|
+
## Files
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
product/designs/<design>.yaml view, title, chosen, options (id, file, note, state, x, y)
|
|
60
|
+
product/designs/<design>/<id>.html one full HTML page per option
|
|
61
|
+
product/docs/<document>.md markdown, optional front matter: title, x, y
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`--root DIR` sets the folder that holds `product/` (default: the current folder).
|
|
65
|
+
|
|
66
|
+
## Agent tools
|
|
67
|
+
|
|
68
|
+
- `list_artifacts`: the designs, their options and the documents.
|
|
69
|
+
- `get_choices`: what a person chose, and the state of every option.
|
|
70
|
+
- `propose_option`: add or replace one option as a full HTML page.
|
|
71
|
+
- `read_document`, `write_document`: markdown documents.
|
|
72
|
+
|
|
73
|
+
There is no tool to choose an option. Only a person chooses.
|
|
74
|
+
|
|
75
|
+
## Key features
|
|
76
|
+
|
|
77
|
+
- Live updates: a changed file reaches every open page in under half a second.
|
|
78
|
+
- Live cursors and drags between people on the same server.
|
|
79
|
+
- Pan, zoom, fit, and a sandboxed frame for each page.
|
|
80
|
+
- Writes are atomic and names are checked, so an agent cannot write outside `product/`.
|
|
81
|
+
|
|
82
|
+
## Limits
|
|
83
|
+
|
|
84
|
+
- One server on `127.0.0.1`. Remote collaborators need a tunnel. There is no login.
|
|
85
|
+
- Saving a design rewrites its YAML file and drops its comments.
|
|
86
|
+
- Last write wins. No undo.
|
|
87
|
+
- Many live pages on screen at a low zoom can be slow.
|
|
88
|
+
|
|
89
|
+
## Links
|
|
90
|
+
|
|
91
|
+
- Docs: https://cardona-oss.gitlab.io/deskc/
|
|
92
|
+
- Source: https://gitlab.com/cardona-oss/deskc
|
|
93
|
+
- Changelog: https://gitlab.com/cardona-oss/deskc/-/blob/main/CHANGELOG.md
|
|
94
|
+
|
|
95
|
+
## Contributing
|
|
96
|
+
|
|
97
|
+
`uv sync && make install-hooks`, then `make check`. See [CONTRIBUTING.md](https://gitlab.com/cardona-oss/deskc/-/blob/main/CONTRIBUTING.md).
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
MIT © 2026 Jorge Cardona (see [LICENSE](https://gitlab.com/cardona-oss/deskc/-/blob/main/LICENSE)).
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "deskc"
|
|
3
|
+
dynamic = ["version"] # the single source of truth is __version__ in src/deskc/__init__.py (see [tool.hatch.version])
|
|
4
|
+
description = "Local live board where an agent proposes design options and documents and people choose and move them"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
authors = [{ name = "Jorge Cardona", email = "jorgeecardona@gmail.com" }]
|
|
10
|
+
keywords = ["design", "whiteboard", "mcp", "agent", "canvas", "live"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 3 - Alpha",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3.12",
|
|
16
|
+
"Programming Language :: Python :: 3.13",
|
|
17
|
+
"Topic :: Software Development :: User Interfaces",
|
|
18
|
+
"Typing :: Typed",
|
|
19
|
+
]
|
|
20
|
+
dependencies = ["pyyaml>=6", "markdown>=3.6", "mcp>=2,<3"]
|
|
21
|
+
|
|
22
|
+
[project.scripts]
|
|
23
|
+
deskc = "deskc.cli:main"
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
# docs are an *extra* (not a uv dependency-group) so Read the Docs can install them via pip
|
|
27
|
+
docs = [
|
|
28
|
+
"mkdocs>=1.6",
|
|
29
|
+
"mkdocs-material>=9.5",
|
|
30
|
+
"mkdocstrings[python]>=0.27",
|
|
31
|
+
"mkdocs-llmstxt>=0.5",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://gitlab.com/cardona-oss/deskc"
|
|
36
|
+
Repository = "https://gitlab.com/cardona-oss/deskc"
|
|
37
|
+
Documentation = "https://cardona-oss.gitlab.io/deskc/"
|
|
38
|
+
Changelog = "https://gitlab.com/cardona-oss/deskc/-/blob/main/CHANGELOG.md"
|
|
39
|
+
Issues = "https://gitlab.com/cardona-oss/deskc/-/issues"
|
|
40
|
+
|
|
41
|
+
[build-system]
|
|
42
|
+
requires = ["hatchling"]
|
|
43
|
+
build-backend = "hatchling.build"
|
|
44
|
+
|
|
45
|
+
[tool.hatch.version]
|
|
46
|
+
# The version lives as __version__ in the package itself; hatchling reads it (by regex, no import) so
|
|
47
|
+
# pyproject and the runtime never disagree. scripts/bump-version rewrites that literal.
|
|
48
|
+
path = "src/deskc/__init__.py"
|
|
49
|
+
|
|
50
|
+
[tool.hatch.build.targets.wheel]
|
|
51
|
+
packages = ["src/deskc"]
|
|
52
|
+
|
|
53
|
+
[tool.hatch.build.targets.sdist]
|
|
54
|
+
include = ["src", "tests", "README.md", "CHANGELOG.md", "LICENSE"]
|
|
55
|
+
|
|
56
|
+
[tool.uv]
|
|
57
|
+
# The version is dynamic (hatchling reads __version__ from the file below), so uv must watch it too:
|
|
58
|
+
# declaring cache-keys REPLACES uv's defaults, so pyproject.toml is listed explicitly alongside it.
|
|
59
|
+
# Without __init__.py here, bumping the version would not trigger an editable reinstall.
|
|
60
|
+
cache-keys = [{ file = "pyproject.toml" }, { file = "src/deskc/__init__.py" }]
|
|
61
|
+
|
|
62
|
+
[dependency-groups]
|
|
63
|
+
dev = ["ruff>=0.6", "pyright[nodejs]>=1.1.390", "pytest>=8", "prodc>=0.11.4,<0.12"]
|
|
64
|
+
|
|
65
|
+
[tool.pytest.ini_options]
|
|
66
|
+
testpaths = ["tests"]
|
|
67
|
+
addopts = "-q"
|
|
68
|
+
|
|
69
|
+
[tool.ruff]
|
|
70
|
+
line-length = 100
|
|
71
|
+
target-version = "py312"
|
|
72
|
+
src = ["src", "tests"]
|
|
73
|
+
|
|
74
|
+
[tool.ruff.lint]
|
|
75
|
+
select = ["ALL"]
|
|
76
|
+
# The canonical base ignore list shared across the oss/ libraries. E501 (line length) is handled by
|
|
77
|
+
# the formatter; COM812/ISC001 conflict with the formatter; D1/D401 relax docstring presence/mood;
|
|
78
|
+
# TRY003/EM101/EM102 allow inline exception messages; CPY001 drops the copyright-header demand;
|
|
79
|
+
# PLC0415 allows non-top-level imports; TC001/TC002/TC003 don't force type-only import blocks.
|
|
80
|
+
ignore = [
|
|
81
|
+
"E501",
|
|
82
|
+
"COM812",
|
|
83
|
+
"ISC001",
|
|
84
|
+
"D1",
|
|
85
|
+
"D401",
|
|
86
|
+
"TRY003",
|
|
87
|
+
"EM101",
|
|
88
|
+
"EM102",
|
|
89
|
+
"CPY001",
|
|
90
|
+
"PLC0415",
|
|
91
|
+
"TC001",
|
|
92
|
+
"TC002",
|
|
93
|
+
"TC003",
|
|
94
|
+
]
|
|
95
|
+
|
|
96
|
+
[tool.ruff.lint.pydocstyle]
|
|
97
|
+
convention = "pep257"
|
|
98
|
+
|
|
99
|
+
[tool.ruff.lint.per-file-ignores]
|
|
100
|
+
# Tests may assert (S101), use magic values (PLR2004), take unused fixtures (ARG), pass Any to typed
|
|
101
|
+
# calls (ANN401), and group assertions pytest would otherwise split (PT018).
|
|
102
|
+
"tests/**/*.py" = ["S101", "PLR2004", "ARG", "ANN401", "PT018"]
|
|
103
|
+
|
|
104
|
+
[tool.ruff.lint.isort]
|
|
105
|
+
known-first-party = ["deskc"]
|
|
106
|
+
|
|
107
|
+
[tool.pyright]
|
|
108
|
+
include = ["src", "tests"]
|
|
109
|
+
extraPaths = ["src"]
|
|
110
|
+
pythonVersion = "3.12"
|
|
111
|
+
typeCheckingMode = "strict"
|
|
112
|
+
venvPath = "."
|
|
113
|
+
venv = ".venv"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""The ``deskc`` command: ``deskc serve`` (the board page) and ``deskc mcp`` (the agent's tools)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import os
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def main(argv: list[str] | None = None) -> None:
|
|
11
|
+
"""Run a ``deskc`` subcommand."""
|
|
12
|
+
parser = argparse.ArgumentParser(prog="deskc", description=__doc__)
|
|
13
|
+
parser.add_argument(
|
|
14
|
+
"--root", type=Path, default=None, help="folder that holds product/ (default: cwd)"
|
|
15
|
+
)
|
|
16
|
+
sub = parser.add_subparsers(dest="command", required=True)
|
|
17
|
+
serve = sub.add_parser("serve", help="serve the board in a browser")
|
|
18
|
+
serve.add_argument("--port", type=int, default=8765)
|
|
19
|
+
sub.add_parser("mcp", help="serve the agent's tools over MCP (stdio)")
|
|
20
|
+
args = parser.parse_args(argv)
|
|
21
|
+
|
|
22
|
+
# The store reads its root when it is first imported, so set it before the import below.
|
|
23
|
+
if args.root is not None:
|
|
24
|
+
os.environ["DESKC_ROOT"] = str(args.root.resolve())
|
|
25
|
+
if args.command == "serve":
|
|
26
|
+
from deskc.server import serve as run_server
|
|
27
|
+
|
|
28
|
+
run_server(args.port)
|
|
29
|
+
else:
|
|
30
|
+
from deskc.mcp_server import run
|
|
31
|
+
|
|
32
|
+
run()
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"""MCP server for the demo board: the agent's tools on the same files the page shows.
|
|
2
|
+
|
|
3
|
+
Run on stdio: ``deskc mcp``. The web server (``deskc serve``) watches the files, so
|
|
4
|
+
everything written here appears on every open page at once.
|
|
5
|
+
|
|
6
|
+
The agent proposes options and writes documents. It never chooses an option: that is the
|
|
7
|
+
person's decision, and ``choose`` is not a tool here.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from collections.abc import Generator
|
|
13
|
+
from contextlib import contextmanager
|
|
14
|
+
from dataclasses import asdict
|
|
15
|
+
from typing import Any
|
|
16
|
+
|
|
17
|
+
from mcp.server.mcpserver import MCPServer
|
|
18
|
+
from mcp.server.mcpserver.exceptions import ToolError
|
|
19
|
+
from mcp.types import ToolAnnotations
|
|
20
|
+
|
|
21
|
+
from deskc import store
|
|
22
|
+
|
|
23
|
+
INSTRUCTIONS = """\
|
|
24
|
+
A shared board of design options and documents. People watch it live in a browser.
|
|
25
|
+
- Propose design options as complete HTML pages (inline CSS, no external files). Give each
|
|
26
|
+
option a short note that says what is different from the others.
|
|
27
|
+
- Write documents as markdown. Start with a '# Title' line.
|
|
28
|
+
- Read get_choices before you change a design: a person may have chosen or rejected options.
|
|
29
|
+
- Never ask to choose an option for the person. You cannot.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
_READ = ToolAnnotations(read_only_hint=True, open_world_hint=False)
|
|
33
|
+
_WRITE = ToolAnnotations(read_only_hint=False, destructive_hint=False, open_world_hint=False)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@contextmanager
|
|
37
|
+
def refuse_bad_input() -> Generator[None]:
|
|
38
|
+
"""Turn a store error into a tool error, so the agent reads the reason."""
|
|
39
|
+
try:
|
|
40
|
+
yield
|
|
41
|
+
except (ValueError, KeyError, FileNotFoundError) as exc:
|
|
42
|
+
raise ToolError(str(exc) or exc.__class__.__name__) from exc
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
server = MCPServer("design-demo", version="0.0.0", instructions=INSTRUCTIONS)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@server.tool(annotations=_READ)
|
|
49
|
+
def list_artifacts() -> dict[str, Any]:
|
|
50
|
+
"""The designs (with their options) and the documents on the board."""
|
|
51
|
+
return {
|
|
52
|
+
"designs": [asdict(d) for d in store.load_designs()],
|
|
53
|
+
"documents": [asdict(d) for d in store.load_documents()],
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@server.tool(annotations=_READ)
|
|
58
|
+
def get_choices() -> list[dict[str, Any]]:
|
|
59
|
+
"""For each design: the option a person chose (or None) and the state of every option."""
|
|
60
|
+
return [
|
|
61
|
+
{"design": d.slug, "chosen": d.chosen, "states": {o.id: o.state for o in d.options}}
|
|
62
|
+
for d in store.load_designs()
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@server.tool(annotations=_READ)
|
|
67
|
+
def read_document(slug: str) -> str:
|
|
68
|
+
"""The markdown of one document."""
|
|
69
|
+
with refuse_bad_input():
|
|
70
|
+
return store.read_document(slug)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@server.tool(annotations=_WRITE)
|
|
74
|
+
def write_document(slug: str, markdown: str, title: str | None = None) -> str:
|
|
75
|
+
"""Create or replace a document. Its place on the canvas is kept."""
|
|
76
|
+
with refuse_bad_input():
|
|
77
|
+
store.write_document(slug, markdown, title)
|
|
78
|
+
return f"wrote document {slug}"
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
@server.tool(annotations=_WRITE)
|
|
82
|
+
def propose_option( # noqa: PLR0913, PLR0917 (the tool's arguments)
|
|
83
|
+
design: str,
|
|
84
|
+
option_id: str,
|
|
85
|
+
html: str,
|
|
86
|
+
note: str,
|
|
87
|
+
serves: list[str] | None = None,
|
|
88
|
+
view: str | None = None,
|
|
89
|
+
title: str | None = None,
|
|
90
|
+
) -> str:
|
|
91
|
+
"""Add or replace one design option as a full HTML page.
|
|
92
|
+
|
|
93
|
+
Pass ``view`` (for example ``web:/sales/invoices``) and ``title`` to create a new design.
|
|
94
|
+
"""
|
|
95
|
+
with refuse_bad_input():
|
|
96
|
+
store.propose_option(design, option_id, html, note, tuple(serves or ()), view, title)
|
|
97
|
+
return f"wrote option {option_id} of design {design}"
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def run() -> None:
|
|
101
|
+
"""Serve the tools on stdio."""
|
|
102
|
+
server.run("stdio")
|
|
File without changes
|