dsh-plugin-weapp-gateway 0.8.9 → 0.8.10

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/bin/setup-ip.mjs CHANGED
File without changes
@@ -1,10 +1,10 @@
1
1
  const TICKET_RE = /^[A-Za-z0-9_-]{43}$/
2
2
  const MAX_AGE_MS = 3 * 24 * 60 * 60 * 1000
3
3
 
4
- function turnKey(event) {
4
+ function eventTurnKey(event) {
5
5
  const value = event?.data?.turn
6
6
  if (typeof value === 'string' || typeof value === 'number') return `${typeof value}:${String(value)}`
7
- return Number.isSafeInteger(event?.seq) ? `seq:${event.seq}` : null
7
+ return null
8
8
  }
9
9
 
10
10
  function completionUrl(baseUrl) {
@@ -102,7 +102,7 @@ export function createCompletionNotifications({ serviceUrl, fetchImpl = globalTh
102
102
  prune()
103
103
  if (event.type === 'turn/start') {
104
104
  const state = sessionState(sessionId, true)
105
- const key = turnKey(event)
105
+ const key = eventTurnKey(event) || (Number.isSafeInteger(event.seq) ? `seq:${event.seq}` : null)
106
106
  if (key === null) return
107
107
  state.currentTurn = key
108
108
  state.currentTurnAt = now()
@@ -117,7 +117,9 @@ export function createCompletionNotifications({ serviceUrl, fetchImpl = globalTh
117
117
  if (event.type !== 'turn/end') return
118
118
  const state = sessionState(sessionId)
119
119
  if (!state) return
120
- const key = turnKey(event) || state.currentTurn
120
+ // Event sequence numbers differ between start and end; if turn metadata is
121
+ // absent on the end event, close the turn already tracked as current.
122
+ const key = eventTurnKey(event) || state.currentTurn
121
123
  const records = key === null ? [] : state.active.get(key) || []
122
124
  if (key !== null) state.active.delete(key)
123
125
  if (state.currentTurn === key) { state.currentTurn = null; state.currentTurnAt = null }
package/package.json CHANGED
@@ -1,53 +1,51 @@
1
- {
2
- "name": "dsh-plugin-weapp-gateway",
3
- "version": "0.8.9",
4
- "description": "Authenticated mobile gateway for dsh 0.1.7-rc.2 with Session V4 history, live permissions, inbox-based queue sync, plugin management (DSH 0.2.0 hosts), LAN and Cloudflare Tunnel access with public endpoint health checks, device pairing, per-session Agent preset selection, relay access for the WeChat mini-program, and the official speech-input bridge (speech-input-v1)",
5
- "main": "lib/index.mjs",
6
- "files": [
7
- "bin",
8
- "helper",
9
- "lib",
10
- "relay",
11
- "docs",
12
- "cordis.patch.yml",
13
- "PROTOCOL.md"
14
- ],
15
- "repository": {
16
- "type": "git",
17
- "url": "git+https://github.com/huiikeung/dsh-plugin-weapp-gateway.git"
18
- },
19
- "homepage": "https://github.com/huiikeung/dsh-plugin-weapp-gateway#readme",
20
- "bugs": {
21
- "url": "https://github.com/huiikeung/dsh-plugin-weapp-gateway/issues"
22
- },
23
- "dependencies": {
24
- "@deepseek-ai/schemastery": "^3.18.1",
25
- "ws": "^8.18.0",
26
- "qrcode": "^1.5.4"
27
- },
28
- "exports": {
29
- ".": "./lib/index.mjs",
30
- "./client": "./lib/client.js",
31
- "./package.json": "./package.json"
32
- },
33
- "dsh": {
34
- "bundle": {
35
- "patch": "./cordis.patch.yml"
36
- },
37
- "client": {
38
- "platform": "web",
39
- "inject": [
40
- "@deepseek-ai/dsh-client-runtime",
41
- "@deepseek-ai/dsh-client-ui-layout",
42
- "@deepseek-ai/dsh-client-ui-sidebar"
43
- ]
44
- }
45
- },
46
- "license": "MIT",
47
- "scripts": {
48
- "test": "node test/wire-json.test.mjs && node test/setup-ip.test.mjs && node test/host-adapter.test.mjs && node test/speech-input.test.mjs && node test/speech-official.test.mjs && node test/plugin-management.test.mjs && node test/plugin-updates.test.mjs && node test/session-preset.test.mjs && node test/session-follower.test.mjs && node test/completion-notifications.test.mjs && node --test test/workspace-changes.test.mjs && node test/gateway.test.mjs && node test/auth.test.mjs && node test/lan.test.mjs && node test/cloudflared-binary.test.mjs && node test/cloudflare-tunnel.test.mjs && node --test test/public-endpoint-check.test.mjs && node test/gateway-tools.test.mjs && node test/relay-connector.test.mjs && node test/cloudflare-linux.test.mjs && node test/multi-gateway.test.mjs"
49
- },
50
- "bin": {
51
- "dsh-plugin-weapp-gateway": "bin/setup-ip.mjs"
52
- }
53
- }
1
+ {
2
+ "name": "dsh-plugin-weapp-gateway",
3
+ "version": "0.8.10",
4
+ "description": "Authenticated mobile gateway for dsh 0.1.7-rc.2 with Session V4 history, live permissions, inbox-based queue sync, plugin management (DSH 0.2.0 hosts), LAN and Cloudflare Tunnel access with public endpoint health checks, device pairing, per-session Agent preset selection, relay access for the WeChat mini-program, and the official speech-input bridge (speech-input-v1)",
5
+ "main": "lib/index.mjs",
6
+ "files": [
7
+ "bin",
8
+ "helper",
9
+ "lib",
10
+ "relay",
11
+ "docs",
12
+ "cordis.patch.yml",
13
+ "PROTOCOL.md"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/huiikeung/dsh-plugin-weapp-gateway.git"
18
+ },
19
+ "homepage": "https://github.com/huiikeung/dsh-plugin-weapp-gateway#readme",
20
+ "bugs": {
21
+ "url": "https://github.com/huiikeung/dsh-plugin-weapp-gateway/issues"
22
+ },
23
+ "dependencies": {
24
+ "@deepseek-ai/schemastery": "^3.18.1",
25
+ "ws": "^8.18.0",
26
+ "qrcode": "^1.5.4"
27
+ },
28
+ "bin": "bin/setup-ip.mjs",
29
+ "scripts": {
30
+ "test": "node test/wire-json.test.mjs && node test/setup-ip.test.mjs && node test/host-adapter.test.mjs && node test/speech-input.test.mjs && node test/speech-official.test.mjs && node test/plugin-management.test.mjs && node test/plugin-updates.test.mjs && node test/session-preset.test.mjs && node test/session-follower.test.mjs && node test/completion-notifications.test.mjs && node --test test/workspace-changes.test.mjs && node test/gateway.test.mjs && node test/auth.test.mjs && node test/lan.test.mjs && node test/cloudflared-binary.test.mjs && node test/cloudflare-tunnel.test.mjs && node --test test/public-endpoint-check.test.mjs && node test/gateway-tools.test.mjs && node test/relay-connector.test.mjs && node test/cloudflare-linux.test.mjs && node test/multi-gateway.test.mjs"
31
+ },
32
+ "exports": {
33
+ ".": "./lib/index.mjs",
34
+ "./client": "./lib/client.js",
35
+ "./package.json": "./package.json"
36
+ },
37
+ "dsh": {
38
+ "bundle": {
39
+ "patch": "./cordis.patch.yml"
40
+ },
41
+ "client": {
42
+ "platform": "web",
43
+ "inject": [
44
+ "@deepseek-ai/dsh-client-runtime",
45
+ "@deepseek-ai/dsh-client-ui-layout",
46
+ "@deepseek-ai/dsh-client-ui-sidebar"
47
+ ]
48
+ }
49
+ },
50
+ "license": "MIT"
51
+ }