dsh-monkeyai-sessions 0.1.6 → 0.1.7
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/README.md +1 -1
- package/README.zh.md +1 -1
- package/package.json +1 -1
- package/src/host/monkeyai-remote.js +20 -2
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ From a checkout:
|
|
|
61
61
|
npm install
|
|
62
62
|
npm run build
|
|
63
63
|
npm pack
|
|
64
|
-
dsh plugin --profile web add ./dsh-monkeyai-sessions-0.1.
|
|
64
|
+
dsh plugin --profile web add ./dsh-monkeyai-sessions-0.1.7.tgz
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
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.
|
package/README.zh.md
CHANGED
|
@@ -28,7 +28,7 @@ https://artenx.github.io/dsh-monkeyai-sessions/index.json
|
|
|
28
28
|
npm install
|
|
29
29
|
npm run build
|
|
30
30
|
npm pack
|
|
31
|
-
dsh plugin --profile web add ./dsh-monkeyai-sessions-0.1.
|
|
31
|
+
dsh plugin --profile web add ./dsh-monkeyai-sessions-0.1.7.tgz
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
已在真实的 DSH `0.2.2-rc.1` web profile 与在线 MonkeyAI runtime 上端到端验证:授权、完整历史加载、指令下发、模型切换、回合取消均正常工作。
|
package/package.json
CHANGED
|
@@ -974,11 +974,14 @@ export class MonkeyAIRemoteService extends TypertRemoteService {
|
|
|
974
974
|
}
|
|
975
975
|
// The desktop client tracks turn state via _monkeyai/session/state
|
|
976
976
|
// notifications. Seed the panel with the current status so a turn
|
|
977
|
-
// already running when the panel opens is shown as 进行中.
|
|
977
|
+
// already running when the panel opens is shown as 进行中. The state
|
|
978
|
+
// read omits state.status on some runtime builds, so fall back to the
|
|
979
|
+
// session.status field returned by the history read channel.
|
|
980
|
+
const KNOWN_STATUSES = ['running', 'idle', 'error', 'interrupted']
|
|
978
981
|
try {
|
|
979
982
|
const state = await readSessionState({ httpBase: ticketHttpBase, ticket: ticketValue, sessionId: selectedSession, signal })
|
|
980
983
|
const status = state?.state?.status
|
|
981
|
-
if (typeof status === 'string' &&
|
|
984
|
+
if (typeof status === 'string' && KNOWN_STATUSES.includes(status)) {
|
|
982
985
|
emit({
|
|
983
986
|
type: 'notification',
|
|
984
987
|
sessionId: selectedSession,
|
|
@@ -990,6 +993,21 @@ export class MonkeyAIRemoteService extends TypertRemoteService {
|
|
|
990
993
|
// Older runtimes may not expose the state read; live notifications
|
|
991
994
|
// still drive the status once the next turn starts.
|
|
992
995
|
}
|
|
996
|
+
try {
|
|
997
|
+
const latest = await readSessionHistoryPage({ httpBase: ticketHttpBase, ticket: ticketValue, sessionId: selectedSession, limit: 1, signal })
|
|
998
|
+
const status = latest.session?.status
|
|
999
|
+
if (typeof status === 'string' && KNOWN_STATUSES.includes(status)) {
|
|
1000
|
+
emit({
|
|
1001
|
+
type: 'notification',
|
|
1002
|
+
sessionId: selectedSession,
|
|
1003
|
+
method: '_monkeyai/session/state',
|
|
1004
|
+
data: { sessionId: selectedSession, state: { status } },
|
|
1005
|
+
})
|
|
1006
|
+
}
|
|
1007
|
+
} catch {
|
|
1008
|
+
// The history channel may be unavailable; live notifications remain
|
|
1009
|
+
// the source of truth for subsequent turns.
|
|
1010
|
+
}
|
|
993
1011
|
} catch (error) {
|
|
994
1012
|
if (signal?.aborted) throw error
|
|
995
1013
|
const message = error instanceof Error ? error.message : String(error)
|