@dcrays/dcgchat-test 0.3.33 → 0.3.34

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcrays/dcgchat-test",
3
- "version": "0.3.33",
3
+ "version": "0.3.34",
4
4
  "type": "module",
5
5
  "description": "OpenClaw channel plugin for 书灵墨宝 (WebSocket)",
6
6
  "main": "index.ts",
package/src/cron.ts CHANGED
@@ -55,12 +55,8 @@ async function runCronJobsUpload(sessionKey: string): Promise<void> {
55
55
  if (fs.existsSync(jobPath)) {
56
56
  try {
57
57
  const url = await ossUpload(jobPath, botToken ?? '', 0)
58
- dcgLogger(`定时任务创建成功: ${url}`)
59
- if (!sessionKey) {
60
- dcgLogger(`runCronJobsUpload: missing sessionKey on msgCtx`, 'error')
61
- return
62
- }
63
- const sessionInfo = sessionKey.split(':')
58
+ dcgLogger(`定时任务更新成功: ${url}`)
59
+ const sessionInfo = sessionKey?.split(':') || []
64
60
  const sessionId = sessionInfo.at(-1) ?? ''
65
61
  const agentId = sessionInfo.at(-2) ?? ''
66
62
  const params = {
@@ -85,10 +81,6 @@ async function runCronJobsUpload(sessionKey: string): Promise<void> {
85
81
  export function sendDcgchatCron(jobId: string): void {
86
82
  const jobPath = getCronJobsPath()
87
83
  const { sessionKey } = readCronJob(jobPath, jobId) || {}
88
- if (!sessionKey) {
89
- dcgLogger('sendDcgchatCron: no message context (missing token / params)', 'error')
90
- return
91
- }
92
84
  dcgLogger(`sessionKey: ${sessionKey}, jobId: ${jobId}`)
93
85
  if (cronUploadFlushTimer !== null) {
94
86
  clearTimeout(cronUploadFlushTimer)
@@ -368,6 +368,9 @@ export class GatewayConnection {
368
368
  if (msg.payload?.action === 'updated') {
369
369
  sendDcgchatCron(msg.payload?.jobId as string)
370
370
  }
371
+ if (msg.payload?.action === 'removed') {
372
+ sendDcgchatCron(msg.payload?.jobId as string)
373
+ }
371
374
  if (msg.payload?.action === 'finished') {
372
375
  finishedDcgchatCron(msg.payload?.jobId as string)
373
376
  }