@xmodelin/dsh-collab-sessions 0.0.3 → 0.0.4
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 +23 -0
- package/client.js +67 -47
- package/index.js +166 -506
- package/lib/access-policy.js +71 -0
- package/lib/audit.js +34 -0
- package/lib/cancel-request.js +11 -0
- package/lib/delivery-manifest.js +63 -0
- package/lib/health.js +29 -0
- package/lib/panel-api.js +12 -0
- package/lib/presets.js +4 -0
- package/lib/prompt.js +107 -0
- package/lib/task-aliases.js +61 -0
- package/lib/task-views.js +26 -0
- package/lib/tasks.js +0 -5
- package/lib/tool-schemas.js +220 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -252,6 +252,27 @@ Every named session row has a copy action in its hover strip, and the session
|
|
|
252
252
|
right-click menu has **复制会话名 / Copy session name**. The action copies the
|
|
253
253
|
display name to the clipboard and briefly marks the button as copied.
|
|
254
254
|
|
|
255
|
+
## Diagnostics
|
|
256
|
+
|
|
257
|
+
Use `collab_doctor` for a read-only health snapshot of the collaboration session:
|
|
258
|
+
|
|
259
|
+
- registry size;
|
|
260
|
+
- relationship and invalid relationship counts;
|
|
261
|
+
- grant and invalid grant counts;
|
|
262
|
+
- task / active task counts;
|
|
263
|
+
- request / active request counts;
|
|
264
|
+
- audit readability.
|
|
265
|
+
|
|
266
|
+
The append-only audit log lives at:
|
|
267
|
+
|
|
268
|
+
```text
|
|
269
|
+
<state>/audit.jsonl
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
It records authorization, request acceptance, task assignment/completion/closure,
|
|
273
|
+
and delivery publication. Losing the audit file does not affect task or request
|
|
274
|
+
state.
|
|
275
|
+
|
|
255
276
|
## Manual state recovery
|
|
256
277
|
|
|
257
278
|
State is under the DSH home:
|
|
@@ -264,6 +285,7 @@ State is under the DSH home:
|
|
|
264
285
|
tasks.json tasks and subtasks
|
|
265
286
|
requests.json requester↔supervisor requests and deliveries
|
|
266
287
|
notices.json durable protocol notice outbox
|
|
288
|
+
audit.jsonl append-only collaboration action audit
|
|
267
289
|
```
|
|
268
290
|
|
|
269
291
|
A malformed document is moved aside as:
|
|
@@ -333,6 +355,7 @@ That backup is the **bad** file, not a clean backup. Do not restore it blindly.
|
|
|
333
355
|
| `tasks.json` | Task board shows the desired tasks/subtasks; delivery artifacts remain on disk. |
|
|
334
356
|
| `requests.json` | Requester and supervisor can list the requests that still exist. |
|
|
335
357
|
| `notices.json` | Pending wake-ups may be gone; the task/request stores remain authoritative. |
|
|
358
|
+
| `audit.jsonl` | Audit history is append-only; losing it does not affect task/request state. |
|
|
336
359
|
|
|
337
360
|
### Empty skeletons
|
|
338
361
|
|
package/client.js
CHANGED
|
@@ -17,6 +17,20 @@ window.__ModuleLoader__.load({
|
|
|
17
17
|
const React = require('react')
|
|
18
18
|
const h = React.createElement
|
|
19
19
|
const NS = 'dsh-collab-sessions'
|
|
20
|
+
/** Compatibility copy and selectors tied to DSH preset chrome. */
|
|
21
|
+
const COMPAT = Object.freeze({
|
|
22
|
+
presetText: /(协同会话|超级会话|Collab session|Supervisor session)/u,
|
|
23
|
+
modeChip:
|
|
24
|
+
'button[aria-haspopup="menu"][title*="Agent 预设"],'
|
|
25
|
+
+ 'button[aria-haspopup="menu"][title*="Agent preset"]',
|
|
26
|
+
labels: Object.freeze({
|
|
27
|
+
collab: '协同会话',
|
|
28
|
+
supervisor: '超级会话',
|
|
29
|
+
collabEn: 'Collab session',
|
|
30
|
+
supervisorEn: 'Supervisor session',
|
|
31
|
+
}),
|
|
32
|
+
})
|
|
33
|
+
|
|
20
34
|
const BOARD_TAB_ID = '@xmodelin/dsh-collab-sessions/supervisor-tasks'
|
|
21
35
|
const BOARD_TAB_KIND = 'collabSupervisorTasks'
|
|
22
36
|
const WORKERS_TAB_ID = '@xmodelin/dsh-collab-sessions/supervisor-workers'
|
|
@@ -765,6 +779,7 @@ window.__ModuleLoader__.load({
|
|
|
765
779
|
: sorted.map(summary => h('label', {
|
|
766
780
|
key: summary.id,
|
|
767
781
|
className: 'dsh-collab-auth-row',
|
|
782
|
+
'data-collab-preset': presetOf(summary.id) ?? '',
|
|
768
783
|
},
|
|
769
784
|
h('input', {
|
|
770
785
|
type: 'checkbox',
|
|
@@ -1860,8 +1875,8 @@ window.__ModuleLoader__.load({
|
|
|
1860
1875
|
React.useEffect(() => {
|
|
1861
1876
|
const translatePresetCopy = () => {
|
|
1862
1877
|
const pairs = [
|
|
1863
|
-
[
|
|
1864
|
-
[
|
|
1878
|
+
[COMPAT.labels.collab, t('preset.collabName')],
|
|
1879
|
+
[COMPAT.labels.supervisor, t('preset.supervisorName')],
|
|
1865
1880
|
['拥有独立的 .dsh-collab 工作目录、共享的 comm/ 目录和仅本会话可访问的 private/ 目录,并提供经过身份验证的会话间通信工具。', t('preset.collabDescription')],
|
|
1866
1881
|
['负责拆解需求、把子任务分派给已登记的功能会话、核验结果并完成交付;不提供任何实现类工具。', t('preset.supervisorDescription')],
|
|
1867
1882
|
]
|
|
@@ -1878,7 +1893,7 @@ window.__ModuleLoader__.load({
|
|
|
1878
1893
|
// The collab entry's own dropdown also uses role=menuitem.
|
|
1879
1894
|
if (node.closest('.dsh-collab-new-menu') !== null) continue
|
|
1880
1895
|
const text = node.textContent ?? ''
|
|
1881
|
-
if (
|
|
1896
|
+
if (!COMPAT.presetText.test(text)) continue
|
|
1882
1897
|
node.hidden = true
|
|
1883
1898
|
node.setAttribute('aria-hidden', 'true')
|
|
1884
1899
|
node.style.setProperty('display', 'none', 'important')
|
|
@@ -1905,38 +1920,32 @@ window.__ModuleLoader__.load({
|
|
|
1905
1920
|
return () => root.removeAttribute('data-collab-preset-lock')
|
|
1906
1921
|
}, [locked])
|
|
1907
1922
|
return h('style', null,
|
|
1908
|
-
|
|
1909
|
-
+ 'html[data-collab-preset-lock="true"] button[aria-haspopup="menu"][title*="Agent preset"]{display:none!important}')
|
|
1923
|
+
`html[data-collab-preset-lock="true"] ${COMPAT.modeChip}{display:none!important}`)
|
|
1910
1924
|
}
|
|
1911
1925
|
|
|
1912
|
-
|
|
1926
|
+
const autoSeededSupervisorTabs = new Set()
|
|
1927
|
+
|
|
1928
|
+
function CollabSupervisorTabsAutoSeed(props) {
|
|
1913
1929
|
const sessions = props.useSessions(selectSnapshot)
|
|
1914
|
-
const
|
|
1915
|
-
|
|
1930
|
+
const main = Object.values(sessions?.byId ?? {})
|
|
1931
|
+
.find(summary => (summary.retainedBy?.mainView ?? 0) > 0)
|
|
1932
|
+
const preset = main?.projectionValues?.agentPreset
|
|
1933
|
+
?? sessions?.projectionsBySession?.[main?.id]?.values?.agentPreset
|
|
1934
|
+
const sessionId = main?.id
|
|
1916
1935
|
React.useEffect(() => {
|
|
1917
|
-
if (
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
if (wasExpanded) return
|
|
1926
|
-
wasExpanded = true
|
|
1927
|
-
props.openGuide(props.sessionId)
|
|
1928
|
-
props.openTasks(props.sessionId)
|
|
1929
|
-
props.openWorkers(props.sessionId)
|
|
1930
|
-
}
|
|
1931
|
-
seed()
|
|
1932
|
-
const timer = setInterval(seed, 200)
|
|
1933
|
-
return () => clearInterval(timer)
|
|
1934
|
-
}, [supervisor, props.sessionId])
|
|
1936
|
+
if (preset !== 'supervisor' || sessionId === undefined) return undefined
|
|
1937
|
+
if (autoSeededSupervisorTabs.has(sessionId)) return undefined
|
|
1938
|
+
autoSeededSupervisorTabs.add(sessionId)
|
|
1939
|
+
props.openTasks(sessionId)
|
|
1940
|
+
props.openWorkers(sessionId)
|
|
1941
|
+
props.openGuide(sessionId)
|
|
1942
|
+
return undefined
|
|
1943
|
+
}, [preset, sessionId])
|
|
1935
1944
|
return null
|
|
1936
1945
|
}
|
|
1937
1946
|
|
|
1938
1947
|
return {
|
|
1939
|
-
__test: { isCollabSummary, isSupervisorSessionSummary, parseBasePromptCommand },
|
|
1948
|
+
__test: { isCollabSummary, isSupervisorSessionSummary, parseBasePromptCommand, COMPAT },
|
|
1940
1949
|
inject: ['slots', 'locale', 'uiWorkspace', 'sessions', 'remote', 'remote.commands', 'remote.collabAuth', 'uiConversation', 'layout', 'sidebarRight', 'sidebarRightTabs'],
|
|
1941
1950
|
apply(ctx) {
|
|
1942
1951
|
ctx.effect(() => ctx.locale.register(NS, { zh: ZH, en: EN }), 'collab-sessions: dictionaries')
|
|
@@ -1947,8 +1956,27 @@ window.__ModuleLoader__.load({
|
|
|
1947
1956
|
revoke: async (a, b) => ctx.remote.collabAuth === undefined ? authUnavailable : ctx.remote.collabAuth.revoke(a, b),
|
|
1948
1957
|
}
|
|
1949
1958
|
const callPanel = (sessionId, operation, args) => {
|
|
1950
|
-
|
|
1951
|
-
|
|
1959
|
+
const auth = ctx.remote.collabAuth
|
|
1960
|
+
if (auth === undefined) return Promise.resolve(authUnavailable)
|
|
1961
|
+
const payload = args ?? {}
|
|
1962
|
+
if (operation === 'board' && typeof auth.board === 'function') return auth.board(sessionId)
|
|
1963
|
+
if (operation === 'link' && typeof auth.link === 'function') {
|
|
1964
|
+
return auth.link(sessionId, String(payload.worker ?? ''), JSON.stringify(payload.payload ?? {}))
|
|
1965
|
+
}
|
|
1966
|
+
if (operation === 'unlink' && typeof auth.unlink === 'function') {
|
|
1967
|
+
return auth.unlink(sessionId, String(payload.worker ?? ''))
|
|
1968
|
+
}
|
|
1969
|
+
if (operation === 'pin' && typeof auth.pin === 'function') {
|
|
1970
|
+
return auth.pin(sessionId, String(payload.worker ?? ''))
|
|
1971
|
+
}
|
|
1972
|
+
if (operation === 'live' && typeof auth.live === 'function') {
|
|
1973
|
+
return auth.live(sessionId, String(payload.worker ?? ''))
|
|
1974
|
+
}
|
|
1975
|
+
if (operation === 'baseGet' && typeof auth.baseGet === 'function') return auth.baseGet(sessionId)
|
|
1976
|
+
if (operation === 'baseSet' && typeof auth.baseSet === 'function') {
|
|
1977
|
+
return auth.baseSet(sessionId, String(payload.value ?? ''))
|
|
1978
|
+
}
|
|
1979
|
+
return auth.panel(sessionId, operation, JSON.stringify(payload))
|
|
1952
1980
|
}
|
|
1953
1981
|
|
|
1954
1982
|
const panelCommand = async (sessionId, operation, args) => {
|
|
@@ -2102,24 +2130,6 @@ window.__ModuleLoader__.load({
|
|
|
2102
2130
|
order: 100,
|
|
2103
2131
|
}, CollabPresetLockProbe))
|
|
2104
2132
|
|
|
2105
|
-
ctx.slots.inject('conversation.session.header.utilities', () => ctx.slots.register({
|
|
2106
|
-
name: 'conversation.session.header.utilities',
|
|
2107
|
-
id: 'collab-supervisor-tabs-on-open',
|
|
2108
|
-
order: 11,
|
|
2109
|
-
inject: () => ({
|
|
2110
|
-
isExpanded: () => ctx.sidebarRight.isExpanded(),
|
|
2111
|
-
openGuide: () => ctx.sidebarRight.openTab('guide', { revealIfOpened: true }),
|
|
2112
|
-
openTasks: (sessionId) => ctx.sidebarRight.openTab(BOARD_TAB_KIND, {
|
|
2113
|
-
params: { sessionId },
|
|
2114
|
-
revealIfOpened: false,
|
|
2115
|
-
}),
|
|
2116
|
-
openWorkers: (sessionId) => ctx.sidebarRight.openTab(WORKERS_TAB_KIND, {
|
|
2117
|
-
params: { sessionId },
|
|
2118
|
-
revealIfOpened: false,
|
|
2119
|
-
}),
|
|
2120
|
-
}),
|
|
2121
|
-
}, CollabSupervisorTabsOnOpen))
|
|
2122
|
-
|
|
2123
2133
|
ctx.effect(
|
|
2124
2134
|
() => ctx.uiConversation.events.register(collabAuthRefusedDefinition),
|
|
2125
2135
|
'collab-sessions: authorization-refusal turn data',
|
|
@@ -2148,6 +2158,16 @@ window.__ModuleLoader__.load({
|
|
|
2148
2158
|
locale: NS,
|
|
2149
2159
|
}, CollabBasePromptEditor))
|
|
2150
2160
|
|
|
2161
|
+
ctx.slots.inject('shell.overlay', () => ctx.slots.register({
|
|
2162
|
+
name: 'shell.overlay',
|
|
2163
|
+
id: 'collab-supervisor-tabs-auto-seed',
|
|
2164
|
+
inject: () => ({
|
|
2165
|
+
openGuide: (sessionId) => ctx.sidebarRight.openTab('guide', { params: { sessionId }, revealIfOpened: false }),
|
|
2166
|
+
openTasks: (sessionId) => ctx.sidebarRight.openTab(BOARD_TAB_KIND, { params: { sessionId }, revealIfOpened: false }),
|
|
2167
|
+
openWorkers: (sessionId) => ctx.sidebarRight.openTab(WORKERS_TAB_KIND, { params: { sessionId }, revealIfOpened: false }),
|
|
2168
|
+
}),
|
|
2169
|
+
}, CollabSupervisorTabsAutoSeed))
|
|
2170
|
+
|
|
2151
2171
|
ctx.slots.inject('shell.overlay', () => ctx.slots.register({
|
|
2152
2172
|
name: 'shell.overlay',
|
|
2153
2173
|
id: 'collab-preset-menu-filter',
|