dsh-feishu-lark-notify 0.26.1 → 0.26.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/lib/index.js +13 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -37,7 +37,7 @@ import { startWsInbound } from './inbound-ws.js'
|
|
|
37
37
|
export const name = 'feishu-notify'
|
|
38
38
|
|
|
39
39
|
/** 版本号(与 package.json 保持一致,单测会校验)。 */
|
|
40
|
-
export const VERSION = '0.26.
|
|
40
|
+
export const VERSION = '0.26.2'
|
|
41
41
|
|
|
42
42
|
/** 内存日志上限。 */
|
|
43
43
|
const LOG_LIMIT = 200
|
|
@@ -1912,6 +1912,14 @@ export function apply(ctx, rawConfig) {
|
|
|
1912
1912
|
return { ok: true, path: filePath, prompt, kindLabel }
|
|
1913
1913
|
}
|
|
1914
1914
|
|
|
1915
|
+
/**
|
|
1916
|
+
* 生成一个不会撞车的会话 id(`session-<uuid>`,与 DSH 自己的命名习惯一致)。
|
|
1917
|
+
* @returns 会话 id。
|
|
1918
|
+
*/
|
|
1919
|
+
function newSessionId() {
|
|
1920
|
+
return `session-${crypto.randomUUID()}`
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1915
1923
|
/**
|
|
1916
1924
|
* 新建会话时借一个模型配置。
|
|
1917
1925
|
*
|
|
@@ -1955,6 +1963,7 @@ export function apply(ctx, rawConfig) {
|
|
|
1955
1963
|
return { ok: false, created: false, reason: 'unsupported' }
|
|
1956
1964
|
}
|
|
1957
1965
|
// 借一个「活着的」agent 来取模型配置(liveSessions() 是投影对象,没有 options)
|
|
1966
|
+
// 会话 id 自己生成,避免宿主用 session-1/session-2 这种会撞车的自增 id
|
|
1958
1967
|
const anchorAgent = (() => {
|
|
1959
1968
|
try {
|
|
1960
1969
|
const roots = ctx.get('agents')?.roots?.() ?? []
|
|
@@ -1980,6 +1989,9 @@ export function apply(ctx, rawConfig) {
|
|
|
1980
1989
|
let handle
|
|
1981
1990
|
try {
|
|
1982
1991
|
handle = await agents.create({
|
|
1992
|
+
// 必须自己给一个唯一 id:不给的话宿主会生成 `session-1`、`session-2` 这种,
|
|
1993
|
+
// 一旦上一次那个还活着,第二次建就直接报 `session "session-1" already exists`。
|
|
1994
|
+
sessionId: newSessionId(),
|
|
1983
1995
|
agentOptions: {
|
|
1984
1996
|
provider: model.provider,
|
|
1985
1997
|
model: model.model,
|