@zhin.js/plugin-calendar 0.1.3 → 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/CHANGELOG.md +16 -0
- package/README.md +39 -35
- package/package.json +10 -9
- package/plugin.js +1 -2
- package/schema.json +209 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @zhin.js/plugin-calendar
|
|
2
2
|
|
|
3
|
+
## 0.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9816c18: 将应用插件装配改为 configVersion: 2:主配置 plugins 映射实例名到包,disable_plugins 控制启停,业务配置使用顶层同名块。package.json 继续保留 features、entry、engine 等包契约,并支持静态 displayName/icon。
|
|
8
|
+
|
|
9
|
+
这是配置格式的破坏性更新:旧配置不能继续运行,请先停止 Bot,运行 `zhin migrate instances` 预览,再使用 `--apply` 转换;提供备份与中断继续/回滚,无法无损转换的嵌套、optional 和别名碰撞需人工迁移。Runtime、Console、CLI 与创建向导统一使用新声明。
|
|
10
|
+
|
|
11
|
+
保留框架顶层 `menuKeyword` / `menuStyle`,通过当前 generation 的 Root 配置视图供 Command Feature 消费;严格校验和配置修改不会丢失菜单设置,子实例配置保持隔离。
|
|
12
|
+
|
|
13
|
+
- 8550f17: 补齐 Host 配置字段定义与未配置区块入口,完整投影对象、字典、联合、元组和本地引用,避免 Console 丢字段或整份退回源码。原始 Runtime Schema 继续负责校验。日历、提醒、复读和短链接发布静态配置定义,禁用时也可安全配置,无需执行插件代码。
|
|
14
|
+
- Updated dependencies [2b4d6dc]
|
|
15
|
+
- @zhin.js/host-http@1.1.7
|
|
16
|
+
- @zhin.js/skill@1.1.7
|
|
17
|
+
- @zhin.js/tool@1.1.7
|
|
18
|
+
|
|
3
19
|
## 0.1.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -49,35 +49,37 @@ refresh_token 的读取顺序:**插件数据库(聊天授权写入)优先*
|
|
|
49
49
|
## 配置(`zhin.config.yml`)
|
|
50
50
|
|
|
51
51
|
```yaml
|
|
52
|
+
configVersion: 2
|
|
52
53
|
plugins:
|
|
53
|
-
calendar:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
54
|
+
calendar: "@zhin.js/plugin-calendar"
|
|
55
|
+
calendar:
|
|
56
|
+
provider: google # none | caldav | google | microsoft
|
|
57
|
+
timezone: Asia/Manila
|
|
58
|
+
work_day_start: "09:00"
|
|
59
|
+
work_day_end: "18:00"
|
|
60
|
+
# OAuth 回调:默认使用 zhin HTTP Host 的本机地址,例如 http://127.0.0.1:8068/calendar/oauth/callback
|
|
61
|
+
oauth_redirect_base_url: "" # 浏览器和机器人不在同一台机器时,填外部可访问地址,如 https://bot.example.com
|
|
62
|
+
oauth_callback_path: /calendar/oauth/callback
|
|
63
|
+
google:
|
|
64
|
+
enabled: true
|
|
65
|
+
client_id: ${GOOGLE_CALENDAR_CLIENT_ID}
|
|
66
|
+
client_secret: ${GOOGLE_CALENDAR_CLIENT_SECRET}
|
|
67
|
+
refresh_token: "" # 可选后备;聊天授权后可以留空
|
|
68
|
+
calendar_id: primary
|
|
69
|
+
token_file: ""
|
|
70
|
+
microsoft:
|
|
71
|
+
enabled: false
|
|
72
|
+
client_id: ${MS_GRAPH_CLIENT_ID}
|
|
73
|
+
client_secret: ${MS_GRAPH_CLIENT_SECRET} # 公共客户端可留空
|
|
74
|
+
refresh_token: ""
|
|
75
|
+
tenant: common
|
|
76
|
+
calendar_id: "" # 空 / primary / me = 默认日历;否则 Graph calendar id
|
|
77
|
+
token_file: ""
|
|
78
|
+
caldav:
|
|
79
|
+
enabled: false
|
|
80
|
+
calendar_url: ${CALDAV_CALENDAR_URL}
|
|
81
|
+
username: ${CALDAV_USERNAME}
|
|
82
|
+
password: ${CALDAV_PASSWORD}
|
|
81
83
|
```
|
|
82
84
|
|
|
83
85
|
运行项目的 `.env`(放在启动 zhin 的项目根目录,不是插件目录):
|
|
@@ -137,14 +139,16 @@ oauth_callback_path: /grokbot/calendar/oauth/callback
|
|
|
137
139
|
## CalDAV
|
|
138
140
|
|
|
139
141
|
```yaml
|
|
142
|
+
configVersion: 2
|
|
140
143
|
plugins:
|
|
141
|
-
calendar:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
calendar: "@zhin.js/plugin-calendar"
|
|
145
|
+
calendar:
|
|
146
|
+
provider: caldav
|
|
147
|
+
caldav:
|
|
148
|
+
enabled: true
|
|
149
|
+
calendar_url: ${CALDAV_CALENDAR_URL} # 日历 collection URL
|
|
150
|
+
username: ${CALDAV_USERNAME}
|
|
151
|
+
password: ${CALDAV_PASSWORD} # iCloud 请使用 App 专用密码
|
|
148
152
|
```
|
|
149
153
|
|
|
150
154
|
CalDAV 不需要聊天授权。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/plugin-calendar",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "CalDAV / Google / Microsoft calendar tools for Zhin Agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"lib",
|
|
23
23
|
"skills",
|
|
24
24
|
"README.md",
|
|
25
|
-
"CHANGELOG.md"
|
|
25
|
+
"CHANGELOG.md",
|
|
26
|
+
"schema.json"
|
|
26
27
|
],
|
|
27
28
|
"keywords": [
|
|
28
29
|
"zhin",
|
|
@@ -38,22 +39,22 @@
|
|
|
38
39
|
"url": "https://github.com/lc-cn"
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
|
-
"@zhin.js/host-http": "1.1.
|
|
42
|
+
"@zhin.js/host-http": "1.1.7",
|
|
42
43
|
"@zhin.js/im-contract": "1.1.4",
|
|
43
|
-
"@zhin.js/skill": "1.1.
|
|
44
|
-
"@zhin.js/tool": "1.1.
|
|
44
|
+
"@zhin.js/skill": "1.1.7",
|
|
45
|
+
"@zhin.js/tool": "1.1.7"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"typescript": "^6.0.3",
|
|
48
49
|
"vitest": "^4.1.10",
|
|
49
50
|
"zod": "^4.4.3",
|
|
50
|
-
"@zhin.js/command": "1.1.
|
|
51
|
-
"zhin.js": "1.1.
|
|
51
|
+
"@zhin.js/command": "1.1.8",
|
|
52
|
+
"zhin.js": "1.1.11"
|
|
52
53
|
},
|
|
53
54
|
"peerDependencies": {
|
|
54
55
|
"zod": "^4.0.0",
|
|
55
|
-
"@zhin.js/command": "^1.1.
|
|
56
|
-
"zhin.js": "^1.1.
|
|
56
|
+
"@zhin.js/command": "^1.1.8",
|
|
57
|
+
"zhin.js": "^1.1.11"
|
|
57
58
|
},
|
|
58
59
|
"peerDependenciesMeta": {
|
|
59
60
|
"@zhin.js/command": {
|
package/plugin.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
2
|
import { databaseHostToken, definePlugin, outboundHostToken, } from "zhin.js";
|
|
3
3
|
import { httpHostToken } from "@zhin.js/host-http";
|
|
4
|
-
import { assertCalendarTimezone,
|
|
4
|
+
import { assertCalendarTimezone, createCalendarProvider, createOAuthTokenManagers, } from "./lib/index.js";
|
|
5
5
|
import { buildRedirectUri, CalendarAuthService, DEFAULT_OAUTH_CALLBACK_PATH, localOriginFromAddress, } from "./lib/chat-auth.js";
|
|
6
6
|
import { CalendarCredentialStore, } from "./lib/credential-store.js";
|
|
7
7
|
import { registerOAuthCallbackRoute } from "./lib/http-callback.js";
|
|
8
8
|
import { calendarRuntimeToken } from "./lib/runtime.js";
|
|
9
9
|
export default definePlugin({
|
|
10
10
|
name: "calendar",
|
|
11
|
-
config: calendarConfig,
|
|
12
11
|
metadata: { displayName: "日历" },
|
|
13
12
|
setup(context) {
|
|
14
13
|
const config = context.config.get();
|
package/schema.json
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"additionalProperties": false,
|
|
4
|
+
"properties": {
|
|
5
|
+
"provider": {
|
|
6
|
+
"anyOf": [
|
|
7
|
+
{
|
|
8
|
+
"const": "none",
|
|
9
|
+
"default": "none"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"const": "caldav",
|
|
13
|
+
"default": "caldav"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"const": "google",
|
|
17
|
+
"default": "google"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"const": "microsoft",
|
|
21
|
+
"default": "microsoft"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"description": "日历后端;none 时工具返回未启用提示",
|
|
25
|
+
"default": "none",
|
|
26
|
+
"x-zhin-config": {
|
|
27
|
+
"effect": "reload"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"timezone": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "解释无偏移时间与展示用的 IANA 时区",
|
|
33
|
+
"default": "Asia/Manila",
|
|
34
|
+
"x-zhin-config": {
|
|
35
|
+
"effect": "reload"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"work_day_start": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"default": "09:00",
|
|
41
|
+
"x-zhin-config": {
|
|
42
|
+
"effect": "reload"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"work_day_end": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"default": "18:00",
|
|
48
|
+
"x-zhin-config": {
|
|
49
|
+
"effect": "reload"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"oauth_redirect_base_url": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"description": "聊天授权回调的外部基础地址(如 https://bot.example.com);留空时使用 zhin HTTP Host 的本机地址",
|
|
55
|
+
"default": "",
|
|
56
|
+
"x-zhin-config": {
|
|
57
|
+
"effect": "reload"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"oauth_callback_path": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"description": "聊天授权回调路由,挂在 zhin HTTP Host 上;反向代理/隧道只转发部分路径时可调整",
|
|
63
|
+
"default": "/calendar/oauth/callback",
|
|
64
|
+
"x-zhin-config": {
|
|
65
|
+
"effect": "reload"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"caldav": {
|
|
69
|
+
"type": "object",
|
|
70
|
+
"additionalProperties": false,
|
|
71
|
+
"properties": {
|
|
72
|
+
"enabled": {
|
|
73
|
+
"type": "boolean",
|
|
74
|
+
"default": false
|
|
75
|
+
},
|
|
76
|
+
"calendar_url": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"description": "日历 collection URL",
|
|
79
|
+
"default": "",
|
|
80
|
+
"x-zhin-config": {
|
|
81
|
+
"effect": "reload"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"username": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"default": "",
|
|
87
|
+
"x-zhin-config": {
|
|
88
|
+
"effect": "reload"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"password": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"default": "",
|
|
94
|
+
"x-zhin-config": {
|
|
95
|
+
"effect": "reload"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"google": {
|
|
101
|
+
"type": "object",
|
|
102
|
+
"additionalProperties": false,
|
|
103
|
+
"properties": {
|
|
104
|
+
"enabled": {
|
|
105
|
+
"type": "boolean",
|
|
106
|
+
"default": false
|
|
107
|
+
},
|
|
108
|
+
"client_id": {
|
|
109
|
+
"type": "string",
|
|
110
|
+
"description": "${GOOGLE_CALENDAR_CLIENT_ID}",
|
|
111
|
+
"default": "",
|
|
112
|
+
"x-zhin-config": {
|
|
113
|
+
"effect": "reload"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"client_secret": {
|
|
117
|
+
"type": "string",
|
|
118
|
+
"description": "${GOOGLE_CALENDAR_CLIENT_SECRET}",
|
|
119
|
+
"default": "",
|
|
120
|
+
"x-zhin-config": {
|
|
121
|
+
"effect": "reload"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"refresh_token": {
|
|
125
|
+
"type": "string",
|
|
126
|
+
"description": "${GOOGLE_CALENDAR_REFRESH_TOKEN};用 auth google 获取",
|
|
127
|
+
"default": "",
|
|
128
|
+
"x-zhin-config": {
|
|
129
|
+
"effect": "reload"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"calendar_id": {
|
|
133
|
+
"type": "string",
|
|
134
|
+
"description": "日历 ID,默认 primary;可换成其它日历的 id",
|
|
135
|
+
"default": "primary",
|
|
136
|
+
"x-zhin-config": {
|
|
137
|
+
"effect": "reload"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"token_file": {
|
|
141
|
+
"type": "string",
|
|
142
|
+
"description": "可选:持久化轮换后的 refresh_token 的 JSON 路径(如 data/calendar-google-token.json)",
|
|
143
|
+
"default": "",
|
|
144
|
+
"x-zhin-config": {
|
|
145
|
+
"effect": "reload"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"microsoft": {
|
|
151
|
+
"type": "object",
|
|
152
|
+
"additionalProperties": false,
|
|
153
|
+
"properties": {
|
|
154
|
+
"enabled": {
|
|
155
|
+
"type": "boolean",
|
|
156
|
+
"default": false
|
|
157
|
+
},
|
|
158
|
+
"client_id": {
|
|
159
|
+
"type": "string",
|
|
160
|
+
"description": "${MS_GRAPH_CLIENT_ID}",
|
|
161
|
+
"default": "",
|
|
162
|
+
"x-zhin-config": {
|
|
163
|
+
"effect": "reload"
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"client_secret": {
|
|
167
|
+
"type": "string",
|
|
168
|
+
"description": "可选;公共客户端可留空。${MS_GRAPH_CLIENT_SECRET}",
|
|
169
|
+
"default": "",
|
|
170
|
+
"x-zhin-config": {
|
|
171
|
+
"effect": "reload"
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"refresh_token": {
|
|
175
|
+
"type": "string",
|
|
176
|
+
"description": "${MS_GRAPH_REFRESH_TOKEN};用 auth microsoft 获取",
|
|
177
|
+
"default": "",
|
|
178
|
+
"x-zhin-config": {
|
|
179
|
+
"effect": "reload"
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"tenant": {
|
|
183
|
+
"type": "string",
|
|
184
|
+
"description": "Azure tenant,默认 common",
|
|
185
|
+
"default": "common",
|
|
186
|
+
"x-zhin-config": {
|
|
187
|
+
"effect": "reload"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"calendar_id": {
|
|
191
|
+
"type": "string",
|
|
192
|
+
"description": "留空或 primary/me = 默认日历;否则为 Graph calendar id",
|
|
193
|
+
"default": "",
|
|
194
|
+
"x-zhin-config": {
|
|
195
|
+
"effect": "reload"
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
"token_file": {
|
|
199
|
+
"type": "string",
|
|
200
|
+
"description": "可选:持久化轮换后的 refresh_token 的 JSON 路径(如 data/calendar-ms-token.json)",
|
|
201
|
+
"default": "",
|
|
202
|
+
"x-zhin-config": {
|
|
203
|
+
"effect": "reload"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|