dsh-deepseek-webchat 0.4.9 → 0.4.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/lib/index.js +20 -6
- package/package.json +1 -1
- package/src/index.js +20 -6
package/lib/index.js
CHANGED
|
@@ -821,12 +821,26 @@ function messageCacheKey(sessionId, advanced) {
|
|
|
821
821
|
async function sessionToken(ctx, sessionId) {
|
|
822
822
|
const sessions = ctx.get('sessions')
|
|
823
823
|
if (sessions !== undefined && typeof sessions.get === 'function') {
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
824
|
+
// A Session id reaches this half in either form — DSH hands out the bare
|
|
825
|
+
// uuid from its event/query APIs and `session-<uuid>` from the store — and
|
|
826
|
+
// `sessions.get` keys on whichever the store minted. Try the id as given,
|
|
827
|
+
// then its other spelling, so a live session is never mistaken for a cold
|
|
828
|
+
// one and silently judged by a stale `stat`.
|
|
829
|
+
const canonical = canonicalSessionId(sessionId)
|
|
830
|
+
const candidates = [
|
|
831
|
+
sessionId,
|
|
832
|
+
canonical,
|
|
833
|
+
canonical === '' ? '' : 'session-' + canonical,
|
|
834
|
+
]
|
|
835
|
+
for (const candidate of candidates) {
|
|
836
|
+
if (candidate === '') continue
|
|
837
|
+
try {
|
|
838
|
+
const live = sessions.get(candidate)
|
|
839
|
+
const seq = live?.seq
|
|
840
|
+
if (typeof seq === 'number') return 'live:' + seq
|
|
841
|
+
} catch (error) {
|
|
842
|
+
// Try the next spelling.
|
|
843
|
+
}
|
|
830
844
|
}
|
|
831
845
|
}
|
|
832
846
|
const persistence = ctx.get('sessionPersistence')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-deepseek-webchat",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
4
4
|
"description": "Embeds the official chat.deepseek.com web app in a DSH sidebar tab through the desktop shell's native browser guest, binds one DeepSeek conversation per DSH Session, and sends selected DSH context into the DeepSeek composer as a blockquote.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
package/src/index.js
CHANGED
|
@@ -821,12 +821,26 @@ function messageCacheKey(sessionId, advanced) {
|
|
|
821
821
|
async function sessionToken(ctx, sessionId) {
|
|
822
822
|
const sessions = ctx.get('sessions')
|
|
823
823
|
if (sessions !== undefined && typeof sessions.get === 'function') {
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
824
|
+
// A Session id reaches this half in either form — DSH hands out the bare
|
|
825
|
+
// uuid from its event/query APIs and `session-<uuid>` from the store — and
|
|
826
|
+
// `sessions.get` keys on whichever the store minted. Try the id as given,
|
|
827
|
+
// then its other spelling, so a live session is never mistaken for a cold
|
|
828
|
+
// one and silently judged by a stale `stat`.
|
|
829
|
+
const canonical = canonicalSessionId(sessionId)
|
|
830
|
+
const candidates = [
|
|
831
|
+
sessionId,
|
|
832
|
+
canonical,
|
|
833
|
+
canonical === '' ? '' : 'session-' + canonical,
|
|
834
|
+
]
|
|
835
|
+
for (const candidate of candidates) {
|
|
836
|
+
if (candidate === '') continue
|
|
837
|
+
try {
|
|
838
|
+
const live = sessions.get(candidate)
|
|
839
|
+
const seq = live?.seq
|
|
840
|
+
if (typeof seq === 'number') return 'live:' + seq
|
|
841
|
+
} catch (error) {
|
|
842
|
+
// Try the next spelling.
|
|
843
|
+
}
|
|
830
844
|
}
|
|
831
845
|
}
|
|
832
846
|
const persistence = ctx.get('sessionPersistence')
|