dsh-agentic-pet 0.0.0-stage → 0.3.0
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.i18n.yaml +4 -0
- package/README.md +49 -2
- package/README.zh.md +50 -0
- package/carrier/dist-renderer/assets/index-BHG2MI7t.css +1 -0
- package/carrier/dist-renderer/assets/index-C61Q_dyJ.js +1 -0
- package/carrier/dist-renderer/index.html +19 -0
- package/carrier/lib/host-child.js +49 -0
- package/carrier/lib/main.js +1038 -0
- package/carrier/lib/preload.js +63 -0
- package/carrier/package.json +8 -0
- package/client/pet-settings.js +261 -0
- package/cordis.patch.yml +11 -0
- package/lib/index.js +589 -0
- package/lib/service-Vj-lLpIv.js +6258 -0
- package/lib/tools.js +41 -0
- package/lib/types/actions.d.ts +42 -0
- package/lib/types/driver.d.ts +57 -0
- package/lib/types/index.d.ts +64 -0
- package/lib/types/inner-voice.d.ts +103 -0
- package/lib/types/registry.d.ts +54 -0
- package/lib/types/service.d.ts +159 -0
- package/lib/types/settings-page.d.ts +22 -0
- package/lib/types/tools.d.ts +29 -0
- package/package.json +58 -3
- package/presets/pet-inner-voice.patch.yml +53 -0
- package/presets/pet.patch.yml +142 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-pet preload. Exposes the one bridge the renderer needs: toggling the
|
|
3
|
+
* window's OS-level mouse-ignore so the desktop underneath stays clickable
|
|
4
|
+
* everywhere except over the pet body and bubbles. Runs unsandboxed because
|
|
5
|
+
* the carrier's preload is ESM; contextIsolation stays on.
|
|
6
|
+
*/
|
|
7
|
+
import { contextBridge, ipcRenderer } from 'electron';
|
|
8
|
+
contextBridge.exposeInMainWorld('petDesktop', {
|
|
9
|
+
/** Report whether an interaction bubble is currently on screen. */
|
|
10
|
+
setBubbleVisible(visible) {
|
|
11
|
+
ipcRenderer.send('pet:bubble-visibility', visible === true);
|
|
12
|
+
},
|
|
13
|
+
/**
|
|
14
|
+
* Manual window drag: the renderer reports the gesture in one coordinate
|
|
15
|
+
* space end to end — its own fractional DIP screenX/screenY — and the main
|
|
16
|
+
* process follows with size-pinned setBounds (see main.ts for why).
|
|
17
|
+
*/
|
|
18
|
+
dragStart(screenX, screenY) { ipcRenderer.send('pet:drag-start', screenX, screenY); },
|
|
19
|
+
dragMove(screenX, screenY) { ipcRenderer.send('pet:drag-move', screenX, screenY); },
|
|
20
|
+
dragEnd() { ipcRenderer.send('pet:drag-end'); },
|
|
21
|
+
/** Control interface (driver's four operations) deliveries from the main process. */
|
|
22
|
+
onSay(listener) {
|
|
23
|
+
ipcRenderer.on('pet:say', (_event, notice) => { listener(notice); });
|
|
24
|
+
},
|
|
25
|
+
reportStatus(snapshot) {
|
|
26
|
+
ipcRenderer.send('pet:status-report', snapshot);
|
|
27
|
+
},
|
|
28
|
+
onState(listener) {
|
|
29
|
+
ipcRenderer.on('pet:set-state', (_event, state) => { listener(state); });
|
|
30
|
+
},
|
|
31
|
+
onAction(listener) {
|
|
32
|
+
ipcRenderer.on('pet:action', (_event, action) => { listener(action); });
|
|
33
|
+
},
|
|
34
|
+
/** The action catalog scanned by the main process at boot (what /action
|
|
35
|
+
* names resolve against, and the idle theater's pool). */
|
|
36
|
+
onCatalog(listener) {
|
|
37
|
+
ipcRenderer.on('pet:catalog', (_event, catalog) => { listener(catalog); });
|
|
38
|
+
},
|
|
39
|
+
onInteraction(listener) {
|
|
40
|
+
ipcRenderer.on('pet:interaction', (_event, request) => { listener(request); });
|
|
41
|
+
},
|
|
42
|
+
onInteractionCancel(listener) {
|
|
43
|
+
ipcRenderer.on('pet:interaction-cancel', (_event, notice) => { listener(notice); });
|
|
44
|
+
},
|
|
45
|
+
answerInteraction(id, answer) {
|
|
46
|
+
ipcRenderer.send('pet:interaction-answer', { id, answer });
|
|
47
|
+
},
|
|
48
|
+
/** A completed touch gesture on the pet body (click, not drag). */
|
|
49
|
+
reportTouch(touch) {
|
|
50
|
+
ipcRenderer.send('pet:touch', touch);
|
|
51
|
+
},
|
|
52
|
+
/** A finished one-shot animation: the completion trace for /action. */
|
|
53
|
+
reportActionDone(done) {
|
|
54
|
+
ipcRenderer.send('pet:action-done', done);
|
|
55
|
+
},
|
|
56
|
+
/** chat上行 (§6 2026-10-31): one in-flight message per pet — the main
|
|
57
|
+
* process rejects with reason:'busy' until the previous one is carried out
|
|
58
|
+
* by a /events response. */
|
|
59
|
+
async sendChat(text) {
|
|
60
|
+
return await ipcRenderer.invoke('pet:chat', { text });
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=preload.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deepseek-ai/dsh-pet",
|
|
3
|
+
"description": "Pet window carrier spawned by the dsh-pet-app bundle inside its host runtime (attach-only; Electron provided by the host binary)",
|
|
4
|
+
"version": "0.2.1-rc.3",
|
|
5
|
+
"private": true,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "lib/main.js"
|
|
8
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/* pet-settings — browser half (hand-written __ModuleLoader__ bundle, no build
|
|
2
|
+
* step, dsh-qqbot precedent). Registers a "桌宠" section into the desktop
|
|
3
|
+
* settings sidebar via the slot system; data goes through the host half's
|
|
4
|
+
* same-origin routes (/api/pet-settings/*). The client startup audit is
|
|
5
|
+
* fatal on throw — apply degrades section by section, never failing the page.
|
|
6
|
+
*/
|
|
7
|
+
window.__ModuleLoader__.load({
|
|
8
|
+
id: 'dsh-agentic-pet',
|
|
9
|
+
factory: function (require) {
|
|
10
|
+
var React = require('react')
|
|
11
|
+
var h = React.createElement
|
|
12
|
+
var useState = React.useState
|
|
13
|
+
var useEffect = React.useEffect
|
|
14
|
+
var useCallback = React.useCallback
|
|
15
|
+
|
|
16
|
+
var READ = '/api/pet-settings/read'
|
|
17
|
+
var UPDATE = '/api/pet-settings/update'
|
|
18
|
+
|
|
19
|
+
// Theme-neutral: inherit foreground, translucent borders — readable on
|
|
20
|
+
// both the host's dark and light themes without a design system.
|
|
21
|
+
var card = { border: '1px solid rgba(127,127,127,.35)', borderRadius: 10, padding: '10px 14px 12px', margin: '10px 0' }
|
|
22
|
+
var cardTitle = { fontWeight: 700, fontSize: 14, margin: '2px 0 8px' }
|
|
23
|
+
var row = { display: 'flex', alignItems: 'center', gap: 10, margin: '6px 0', fontSize: 13, flexWrap: 'wrap' }
|
|
24
|
+
var muted = { color: 'rgba(127,127,127,.9)', fontSize: 12 }
|
|
25
|
+
var inputStyle = { width: 64, padding: '2px 6px', border: '1px solid rgba(127,127,127,.4)', borderRadius: 6, background: 'transparent', color: 'inherit', font: 'inherit' }
|
|
26
|
+
function btnStyle(variant) {
|
|
27
|
+
var base = { border: '1px solid rgba(127,127,127,.4)', borderRadius: 6, cursor: 'pointer', font: 'inherit', fontSize: 12, padding: '3px 12px', background: 'transparent', color: 'inherit' }
|
|
28
|
+
if (variant === 'primary') return Object.assign(base, { fontWeight: 700, borderColor: 'rgba(124,108,240,.6)' })
|
|
29
|
+
if (variant === 'danger') return Object.assign(base, { color: '#ff7369', borderColor: 'rgba(229,72,77,.5)' })
|
|
30
|
+
return base
|
|
31
|
+
}
|
|
32
|
+
function SButton(props) {
|
|
33
|
+
return h('button', { style: btnStyle(props.variant), disabled: props.disabled, onClick: props.onClick }, props.children)
|
|
34
|
+
}
|
|
35
|
+
function Toggle(props) {
|
|
36
|
+
return h('button', {
|
|
37
|
+
onClick: props.onChange,
|
|
38
|
+
style: {
|
|
39
|
+
cursor: 'pointer', font: 'inherit', fontSize: 12, padding: '2px 12px', borderRadius: 12,
|
|
40
|
+
border: '1px solid ' + (props.value ? 'rgba(31,158,79,.7)' : 'rgba(127,127,127,.4)'),
|
|
41
|
+
color: props.value ? '#3ddc84' : 'inherit',
|
|
42
|
+
background: props.value ? 'rgba(31,158,79,.12)' : 'transparent',
|
|
43
|
+
},
|
|
44
|
+
}, props.value ? '已开启' : '已关闭')
|
|
45
|
+
}
|
|
46
|
+
function Section(props) {
|
|
47
|
+
return h('div', { style: card }, h('div', { style: cardTitle }, props.title), props.children)
|
|
48
|
+
}
|
|
49
|
+
function Hint(props) {
|
|
50
|
+
return h('div', { style: Object.assign({ margin: '6px 0 2px' }, muted) }, props.children)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function PetSettingsPage() {
|
|
54
|
+
var state = useState(null)
|
|
55
|
+
var data = state[0]
|
|
56
|
+
var setData = state[1]
|
|
57
|
+
var msgState = useState('')
|
|
58
|
+
var msg = msgState[0]
|
|
59
|
+
var setMsg = msgState[1]
|
|
60
|
+
var busyState = useState(false)
|
|
61
|
+
var busy = busyState[0]
|
|
62
|
+
var setBusy = busyState[1]
|
|
63
|
+
|
|
64
|
+
var refresh = useCallback(function () {
|
|
65
|
+
fetch(READ, { credentials: 'same-origin' })
|
|
66
|
+
.then(function (r) { return r.json() })
|
|
67
|
+
.then(function (d) { setData(d) })
|
|
68
|
+
.catch(function (e) { setMsg('读取失败: ' + (e && e.message)) })
|
|
69
|
+
}, [])
|
|
70
|
+
useEffect(function () { refresh() }, [refresh])
|
|
71
|
+
|
|
72
|
+
var act = useCallback(function (path, body, doneMessage) {
|
|
73
|
+
setBusy(true)
|
|
74
|
+
setMsg('')
|
|
75
|
+
fetch(path, {
|
|
76
|
+
method: 'POST',
|
|
77
|
+
credentials: 'same-origin',
|
|
78
|
+
headers: { 'content-type': 'application/json' },
|
|
79
|
+
body: JSON.stringify(body || {}),
|
|
80
|
+
})
|
|
81
|
+
.then(function (r) { return r.json() })
|
|
82
|
+
.then(function (d) {
|
|
83
|
+
if (d && d.error) setMsg('失败: ' + d.error)
|
|
84
|
+
else setMsg(doneMessage || '完成')
|
|
85
|
+
refresh()
|
|
86
|
+
})
|
|
87
|
+
.catch(function (e) { setMsg('请求失败: ' + (e && e.message)) })
|
|
88
|
+
.finally(function () { setBusy(false) })
|
|
89
|
+
}, [refresh])
|
|
90
|
+
|
|
91
|
+
var settings = (data && data.settings) || {}
|
|
92
|
+
var pro = settings.proactivity || {}
|
|
93
|
+
var iv = settings.innerVoice || {}
|
|
94
|
+
var debug = settings.debug || {}
|
|
95
|
+
var affection = (data && data.affection) || {}
|
|
96
|
+
var pets = (data && data.pets) || []
|
|
97
|
+
if (!(pets && pets.length) && data && data.pet) pets = [Object.assign({ id: 'electron' }, data.pet)]
|
|
98
|
+
var moodOf = function (a) { return a >= 80 ? '开心' : a >= 40 ? '满足' : '平静' }
|
|
99
|
+
|
|
100
|
+
function update(patch, doneMessage) { act(UPDATE, { patch: patch }, doneMessage) }
|
|
101
|
+
|
|
102
|
+
return h('div', { style: { width: '100%', maxWidth: 720 } },
|
|
103
|
+
h('div', { style: { display: 'flex', alignItems: 'center', gap: 10, margin: '2px 0 10px' } },
|
|
104
|
+
h('span', { style: { fontWeight: 700, fontSize: 15 } }, '桌宠'),
|
|
105
|
+
h('span', { style: muted }, '驱动插件 dsh-agentic-pet'),
|
|
106
|
+
h('span', { style: { flex: 1 } }),
|
|
107
|
+
h(SButton, { onClick: refresh, disabled: busy }, '刷新')),
|
|
108
|
+
msg ? h('div', { style: { fontSize: 12, margin: '0 0 6px', color: msg.indexOf('失败') >= 0 ? '#ff7369' : 'inherit' } }, msg) : null,
|
|
109
|
+
|
|
110
|
+
// ── 状态(每宠一行) ──
|
|
111
|
+
h(Section, { title: '宠物' },
|
|
112
|
+
pets.length
|
|
113
|
+
? pets.map(function (p) {
|
|
114
|
+
var name = p.id === 'electron' ? 'TS 宠物' : p.id === 'pure' ? 'Pure 宠物' : String(p.id)
|
|
115
|
+
return h('div', { key: p.id, style: row },
|
|
116
|
+
h('span', { style: { fontWeight: 700 } }, name),
|
|
117
|
+
p.online
|
|
118
|
+
? h('span', null, '在线',
|
|
119
|
+
h('span', { style: muted }, 'pid ' + String(p.pid ?? '?')),
|
|
120
|
+
p.state ? h('span', { style: muted }, '状态: ' + String(p.state)) : null,
|
|
121
|
+
p.animation ? h('span', { style: muted }, String(p.animation)) : null)
|
|
122
|
+
: h('span', { style: muted }, '离线'))
|
|
123
|
+
})
|
|
124
|
+
: h('div', null, '没有在线的宠物', h(Hint, null, '启动 DeepSeek Harness 后 TS 宠物会自动上桌;Pure 宠物需自行启动。'))),
|
|
125
|
+
|
|
126
|
+
// ── 好感度(每宠独立账本) ──
|
|
127
|
+
h(Section, { title: '好感度' },
|
|
128
|
+
(function () {
|
|
129
|
+
var bookIds = affection && typeof affection === 'object' ? Object.keys(affection) : []
|
|
130
|
+
var ids = []
|
|
131
|
+
pets.forEach(function (p) { if (ids.indexOf(p.id) < 0) ids.push(p.id) })
|
|
132
|
+
bookIds.forEach(function (id) { if (ids.indexOf(id) < 0) ids.push(id) })
|
|
133
|
+
if (!ids.length) return h('div', { style: muted }, '还没有互动记录')
|
|
134
|
+
return ids.map(function (id) {
|
|
135
|
+
var book = (affection && affection[id]) || { affection: 0, total: 0 }
|
|
136
|
+
var name = id === 'electron' ? 'TS 宠物' : id === 'pure' ? 'Pure 宠物' : id
|
|
137
|
+
return h('div', { key: id, style: row },
|
|
138
|
+
h('span', { style: { fontWeight: 700 } }, name),
|
|
139
|
+
h('span', { style: { fontSize: 18, fontWeight: 700 } }, String(book.affection ?? 0)),
|
|
140
|
+
h('span', { style: muted }, '/ 100 · ' + moodOf(book.affection ?? 0)),
|
|
141
|
+
h('span', { style: muted }, '累计 ' + String(book.total ?? 0) + ' 次'))
|
|
142
|
+
})
|
|
143
|
+
})(),
|
|
144
|
+
h('div', { style: row }, h(SButton, { variant: 'danger', disabled: busy, onClick: function () {
|
|
145
|
+
if (window.confirm('清空所有好感度账本?此操作不可撤销。')) act('/api/pet-settings/reset-affection', {}, '账本已清空')
|
|
146
|
+
} }, '重置账本'),
|
|
147
|
+
h('span', { style: muted }, '每跨 10 点该宠物会自主庆祝一次'))),
|
|
148
|
+
|
|
149
|
+
// ── 内心戏(宠物自主说话)──
|
|
150
|
+
h(Section, { title: h('span', null, '自主表达 ', h('span', { style: { fontSize: 11, fontWeight: 400, color: 'rgba(127,127,127,.9)' } }, '模型驱动')) },
|
|
151
|
+
h('div', { style: row }, '宠物自主醒来', h(Toggle, { value: iv.enabled !== false, onChange: function () {
|
|
152
|
+
update({ innerVoice: { enabled: !(iv.enabled !== false) } })
|
|
153
|
+
} })),
|
|
154
|
+
h('div', { style: row },
|
|
155
|
+
'唤醒间隔',
|
|
156
|
+
h('input', { style: inputStyle, value: String(iv.wakeIntervalMinutes ?? 2), onChange: function (e) {
|
|
157
|
+
var v = parseInt(e.target.value, 10)
|
|
158
|
+
if (Number.isFinite(v)) update({ innerVoice: { wakeIntervalMinutes: v } })
|
|
159
|
+
} }),
|
|
160
|
+
'分钟'),
|
|
161
|
+
h('div', { style: row },
|
|
162
|
+
'请求模型的概率',
|
|
163
|
+
h('input', { style: inputStyle, value: String(Math.round(((typeof iv.speakProbability === 'number' ? iv.speakProbability : 0.5)) * 100)), onChange: function (e) {
|
|
164
|
+
var v = parseFloat(e.target.value)
|
|
165
|
+
if (Number.isFinite(v)) update({ innerVoice: { speakProbability: Math.min(100, Math.max(0, v)) / 100 } })
|
|
166
|
+
} }),
|
|
167
|
+
'%'),
|
|
168
|
+
h('div', { style: row },
|
|
169
|
+
'被摸回应概率',
|
|
170
|
+
h('input', { style: inputStyle, value: String(Math.round(((typeof iv.touchReplyProbability === 'number' ? iv.touchReplyProbability : 0.3)) * 100)), onChange: function (e) {
|
|
171
|
+
var v = parseFloat(e.target.value)
|
|
172
|
+
if (Number.isFinite(v)) update({ innerVoice: { touchReplyProbability: Math.min(100, Math.max(0, v)) / 100 } })
|
|
173
|
+
} }),
|
|
174
|
+
'%'),
|
|
175
|
+
h('div', { style: row },
|
|
176
|
+
'两次被摸回应至少间隔',
|
|
177
|
+
h('input', { style: inputStyle, value: String(iv.touchReplyCooldownSeconds ?? Math.round((iv.touchReplyCooldownMinutes ?? 5) * 60)), onChange: function (e) {
|
|
178
|
+
var v = parseInt(e.target.value, 10)
|
|
179
|
+
if (Number.isFinite(v) && v >= 0) update({ innerVoice: { touchReplyCooldownSeconds: Math.min(600, v) } })
|
|
180
|
+
} }),
|
|
181
|
+
'秒(0 = 不限)'),
|
|
182
|
+
h('div', { style: row }, '会话模式',
|
|
183
|
+
(function () {
|
|
184
|
+
var seg = function (active, side) {
|
|
185
|
+
return { padding: '4px 12px', fontSize: 12, cursor: 'pointer',
|
|
186
|
+
border: '1px solid ' + (active ? '#22c55e' : '#c9d4e0'),
|
|
187
|
+
background: active ? '#22c55e' : '#f4f7fa',
|
|
188
|
+
color: active ? '#ffffff' : '#1c2733',
|
|
189
|
+
borderRadius: side === 'left' ? '4px 0 0 4px' : '0 4px 4px 0',
|
|
190
|
+
marginLeft: side === 'right' ? -1 : 0 }
|
|
191
|
+
}
|
|
192
|
+
return h('div', { style: { display: 'inline-flex' } },
|
|
193
|
+
h('button', { style: seg(iv.preset !== 'pet', 'left'), onClick: function () {
|
|
194
|
+
if (iv.preset !== 'pet-inner-voice') update({ innerVoice: { preset: 'pet-inner-voice' } })
|
|
195
|
+
} }, '精简(仅表达)'),
|
|
196
|
+
h('button', { style: seg(iv.preset === 'pet', 'right'), onClick: function () {
|
|
197
|
+
if (iv.preset !== 'pet') update({ innerVoice: { preset: 'pet' } })
|
|
198
|
+
} }, '普通(含工作工具)'))
|
|
199
|
+
})()),
|
|
200
|
+
h('div', { style: row }, '指定会话(高级)',
|
|
201
|
+
h('input', { style: Object.assign({}, inputStyle, { width: 340, flex: '1 1 260px' }), value: String((iv.boundSessions && iv.boundSessions.electron) || ''), placeholder: '会话 id,留空 = 自动管理', onChange: function (e) {
|
|
202
|
+
var v = e.target.value.trim()
|
|
203
|
+
var next = Object.assign({}, iv.boundSessions || {})
|
|
204
|
+
if (v !== '') next.electron = v
|
|
205
|
+
else delete next.electron
|
|
206
|
+
update({ innerVoice: { boundSessions: next } })
|
|
207
|
+
} })),
|
|
208
|
+
h(Hint, null, '宠物在自己专属的会话里醒来,用气泡和动作自主表达;那条「鲸鱼娘的内心戏」会话可在会话列表查看,也可以直接在那里和它聊天。用户忙于会话或宠物表达未完成时不会打扰。会话模式切换只对新建会话生效:归档旧会话后,她会在下次对话时自动换代重建(旧会话记忆不迁移)。指定会话立即生效——下一次对话就用新绑定的会话;清空后自动回落到她之前的会话(那条若已被归档,会自动创建新的)。')),
|
|
209
|
+
|
|
210
|
+
h(Section, { title: h('span', null, '自由活动 ', h('span', { style: { fontSize: 11, fontWeight: 400, color: 'rgba(127,127,127,.9)' } }, '逻辑驱动')) },
|
|
211
|
+
h('div', { style: row }, '自由活动(宠物自娱)', h(Toggle, { value: pro.idleAnimation !== false, onChange: function () {
|
|
212
|
+
update({ proactivity: { idleAnimation: !(pro.idleAnimation !== false) } })
|
|
213
|
+
} })),
|
|
214
|
+
h('div', { style: row },
|
|
215
|
+
'两次小剧场至少间隔',
|
|
216
|
+
h('input', { style: inputStyle, value: String(pro.idleAnimationGapMinutes ?? 10), onChange: function (e) {
|
|
217
|
+
var v = parseInt(e.target.value, 10)
|
|
218
|
+
if (Number.isFinite(v)) update({ proactivity: { idleAnimationGapMinutes: v } })
|
|
219
|
+
} }),
|
|
220
|
+
'分钟'),
|
|
221
|
+
h(Hint, null, '自由活动:宠物空闲时随机播放一段小动画(纯动画,无模型参与),改动即时推送。')),
|
|
222
|
+
|
|
223
|
+
// ── 调试 ──
|
|
224
|
+
h(Section, { title: '调试' },
|
|
225
|
+
h('div', { style: row }, 'CDP 调试端口 (9222)', h(Toggle, { value: debug.cdp === true, onChange: function () {
|
|
226
|
+
update({ debug: { cdp: !(debug.cdp === true) } })
|
|
227
|
+
} }),
|
|
228
|
+
h('span', { style: muted }, '重启 DeepSeek Harness 后生效')),
|
|
229
|
+
h('div', { style: row },
|
|
230
|
+
h(SButton, { disabled: busy, onClick: function () { act('/api/pet-settings/open-logs', {}, '已打开') } }, '打开日志文件夹'),
|
|
231
|
+
h(SButton, { disabled: busy, onClick: function () {
|
|
232
|
+
if (window.confirm('清除记住的窗口位置?下次启动回到默认位置。')) act('/api/pet-settings/reset-position', {}, '已清除,下次启动生效')
|
|
233
|
+
} }, '重置窗口位置')),
|
|
234
|
+
h(Hint, null, '拖动宠物结束后自动记住位置(pet-window.json)。'))
|
|
235
|
+
)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function apply(ctx) {
|
|
239
|
+
// Client-side startup audit is fatal on throw: degrade per section.
|
|
240
|
+
var safe = function (label, fn) {
|
|
241
|
+
try { return fn() } catch (e) {
|
|
242
|
+
try { console.warn('[pet-settings] ' + label + ' degraded: ' + String((e && e.message) || e)) } catch (x) { /* ignore */ }
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
safe('settings section', function () {
|
|
246
|
+
var slots = ctx.slots
|
|
247
|
+
if (!slots) { console.warn('[pet-settings] slots unavailable'); return }
|
|
248
|
+
slots.inject('settings.section', function () {
|
|
249
|
+
return slots.register(
|
|
250
|
+
{ name: 'settings.section', id: 'pet-surface', order: 40, label: '桌宠' },
|
|
251
|
+
function (props) { return h(PetSettingsPage, { close: props && props.close }) })
|
|
252
|
+
})
|
|
253
|
+
})
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
var exports = {}
|
|
257
|
+
exports.inject = ['slots']
|
|
258
|
+
exports.apply = apply
|
|
259
|
+
return exports
|
|
260
|
+
},
|
|
261
|
+
})
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# The dsh-pet-app bundle patch: the pet surface over the web composition layer.
|
|
2
|
+
# Applied after dsh-web-app; the webserver, Connection authentication, and the
|
|
3
|
+
# API gateway rows all exist by the time this layer composes. The pet-surface
|
|
4
|
+
# row owns the `/pet` prefix route serving the desktop pet's renderer dist.
|
|
5
|
+
#
|
|
6
|
+
# A patch replaces the targeted row's whole `config`, so each row below
|
|
7
|
+
# restates every key it owns.
|
|
8
|
+
|
|
9
|
+
- insert:
|
|
10
|
+
- id: pet-surface
|
|
11
|
+
name: 'dsh-agentic-pet'
|