@wwwfz/dsh-agent-bridge 0.10.0 → 0.11.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.md +56 -28
- package/THIRD_PARTY_NOTICES.md +5 -63
- package/package.json +2 -1
- package/src/assets.js +32 -19
- package/src/catalog.js +1139 -999
- package/src/client.js +37 -8
- package/src/conversation-search.js +55 -0
- package/src/conversation-store.js +189 -25
- package/src/export.js +3 -2
- package/src/handoff.js +149 -0
- package/src/history-attachment.js +41 -0
- package/src/index.js +31 -7
- package/src/project-archive.js +50 -0
- package/src/projects.js +109 -29
- package/src/session-import.js +17 -2
- package/src/skill-cli.js +287 -0
- package/src/skill-history.js +129 -0
- package/src/skill-output.js +19 -0
- package/src/skill-package.js +303 -321
- package/src/skill-provider.js +155 -193
- package/web/panel.css +28 -0
- package/web/panel.html +16 -3
- package/web/panel.js +632 -75
- package/web/reader.css +52 -0
- package/web/relay-categories.js +3 -0
- package/web/share-redaction.js +136 -0
- package/web/share-review.js +204 -0
package/src/skill-provider.js
CHANGED
|
@@ -1,247 +1,209 @@
|
|
|
1
1
|
import path from 'node:path'
|
|
2
|
+
import { readSkillPackage } from './skill-package.js'
|
|
2
3
|
import {
|
|
3
4
|
PROVIDER_NAME, PROVIDER_RANK, SkillActivationStore, SkillHandoff, SkillHandoffError,
|
|
4
5
|
findProjectRoot, resolveSkillStoreRoot,
|
|
5
6
|
} from './skill-handoff.js'
|
|
6
7
|
|
|
7
8
|
function pathKey(value) {
|
|
8
|
-
const normalized = path.normalize(value)
|
|
9
|
+
const normalized = path.normalize(value).replace(/^\\\\\?\\/, '')
|
|
9
10
|
return process.platform === 'win32' ? normalized.toLowerCase() : normalized
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
function
|
|
13
|
+
function skillRecord(bundle) {
|
|
13
14
|
return {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
sourceChanged: false,
|
|
24
|
-
reason,
|
|
25
|
-
}])),
|
|
15
|
+
name: bundle.name,
|
|
16
|
+
description: bundle.description,
|
|
17
|
+
invocation: bundle.invocation,
|
|
18
|
+
...(bundle.whenToUse ? { whenToUse: bundle.whenToUse } : {}),
|
|
19
|
+
...(bundle.metadata ? { metadata: bundle.metadata } : {}),
|
|
20
|
+
path: bundle.skillFile,
|
|
21
|
+
resourceBase: { kind: 'directory', path: bundle.sourceRoot },
|
|
22
|
+
provider: PROVIDER_NAME,
|
|
23
|
+
source: PROVIDER_NAME,
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
async function
|
|
30
|
-
|
|
27
|
+
async function readPrivateBundle(directory, expectedName, contentHash) {
|
|
28
|
+
const bundle = await readSkillPackage(path.join(directory, 'SKILL.md'), { content: true })
|
|
29
|
+
if (pathKey(bundle.sourceRoot) !== pathKey(directory)
|
|
30
|
+
|| pathKey(bundle.skillFile) !== pathKey(path.join(directory, 'SKILL.md'))
|
|
31
|
+
|| bundle.name !== expectedName || (contentHash !== undefined && bundle.contentHash !== contentHash)) {
|
|
32
|
+
throw new SkillHandoffError('snapshot-invalid', '私有技能包与启用记录不一致。')
|
|
33
|
+
}
|
|
34
|
+
return bundle
|
|
31
35
|
}
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
37
|
+
function mountProvider(store, handoff, contextSignal) {
|
|
38
|
+
async function projectState(options) {
|
|
39
|
+
contextSignal?.throwIfAborted()
|
|
40
|
+
options.signal?.throwIfAborted()
|
|
41
|
+
const project = await findProjectRoot(options.cwd)
|
|
42
|
+
if (!project) return
|
|
43
|
+
const state = await store.read()
|
|
44
|
+
return { state, active: handoff.activeSnapshots(state, project) }
|
|
45
|
+
}
|
|
46
|
+
async function inspectSnapshot(entry, options) {
|
|
47
|
+
const directory = store.snapshotPath(entry.id)
|
|
48
|
+
try {
|
|
49
|
+
const bundle = await readPrivateBundle(directory, entry.dshName, entry.contentHash)
|
|
50
|
+
return bundle
|
|
51
|
+
} catch {
|
|
52
|
+
return undefined
|
|
53
|
+
} finally {
|
|
54
|
+
contextSignal?.throwIfAborted()
|
|
55
|
+
options.signal?.throwIfAborted()
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
name: PROVIDER_NAME,
|
|
60
|
+
async list(options = {}) {
|
|
61
|
+
const project = await projectState(options)
|
|
62
|
+
if (!project) return []
|
|
63
|
+
const { state, active } = project
|
|
64
|
+
const candidates = []
|
|
65
|
+
let complete = true
|
|
66
|
+
for (const entry of Object.values(state.snapshots)) {
|
|
67
|
+
if (!active.has(pathKey(store.snapshotPath(entry.id)))) continue
|
|
68
|
+
const bundle = await inspectSnapshot(entry, options)
|
|
69
|
+
if (bundle) candidates.push({ ...skillRecord(bundle), rank: PROVIDER_RANK, locator: { id: entry.id } })
|
|
70
|
+
else complete = false
|
|
71
|
+
}
|
|
72
|
+
return { candidates, complete }
|
|
56
73
|
},
|
|
57
|
-
get(
|
|
58
|
-
|
|
59
|
-
|
|
74
|
+
async get(candidate, options = {}) {
|
|
75
|
+
const project = await projectState(options)
|
|
76
|
+
const id = candidate?.locator?.id
|
|
77
|
+
if (!project || typeof id !== 'string' || !Object.hasOwn(project.state.snapshots, id)) return
|
|
78
|
+
const entry = project.state.snapshots[id]
|
|
79
|
+
if (entry.dshName !== candidate.name || !project.active.has(pathKey(store.snapshotPath(entry.id)))) return
|
|
80
|
+
const bundle = await inspectSnapshot(entry, options)
|
|
81
|
+
if (bundle) return { ...skillRecord(bundle), content: bundle.body }
|
|
60
82
|
},
|
|
61
83
|
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function textOnly(assets) {
|
|
87
|
+
const unavailable = {
|
|
88
|
+
label: '仅可带入说明', state: 'handoff', action: 'view', allowed: false, current: false,
|
|
89
|
+
sourceChanged: false, reason: '当前 DSH 未提供可用的原生技能目录。',
|
|
90
|
+
}
|
|
91
|
+
return { available: false, managedSkills: [], skills: Object.fromEntries(assets.map(asset => [asset.id, unavailable])) }
|
|
92
|
+
}
|
|
62
93
|
|
|
94
|
+
export function createSkillBridge(ctx, { storeRoot = resolveSkillStoreRoot() } = {}) {
|
|
95
|
+
const store = new SkillActivationStore(storeRoot)
|
|
96
|
+
const service = () => ctx.get?.('skills') ?? ctx.skills
|
|
97
|
+
let refreshCatalog
|
|
98
|
+
let unregister
|
|
99
|
+
let timer
|
|
100
|
+
let stopped = false
|
|
101
|
+
let failure
|
|
63
102
|
const handoff = new SkillHandoff({
|
|
64
103
|
store,
|
|
65
|
-
native
|
|
66
|
-
|
|
67
|
-
|
|
104
|
+
native: {
|
|
105
|
+
list: options => service().list(options),
|
|
106
|
+
get: (name, options) => service().get(name, options),
|
|
68
107
|
},
|
|
108
|
+
invalidate: () => refreshCatalog?.(),
|
|
69
109
|
logger: ctx.logger,
|
|
70
|
-
async validateBundle(directory,
|
|
71
|
-
|
|
72
|
-
const lifecycle = new AbortController()
|
|
73
|
-
const provider = new FileSystemSkillProvider(ctx, {
|
|
74
|
-
signal: lifecycle.signal,
|
|
75
|
-
invalidate() {},
|
|
76
|
-
}, {
|
|
77
|
-
providerName: 'agent-bridge-validation',
|
|
78
|
-
includeDefaultRoots: false,
|
|
79
|
-
customSkillDirs: [path.dirname(directory)],
|
|
80
|
-
watch: false,
|
|
81
|
-
})
|
|
82
|
-
try {
|
|
83
|
-
const output = await provider.list({ cwd: projectRoot, signal: lifecycle.signal })
|
|
84
|
-
const candidates = Array.isArray(output) ? output : output?.candidates ?? []
|
|
85
|
-
const candidate = candidates.find(item => (
|
|
86
|
-
pathKey(item.resourceBase?.path ?? item.locator?.directory ?? '') === pathKey(directory)
|
|
87
|
-
))
|
|
88
|
-
if (!candidate) throw new SkillHandoffError('invalid-package', 'DSH 未识别这个技能包。')
|
|
89
|
-
const definition = await provider.get(candidate, { cwd: projectRoot, signal: lifecycle.signal })
|
|
90
|
-
if (!definition || definition.name !== expectedName) {
|
|
91
|
-
throw new SkillHandoffError('invalid-package', 'DSH 读取到的技能名与预览不一致。')
|
|
92
|
-
}
|
|
93
|
-
if (pathKey(definition.resourceBase?.path ?? '') !== pathKey(directory)) {
|
|
94
|
-
throw new SkillHandoffError('invalid-package', 'DSH 未返回私有技能资源目录。')
|
|
95
|
-
}
|
|
96
|
-
} finally {
|
|
97
|
-
lifecycle.abort(new Error('validation finished'))
|
|
98
|
-
await provider.dispose().catch(() => {})
|
|
99
|
-
}
|
|
110
|
+
async validateBundle(directory, _project, expectedName) {
|
|
111
|
+
await readPrivateBundle(directory, expectedName)
|
|
100
112
|
},
|
|
101
113
|
})
|
|
102
114
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const module = await loadProvider()
|
|
108
|
-
FileSystemSkillProvider = module.FileSystemSkillProvider
|
|
109
|
-
if (typeof FileSystemSkillProvider !== 'function') {
|
|
110
|
-
throw new SkillHandoffError('native-unavailable', '官方 FileSystemSkillProvider 不可用。')
|
|
115
|
+
try {
|
|
116
|
+
const skills = service()
|
|
117
|
+
if (typeof skills?.registerProvider !== 'function') {
|
|
118
|
+
throw new SkillHandoffError('native-unavailable', '当前 DSH 未提供 ctx.skills.registerProvider。')
|
|
111
119
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const inner = new FileSystemSkillProvider(ctx, providerControl, {
|
|
116
|
-
providerName: PROVIDER_NAME,
|
|
117
|
-
includeDefaultRoots: false,
|
|
118
|
-
customSkillDirs: [store.bundlesDir],
|
|
119
|
-
watch: false,
|
|
120
|
-
})
|
|
121
|
-
return {
|
|
122
|
-
name: PROVIDER_NAME,
|
|
123
|
-
async list(options) {
|
|
124
|
-
const projectRoot = await findProjectRoot(options.cwd)
|
|
125
|
-
if (!projectRoot) return []
|
|
126
|
-
const output = await inner.list(options)
|
|
127
|
-
const candidates = Array.isArray(output) ? output : output?.candidates ?? []
|
|
128
|
-
const active = handoff.activeSnapshots(await store.read(), projectRoot)
|
|
129
|
-
const filtered = candidates.filter(candidate => active.has(pathKey(
|
|
130
|
-
candidate.resourceBase?.path ?? candidate.locator?.directory ?? '',
|
|
131
|
-
))).map(candidate => ({
|
|
132
|
-
...candidate,
|
|
133
|
-
source: PROVIDER_NAME,
|
|
134
|
-
rank: PROVIDER_RANK,
|
|
135
|
-
}))
|
|
136
|
-
return Array.isArray(output) ? filtered : { candidates: filtered, complete: output.complete }
|
|
137
|
-
},
|
|
138
|
-
async get(candidate, options) {
|
|
139
|
-
const projectRoot = await findProjectRoot(options.cwd)
|
|
140
|
-
if (!projectRoot) return undefined
|
|
141
|
-
const active = handoff.activeSnapshots(await store.read(), projectRoot)
|
|
142
|
-
const directory = candidate.resourceBase?.path ?? candidate.locator?.directory
|
|
143
|
-
if (!directory || !active.has(pathKey(directory))) return undefined
|
|
144
|
-
return inner.get(candidate, options)
|
|
145
|
-
},
|
|
146
|
-
}
|
|
120
|
+
unregister = ctx.effect(() => skills.registerProvider(lifecycle => {
|
|
121
|
+
refreshCatalog = () => lifecycle.invalidate()
|
|
122
|
+
return mountProvider(store, handoff, lifecycle.signal)
|
|
147
123
|
}))
|
|
148
|
-
|
|
149
|
-
const pollRevision = async () => {
|
|
150
|
-
if (disposed) return
|
|
151
|
-
try {
|
|
152
|
-
const revision = await store.revision()
|
|
153
|
-
if (revision !== observedRevision) {
|
|
154
|
-
observedRevision = revision
|
|
155
|
-
control?.invalidate?.()
|
|
156
|
-
}
|
|
157
|
-
} catch {
|
|
158
|
-
// A host without a native skills service can keep running in text mode.
|
|
159
|
-
} finally {
|
|
160
|
-
if (!disposed) revisionTimer = setTimeout(pollRevision, 250)
|
|
161
|
-
revisionTimer?.unref?.()
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
revisionTimer = setTimeout(pollRevision, 250)
|
|
165
|
-
revisionTimer.unref?.()
|
|
166
|
-
})().catch(error => {
|
|
124
|
+
} catch (error) {
|
|
167
125
|
failure = error
|
|
168
|
-
ctx.logger?.warn?.(
|
|
169
|
-
}
|
|
126
|
+
ctx.logger?.warn?.('agent-bridge native skills unavailable: ' + (error?.message ?? error))
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const ready = (async () => {
|
|
130
|
+
if (failure) return
|
|
131
|
+
let previous = await store.revision().catch(() => 0)
|
|
132
|
+
const schedule = () => {
|
|
133
|
+
if (stopped) return
|
|
134
|
+
timer = setTimeout(async () => {
|
|
135
|
+
try {
|
|
136
|
+
const revision = await store.revision()
|
|
137
|
+
if (!stopped && revision !== previous) {
|
|
138
|
+
previous = revision
|
|
139
|
+
refreshCatalog?.()
|
|
140
|
+
}
|
|
141
|
+
} catch { /* Retry on the next read when the database is available. */ }
|
|
142
|
+
schedule()
|
|
143
|
+
}, 250)
|
|
144
|
+
timer.unref?.()
|
|
145
|
+
}
|
|
146
|
+
schedule()
|
|
147
|
+
})()
|
|
170
148
|
|
|
171
|
-
async function
|
|
149
|
+
async function requireProvider() {
|
|
172
150
|
await ready
|
|
173
151
|
if (failure) throw failure
|
|
152
|
+
if (stopped) throw new SkillHandoffError('native-unavailable', '原生技能目录已关闭。')
|
|
153
|
+
}
|
|
154
|
+
function command(method) {
|
|
155
|
+
return async (...args) => {
|
|
156
|
+
await requireProvider()
|
|
157
|
+
return handoff[method](...args)
|
|
158
|
+
}
|
|
174
159
|
}
|
|
175
160
|
|
|
176
161
|
const bridge = {
|
|
177
162
|
ready,
|
|
178
|
-
get available() {
|
|
179
|
-
|
|
180
|
-
},
|
|
181
|
-
get failure() {
|
|
182
|
-
return failure
|
|
183
|
-
},
|
|
163
|
+
get available() { return !failure && !stopped && Boolean(refreshCatalog) },
|
|
164
|
+
get failure() { return failure },
|
|
184
165
|
async inspect(project, skills) {
|
|
166
|
+
await ready
|
|
185
167
|
try {
|
|
186
|
-
await
|
|
187
|
-
return
|
|
188
|
-
} catch
|
|
189
|
-
|
|
190
|
-
try {
|
|
191
|
-
return {
|
|
192
|
-
...await handoff.inspect(project, skills),
|
|
193
|
-
available: false,
|
|
194
|
-
}
|
|
195
|
-
} catch {
|
|
196
|
-
return unavailableStatuses(skills, '当前 DSH 未提供可用的原生技能目录。')
|
|
197
|
-
}
|
|
168
|
+
const result = await handoff.inspect(project, skills)
|
|
169
|
+
return bridge.available ? result : { ...result, available: false }
|
|
170
|
+
} catch {
|
|
171
|
+
return textOnly(skills)
|
|
198
172
|
}
|
|
199
173
|
},
|
|
200
174
|
async conversationCandidates(project, usedSkills, skills) {
|
|
201
175
|
try {
|
|
202
|
-
await
|
|
203
|
-
const
|
|
204
|
-
if (!
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
176
|
+
await requireProvider()
|
|
177
|
+
const names = new Set((usedSkills ?? []).map(name => String(name).toLowerCase()))
|
|
178
|
+
if (!names.size) return []
|
|
179
|
+
const { skills: statuses } = await handoff.inspect(project, skills)
|
|
180
|
+
const relevant = []
|
|
181
|
+
for (const { id, name } of skills) {
|
|
182
|
+
const entry = statuses[id]
|
|
183
|
+
if (!entry || ![name, entry.dshName].some(value => names.has(String(value).toLowerCase()))) continue
|
|
184
|
+
relevant.push({ assetId: id, ...entry })
|
|
185
|
+
if (relevant.length === 3) break
|
|
186
|
+
}
|
|
187
|
+
return relevant
|
|
211
188
|
} catch {
|
|
212
189
|
return []
|
|
213
190
|
}
|
|
214
191
|
},
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
await ensure()
|
|
221
|
-
return handoff.authorizeTextOmission(project, assets)
|
|
222
|
-
},
|
|
223
|
-
async apply(ticket) {
|
|
224
|
-
await ensure()
|
|
225
|
-
return handoff.apply(ticket)
|
|
226
|
-
},
|
|
227
|
-
async deactivate(project, activationId) {
|
|
228
|
-
await ensure()
|
|
229
|
-
return handoff.deactivate(project, activationId)
|
|
230
|
-
},
|
|
231
|
-
async undo(project, activationId) {
|
|
232
|
-
await ensure()
|
|
233
|
-
return handoff.undo(project, activationId)
|
|
234
|
-
},
|
|
192
|
+
preview: command('preview'),
|
|
193
|
+
authorizeTextOmission: command('authorizeTextOmission'),
|
|
194
|
+
apply: command('apply'),
|
|
195
|
+
deactivate: command('deactivate'),
|
|
196
|
+
undo: command('undo'),
|
|
235
197
|
async revision() {
|
|
236
|
-
await
|
|
198
|
+
await requireProvider()
|
|
237
199
|
return store.revision()
|
|
238
200
|
},
|
|
239
201
|
dispose() {
|
|
240
|
-
if (
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
try {
|
|
202
|
+
if (stopped) return
|
|
203
|
+
stopped = true
|
|
204
|
+
clearTimeout(timer)
|
|
205
|
+
refreshCatalog = undefined
|
|
206
|
+
try { unregister?.() } catch { /* The host may already have disposed the registration. */ }
|
|
245
207
|
},
|
|
246
208
|
}
|
|
247
209
|
ctx.effect(() => () => bridge.dispose())
|
package/web/panel.css
CHANGED
|
@@ -223,6 +223,10 @@ img.agent-brand-mark { width: 16px; height: 16px; }
|
|
|
223
223
|
.conversation-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
|
|
224
224
|
.conversation-list:empty { display: none; }
|
|
225
225
|
.conversation-item { min-width: 0; }
|
|
226
|
+
.conversation-item:has(> .conversation-copy) {
|
|
227
|
+
display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 6px;
|
|
228
|
+
}
|
|
229
|
+
.conversation-copy { white-space: nowrap; }
|
|
226
230
|
.conversation-row {
|
|
227
231
|
display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; align-items: center; text-align: left;
|
|
228
232
|
width: 100%; min-block-size: 58px; padding: 8px; border: 1px solid transparent; border-radius: 3px;
|
|
@@ -388,6 +392,30 @@ pre {
|
|
|
388
392
|
.history-source { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
|
|
389
393
|
.history-choice:not([hidden]) { margin-block-end: 14px; }
|
|
390
394
|
.dialog-text[data-format='history'] { display: grid; gap: 9px; min-width: 0; }
|
|
395
|
+
.history-search-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
|
|
396
|
+
.history-search-tools select { width: auto; max-width: 100%; }
|
|
397
|
+
.history-match-snippet { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
|
|
398
|
+
.history-match-snippet mark { color: var(--accent); background: var(--field); font-weight: 650; }
|
|
399
|
+
.bridge-reader .reader-row.history-jump-match { background: var(--field); scroll-margin: 8px; }
|
|
400
|
+
.history-excerpt-option { display: inline-flex; align-items: center; gap: 6px; }
|
|
401
|
+
.history-excerpt-list { list-style: none; padding: 0; margin: 8px 0 12px; }
|
|
402
|
+
.history-excerpt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-block: 6px; }
|
|
403
|
+
.history-excerpt > span { min-width: 0; overflow-wrap: anywhere; }
|
|
404
|
+
.history-context-messages { display: grid; gap: 8px; }
|
|
405
|
+
.history-context-body { white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
406
|
+
.relay-columns { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); }
|
|
407
|
+
.relay-column { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
|
|
408
|
+
.relay-column h3 { margin-bottom: 8px; font-size: .9rem; }
|
|
409
|
+
.relay-items { display: grid; gap: 9px; }
|
|
410
|
+
.relay-items:not(:empty) + .relay-empty { display: none; }
|
|
411
|
+
.relay-item { min-width: 0; padding: 9px; background: var(--field); border-radius: 7px; }
|
|
412
|
+
.relay-source, .relay-editor summary { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
|
|
413
|
+
.relay-text { margin-block: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
414
|
+
.relay-editor summary { margin-block-start: 7px; cursor: pointer; }
|
|
415
|
+
.relay-form { display: grid; gap: 6px; }
|
|
416
|
+
.relay-form textarea { min-height: 85px; width: 100%; padding: 6px; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); }
|
|
417
|
+
.relay-actions { display: flex; flex-wrap: wrap; gap: 5px; }
|
|
418
|
+
.relay-actions select, .reader-actions select { width: auto; }
|
|
391
419
|
.history-message { padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; }
|
|
392
420
|
.history-message[data-role='user'] { background: var(--field); }
|
|
393
421
|
.history-message .preview-body { margin-block-start: 4px; }
|
package/web/panel.html
CHANGED
|
@@ -144,6 +144,7 @@
|
|
|
144
144
|
</header>
|
|
145
145
|
<p id="recent-status" class="recent-status" role="status"></p>
|
|
146
146
|
<ul id="recent-conversations" class="conversation-list" aria-label="最近对话"></ul>
|
|
147
|
+
<button id="project-relay" class="text-action" type="button">项目接力单</button>
|
|
147
148
|
<button id="browse-history" class="text-action" type="button" hidden>
|
|
148
149
|
<span id="browse-history-label">查看全部对话</span><svg class="icon" aria-hidden="true"><use href="#icon-arrow"/></svg>
|
|
149
150
|
</button>
|
|
@@ -214,9 +215,16 @@
|
|
|
214
215
|
<div class="field">
|
|
215
216
|
<svg class="icon field-icon" aria-hidden="true"><use href="#icon-search"/></svg>
|
|
216
217
|
<label class="sr-only" for="history-search">搜索来源对话</label>
|
|
217
|
-
<input id="history-search" type="search" placeholder="
|
|
218
|
+
<input id="history-search" type="search" placeholder="搜本项目的对话正文" autocomplete="off" maxlength="200">
|
|
218
219
|
<button class="clear-search icon-button" id="clear-history-search" type="button" aria-label="清除对话搜索" hidden><svg class="icon" aria-hidden="true"><use href="#icon-close"/></svg></button>
|
|
219
220
|
</div>
|
|
221
|
+
<div class="history-search-tools">
|
|
222
|
+
<select id="history-search-scope" aria-label="对话搜索范围">
|
|
223
|
+
<option value="body">正文</option>
|
|
224
|
+
<option value="title">标题或 Agent</option>
|
|
225
|
+
</select>
|
|
226
|
+
<span id="history-selected-count" class="muted" role="status"></span>
|
|
227
|
+
</div>
|
|
220
228
|
<p id="history-empty" class="recent-status" role="status"></p>
|
|
221
229
|
<ul id="history-results" class="conversation-list" aria-label="来源对话"></ul>
|
|
222
230
|
<button id="history-more" class="secondary" type="button" hidden>显示更多</button>
|
|
@@ -227,7 +235,7 @@
|
|
|
227
235
|
</div>
|
|
228
236
|
<div id="history-back" class="history-back" hidden>
|
|
229
237
|
<button id="history-back-button" class="text-action" type="button">
|
|
230
|
-
<svg class="icon" aria-hidden="true"><use href="#icon-chevron"/></svg
|
|
238
|
+
<svg class="icon" aria-hidden="true"><use href="#icon-chevron"/></svg>返回对话搜索
|
|
231
239
|
</button>
|
|
232
240
|
</div>
|
|
233
241
|
<div id="dialog-text" class="dialog-text" tabindex="0"></div>
|
|
@@ -244,17 +252,22 @@
|
|
|
244
252
|
</details>
|
|
245
253
|
</div>
|
|
246
254
|
<footer class="dialog-actions">
|
|
255
|
+
<button id="relay-return" class="secondary" type="button" hidden>项目接力单</button>
|
|
256
|
+
<button id="relay-pick" class="secondary" type="button" hidden>从对话选内容</button>
|
|
257
|
+
<button id="relay-export" class="primary" type="button" hidden>审阅并导出接力单</button>
|
|
247
258
|
<label id="export-trace-option" class="export-trace-option" hidden>
|
|
248
259
|
<input type="checkbox" id="export-trace">
|
|
249
260
|
<span>附带来源记录(工具名与结果摘录)</span>
|
|
250
261
|
</label>
|
|
251
262
|
<a id="export-download" class="secondary" download hidden><svg class="icon button-icon" aria-hidden="true"><use href="#icon-download"/></svg>下载 Markdown</a>
|
|
252
263
|
<button id="export" class="secondary" type="button" hidden><svg class="icon button-icon" aria-hidden="true"><use href="#icon-download"/></svg>导出本机版</button>
|
|
253
|
-
<button id="export-share" class="secondary" type="button" hidden><svg class="icon button-icon" aria-hidden="true"><use href="#icon-download"/></svg
|
|
264
|
+
<button id="export-share" class="secondary" type="button" hidden><svg class="icon button-icon" aria-hidden="true"><use href="#icon-download"/></svg>审阅分享版</button>
|
|
254
265
|
<button id="recover-draft" class="secondary" type="button" hidden>打开已创建的会话</button>
|
|
255
266
|
<button id="skill-undo" class="secondary" type="button" hidden>恢复上一版</button>
|
|
256
267
|
<button id="skill-deactivate" class="secondary" type="button" hidden>停用技能</button>
|
|
257
268
|
<button id="skill-apply" class="primary" type="button" hidden><span id="skill-apply-label">启用技能</span><svg class="icon button-icon" aria-hidden="true"><use href="#icon-arrow"/></svg></button>
|
|
269
|
+
<button id="history-copy" class="secondary" type="button" hidden>另开副本</button>
|
|
270
|
+
<button id="history-open-existing" class="primary" type="button" hidden>打开已有会话<svg class="icon button-icon" aria-hidden="true"><use href="#icon-arrow"/></svg></button>
|
|
258
271
|
<button id="history-import" class="primary" type="button" hidden><span id="history-import-label">迁入并继续</span><svg class="icon button-icon" aria-hidden="true"><use href="#icon-arrow"/></svg></button>
|
|
259
272
|
<button id="import" class="primary" type="button" hidden>打开新对话<svg class="icon button-icon" aria-hidden="true"><use href="#icon-arrow"/></svg></button>
|
|
260
273
|
</footer>
|