@chenkai114/dsh-team-admin 0.1.2 → 0.1.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/package.json +1 -1
- package/src/client.js +11 -3
- package/src/dismiss.mjs +27 -1
- package/src/index.js +1 -1
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -104,9 +104,17 @@
|
|
|
104
104
|
.ta-confirm__actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
|
|
105
105
|
.ta-summary{font-size:12px;color:var(--ta-text-sub);line-height:1.5}
|
|
106
106
|
.ta-host{display:block;min-width:0}
|
|
107
|
-
|
|
108
|
-
.ta-
|
|
109
|
-
|
|
107
|
+
/* 整页面板:宿主 main 槽是 flex column,这里把卡片与左右两栏一路撑满,滚动只发生在内部列表 */
|
|
108
|
+
.ta-main{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden;padding:18px;background:var(--dsw-alias-bg-base)}
|
|
109
|
+
.ta-main__inner{display:flex;flex-direction:column;flex:1;min-height:0;width:100%;min-width:0}
|
|
110
|
+
.ta-main .ta-host{display:flex;flex-direction:column;flex:1;min-height:0}
|
|
111
|
+
.ta-main .ta-root{flex:1;min-height:0}
|
|
112
|
+
.ta-main .ta-body{flex:1;min-height:0;grid-template-rows:minmax(0,1fr);align-items:stretch}
|
|
113
|
+
.ta-main .ta-col{min-height:0}
|
|
114
|
+
.ta-main .ta-list-host{display:flex;flex-direction:column;flex:1;min-height:0}
|
|
115
|
+
.ta-main .ta-sessions{flex:1;min-height:0;max-height:none}
|
|
116
|
+
.ta-main .ta-col--detail{overflow:auto;padding-right:2px}
|
|
117
|
+
@media (max-width:760px){.ta-body{grid-template-columns:1fr}.ta-col--list{padding-right:0;padding-bottom:10px;border-right:0;border-bottom:1px solid var(--ta-border)}.ta-sessions{max-height:220px}.ta-main .ta-body{grid-template-rows:minmax(0,1fr) minmax(0,1fr)}}
|
|
110
118
|
@media (prefers-reduced-motion:reduce){.ta-btn{transition:none}}
|
|
111
119
|
`
|
|
112
120
|
|
package/src/dismiss.mjs
CHANGED
|
@@ -148,7 +148,30 @@ async function stopMember(ctx, { leadSessionId, memberId, timeoutMs, logSystem }
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
|
-
*
|
|
151
|
+
* 释放一个子会话的 Activation 注册:宿主 GUI 的子智能体选择器按注册列表渲染,
|
|
152
|
+
* 只删会话文件不会摘掉该条目(点进去报 subagent/not-found)。
|
|
153
|
+
* 宿主没有该方法、Lead Agent 不在线或释放失败都只记日志——删除本身已经生效。
|
|
154
|
+
* @param {object} ctx - 宿主上下文。
|
|
155
|
+
* @param {{leadSessionId: string, memberId: string, logSystem: (line: string) => void}} request - 根会话、成员、日志函数。
|
|
156
|
+
* @returns {Promise<void>} 释放结束(失败已吞并记录)。
|
|
157
|
+
*/
|
|
158
|
+
async function releaseActivation(ctx, { leadSessionId, memberId, logSystem }) {
|
|
159
|
+
const subagents = service(ctx, 'subagents')
|
|
160
|
+
if (subagents === undefined || typeof subagents.drainChildren !== 'function') return
|
|
161
|
+
const leadAgent = liveAgent(ctx, leadSessionId)
|
|
162
|
+
if (leadAgent === undefined) {
|
|
163
|
+
logSystem('[team-admin] 无法释放 ' + memberId + ' 的子会话激活:Lead Agent 未加载')
|
|
164
|
+
return
|
|
165
|
+
}
|
|
166
|
+
try {
|
|
167
|
+
await subagents.drainChildren(leadAgent, [memberId])
|
|
168
|
+
} catch (error) {
|
|
169
|
+
logSystem('[team-admin] 释放子会话激活 ' + memberId + ' 失败:' + String(error?.message ?? error))
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* 删除一个团队成员:停会话 → 子会话目录进回收站 → 释放子会话激活 → 写墓碑。
|
|
152
175
|
* @param {object} ctx - 宿主上下文(sessionPersistence / agents / subagents 均可选)。
|
|
153
176
|
* @param {{sessionId: string, name: string, deleteSession?: boolean}} request - 根会话、成员名、是否清理子会话(默认 true)。
|
|
154
177
|
* @param {{store?: object, now?: number|(() => number), logSystem?: (line: string) => void, interruptTimeoutMs?: number}} [options]
|
|
@@ -235,6 +258,9 @@ export async function dismissMember(ctx, request, options = {}) {
|
|
|
235
258
|
}
|
|
236
259
|
}
|
|
237
260
|
|
|
261
|
+
// 移动成功后释放该子会话的 Activation 注册;失败只记日志,删除与墓碑照常。
|
|
262
|
+
if (sessionDeleted) await releaseActivation(ctx, { leadSessionId: sessionId, memberId, logSystem })
|
|
263
|
+
|
|
238
264
|
const record = await store.record(sessionId, memberId, {
|
|
239
265
|
name: isRecord(member) && typeof member.name === 'string' ? member.name : name,
|
|
240
266
|
dismissedAt: stamp,
|
package/src/index.js
CHANGED
|
@@ -17,7 +17,7 @@ const DATA_DIR_ENV = 'DSH_TEAM_ADMIN_DATA_DIR'
|
|
|
17
17
|
/** 路由前缀:webServer 只支持 exact/prefix 注册。 */
|
|
18
18
|
const ROUTE_PREFIX = '/api/team-admin'
|
|
19
19
|
/** 与 package.json 版本保持一致(发布前由测试校验)。 */
|
|
20
|
-
const PLUGIN_VERSION = '0.1.
|
|
20
|
+
const PLUGIN_VERSION = '0.1.4'
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* 解析插件数据目录。
|