@deep-podder/dsh-remote-mobile 0.0.0-stage → 0.0.5
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/PROTOCOL.md +627 -0
- package/README.md +313 -2
- package/SECURITY.md +207 -0
- package/auth.js +290 -0
- package/bridge.js +3167 -0
- package/client.js +687 -0
- package/cordis.patch.yml +7 -0
- package/docs/api-notes-v2.md +978 -0
- package/docs/api-notes.md +583 -0
- package/docs/screenshots/chat-light.png +0 -0
- package/docs/screenshots/commands-dark.png +0 -0
- package/docs/screenshots/pairing-light.png +0 -0
- package/docs/screenshots/sessions-light.png +0 -0
- package/docs/verification.md +92 -0
- package/icon.svg +14 -0
- package/index.js +108 -0
- package/locale/en.json +29 -0
- package/mobile/README.md +1281 -0
- package/mobile/app.js +10835 -0
- package/mobile/favicon.svg +6 -0
- package/mobile/icons/apple-touch-icon.png +0 -0
- package/mobile/icons/icon-192.png +0 -0
- package/mobile/icons/icon-512.png +0 -0
- package/mobile/icons/icon-maskable-512.png +0 -0
- package/mobile/index.html +377 -0
- package/mobile/manifest.webmanifest +40 -0
- package/mobile/mock-server.js +2800 -0
- package/mobile/styles.css +4698 -0
- package/mobile/sw.js +396 -0
- package/package.json +74 -4
- package/push.js +531 -0
- package/qr.js +49 -0
- package/server.js +2648 -0
- package/vendor/LICENSE +25 -0
- package/vendor/qrcode.js +2302 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Internal verification log
|
|
2
|
+
|
|
3
|
+
**Status: maintainer notes, not part of the public contract.** This file preserves the
|
|
4
|
+
manual verification evidence gathered while building v1 on the installed
|
|
5
|
+
**DeepSeek Harness 0.2.2-rc.1 Desktop profile**. Re-run the deterministic checks in
|
|
6
|
+
[README.md](../README.md) before a release and refresh this log; live probes are manual and
|
|
7
|
+
mutate the Host, so they are not CI checks.
|
|
8
|
+
|
|
9
|
+
## Host activation and pairing
|
|
10
|
+
|
|
11
|
+
- Host activation: plugin row `include:dsh-remote-mobile` active; `GET :3456/api/health` OK.
|
|
12
|
+
- Pairing: token pairing sets an `HttpOnly` cookie; replaying the token is rejected; wrong
|
|
13
|
+
PINs trip the per-IP limiter (429); unauthenticated WebSocket upgrades are refused.
|
|
14
|
+
- Desktop data: panel status endpoint returns PIN, QR SVG and ranked LAN addresses.
|
|
15
|
+
- Live session data over the phone protocol: 6 sessions listed with titles/presets, history
|
|
16
|
+
pages, 31-model catalog, preset roster, new-session creation and a real streaming prompt
|
|
17
|
+
round-trip (`assistant.start → deltas → assistant.end`).
|
|
18
|
+
- Client half: module factory executes and registers `settings.section` `remote-mobile` and
|
|
19
|
+
the `shell.overlay` desktop approval dock.
|
|
20
|
+
- Approval round-trip over the phone protocol: request reached the phone, the same request
|
|
21
|
+
appeared in the desktop pending list, approving from the phone resolved it, the pending
|
|
22
|
+
list emptied (dock closes) and the turn completed. Re-confirmed on the real phone against
|
|
23
|
+
the installed plugin (the answer is recorded as `approval.answer … accepted=true` in
|
|
24
|
+
`remote-mobile-state.json.debug.log`).
|
|
25
|
+
- Mobile SPA rendering, verified headless at 390 and 320 px in light and dark themes: the
|
|
26
|
+
cross-session notice bar occupies its own grid row (no overlap, no overflow, +N count, 44 px
|
|
27
|
+
Open target); only the owning session renders a pending card; Open switches session and
|
|
28
|
+
re-attaches approvals and questions; approval and question button rows are exactly even
|
|
29
|
+
(same 46 px height and border box); attachment thumbnails open a lightbox, and the attach
|
|
30
|
+
control is never clipped (38/38 assertions, plus all earlier suites green with zero console
|
|
31
|
+
errors).
|
|
32
|
+
- Installable PWA surface served by the live plugin: manifest parses with the expected
|
|
33
|
+
name/display/start_url, three icons (including a maskable one), `/sw.js` is returned with
|
|
34
|
+
`Service-Worker-Allowed: /`, every icon is a valid PNG, and `/share-target` redirects into
|
|
35
|
+
the app with the JSON payload.
|
|
36
|
+
- Session management over the live phone protocol: a session created with an explicit
|
|
37
|
+
working directory, renamed (empty title rejected as `bad-request`), pinned/unpinned,
|
|
38
|
+
archived/unarchived (the `session.archived` frame and the `sessions` set carry the flag; the
|
|
39
|
+
phone hides archived rows by default behind **Show archived (N)**), and a cold session
|
|
40
|
+
correctly rejects queue operations with `not-live`.
|
|
41
|
+
- Inline image prompt over the live protocol: a 16x16 red PNG uploaded from the phone was
|
|
42
|
+
answered "Red OK" with no `read_image` tool call, proving the model received the image as
|
|
43
|
+
an inline content part. The Host advertised limits (`maxImages: 4`, `maxBytes: 5 MiB`,
|
|
44
|
+
png/jpeg/webp/gif).
|
|
45
|
+
- Approval cards over the live protocol: a real sandbox-escalation approval carried
|
|
46
|
+
`argsKind: command`, `detail.kind: command` and the exact command in `argsPreview`; the
|
|
47
|
+
escalation was rejected from the phone. The same run proved per-device permission: with
|
|
48
|
+
`canApprove:false` the phone's `approval.answer` was refused with `forbidden`, the desktop
|
|
49
|
+
toggle restored it, and the desktop device list reported the flag.
|
|
50
|
+
- Batch C UI (sessions grouping, rename/pin/archive/fork, queue strip, Queue/Steer, approval
|
|
51
|
+
context, read-only device) verified with a protocol-level mock run (all frames and
|
|
52
|
+
rejections) plus static integration checks; batch B PWA/voice/notification paths are
|
|
53
|
+
covered by the static/PWA checks and the HTTP surfaces listed above.
|
|
54
|
+
- Static assets are versioned `?v=20` and served `no-store`, with the service worker cache
|
|
55
|
+
bumped in step so an installed phone cannot pin an older bundle.
|
|
56
|
+
- Command palette over the live protocol (v20): `commands.list` for a live `standard` Agent
|
|
57
|
+
returned `compact, feedback, goal, plan` with argument hints (`/goal`/`/plan` hints);
|
|
58
|
+
`/compact` compacted 4 history items (~909 tokens), `/goal` reported "No goal is currently
|
|
59
|
+
set", an unknown command was refused `forbidden`, and `commands.execute` preserved
|
|
60
|
+
arguments. `/export` and the policy-changing `/permission` are hidden from the phone (the
|
|
61
|
+
latter also by first-party definition id, so a renamed alias cannot re-expose it). The sheet
|
|
62
|
+
no longer sticks on "Loading commands…" because the SPA rebuilds the sheet body through
|
|
63
|
+
`buildSheet()` when the frame arrives; a 10-second timeout covers a lost reply.
|
|
64
|
+
- Project grouping over the live protocol (v20): every `ready`/`sessions` frame carries the
|
|
65
|
+
registered workspaces (one project with 5 accounted sessions in the test Host) and session
|
|
66
|
+
rows carry `workspaceId` (`null` for sessions created in temp directories). The SPA renders
|
|
67
|
+
one collapsible section per project plus **Ungrouped**, keeps archived sessions out of the
|
|
68
|
+
default list (explicit **Show archived (N)** control), persists collapsed projects, and
|
|
69
|
+
forces sections open while searching. `dev/ui-check.mjs` asserts all of this against
|
|
70
|
+
headless Chrome with zero console errors.
|
|
71
|
+
- Web Push hardening (v20): a subscription endpoint must be HTTPS on a known browser push
|
|
72
|
+
provider (FCM/Mozilla/WNS/Apple) or an operator-configured suffix
|
|
73
|
+
(`PA_REMOTE_MOBILE_PUSH_HOSTS`), so a paired device cannot use the Host as an HTTPS request
|
|
74
|
+
proxy; arbitrary endpoints are also dropped when a saved state file is restored. A device
|
|
75
|
+
may keep at most 4 subscriptions, `POST /api/push/test` returns counts only (never the push
|
|
76
|
+
service's response body) and is limited to 6 sends/minute per device, and
|
|
77
|
+
`POST /api/push/report` fields are collapsed to one bounded log line. `dev/push-check.mjs`
|
|
78
|
+
asserts the allowlist and the RFC 8291/VAPID wire proof.
|
|
79
|
+
- Batch C3 over the live protocol (pre-v20 history): `context.get` reported
|
|
80
|
+
`usedTokens 11214` against a `contextWindow` of 1,000,000 with `basis: "usage"` after a real
|
|
81
|
+
turn; changed-file frames and diff hunks are covered by the deterministic bridge harness
|
|
82
|
+
(`dev/changes-bridge-check.mjs`) and the transport smoke test; the live model only produced
|
|
83
|
+
a file-writing turn intermittently, so the end-to-end live probe is best-effort.
|
|
84
|
+
- App lock: the state machine (cold start locked → assertion unlocks → 5-minute grace →
|
|
85
|
+
30-second hidden relock → disable requires assertion) is executed headlessly, and the
|
|
86
|
+
WebAuthn request parameters (`platform`, `userVerification: required`, ES256/RS256) are
|
|
87
|
+
asserted by the static harness; real biometric prompts remain a device spot-check.
|
|
88
|
+
- Not verified automatically: the rendered desktop panel/dock appearance, real service
|
|
89
|
+
worker install/offline behaviour, actual microphone input, live in-app notifications and
|
|
90
|
+
Android share-sheet delivery (no browser control in the build session); the HTTP and wire
|
|
91
|
+
surfaces behind them are verified, and the device spot-checks are listed in
|
|
92
|
+
[mobile/README.md](../mobile/README.md).
|
package/icon.svg
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="Remote mobile access">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="g" x1="0" y1="0" x2="1" y2="1">
|
|
4
|
+
<stop offset="0" stop-color="#5B8DEF"/>
|
|
5
|
+
<stop offset="1" stop-color="#8B5CF6"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<rect x="4" y="4" width="56" height="56" rx="14" fill="#0F1117"/>
|
|
9
|
+
<rect x="22" y="12" width="20" height="34" rx="5" fill="none" stroke="url(#g)" stroke-width="3"/>
|
|
10
|
+
<line x1="29" y1="17" x2="35" y2="17" stroke="url(#g)" stroke-width="3" stroke-linecap="round"/>
|
|
11
|
+
<circle cx="32" cy="41" r="2.5" fill="url(#g)"/>
|
|
12
|
+
<path d="M46 38a12 12 0 0 0 0-12M52 42a19 19 0 0 0 0-20" stroke="url(#g)" stroke-width="3" stroke-linecap="round" fill="none"/>
|
|
13
|
+
<path d="M10 52h16M18 46v12" stroke="#1F2937" stroke-width="3" stroke-linecap="round"/>
|
|
14
|
+
</svg>
|
package/index.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// Host half of dsh-remote-mobile: starts the standalone phone server, wires it
|
|
2
|
+
// to the DSH runtime through bridge.js, and publishes pairing data to the
|
|
3
|
+
// desktop page so the Client half can render the QR/PIN panel.
|
|
4
|
+
import { createBridge } from './bridge.js'
|
|
5
|
+
import { RemoteMobileServer } from './server.js'
|
|
6
|
+
|
|
7
|
+
const VERSION = '0.0.5'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @param {object} ctx Cordis host context
|
|
11
|
+
* @param {{ enabled?: boolean, host?: string, port?: number }} [config]
|
|
12
|
+
*/
|
|
13
|
+
export function apply(ctx, config = {}) {
|
|
14
|
+
const log = ctx.logger ?? console
|
|
15
|
+
if (config.enabled === false) {
|
|
16
|
+
log.info?.('remote-mobile: disabled by configuration')
|
|
17
|
+
return
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// The bridge needs to know whether a phone is actually connected before it
|
|
21
|
+
// intercepts a waterfall request; if not, the desktop answerer stays in charge.
|
|
22
|
+
// The server reference is assigned synchronously below.
|
|
23
|
+
let server
|
|
24
|
+
const hasPeers = () => server !== undefined && server.peers.size > 0
|
|
25
|
+
const bridge = createBridge(ctx, {
|
|
26
|
+
log,
|
|
27
|
+
hasApprovalPeers: hasPeers,
|
|
28
|
+
hasQuestionPeers: hasPeers,
|
|
29
|
+
})
|
|
30
|
+
server = new RemoteMobileServer(ctx, config, bridge, log)
|
|
31
|
+
|
|
32
|
+
ctx.effect(() => {
|
|
33
|
+
let stopping = false
|
|
34
|
+
server.start().catch((error) => {
|
|
35
|
+
log.error?.(`remote-mobile: server failed to start: ${error instanceof Error ? error.message : String(error)}`)
|
|
36
|
+
})
|
|
37
|
+
return () => {
|
|
38
|
+
if (stopping) return
|
|
39
|
+
stopping = true
|
|
40
|
+
return server.stop()
|
|
41
|
+
}
|
|
42
|
+
}, 'remote-mobile.server')
|
|
43
|
+
|
|
44
|
+
// Same-origin routes on the DSH web server. The desktop panel uses these when
|
|
45
|
+
// cross-origin fetch is blocked (page CSP or file:// origin); the server
|
|
46
|
+
// answers them only for loopback callers with a loopback Host header.
|
|
47
|
+
//
|
|
48
|
+
// Registration waits for the `webServer` service instead of reading it once:
|
|
49
|
+
// at profile boot this row can apply before the HTTP carrier is active, and a
|
|
50
|
+
// one-shot `ctx.get('webServer')` would then silently skip the routes (the
|
|
51
|
+
// panel would show 404 on its same-origin fallback and fail to recover).
|
|
52
|
+
const routePaths = [
|
|
53
|
+
'/remote-mobile/pairing',
|
|
54
|
+
'/remote-mobile/pairing/rotate',
|
|
55
|
+
'/remote-mobile/pairing/revoke',
|
|
56
|
+
'/remote-mobile/pairing/enable',
|
|
57
|
+
'/remote-mobile/pairing/disable',
|
|
58
|
+
'/remote-mobile/pairing/pending',
|
|
59
|
+
'/remote-mobile/pairing/answer',
|
|
60
|
+
'/remote-mobile/pairing/device',
|
|
61
|
+
]
|
|
62
|
+
const registerRoutes = (scope) => {
|
|
63
|
+
const carrier = scope.webServer ?? scope.get?.('webServer')
|
|
64
|
+
if (!carrier || typeof carrier.register !== 'function') return
|
|
65
|
+
for (const path of routePaths) {
|
|
66
|
+
scope.effect(() => carrier.register({
|
|
67
|
+
kind: 'exact',
|
|
68
|
+
path,
|
|
69
|
+
handler: (req, res) => {
|
|
70
|
+
server.handlePairingRoute(req, res).catch((error) => {
|
|
71
|
+
log.warn?.(`remote-mobile: pairing route failed: ${error instanceof Error ? error.message : String(error)}`)
|
|
72
|
+
if (!res.headersSent) {
|
|
73
|
+
res.writeHead(500, { 'content-type': 'application/json; charset=utf-8' })
|
|
74
|
+
res.end('{"error":"internal"}')
|
|
75
|
+
} else {
|
|
76
|
+
res.destroy()
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
},
|
|
80
|
+
}), `remote-mobile.route:${path}`)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (typeof ctx.inject === 'function') {
|
|
84
|
+
ctx.inject(['webServer'], registerRoutes)
|
|
85
|
+
} else {
|
|
86
|
+
registerRoutes(ctx)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Same-origin bootstrap for the desktop Client half. The web server renders
|
|
90
|
+
// index injections per authenticated page, so the page's own session gates
|
|
91
|
+
// access; owner-only keeps liveshare viewers out.
|
|
92
|
+
ctx.effect(() => ctx.on('webserver/index-inject', (table, peer) => {
|
|
93
|
+
const kind = peer && peer.principal ? peer.principal.kind : 'owner'
|
|
94
|
+
if (kind !== 'owner') return
|
|
95
|
+
if (!Array.isArray(table)) return
|
|
96
|
+
table.push({
|
|
97
|
+
kind: 'global',
|
|
98
|
+
name: '__DSH_REMOTE_MOBILE__',
|
|
99
|
+
value: {
|
|
100
|
+
enabled: true,
|
|
101
|
+
version: VERSION,
|
|
102
|
+
port: server.port,
|
|
103
|
+
key: server.deskKey,
|
|
104
|
+
bindHost: server.bindHost,
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
}), 'remote-mobile.index-inject')
|
|
108
|
+
}
|
package/locale/en.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "Remote mobile access",
|
|
4
|
+
"description": "Pair your phone with a secure QR code and control this Harness session from a mobile browser."
|
|
5
|
+
},
|
|
6
|
+
"section": {
|
|
7
|
+
"title": "Remote mobile access",
|
|
8
|
+
"subtitle": "Control this session from your phone over the local network."
|
|
9
|
+
},
|
|
10
|
+
"panel": {
|
|
11
|
+
"title": "Pair your phone",
|
|
12
|
+
"subtitle": "Scan the code, or enter the PIN at the address below.",
|
|
13
|
+
"address": "Address",
|
|
14
|
+
"pin": "PIN",
|
|
15
|
+
"expires": "Expires in",
|
|
16
|
+
"devices": "Paired devices",
|
|
17
|
+
"noDevices": "No devices paired yet.",
|
|
18
|
+
"rotate": "New PIN",
|
|
19
|
+
"revoke": "Revoke",
|
|
20
|
+
"revokeAll": "Revoke all",
|
|
21
|
+
"copy": "Copy link",
|
|
22
|
+
"copied": "Copied",
|
|
23
|
+
"open": "Open",
|
|
24
|
+
"disabled": "Remote access is off.",
|
|
25
|
+
"enabled": "Remote access is on.",
|
|
26
|
+
"pairing": "Waiting for a phone to pair.",
|
|
27
|
+
"lastSeen": "Last seen"
|
|
28
|
+
}
|
|
29
|
+
}
|