dsh-asuta-reasoning-effort-memory 0.0.0-stage → 0.1.2
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 +4 -2
- package/client.js +60 -0
- package/cordis.patch.yml +4 -0
- package/icon.svg +1 -0
- package/index.js +2 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +57 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Asuta and contributors
|
|
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,5 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Reasoning Effort Memory
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Remembers reasoning effort by provider and model in browser storage. Intercepts the native model picker's remote.session.selectModel call; when a model is selected again in a conversation, the remembered effort is applied. Default is remembered too.
|
|
4
|
+
|
|
5
|
+
Install with dsh plugin --profile desktop add <plugin-directory>.
|
package/client.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: 'dsh-asuta-reasoning-effort-memory',
|
|
3
|
+
factory() {
|
|
4
|
+
const STORAGE_KEY = 'reasoning-effort-memory:v1'
|
|
5
|
+
function read() {
|
|
6
|
+
try {
|
|
7
|
+
const value = JSON.parse(localStorage.getItem(STORAGE_KEY) || '{}')
|
|
8
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : {}
|
|
9
|
+
} catch { return {} }
|
|
10
|
+
}
|
|
11
|
+
function write(value) {
|
|
12
|
+
try { localStorage.setItem(STORAGE_KEY, JSON.stringify(value)) } catch (error) { console.warn('reasoning-effort-memory: could not persist preferences', error) }
|
|
13
|
+
}
|
|
14
|
+
function keyOf(selection) {
|
|
15
|
+
return typeof selection?.provider === 'string' && typeof selection?.model === 'string'
|
|
16
|
+
? JSON.stringify([selection.provider, selection.model]) : null
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
inject: ['remote', 'remote.session'],
|
|
20
|
+
apply(ctx) {
|
|
21
|
+
ctx.effect(() => {
|
|
22
|
+
const sessionRemote = ctx.remote.session
|
|
23
|
+
const owner = sessionRemote?.[Symbol.for('cordis.original')]
|
|
24
|
+
const descriptor = owner && Object.getOwnPropertyDescriptor(owner, 'selectModel')
|
|
25
|
+
if (!descriptor?.configurable || typeof descriptor.get !== 'function') return
|
|
26
|
+
const active = new Map()
|
|
27
|
+
const remembered = read()
|
|
28
|
+
function wrappedGetter() {
|
|
29
|
+
const select = descriptor.get.call(this)
|
|
30
|
+
return async function(selection, ...rest) {
|
|
31
|
+
const key = keyOf(selection)
|
|
32
|
+
if (!key) return select.call(this, selection, ...rest)
|
|
33
|
+
const sessionId = selection.sessionId
|
|
34
|
+
const previousKey = active.get(sessionId)
|
|
35
|
+
const outgoing = { ...selection }
|
|
36
|
+
if (key !== previousKey && Object.hasOwn(remembered, key)) {
|
|
37
|
+
if (remembered[key] === null) delete outgoing.reasoningEffort
|
|
38
|
+
else outgoing.reasoningEffort = remembered[key]
|
|
39
|
+
}
|
|
40
|
+
const result = await select.call(this, outgoing, ...rest)
|
|
41
|
+
if (result?.ok !== false) {
|
|
42
|
+
if (key === previousKey || !Object.hasOwn(remembered, key)) {
|
|
43
|
+
remembered[key] = selection.reasoningEffort ?? null
|
|
44
|
+
write(remembered)
|
|
45
|
+
}
|
|
46
|
+
active.set(sessionId, key)
|
|
47
|
+
}
|
|
48
|
+
return result
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
try { Object.defineProperty(owner, 'selectModel', { ...descriptor, get: wrappedGetter }) }
|
|
52
|
+
catch (error) { console.warn('reasoning-effort-memory: model selector is not patchable', error); return }
|
|
53
|
+
return () => {
|
|
54
|
+
if (Object.getOwnPropertyDescriptor(owner, 'selectModel')?.get === wrappedGetter) Object.defineProperty(owner, 'selectModel', descriptor)
|
|
55
|
+
}
|
|
56
|
+
}, 'reasoning-effort-memory: model preference persistence')
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
})
|
package/cordis.patch.yml
ADDED
package/icon.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect x="8" y="8" width="20" height="20" rx="5" fill="#6e9fff"/><rect x="36" y="8" width="20" height="20" rx="5" fill="#8bc9b2"/><rect x="8" y="36" width="20" height="20" rx="5" fill="#b4a0e8"/><rect x="36" y="36" width="20" height="20" rx="5" fill="#e9ba87"/></svg>
|
package/index.js
ADDED
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-asuta-reasoning-effort-memory",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"description": "Remember the selected reasoning effort for each provider and model.",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.js",
|
|
9
|
+
"./client": "./client.js",
|
|
10
|
+
"./package.json": "./package.json",
|
|
11
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
12
|
+
"./locale/*.json": "./locale/*.json"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"index.js",
|
|
16
|
+
"client.js",
|
|
17
|
+
"cordis.patch.yml",
|
|
18
|
+
"README.md",
|
|
19
|
+
"icon.svg",
|
|
20
|
+
"locale/*.json",
|
|
21
|
+
"LICENSE*",
|
|
22
|
+
"NOTICE*",
|
|
23
|
+
"THIRD_PARTY_NOTICES.md"
|
|
24
|
+
],
|
|
25
|
+
"dsh": {
|
|
26
|
+
"bundle": {
|
|
27
|
+
"patch": "./cordis.patch.yml"
|
|
28
|
+
},
|
|
29
|
+
"client": {
|
|
30
|
+
"platform": "web",
|
|
31
|
+
"immediately": true,
|
|
32
|
+
"inject": [
|
|
33
|
+
"@deepseek-ai/dsh-client-ui-session"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/Asuta/dsh-cdx-plus.git",
|
|
43
|
+
"directory": "packages/reasoning-effort-memory"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/Asuta/dsh-cdx-plus/tree/main/packages/reasoning-effort-memory",
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/Asuta/dsh-cdx-plus/issues"
|
|
48
|
+
},
|
|
49
|
+
"keywords": [
|
|
50
|
+
"dsh-plugin",
|
|
51
|
+
"deepseek-harness"
|
|
52
|
+
],
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": "^22.19.0 || >=24",
|
|
55
|
+
"dsh": "0.2.2-rc.2"
|
|
56
|
+
},
|
|
57
|
+
"license": "MIT",
|
|
58
|
+
"icon": "./icon.svg"
|
|
59
|
+
}
|