@dcrays/dcgchat-test 0.7.0 → 0.7.1

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.
@@ -12,8 +12,7 @@
12
12
  },
13
13
  "contracts": {
14
14
  "tools": [
15
- "dcgchat_message",
16
- "agent_send"
15
+ "dcgchat_message"
17
16
  ]
18
17
  },
19
18
  "channelConfigs": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcrays/dcgchat-test",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "description": "书灵墨宝Channel插件",
6
6
  "main": "index.js",
@@ -0,0 +1,221 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://dcgchat.local/schemas/gateway-cron-finished.payload.json",
4
+ "title": "Gateway WS event: cron finished (dcgchat contract)",
5
+ "description": "网关下行 `event: \"cron\"` 且 `payload.action === \"finished\"` 时的 payload 契约。当前插件 finished 分支强依赖 `jobId` 反查 OpenClaw cron job,`status !== \"ok\"` 会按失败处理,并优先从 `summary`、`error.message`、`diagnostics.summary` 生成用户可见失败提示。定时任务生成文件时,应在任务执行期间调用 `dcgchat_message`,使用 `media: [{ \"file\": \"绝对路径\" }]` 发送附件;finished 事件只负责收尾,不承载附件投递。cron 创建侧会把任务规范化为 `sessionTarget: \"current\"`、`wakeMode: \"now\"`、`delivery.mode: \"announce\"`、`delivery.to: \"dcg-cron:${sessionKey}\"`、`payload.kind: \"agentTurn\"`、`payload.timeoutSeconds >= 600`;若 finished 事件携带 `job`,建议使用同一形态。",
6
+ "type": "object",
7
+ "additionalProperties": true,
8
+ "required": ["action", "jobId", "status"],
9
+ "properties": {
10
+ "action": {
11
+ "const": "finished",
12
+ "description": "cron 生命周期动作;本 schema 仅描述 finished。"
13
+ },
14
+ "jobId": {
15
+ "$ref": "#/$defs/nonEmptyString",
16
+ "description": "OpenClaw cron job id;插件用它调用 `cron.get` 反查 sessionKey、标题和描述。"
17
+ },
18
+ "runId": {
19
+ "$ref": "#/$defs/nonEmptyString",
20
+ "description": "本次运行 id;如宿主支持 cron run 记录,建议携带。"
21
+ },
22
+ "status": {
23
+ "type": "string",
24
+ "minLength": 1,
25
+ "description": "`ok` 表示成功;当前插件会把任何非 `ok` 值视作失败,并向用户发送失败提示。",
26
+ "examples": ["ok", "failed", "error", "timeout", "cancelled"]
27
+ },
28
+ "summary": {
29
+ "type": "string",
30
+ "description": "运行摘要。失败时会作为首选失败详情;成功时当前 finished 分支不会主动发送该正文。"
31
+ },
32
+ "error": {
33
+ "$ref": "#/$defs/errorLike",
34
+ "description": "失败详情;当 `summary` 为空时,插件会读取字符串值或对象中的 `message`。"
35
+ },
36
+ "diagnostics": {
37
+ "type": "object",
38
+ "additionalProperties": true,
39
+ "description": "宿主诊断信息;当前插件会在失败时读取 `diagnostics.summary` 作为兜底详情。",
40
+ "properties": {
41
+ "summary": { "type": "string" },
42
+ "status": { "type": "string" },
43
+ "error": { "$ref": "#/$defs/errorLike" },
44
+ "durationMs": { "type": "integer", "minimum": 0 }
45
+ }
46
+ },
47
+ "sessionKey": {
48
+ "$ref": "#/$defs/nonEmptyString",
49
+ "description": "可选冗余字段。DCG 会话 key;如果携带,应与 `job.sessionKey` 或 `job.delivery.to` 去掉 `dcg-cron:` 前缀后一致。"
50
+ },
51
+ "sessionId": {
52
+ "type": "string",
53
+ "description": "可选冗余字段。当前 finished 分支不直接使用,实际路由以 `cron.get(jobId)` 返回的 sessionKey 为准。"
54
+ },
55
+ "delivery": {
56
+ "$ref": "#/$defs/delivery",
57
+ "description": "可选冗余字段。建议与 `job.delivery` 保持一致,便于日志和外部消费者定位投递目标。"
58
+ },
59
+ "job": {
60
+ "$ref": "#/$defs/cronJob",
61
+ "description": "可选 cron job 快照。若宿主在 finished 事件中携带,建议使用 DCG 创建侧规范化后的完整 job。"
62
+ },
63
+ "startedAtMs": { "$ref": "#/$defs/epochMs" },
64
+ "finishedAtMs": { "$ref": "#/$defs/epochMs" },
65
+ "durationMs": {
66
+ "type": "integer",
67
+ "minimum": 0,
68
+ "description": "本次运行耗时,单位毫秒。"
69
+ },
70
+ "delivered": {
71
+ "type": "boolean",
72
+ "description": "宿主 delivery 层是否已完成投递尝试;当前插件不依赖该字段。"
73
+ },
74
+ "deliveryStatus": {
75
+ "type": "string",
76
+ "description": "宿主 delivery 层状态;当前插件不依赖该字段。",
77
+ "examples": ["sent", "skipped", "failed", "best-effort"]
78
+ }
79
+ },
80
+ "$defs": {
81
+ "nonEmptyString": {
82
+ "type": "string",
83
+ "minLength": 1
84
+ },
85
+ "epochMs": {
86
+ "type": "integer",
87
+ "minimum": 0,
88
+ "description": "Unix epoch milliseconds。"
89
+ },
90
+ "errorLike": {
91
+ "oneOf": [
92
+ { "type": "string" },
93
+ {
94
+ "type": "object",
95
+ "additionalProperties": true,
96
+ "properties": {
97
+ "message": { "type": "string" },
98
+ "code": { "type": ["string", "number"] },
99
+ "name": { "type": "string" },
100
+ "stack": { "type": "string" }
101
+ }
102
+ }
103
+ ]
104
+ },
105
+ "delivery": {
106
+ "type": "object",
107
+ "additionalProperties": true,
108
+ "properties": {
109
+ "mode": {
110
+ "const": "announce",
111
+ "description": "DCG cron 创建侧固定为 announce。"
112
+ },
113
+ "channel": {
114
+ "enum": ["dcgchat", "dcgchat-test"],
115
+ "description": "DCG channel id;生产为 `dcgchat`,测试默认是 `dcgchat-test`。"
116
+ },
117
+ "to": {
118
+ "type": "string",
119
+ "pattern": "^dcg-cron:.+",
120
+ "description": "投递目标,固定使用 `dcg-cron:${sessionKey}`。"
121
+ },
122
+ "bestEffort": {
123
+ "const": true,
124
+ "description": "DCG cron 创建侧固定为 true。"
125
+ },
126
+ "accountId": {
127
+ "type": "string",
128
+ "description": "从 sessionKey 解析出的 agentId。"
129
+ },
130
+ "intended": {
131
+ "type": "object",
132
+ "additionalProperties": true,
133
+ "properties": {
134
+ "to": { "type": "string" }
135
+ }
136
+ },
137
+ "resolved": {
138
+ "type": "object",
139
+ "additionalProperties": true,
140
+ "properties": {
141
+ "to": { "type": "string" }
142
+ }
143
+ }
144
+ }
145
+ },
146
+ "schedule": {
147
+ "type": "object",
148
+ "additionalProperties": true,
149
+ "properties": {
150
+ "kind": {
151
+ "type": "string",
152
+ "examples": ["cron", "at", "every"]
153
+ },
154
+ "cron": { "type": "string" },
155
+ "expr": { "type": "string" },
156
+ "tz": {
157
+ "type": "string",
158
+ "description": "cron 表达式任务由 DCG 创建侧补为 `Asia/Shanghai`。"
159
+ },
160
+ "at": { "type": "string" },
161
+ "atMs": { "$ref": "#/$defs/epochMs" },
162
+ "every": { "type": "string" },
163
+ "everyMs": { "type": "integer", "minimum": 1 },
164
+ "anchorMs": { "$ref": "#/$defs/epochMs" },
165
+ "stagger": { "type": "string" },
166
+ "staggerMs": { "type": "integer", "minimum": 0 },
167
+ "exact": { "type": "boolean" }
168
+ }
169
+ },
170
+ "cronPayload": {
171
+ "type": "object",
172
+ "additionalProperties": true,
173
+ "properties": {
174
+ "kind": {
175
+ "type": "string",
176
+ "description": "普通 DCG cron 创建侧默认为 `agentTurn`;`systemEvent` 会保留并使用 `text`。"
177
+ },
178
+ "message": { "type": "string" },
179
+ "text": { "type": "string" },
180
+ "timeoutSeconds": {
181
+ "type": "number",
182
+ "minimum": 600,
183
+ "description": "普通 agentTurn cron 由 DCG 创建侧补为至少 600 秒。"
184
+ },
185
+ "model": { "type": "string" },
186
+ "fallbacks": { "type": "array" },
187
+ "thinking": {},
188
+ "toolsAllow": { "type": "array", "items": { "type": "string" } },
189
+ "lightContext": { "type": "boolean" },
190
+ "allowUnsafeExternalContent": { "type": "boolean" }
191
+ }
192
+ },
193
+ "cronJob": {
194
+ "type": "object",
195
+ "additionalProperties": true,
196
+ "properties": {
197
+ "id": { "$ref": "#/$defs/nonEmptyString" },
198
+ "name": { "type": "string" },
199
+ "description": { "type": "string" },
200
+ "enabled": { "type": "boolean" },
201
+ "deleteAfterRun": { "type": "boolean" },
202
+ "sessionKey": { "$ref": "#/$defs/nonEmptyString" },
203
+ "sessionTarget": {
204
+ "const": "current",
205
+ "description": "DCG cron 创建侧固定为 current。"
206
+ },
207
+ "wakeMode": {
208
+ "const": "now",
209
+ "description": "DCG cron 创建侧固定为 now。"
210
+ },
211
+ "delivery": { "$ref": "#/$defs/delivery" },
212
+ "schedule": { "$ref": "#/$defs/schedule" },
213
+ "payload": { "$ref": "#/$defs/cronPayload" },
214
+ "failureAlert": {},
215
+ "agentId": { "type": "string" },
216
+ "createdAtMs": { "$ref": "#/$defs/epochMs" },
217
+ "updatedAtMs": { "$ref": "#/$defs/epochMs" }
218
+ }
219
+ }
220
+ }
221
+ }
@@ -1,39 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://dcgchat.local/schemas/gateway-cron-finished.payload.json",
4
- "title": "Gateway WS event: cron finished (dcgchat contract)",
5
- "description": "网关下行 `event: \"cron\"` 且 `payload.action === \"finished\"` 时,书灵通道插件读取的约定字段。`attachments` 为首选:须为 Gateway 进程可读的绝对路径,经通道 sendMedia 发送。若宿主未提供 `attachments`,插件会回退为仅在工作区/挂载规则下从 `summary` 提取路径(与 dcgchat_message 一致),直至宿主实现本字段。",
6
- "type": "object",
7
- "properties": {
8
- "jobId": { "type": "string" },
9
- "action": { "const": "finished" },
10
- "status": { "type": "string" },
11
- "summary": { "type": "string" },
12
- "delivered": { "type": "boolean" },
13
- "deliveryStatus": { "type": "string" },
14
- "sessionId": { "type": "string" },
15
- "sessionKey": { "type": "string" },
16
- "attachments": {
17
- "type": "array",
18
- "description": "本轮定时任务产出的本地文件路径,按顺序经通道发送为附件",
19
- "items": {
20
- "oneOf": [
21
- {
22
- "type": "string",
23
- "minLength": 1,
24
- "description": "绝对路径"
25
- },
26
- {
27
- "type": "object",
28
- "additionalProperties": false,
29
- "properties": {
30
- "path": { "type": "string", "minLength": 1 },
31
- "file": { "type": "string", "minLength": 1 }
32
- },
33
- "description": "对象形式:优先读取 `path`,否则 `file`"
34
- }
35
- ]
36
- }
37
- }
38
- }
39
- }