dsh-monkeyai-sessions 0.0.0-stage → 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +83 -2
- package/assets/icon.svg +11 -0
- package/client.js +1887 -0
- package/cordis.patch.yml +3 -0
- package/lib/client-runtime.cjs +1878 -0
- package/package.json +75 -4
- package/scripts/build-client.mjs +41 -0
- package/src/client/index.js +1183 -0
- package/src/host/monkeyai-remote.js +1364 -0
- package/src/index.js +19 -0
- package/src/remote.js +230 -0
- package/src/shared/acp-json-rpc.mjs +231 -0
- package/src/shared/async-queue.mjs +116 -0
- package/src/shared/http-json.mjs +104 -0
- package/src/shared/oauth-pkce.mjs +152 -0
- package/src/shared/projection.mjs +149 -0
- package/src/shared/remote-info-lite.mjs +65 -0
- package/src/typert.js +11 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Artenx
|
|
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.
|
package/README.md
CHANGED
|
@@ -1,3 +1,84 @@
|
|
|
1
|
-
#
|
|
1
|
+
# DSH MonkeyAI Sessions
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Read and continue your MonkeyAI conversations inside DeepSeek Harness.
|
|
4
|
+
|
|
5
|
+
Browse the sessions on your MonkeyAI devices, open one to read its full conversation history, and send new instructions to carry on the work you started in the MonkeyAI client — no copy-pasting context, no restarting the task. Replies stream back live, and you can stop a running turn or switch models without leaving DSH.
|
|
6
|
+
|
|
7
|
+
Authorization uses the MonkeyAI OAuth authorization-code flow with PKCE; DSH stores the resulting grant in its credential store.
|
|
8
|
+
|
|
9
|
+
## Development
|
|
10
|
+
|
|
11
|
+
The plugin targets DSH `v0.2.2-rc.1` and Node.js `>=24.9.0`.
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm test
|
|
15
|
+
npm run build
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`npm test` builds the Client bundle before running tests. The build generates `client.js` and `lib/client-runtime.cjs`; both artifacts are distributed with the package.
|
|
19
|
+
Tests load the generated Client bundle, validate unary and duplex stream descriptors, check the `main` and `sidebar.panellist` registrations, verify stream and Remote cleanup on unload, and test PKCE state/challenge construction.
|
|
20
|
+
Host-service and Host-stream tests use credential-store, fetch, and WebSocket fakes to cover authorization exchange, device/session scoping, connection tickets, history and live frames, prompt delivery, connection loss, permission revocation, and read-only rejection.
|
|
21
|
+
|
|
22
|
+
The Host registers invocation descriptors through `ctx.typert`. The Client mounts the package's Remote contribution with `$mount()`. Shared Remote metadata uses the protocol package's `remote-info` entry, which has no Cordis runtime import.
|
|
23
|
+
The Client bundle inlines a spec-compatible copy of that factory (`src/shared/remote-info-lite.mjs`): DSH materializes only the modules listed in `dsh.client.inject`, and the protocol package's subpath entries are not seed words there.
|
|
24
|
+
|
|
25
|
+
## Authorization
|
|
26
|
+
|
|
27
|
+
The panel uses DSH's light theme for a consistent, simple look. The layout is state-driven: an unconnected panel shows a single connect card (server origin plus one primary button, with the paste-callback mode collapsed), a connected panel shows a compact toolbar (account, device, one Refresh action that loads devices and sessions together, disconnect) above the session cards, and an open session focuses the conversation with a compact header (back button, title, model switcher), an approval card with plain option buttons instead of raw JSON, and an Enter-to-send composer. Secondary actions (adding a device by machine ID, creating a new session) stay collapsed in details sections.
|
|
28
|
+
The device list reads the account-wide endpoint directory (`GET /api/v1/endpoints`, no runtime-API header) so every registered device appears, marking `online` from the boolean field and skipping revoked entries. Selecting a device loads its sessions automatically. Headless runtime devices that register through the separate device-code grant may not appear in that directory; for those, add a device manually by machine ID ("Device missing?..." section in the panel) - the entry is kept in browser storage and merged into the device selector.
|
|
29
|
+
|
|
30
|
+
Three ways to connect, in order of convenience:
|
|
31
|
+
|
|
32
|
+
- **Sign in (default)**: enter the MonkeyAI server origin, account email, and password in the panel. The Host performs the whole OAuth exchange server-side — it logs in, opens an authorization request, approves it, and exchanges the returned code — so nothing has to come back from the browser. This is the only mode that works when the browser runs on a phone or any machine other than the DSH Host. The password is used for those requests only and is never stored; the panel clears the field on success.
|
|
33
|
+
- **Browser authorization (loopback)**: the Host listens on `127.0.0.1` with a random port and the MonkeyAI server redirects to `http://127.0.0.1:<port>/oauth/callback`. When the browser shares the Host's machine the callback page posts the code back to the panel and the grant completes with no copy-paste. A remote browser cannot reach that loopback address, so use sign-in instead.
|
|
34
|
+
- **Paste callback (scheme)**: the original `monkeyai-desktop://oauth/callback` redirect for environments where loopback is rejected.
|
|
35
|
+
|
|
36
|
+
All three request `device:connect`, `session:read`, and `session:control` through the registered `monkeyai-desktop` public client. OAuth state and the PKCE verifier stay in the DSH Host process.
|
|
37
|
+
|
|
38
|
+
## Sessions
|
|
39
|
+
|
|
40
|
+
Full conversation history is loaded over the runtime's HTTP read channel (`POST {http_base}/read/session` with `_monkeyai/session/messages`, paginated by cursor) instead of the bounded ACP `session/load` replay, so long sessions show every turn including the latest replies. While a turn is running the composer shows a stop button that sends `session/cancel`; the model switcher uses `_monkeyai/session/model/set` on the live session connection. Assistant messages render lightweight markdown (code blocks, inline code, bold, headings, lists).
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
From npm, once published:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
dsh plugin --profile web add dsh-monkeyai-sessions
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
From the plugin market index: enable **Custom plugin indexes** under Plugins → Experimental plugins, open **Discover**, and add this index source:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
https://artenx.github.io/dsh-monkeyai-sessions/index.json
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
From a checkout:
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
npm install
|
|
60
|
+
npm run build
|
|
61
|
+
npm pack
|
|
62
|
+
dsh plugin --profile web add ./dsh-monkeyai-sessions-0.1.0.tgz
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Verified against a real DSH `0.2.2-rc.1` web profile and a live MonkeyAI runtime: authorization, full history loading, prompt delivery, model switching, and turn cancellation all work end to end.
|
|
66
|
+
|
|
67
|
+
## Publishing
|
|
68
|
+
|
|
69
|
+
The package declares a DSH bundle (`dsh.bundle.patch`), a web Client (`dsh.client`), and `engines.dsh`. Host-provided modules resolve through the running DSH installation, so the only peer dependency is `@deepseek-ai/cordis`.
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
# Build the Client bundle and the market index
|
|
73
|
+
npm run build
|
|
74
|
+
npm run build:market
|
|
75
|
+
|
|
76
|
+
# Publish the package (requires an npm account with publish rights)
|
|
77
|
+
npm publish --access public
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`scripts/build-market-index.mjs` reads published versions and their publish times from the npm registry, falling back to the current `package.json` version before the first release. The resulting `market/index.json` follows plugin market index format 1 and is deployed to GitHub Pages by `.github/workflows/market-index.yml`. Set `MARKET_INDEX_URL` to override the printed index address.
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
MIT
|
package/assets/icon.svg
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="64" height="64">
|
|
2
|
+
<circle cx="7" cy="9.5" r="3.2" fill="#8b5e3c"/>
|
|
3
|
+
<circle cx="17" cy="9.5" r="3.2" fill="#8b5e3c"/>
|
|
4
|
+
<circle cx="7" cy="9.5" r="1.6" fill="#e8c9a8"/>
|
|
5
|
+
<circle cx="17" cy="9.5" r="1.6" fill="#e8c9a8"/>
|
|
6
|
+
<circle cx="12" cy="12" r="7.5" fill="#a06b42"/>
|
|
7
|
+
<path d="M6.8 12.2c0-2.6 2.3-4.4 5.2-4.4s5.2 1.8 5.2 4.4c0 3.2-2.3 5.6-5.2 5.6s-5.2-2.4-5.2-5.6z" fill="#f3ddc4"/>
|
|
8
|
+
<circle cx="9.7" cy="11.6" r="1.05" fill="#3d2b1c"/>
|
|
9
|
+
<circle cx="14.3" cy="11.6" r="1.05" fill="#3d2b1c"/>
|
|
10
|
+
<path d="M9.8 14.9c.6.7 1.4 1 2.2 1s1.6-.3 2.2-1" stroke="#3d2b1c" stroke-width="1.1" stroke-linecap="round" fill="none"/>
|
|
11
|
+
</svg>
|