@zhin.js/plugin-calendar 0.1.12 → 0.1.14
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 +40 -0
- package/README.md +4 -0
- package/lib/config.d.ts +204 -55
- package/lib/config.d.ts.map +1 -1
- package/lib/console.d.ts +4 -0
- package/lib/console.d.ts.map +1 -0
- package/lib/console.js +36 -0
- package/lib/console.js.map +1 -0
- package/lib/credential-store.d.ts +4 -3
- package/lib/credential-store.d.ts.map +1 -1
- package/lib/credential-store.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/runtime.d.ts +2 -1
- package/lib/runtime.d.ts.map +1 -1
- package/lib/runtime.js +3 -2
- package/lib/runtime.js.map +1 -1
- package/package.json +19 -9
- package/pages/index/index.js +57 -0
- package/pages/index/index.ts +66 -0
- package/plugin.js +21 -7
- package/src/console.ts +56 -0
- package/src/credential-store.ts +5 -4
- package/src/index.ts +1 -0
- package/src/runtime.ts +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @zhin.js/plugin-calendar
|
|
2
2
|
|
|
3
|
+
## 0.1.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- cbf1fb1: Unify Console page blueprints (`definePageBlueprint`, `defineAdapterPage`, `defineCommentReviewPage`, `projectBlueprintToImCard`, `projectBlueprintToCliPanel`) into `@zhin.js/console-contract` and `@zhin.js/page`, add zero-esbuild pure Blueprint synthesis + static client bundle mounting to `@zhin.js/pagemanager`, remove `@zhin.js/client` (React 19) and `.tsx` from all 30 server-side plugins and adapters (including `bilibili` and `juejin`), and remove legacy Era-1 Koa `PageManager` code.
|
|
8
|
+
- 5419b88: Add generation-scoped `definePluginStore` (`PluginStore`), `Scope.get()`, declarative `PluginSetupCapabilities` return in `definePlugin()`, and `JsonSerializable<T>` typing on `PluginStateStore` to eliminate `as never` casts on TypeScript interfaces.
|
|
9
|
+
- Updated dependencies [cbf1fb1]
|
|
10
|
+
- Updated dependencies [008ccad]
|
|
11
|
+
- Updated dependencies [a1f1028]
|
|
12
|
+
- @zhin.js/console-contract@1.1.4
|
|
13
|
+
- @zhin.js/page@1.1.16
|
|
14
|
+
- @zhin.js/im-contract@1.1.13
|
|
15
|
+
- @zhin.js/host-http@1.1.16
|
|
16
|
+
- @zhin.js/tool@1.1.17
|
|
17
|
+
- @zhin.js/skill@1.1.15
|
|
18
|
+
|
|
19
|
+
## 0.1.13
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- aa41889: Upgrade official business plugins with declarative Console pages & AI skills/tools, decompose core monolith modules, and polish scaffolding DX:
|
|
24
|
+
|
|
25
|
+
- **Official Plugin Ecosystem Upgrade**: Add declarative Console pages (`pages/index/index.ts`), `definePluginConsoleRpc` handlers (`src/console.ts`), and progressive-disclosure AI skills/tools (`skills/<name>/tools/`) across `@zhin.js/plugin-ledger`, `@zhin.js/plugin-reminder`, `@zhin.js/plugin-rss`, `@zhin.js/plugin-calendar`, `@zhin.js/plugin-group-suite`, `@zhin.js/plugin-content-moderation`, `@zhin.js/process-monitor`, and `@zhin.js/plugin-game-hub`.
|
|
26
|
+
- **Core Monolith Decomposition**: Decompose 9 core monolith modules (`agent-core-run.ts`, `full-agent-turn-engine.ts`, `ingress-route.ts`, `request.ts`, `root-runtime.ts`, `account-runtime.ts`, `page-renderer.ts`, `console-rpc.ts`, and `console-rest-pages.ts`) into cohesive, acyclic submodules (`< 620` lines each) while preserving 100% of public exports.
|
|
27
|
+
- **Scaffolding & First-Screen DX**: Upgrade `create-zhin-app` and `@zhin.js/scaffold-wizard` to generate declarative `ConsolePageBlueprint` homepages and `definePluginConsoleRpc` status/ping endpoints in both `zh-CN` and `en`; upgrade `zhin new` (`@zhin.js/cli`) to include `pages/` and compile progressive-disclosure tools under `skills/**/tools/` and `agents/**/tools/`.
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [6163abc]
|
|
30
|
+
- Updated dependencies [fed2c27]
|
|
31
|
+
- Updated dependencies [bc6ccb1]
|
|
32
|
+
- Updated dependencies [72b5a12]
|
|
33
|
+
- Updated dependencies [aa41889]
|
|
34
|
+
- Updated dependencies [4427e72]
|
|
35
|
+
- Updated dependencies [22bd14a]
|
|
36
|
+
- @zhin.js/client@1.1.25
|
|
37
|
+
- @zhin.js/page@1.1.15
|
|
38
|
+
- @zhin.js/im-contract@1.1.12
|
|
39
|
+
- @zhin.js/host-http@1.1.15
|
|
40
|
+
- @zhin.js/tool@1.1.16
|
|
41
|
+
- @zhin.js/skill@1.1.14
|
|
42
|
+
|
|
3
43
|
## 0.1.12
|
|
4
44
|
|
|
5
45
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -193,6 +193,10 @@ npx zhin-calendar-auth microsoft
|
|
|
193
193
|
|
|
194
194
|
创建前应向用户确认标题、时间与时区。
|
|
195
195
|
|
|
196
|
+
## Console 状态页 (`pages/index`)
|
|
197
|
+
|
|
198
|
+
插件提供声明式 Console 页面(路由 `/calendar`,权限 `calendar:read`),通过 `plugin.<pluginId>.status` 只读展示当前日历后端(`provider`)、时区(`timezone`)、就绪状态(`ready`)、OAuth 回调路径(`oauthCallbackPath`)与工作时段(`workingHours`),不暴露任何客户端密钥或 `refresh_token`。
|
|
199
|
+
|
|
196
200
|
## Language / 语言
|
|
197
201
|
|
|
198
202
|
授权命令按当前操作语言回复,OAuth 回调页面、完成通知和后续授权失效通知固定使用发起授权时的语言。refresh_token 轮换保留该语言和原完整通知目标。状态页中的授权指令由当前命令上下文解析真实前缀与插件命名空间;没有可用命令上下文时只描述授权入口,不猜测指令。
|
package/lib/config.d.ts
CHANGED
|
@@ -11,12 +11,95 @@ export declare const calendarConfig: Schema<Schema.InputRecord<{
|
|
|
11
11
|
calendar_url: Schema<string, string> & Schema.Present;
|
|
12
12
|
username: Schema<string, string> & Schema.Present;
|
|
13
13
|
password: Schema<string, string> & Schema.Present;
|
|
14
|
-
}>, {
|
|
15
|
-
enabled: boolean;
|
|
16
|
-
calendar_url: string;
|
|
17
|
-
username: string;
|
|
18
|
-
password: string;
|
|
19
|
-
} & {
|
|
14
|
+
}>, Schema.RecordTypes<{
|
|
15
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
16
|
+
calendar_url: Schema<string, string> & Schema.Present;
|
|
17
|
+
username: Schema<string, string> & Schema.Present;
|
|
18
|
+
password: Schema<string, string> & Schema.Present;
|
|
19
|
+
}>> & {
|
|
20
|
+
readonly output?: Schema.RecordTypes<{
|
|
21
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
22
|
+
calendar_url: Schema<string, string> & Schema.Present;
|
|
23
|
+
username: Schema<string, string> & Schema.Present;
|
|
24
|
+
password: Schema<string, string> & Schema.Present;
|
|
25
|
+
}> | undefined;
|
|
26
|
+
};
|
|
27
|
+
google: Schema<Schema.InputRecord<{
|
|
28
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
29
|
+
client_id: Schema<string, string> & Schema.Present;
|
|
30
|
+
client_secret: Schema<string, string> & Schema.Present;
|
|
31
|
+
refresh_token: Schema<string, string> & Schema.Present;
|
|
32
|
+
calendar_id: Schema<string, string> & Schema.Present;
|
|
33
|
+
token_file: Schema<string, string> & Schema.Present;
|
|
34
|
+
}>, Schema.RecordTypes<{
|
|
35
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
36
|
+
client_id: Schema<string, string> & Schema.Present;
|
|
37
|
+
client_secret: Schema<string, string> & Schema.Present;
|
|
38
|
+
refresh_token: Schema<string, string> & Schema.Present;
|
|
39
|
+
calendar_id: Schema<string, string> & Schema.Present;
|
|
40
|
+
token_file: Schema<string, string> & Schema.Present;
|
|
41
|
+
}>> & {
|
|
42
|
+
readonly output?: Schema.RecordTypes<{
|
|
43
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
44
|
+
client_id: Schema<string, string> & Schema.Present;
|
|
45
|
+
client_secret: Schema<string, string> & Schema.Present;
|
|
46
|
+
refresh_token: Schema<string, string> & Schema.Present;
|
|
47
|
+
calendar_id: Schema<string, string> & Schema.Present;
|
|
48
|
+
token_file: Schema<string, string> & Schema.Present;
|
|
49
|
+
}> | undefined;
|
|
50
|
+
};
|
|
51
|
+
microsoft: Schema<Schema.InputRecord<{
|
|
52
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
53
|
+
client_id: Schema<string, string> & Schema.Present;
|
|
54
|
+
client_secret: Schema<string, string> & Schema.Present;
|
|
55
|
+
refresh_token: Schema<string, string> & Schema.Present;
|
|
56
|
+
tenant: Schema<string, string> & Schema.Present;
|
|
57
|
+
calendar_id: Schema<string, string> & Schema.Present;
|
|
58
|
+
token_file: Schema<string, string> & Schema.Present;
|
|
59
|
+
}>, Schema.RecordTypes<{
|
|
60
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
61
|
+
client_id: Schema<string, string> & Schema.Present;
|
|
62
|
+
client_secret: Schema<string, string> & Schema.Present;
|
|
63
|
+
refresh_token: Schema<string, string> & Schema.Present;
|
|
64
|
+
tenant: Schema<string, string> & Schema.Present;
|
|
65
|
+
calendar_id: Schema<string, string> & Schema.Present;
|
|
66
|
+
token_file: Schema<string, string> & Schema.Present;
|
|
67
|
+
}>> & {
|
|
68
|
+
readonly output?: Schema.RecordTypes<{
|
|
69
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
70
|
+
client_id: Schema<string, string> & Schema.Present;
|
|
71
|
+
client_secret: Schema<string, string> & Schema.Present;
|
|
72
|
+
refresh_token: Schema<string, string> & Schema.Present;
|
|
73
|
+
tenant: Schema<string, string> & Schema.Present;
|
|
74
|
+
calendar_id: Schema<string, string> & Schema.Present;
|
|
75
|
+
token_file: Schema<string, string> & Schema.Present;
|
|
76
|
+
}> | undefined;
|
|
77
|
+
};
|
|
78
|
+
}>, Schema.RecordTypes<{
|
|
79
|
+
provider: Schema<"caldav" | "google" | "microsoft" | "none", "caldav" | "google" | "microsoft" | "none"> & Schema.Present;
|
|
80
|
+
timezone: Schema<string, string> & Schema.Present;
|
|
81
|
+
work_day_start: Schema<string, string> & Schema.Present;
|
|
82
|
+
work_day_end: Schema<string, string> & Schema.Present;
|
|
83
|
+
oauth_redirect_base_url: Schema<string, string> & Schema.Present;
|
|
84
|
+
oauth_callback_path: Schema<string, string> & Schema.Present;
|
|
85
|
+
caldav: Schema<Schema.InputRecord<{
|
|
86
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
87
|
+
calendar_url: Schema<string, string> & Schema.Present;
|
|
88
|
+
username: Schema<string, string> & Schema.Present;
|
|
89
|
+
password: Schema<string, string> & Schema.Present;
|
|
90
|
+
}>, Schema.RecordTypes<{
|
|
91
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
92
|
+
calendar_url: Schema<string, string> & Schema.Present;
|
|
93
|
+
username: Schema<string, string> & Schema.Present;
|
|
94
|
+
password: Schema<string, string> & Schema.Present;
|
|
95
|
+
}>> & {
|
|
96
|
+
readonly output?: Schema.RecordTypes<{
|
|
97
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
98
|
+
calendar_url: Schema<string, string> & Schema.Present;
|
|
99
|
+
username: Schema<string, string> & Schema.Present;
|
|
100
|
+
password: Schema<string, string> & Schema.Present;
|
|
101
|
+
}> | undefined;
|
|
102
|
+
};
|
|
20
103
|
google: Schema<Schema.InputRecord<{
|
|
21
104
|
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
22
105
|
client_id: Schema<string, string> & Schema.Present;
|
|
@@ -24,14 +107,23 @@ export declare const calendarConfig: Schema<Schema.InputRecord<{
|
|
|
24
107
|
refresh_token: Schema<string, string> & Schema.Present;
|
|
25
108
|
calendar_id: Schema<string, string> & Schema.Present;
|
|
26
109
|
token_file: Schema<string, string> & Schema.Present;
|
|
27
|
-
}>, {
|
|
28
|
-
enabled: boolean;
|
|
29
|
-
client_id: string;
|
|
30
|
-
client_secret: string;
|
|
31
|
-
refresh_token: string;
|
|
32
|
-
calendar_id: string;
|
|
33
|
-
token_file: string;
|
|
34
|
-
} & {
|
|
110
|
+
}>, Schema.RecordTypes<{
|
|
111
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
112
|
+
client_id: Schema<string, string> & Schema.Present;
|
|
113
|
+
client_secret: Schema<string, string> & Schema.Present;
|
|
114
|
+
refresh_token: Schema<string, string> & Schema.Present;
|
|
115
|
+
calendar_id: Schema<string, string> & Schema.Present;
|
|
116
|
+
token_file: Schema<string, string> & Schema.Present;
|
|
117
|
+
}>> & {
|
|
118
|
+
readonly output?: Schema.RecordTypes<{
|
|
119
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
120
|
+
client_id: Schema<string, string> & Schema.Present;
|
|
121
|
+
client_secret: Schema<string, string> & Schema.Present;
|
|
122
|
+
refresh_token: Schema<string, string> & Schema.Present;
|
|
123
|
+
calendar_id: Schema<string, string> & Schema.Present;
|
|
124
|
+
token_file: Schema<string, string> & Schema.Present;
|
|
125
|
+
}> | undefined;
|
|
126
|
+
};
|
|
35
127
|
microsoft: Schema<Schema.InputRecord<{
|
|
36
128
|
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
37
129
|
client_id: Schema<string, string> & Schema.Present;
|
|
@@ -40,47 +132,104 @@ export declare const calendarConfig: Schema<Schema.InputRecord<{
|
|
|
40
132
|
tenant: Schema<string, string> & Schema.Present;
|
|
41
133
|
calendar_id: Schema<string, string> & Schema.Present;
|
|
42
134
|
token_file: Schema<string, string> & Schema.Present;
|
|
43
|
-
}>, {
|
|
44
|
-
enabled: boolean;
|
|
45
|
-
client_id: string;
|
|
46
|
-
client_secret: string;
|
|
47
|
-
refresh_token: string;
|
|
48
|
-
tenant: string;
|
|
49
|
-
calendar_id: string;
|
|
50
|
-
token_file: string;
|
|
51
|
-
} & {
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
135
|
+
}>, Schema.RecordTypes<{
|
|
136
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
137
|
+
client_id: Schema<string, string> & Schema.Present;
|
|
138
|
+
client_secret: Schema<string, string> & Schema.Present;
|
|
139
|
+
refresh_token: Schema<string, string> & Schema.Present;
|
|
140
|
+
tenant: Schema<string, string> & Schema.Present;
|
|
141
|
+
calendar_id: Schema<string, string> & Schema.Present;
|
|
142
|
+
token_file: Schema<string, string> & Schema.Present;
|
|
143
|
+
}>> & {
|
|
144
|
+
readonly output?: Schema.RecordTypes<{
|
|
145
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
146
|
+
client_id: Schema<string, string> & Schema.Present;
|
|
147
|
+
client_secret: Schema<string, string> & Schema.Present;
|
|
148
|
+
refresh_token: Schema<string, string> & Schema.Present;
|
|
149
|
+
tenant: Schema<string, string> & Schema.Present;
|
|
150
|
+
calendar_id: Schema<string, string> & Schema.Present;
|
|
151
|
+
token_file: Schema<string, string> & Schema.Present;
|
|
152
|
+
}> | undefined;
|
|
153
|
+
};
|
|
154
|
+
}>> & {
|
|
155
|
+
readonly output?: Schema.RecordTypes<{
|
|
156
|
+
provider: Schema<"caldav" | "google" | "microsoft" | "none", "caldav" | "google" | "microsoft" | "none"> & Schema.Present;
|
|
157
|
+
timezone: Schema<string, string> & Schema.Present;
|
|
158
|
+
work_day_start: Schema<string, string> & Schema.Present;
|
|
159
|
+
work_day_end: Schema<string, string> & Schema.Present;
|
|
160
|
+
oauth_redirect_base_url: Schema<string, string> & Schema.Present;
|
|
161
|
+
oauth_callback_path: Schema<string, string> & Schema.Present;
|
|
162
|
+
caldav: Schema<Schema.InputRecord<{
|
|
163
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
164
|
+
calendar_url: Schema<string, string> & Schema.Present;
|
|
165
|
+
username: Schema<string, string> & Schema.Present;
|
|
166
|
+
password: Schema<string, string> & Schema.Present;
|
|
167
|
+
}>, Schema.RecordTypes<{
|
|
168
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
169
|
+
calendar_url: Schema<string, string> & Schema.Present;
|
|
170
|
+
username: Schema<string, string> & Schema.Present;
|
|
171
|
+
password: Schema<string, string> & Schema.Present;
|
|
172
|
+
}>> & {
|
|
173
|
+
readonly output?: Schema.RecordTypes<{
|
|
174
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
175
|
+
calendar_url: Schema<string, string> & Schema.Present;
|
|
176
|
+
username: Schema<string, string> & Schema.Present;
|
|
177
|
+
password: Schema<string, string> & Schema.Present;
|
|
178
|
+
}> | undefined;
|
|
179
|
+
};
|
|
180
|
+
google: Schema<Schema.InputRecord<{
|
|
181
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
182
|
+
client_id: Schema<string, string> & Schema.Present;
|
|
183
|
+
client_secret: Schema<string, string> & Schema.Present;
|
|
184
|
+
refresh_token: Schema<string, string> & Schema.Present;
|
|
185
|
+
calendar_id: Schema<string, string> & Schema.Present;
|
|
186
|
+
token_file: Schema<string, string> & Schema.Present;
|
|
187
|
+
}>, Schema.RecordTypes<{
|
|
188
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
189
|
+
client_id: Schema<string, string> & Schema.Present;
|
|
190
|
+
client_secret: Schema<string, string> & Schema.Present;
|
|
191
|
+
refresh_token: Schema<string, string> & Schema.Present;
|
|
192
|
+
calendar_id: Schema<string, string> & Schema.Present;
|
|
193
|
+
token_file: Schema<string, string> & Schema.Present;
|
|
194
|
+
}>> & {
|
|
195
|
+
readonly output?: Schema.RecordTypes<{
|
|
196
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
197
|
+
client_id: Schema<string, string> & Schema.Present;
|
|
198
|
+
client_secret: Schema<string, string> & Schema.Present;
|
|
199
|
+
refresh_token: Schema<string, string> & Schema.Present;
|
|
200
|
+
calendar_id: Schema<string, string> & Schema.Present;
|
|
201
|
+
token_file: Schema<string, string> & Schema.Present;
|
|
202
|
+
}> | undefined;
|
|
203
|
+
};
|
|
204
|
+
microsoft: Schema<Schema.InputRecord<{
|
|
205
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
206
|
+
client_id: Schema<string, string> & Schema.Present;
|
|
207
|
+
client_secret: Schema<string, string> & Schema.Present;
|
|
208
|
+
refresh_token: Schema<string, string> & Schema.Present;
|
|
209
|
+
tenant: Schema<string, string> & Schema.Present;
|
|
210
|
+
calendar_id: Schema<string, string> & Schema.Present;
|
|
211
|
+
token_file: Schema<string, string> & Schema.Present;
|
|
212
|
+
}>, Schema.RecordTypes<{
|
|
213
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
214
|
+
client_id: Schema<string, string> & Schema.Present;
|
|
215
|
+
client_secret: Schema<string, string> & Schema.Present;
|
|
216
|
+
refresh_token: Schema<string, string> & Schema.Present;
|
|
217
|
+
tenant: Schema<string, string> & Schema.Present;
|
|
218
|
+
calendar_id: Schema<string, string> & Schema.Present;
|
|
219
|
+
token_file: Schema<string, string> & Schema.Present;
|
|
220
|
+
}>> & {
|
|
221
|
+
readonly output?: Schema.RecordTypes<{
|
|
222
|
+
enabled: Schema<boolean, boolean> & Schema.Present;
|
|
223
|
+
client_id: Schema<string, string> & Schema.Present;
|
|
224
|
+
client_secret: Schema<string, string> & Schema.Present;
|
|
225
|
+
refresh_token: Schema<string, string> & Schema.Present;
|
|
226
|
+
tenant: Schema<string, string> & Schema.Present;
|
|
227
|
+
calendar_id: Schema<string, string> & Schema.Present;
|
|
228
|
+
token_file: Schema<string, string> & Schema.Present;
|
|
229
|
+
}> | undefined;
|
|
230
|
+
};
|
|
231
|
+
}> | undefined;
|
|
232
|
+
};
|
|
84
233
|
export type CalendarConfig = Schema.Output<typeof calendarConfig>;
|
|
85
234
|
export declare function assertCalendarTimezone(timezone: string): void;
|
|
86
235
|
export { cleanSecret } from "./secrets.js";
|
package/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2FzB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC;AAElE,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAQ7D;AAED,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
|
package/lib/console.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../src/console.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,gBAAgB,EAItB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAmB1E,wBAAgB,wBAAwB,CAAC,cAAc,CAAC,EAAE,eAAe,GAAG,gBAAgB,CA0B3F"}
|
package/lib/console.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { definePluginConsoleRpc, PluginConsoleRpcError, } from 'zhin.js';
|
|
2
|
+
import { DEFAULT_OAUTH_CALLBACK_PATH } from './chat-auth.js';
|
|
3
|
+
import { calendarRuntimeToken } from './runtime.js';
|
|
4
|
+
function resolveCalendarRuntime(call, fallback) {
|
|
5
|
+
const runtime = call.runtime?.use?.(calendarRuntimeToken) ?? fallback;
|
|
6
|
+
if (!runtime) {
|
|
7
|
+
throw new PluginConsoleRpcError('unavailable', 'Calendar runtime is not initialized');
|
|
8
|
+
}
|
|
9
|
+
return runtime;
|
|
10
|
+
}
|
|
11
|
+
export function createCalendarConsoleRpc(defaultRuntime) {
|
|
12
|
+
return definePluginConsoleRpc({
|
|
13
|
+
status: {
|
|
14
|
+
page: 'index',
|
|
15
|
+
requiredPermissions: ['calendar:read'],
|
|
16
|
+
handler(_input, call) {
|
|
17
|
+
const runtime = resolveCalendarRuntime(call, defaultRuntime);
|
|
18
|
+
const cfg = runtime.config;
|
|
19
|
+
const start = cfg.workday_start_hour !== undefined
|
|
20
|
+
? `${cfg.workday_start_hour}:00`
|
|
21
|
+
: cfg.work_day_start?.trim() || '09:00';
|
|
22
|
+
const end = cfg.workday_end_hour !== undefined
|
|
23
|
+
? `${cfg.workday_end_hour}:00`
|
|
24
|
+
: cfg.work_day_end?.trim() || '18:00';
|
|
25
|
+
return {
|
|
26
|
+
provider: cfg.provider,
|
|
27
|
+
timezone: cfg.timezone,
|
|
28
|
+
ready: Boolean(runtime.provider),
|
|
29
|
+
oauthCallbackPath: cfg.oauth_callback_path?.trim() || DEFAULT_OAUTH_CALLBACK_PATH,
|
|
30
|
+
workingHours: `${start} - ${end}`,
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=console.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console.js","sourceRoot":"","sources":["../src/console.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GAKtB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAAE,oBAAoB,EAAwB,MAAM,cAAc,CAAC;AAW1E,SAAS,sBAAsB,CAAC,IAA0B,EAAE,QAA0B;IACpF,MAAM,OAAO,GAAI,IAAI,CAAC,OAA6C,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,IAAI,QAAQ,CAAC;IAC7G,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,qBAAqB,CAAC,aAAa,EAAE,qCAAqC,CAAC,CAAC;IACxF,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,cAAgC;IACvE,OAAO,sBAAsB,CAAC;QAC5B,MAAM,EAAE;YACN,IAAI,EAAE,OAAO;YACb,mBAAmB,EAAE,CAAC,eAAe,CAAC;YACtC,OAAO,CAAC,MAA6B,EAAE,IAA0B;gBAC/D,MAAM,OAAO,GAAG,sBAAsB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;gBAC7D,MAAM,GAAG,GAAG,OAAO,CAAC,MAAgC,CAAC;gBACrD,MAAM,KAAK,GACT,GAAG,CAAC,kBAAkB,KAAK,SAAS;oBAClC,CAAC,CAAC,GAAG,GAAG,CAAC,kBAAkB,KAAK;oBAChC,CAAC,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC;gBAC5C,MAAM,GAAG,GACP,GAAG,CAAC,gBAAgB,KAAK,SAAS;oBAChC,CAAC,CAAC,GAAG,GAAG,CAAC,gBAAgB,KAAK;oBAC9B,CAAC,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC;gBAC1C,OAAO;oBACL,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC;oBAChC,iBAAiB,EAAE,GAAG,CAAC,mBAAmB,EAAE,IAAI,EAAE,IAAI,2BAA2B;oBACjF,YAAY,EAAE,GAAG,KAAK,MAAM,GAAG,EAAE;iBAClC,CAAC;YACJ,CAAC;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Locale } from 'zhin.js/i18n';
|
|
2
|
+
import type { JsonSerializable, JsonValue } from 'zhin.js';
|
|
2
3
|
/**
|
|
3
4
|
* Persists OAuth refresh tokens in the plugin's database state (never in .env).
|
|
4
5
|
*/
|
|
@@ -6,17 +7,17 @@ import type { OAuthProviderKind, RefreshTokenStore } from "./token-manager.js";
|
|
|
6
7
|
/** The subset of zhin's PluginStateStore used by the calendar plugin. */
|
|
7
8
|
export interface CalendarStateStore {
|
|
8
9
|
get<T>(key: string): Promise<T | undefined>;
|
|
9
|
-
set(key: string, value:
|
|
10
|
+
set<T>(key: string, value: T & JsonSerializable<T>): Promise<void>;
|
|
10
11
|
delete(key: string): Promise<void>;
|
|
11
12
|
}
|
|
12
13
|
/** Who completed the chat authorization and where to notify them later. */
|
|
13
|
-
export interface CredentialOwner<Target =
|
|
14
|
+
export interface CredentialOwner<Target = JsonValue> {
|
|
14
15
|
readonly sender_id: string;
|
|
15
16
|
/** Fixed when authorization starts; token rotation preserves it. */
|
|
16
17
|
readonly locale?: Locale;
|
|
17
18
|
readonly target: Target;
|
|
18
19
|
}
|
|
19
|
-
export interface StoredCredential<Target =
|
|
20
|
+
export interface StoredCredential<Target = JsonValue> {
|
|
20
21
|
readonly refresh_token: string;
|
|
21
22
|
readonly authorized_at: string;
|
|
22
23
|
readonly authorized_by: CredentialOwner<Target> | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-store.d.ts","sourceRoot":"","sources":["../src/credential-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,yEAAyE;AACzE,MAAM,WAAW,kBAAkB;IACjC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAC5C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"credential-store.d.ts","sourceRoot":"","sources":["../src/credential-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC3D;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,yEAAyE;AACzE,MAAM,WAAW,kBAAkB;IACjC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAC5C,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED,2EAA2E;AAC3E,MAAM,WAAW,eAAe,CAAC,MAAM,GAAG,SAAS;IACjD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,oEAAoE;IACpE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB,CAAC,MAAM,GAAG,SAAS;IAClD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,eAAe,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CACxD;AAMD,qBAAa,uBAAuB;;gBAGtB,KAAK,EAAE,kBAAkB;IAI/B,GAAG,CACP,QAAQ,EAAE,iBAAiB,GAC1B,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAUlC,IAAI,CACR,QAAQ,EAAE,iBAAiB,EAC3B,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,eAAe,GAAG,IAAI,GACnC,OAAO,CAAC,IAAI,CAAC;IASV,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxD,6EAA6E;IAC7E,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,iBAAiB;CAalE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-store.js","sourceRoot":"","sources":["../src/credential-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"credential-store.js","sourceRoot":"","sources":["../src/credential-store.ts"],"names":[],"mappings":"AA4BA,SAAS,aAAa,CAAC,QAA2B;IAChD,OAAO,SAAS,QAAQ,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,OAAO,uBAAuB;IACzB,MAAM,CAAqB;IAEpC,YAAY,KAAyB;QACnC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,GAAG,CACP,QAA2B;QAE3B,MAAM,MAAM,GAAG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 -8,6 +8,7 @@ export { parseCalDavEvents } from "./caldav.js";
|
|
|
8
8
|
export { calendarConfig, assertCalendarTimezone, type CalendarConfig, } from "./config.js";
|
|
9
9
|
export { cleanSecret } from "./secrets.js";
|
|
10
10
|
export { calendarRuntimeToken, type CalendarRuntime } from "./runtime.js";
|
|
11
|
+
export { createCalendarConsoleRpc } from "./console.js";
|
|
11
12
|
export { OAuthTokenManager, OAuthTokenError, authCommandFor, type OAuthProviderKind, type RefreshTokenStore, type TokenManagerOptions, type TokenSet, } from "./token-manager.js";
|
|
12
13
|
export { CalendarCredentialStore, type CalendarStateStore, type CredentialOwner, type StoredCredential, } from "./credential-store.js";
|
|
13
14
|
export { CalendarAuthService, DEFAULT_OAUTH_CALLBACK_PATH, buildRedirectUri, localOriginFromAddress, parseOAuthProvider, } from "./chat-auth.js";
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAOlD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EACL,iBAAiB,EACjB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EA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CAAC;AAChF,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,WAAW,4BAA4B;IAC3C,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC,CAAC;CAC3E;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,WAAW,CAAC,EAAE,uBAAuB,CAAC;IAC/C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,yBAAyB,CAAC;CAC1D;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,cAAc,EACtB,YAAY,GAAE,wBAA6B,GAC1C,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC,CAiCvD;AAED,2EAA2E;AAC3E,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,cAAc,EACtB,YAAY,GAAE,4BAAiC,GAC9C,gBAAgB,GAAG,SAAS,CAyE9B"}
|
package/lib/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { parseCalDavEvents } from "./caldav.js";
|
|
|
7
7
|
export { calendarConfig, assertCalendarTimezone, } from "./config.js";
|
|
8
8
|
export { cleanSecret } from "./secrets.js";
|
|
9
9
|
export { calendarRuntimeToken } from "./runtime.js";
|
|
10
|
+
export { createCalendarConsoleRpc } from "./console.js";
|
|
10
11
|
export { OAuthTokenManager, OAuthTokenError, authCommandFor, } from "./token-manager.js";
|
|
11
12
|
export { CalendarCredentialStore, } from "./credential-store.js";
|
|
12
13
|
export { CalendarAuthService, DEFAULT_OAUTH_CALLBACK_PATH, buildRedirectUri, localOriginFromAddress, parseOAuthProvider, } from "./chat-auth.js";
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1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MAAM,aAAa,GAAG,QAAQ,EAAE,SAAS,CAAC;QAC1C,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,+BAA+B,CAAC;gBACrC,QAAQ,EAAE,WAAW,CAAC,SAAS,CAAC,SAAS,IAAI,EAAE,CAAC;gBAChD,YAAY,EAAE,aAAa;gBAC3B,UAAU;gBACV,QAAQ,EAAE,MAAM,CAAC,QAAQ;aAC1B,CAAC,CAAC;QACL,CAAC;QACD,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;QACxD,MAAM,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC;QAChE,IAAI,CAAC,QAAQ,IAAI,CAAC,YAAY,EAAE,CAAC;YAC/B,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,+BAA+B,CAAC;YACrC,QAAQ;YACR,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,aAAa,IAAI,EAAE,CAAC,IAAI,SAAS;YACrE,YAAY;YACZ,UAAU;YACV,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,SAAS,CAAC,MAAM,IAAI,QAAQ;YACpC,SAAS,EAAE,WAAW,CAAC,SAAS,CAAC,UAAU,IAAI,EAAE,CAAC,IAAI,SAAS;SAChE,CAAC,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/lib/runtime.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ export interface CalendarRuntime {
|
|
|
7
7
|
/** Chat authorization flow used by the `calendar` commands. */
|
|
8
8
|
readonly auth: CalendarAuthService<unknown>;
|
|
9
9
|
}
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const calendarRuntimeStore: import("zhin.js").PluginStore<CalendarRuntime, unknown>;
|
|
11
|
+
export declare const calendarRuntimeToken: import("zhin.js").PluginStore<CalendarRuntime, unknown>;
|
|
11
12
|
//# sourceMappingURL=runtime.d.ts.map
|
package/lib/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAChD,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;CAC7C;AAED,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAChD,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;CAC7C;AAED,eAAO,MAAM,oBAAoB,yDAGhC,CAAC;AACF,eAAO,MAAM,oBAAoB,yDAAuB,CAAC"}
|
package/lib/runtime.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export const
|
|
1
|
+
import { definePluginStore } from "zhin.js";
|
|
2
|
+
export const calendarRuntimeStore = definePluginStore("zhin.calendar.runtime", "Owner-scoped calendar provider and config");
|
|
3
|
+
export const calendarRuntimeToken = calendarRuntimeStore;
|
|
3
4
|
//# sourceMappingURL=runtime.js.map
|
package/lib/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAY5C,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CACnD,uBAAuB,EACvB,2CAA2C,CAC5C,CAAC;AACF,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC"}
|
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.14",
|
|
4
4
|
"description": "CalDAV / Google / Microsoft calendar tools for Zhin Agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"plugin.js",
|
|
20
20
|
"commands",
|
|
21
|
+
"pages",
|
|
21
22
|
"src",
|
|
22
23
|
"lib",
|
|
23
24
|
"skills",
|
|
@@ -39,22 +40,27 @@
|
|
|
39
40
|
"url": "https://github.com/lc-cn"
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
|
-
"@zhin.js/
|
|
43
|
-
"@zhin.js/
|
|
44
|
-
"@zhin.js/
|
|
45
|
-
"@zhin.js/
|
|
43
|
+
"@zhin.js/console-contract": "1.1.4",
|
|
44
|
+
"@zhin.js/host-http": "1.1.16",
|
|
45
|
+
"@zhin.js/im-contract": "1.1.13",
|
|
46
|
+
"@zhin.js/page": "1.1.16",
|
|
47
|
+
"@zhin.js/skill": "1.1.15",
|
|
48
|
+
"@zhin.js/tool": "1.1.17"
|
|
46
49
|
},
|
|
47
50
|
"devDependencies": {
|
|
48
51
|
"typescript": "^6.0.3",
|
|
49
52
|
"vitest": "^4.1.10",
|
|
50
53
|
"zod": "^4.4.3",
|
|
51
|
-
"@zhin.js/command": "1.1.
|
|
52
|
-
"zhin.js": "1.1.
|
|
54
|
+
"@zhin.js/command": "1.1.16",
|
|
55
|
+
"zhin.js": "1.1.23"
|
|
53
56
|
},
|
|
54
57
|
"peerDependencies": {
|
|
55
58
|
"zod": "^4.0.0",
|
|
56
|
-
"@zhin.js/command": "^1.1.
|
|
57
|
-
"zhin.js": "^1.1.
|
|
59
|
+
"@zhin.js/command": "^1.1.16",
|
|
60
|
+
"@zhin.js/page": "^1.1.16",
|
|
61
|
+
"@zhin.js/skill": "^1.1.15",
|
|
62
|
+
"@zhin.js/tool": "^1.1.17",
|
|
63
|
+
"zhin.js": "^1.1.23"
|
|
58
64
|
},
|
|
59
65
|
"peerDependenciesMeta": {
|
|
60
66
|
"@zhin.js/command": {
|
|
@@ -94,6 +100,10 @@
|
|
|
94
100
|
{
|
|
95
101
|
"package": "@zhin.js/skill",
|
|
96
102
|
"api": "^1.0.0"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"package": "@zhin.js/page",
|
|
106
|
+
"api": "^1.0.0"
|
|
97
107
|
}
|
|
98
108
|
],
|
|
99
109
|
"plugins": []
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { definePage, createDeclarativePage } from '@zhin.js/console-contract';
|
|
3
|
+
export const meta = definePage({
|
|
4
|
+
title: '日历日程',
|
|
5
|
+
titleI18n: { en: 'Calendar' },
|
|
6
|
+
icon: 'Calendar',
|
|
7
|
+
order: 53,
|
|
8
|
+
requiredPermissions: ['calendar:read'],
|
|
9
|
+
});
|
|
10
|
+
export default createDeclarativePage({
|
|
11
|
+
title: { zh: '日历日程', en: 'Calendar' },
|
|
12
|
+
description: {
|
|
13
|
+
zh: '查看日历后端连接状态、时区与工作时间范围',
|
|
14
|
+
en: 'View calendar provider status, timezone, and working hours configuration',
|
|
15
|
+
},
|
|
16
|
+
dictionary: {
|
|
17
|
+
'已就绪': 'Ready',
|
|
18
|
+
'未就绪': 'Not ready',
|
|
19
|
+
},
|
|
20
|
+
badges: [
|
|
21
|
+
{
|
|
22
|
+
key: 'ready',
|
|
23
|
+
label: (data, ctx) => (data.ready ? ctx.t('已就绪') : ctx.t('未就绪')),
|
|
24
|
+
tone: (data) => (data.ready ? 'success' : 'warning'),
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
stats: [
|
|
28
|
+
{
|
|
29
|
+
key: 'provider',
|
|
30
|
+
label: { zh: '日历后端', en: 'Provider' },
|
|
31
|
+
value: 'provider',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
key: 'timezone',
|
|
35
|
+
label: { zh: '时区', en: 'Timezone' },
|
|
36
|
+
value: 'timezone',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: 'workingHours',
|
|
40
|
+
label: { zh: '工作时段', en: 'Working Hours' },
|
|
41
|
+
value: 'workingHours',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
sections: [
|
|
45
|
+
{
|
|
46
|
+
id: 'overview',
|
|
47
|
+
title: { zh: '配置概览', en: 'Configuration Overview' },
|
|
48
|
+
entries: (data) => ({
|
|
49
|
+
provider: data.provider,
|
|
50
|
+
timezone: data.timezone,
|
|
51
|
+
ready: data.ready ? 'true' : 'false',
|
|
52
|
+
oauthCallbackPath: data.oauthCallbackPath,
|
|
53
|
+
workingHours: data.workingHours,
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { definePage, createDeclarativePage } from '@zhin.js/console-contract';
|
|
2
|
+
|
|
3
|
+
export interface CalendarConsoleStatus {
|
|
4
|
+
readonly provider: 'none' | 'google' | 'microsoft' | 'caldav' | 'ics';
|
|
5
|
+
readonly timezone: string;
|
|
6
|
+
readonly ready: boolean;
|
|
7
|
+
readonly oauthCallbackPath: string;
|
|
8
|
+
readonly workingHours: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const meta = definePage({
|
|
12
|
+
title: '日历日程',
|
|
13
|
+
titleI18n: { en: 'Calendar' },
|
|
14
|
+
icon: 'Calendar',
|
|
15
|
+
order: 53,
|
|
16
|
+
requiredPermissions: ['calendar:read'],
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export default createDeclarativePage<CalendarConsoleStatus>({
|
|
20
|
+
title: { zh: '日历日程', en: 'Calendar' },
|
|
21
|
+
description: {
|
|
22
|
+
zh: '查看日历后端连接状态、时区与工作时间范围',
|
|
23
|
+
en: 'View calendar provider status, timezone, and working hours configuration',
|
|
24
|
+
},
|
|
25
|
+
dictionary: {
|
|
26
|
+
'已就绪': 'Ready',
|
|
27
|
+
'未就绪': 'Not ready',
|
|
28
|
+
},
|
|
29
|
+
badges: [
|
|
30
|
+
{
|
|
31
|
+
key: 'ready',
|
|
32
|
+
label: (data, ctx) => (data.ready ? ctx.t('已就绪') : ctx.t('未就绪')),
|
|
33
|
+
tone: (data) => (data.ready ? 'success' : 'warning'),
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
stats: [
|
|
37
|
+
{
|
|
38
|
+
key: 'provider',
|
|
39
|
+
label: { zh: '日历后端', en: 'Provider' },
|
|
40
|
+
value: 'provider',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
key: 'timezone',
|
|
44
|
+
label: { zh: '时区', en: 'Timezone' },
|
|
45
|
+
value: 'timezone',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
key: 'workingHours',
|
|
49
|
+
label: { zh: '工作时段', en: 'Working Hours' },
|
|
50
|
+
value: 'workingHours',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
sections: [
|
|
54
|
+
{
|
|
55
|
+
id: 'overview',
|
|
56
|
+
title: { zh: '配置概览', en: 'Configuration Overview' },
|
|
57
|
+
entries: (data) => ({
|
|
58
|
+
provider: data.provider,
|
|
59
|
+
timezone: data.timezone,
|
|
60
|
+
ready: data.ready ? 'true' : 'false',
|
|
61
|
+
oauthCallbackPath: data.oauthCallbackPath,
|
|
62
|
+
workingHours: data.workingHours,
|
|
63
|
+
}),
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
});
|
package/plugin.js
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
2
|
import { projectLocaleToken } from 'zhin.js/i18n';
|
|
3
|
-
import { databaseHostToken, definePlugin, outboundHostToken, } from "zhin.js";
|
|
3
|
+
import { databaseHostToken, definePlugin, definePluginCapabilityGraph, outboundHostToken, pluginConsoleRpcToken, } from "zhin.js";
|
|
4
4
|
import { httpHostToken } from "@zhin.js/host-http";
|
|
5
|
-
import { assertCalendarTimezone, createCalendarProvider, createOAuthTokenManagers, } from "./lib/index.js";
|
|
5
|
+
import { assertCalendarTimezone, createCalendarConsoleRpc, createCalendarProvider, createOAuthTokenManagers, } from "./lib/index.js";
|
|
6
6
|
import { buildRedirectUri, CalendarAuthService, DEFAULT_OAUTH_CALLBACK_PATH, localOriginFromAddress, } from "./lib/chat-auth.js";
|
|
7
7
|
import { CalendarCredentialStore, } from "./lib/credential-store.js";
|
|
8
8
|
import { registerOAuthCallbackRoute } from "./lib/http-callback.js";
|
|
9
|
-
import {
|
|
9
|
+
import { calendarRuntimeStore } from "./lib/runtime.js";
|
|
10
10
|
export default definePlugin({
|
|
11
11
|
name: "calendar",
|
|
12
12
|
metadata: { displayName: "日历" },
|
|
13
|
+
capabilityGraph: definePluginCapabilityGraph({
|
|
14
|
+
provides: [calendarRuntimeStore, pluginConsoleRpcToken],
|
|
15
|
+
injects: [databaseHostToken, outboundHostToken, httpHostToken, projectLocaleToken],
|
|
16
|
+
features: {
|
|
17
|
+
commands: ["calendar/auth", "calendar/logout", "calendar/status"],
|
|
18
|
+
skills: ["calendar-scheduling"],
|
|
19
|
+
tools: ["create_event", "find_free_time", "list_events"],
|
|
20
|
+
pages: ["index"],
|
|
21
|
+
},
|
|
22
|
+
}),
|
|
13
23
|
setup(context) {
|
|
14
24
|
const config = context.config.get();
|
|
15
25
|
assertCalendarTimezone(config.timezone);
|
|
@@ -54,19 +64,23 @@ export default definePlugin({
|
|
|
54
64
|
resolveRedirectUri,
|
|
55
65
|
});
|
|
56
66
|
const provider = createCalendarProvider(config, { managers });
|
|
57
|
-
|
|
67
|
+
const runtime = {
|
|
58
68
|
config,
|
|
59
69
|
provider,
|
|
60
70
|
auth: auth,
|
|
61
|
-
}
|
|
71
|
+
};
|
|
72
|
+
calendarRuntimeStore.provide(context, runtime);
|
|
62
73
|
if (config.provider !== "none" && !provider) {
|
|
63
74
|
console.warn("[calendar] provider 已配置但凭据为空,日历工具将不可用;Google/Microsoft 请先配置 client_id,再在聊天中发送 calendar auth <provider>");
|
|
64
75
|
}
|
|
65
76
|
const releaseRoute = http
|
|
66
77
|
? registerOAuthCallbackRoute(http, callbackPath, (searchParams) => auth.handleCallback(searchParams))
|
|
67
78
|
: undefined;
|
|
68
|
-
return
|
|
69
|
-
|
|
79
|
+
return {
|
|
80
|
+
consoleRpc: createCalendarConsoleRpc(runtime),
|
|
81
|
+
dispose: () => {
|
|
82
|
+
releaseRoute?.();
|
|
83
|
+
},
|
|
70
84
|
};
|
|
71
85
|
},
|
|
72
86
|
});
|
package/src/console.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
definePluginConsoleRpc,
|
|
3
|
+
PluginConsoleRpcError,
|
|
4
|
+
type PluginConsoleRpc,
|
|
5
|
+
type PluginConsoleRpcCall,
|
|
6
|
+
type PluginConsoleRpcInput,
|
|
7
|
+
type PluginConsoleRpcJson,
|
|
8
|
+
} from 'zhin.js';
|
|
9
|
+
import { DEFAULT_OAUTH_CALLBACK_PATH } from './chat-auth.js';
|
|
10
|
+
import type { CalendarConfig } from './config.js';
|
|
11
|
+
import { calendarRuntimeToken, type CalendarRuntime } from './runtime.js';
|
|
12
|
+
|
|
13
|
+
type CalendarRuntimeLookup = {
|
|
14
|
+
readonly use?: (token: typeof calendarRuntimeToken) => CalendarRuntime | undefined;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type ExtendedCalendarConfig = CalendarConfig & {
|
|
18
|
+
readonly workday_start_hour?: number;
|
|
19
|
+
readonly workday_end_hour?: number;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function resolveCalendarRuntime(call: PluginConsoleRpcCall, fallback?: CalendarRuntime): CalendarRuntime {
|
|
23
|
+
const runtime = (call.runtime as CalendarRuntimeLookup | undefined)?.use?.(calendarRuntimeToken) ?? fallback;
|
|
24
|
+
if (!runtime) {
|
|
25
|
+
throw new PluginConsoleRpcError('unavailable', 'Calendar runtime is not initialized');
|
|
26
|
+
}
|
|
27
|
+
return runtime;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function createCalendarConsoleRpc(defaultRuntime?: CalendarRuntime): PluginConsoleRpc {
|
|
31
|
+
return definePluginConsoleRpc({
|
|
32
|
+
status: {
|
|
33
|
+
page: 'index',
|
|
34
|
+
requiredPermissions: ['calendar:read'],
|
|
35
|
+
handler(_input: PluginConsoleRpcInput, call: PluginConsoleRpcCall): PluginConsoleRpcJson {
|
|
36
|
+
const runtime = resolveCalendarRuntime(call, defaultRuntime);
|
|
37
|
+
const cfg = runtime.config as ExtendedCalendarConfig;
|
|
38
|
+
const start =
|
|
39
|
+
cfg.workday_start_hour !== undefined
|
|
40
|
+
? `${cfg.workday_start_hour}:00`
|
|
41
|
+
: cfg.work_day_start?.trim() || '09:00';
|
|
42
|
+
const end =
|
|
43
|
+
cfg.workday_end_hour !== undefined
|
|
44
|
+
? `${cfg.workday_end_hour}:00`
|
|
45
|
+
: cfg.work_day_end?.trim() || '18:00';
|
|
46
|
+
return {
|
|
47
|
+
provider: cfg.provider,
|
|
48
|
+
timezone: cfg.timezone,
|
|
49
|
+
ready: Boolean(runtime.provider),
|
|
50
|
+
oauthCallbackPath: cfg.oauth_callback_path?.trim() || DEFAULT_OAUTH_CALLBACK_PATH,
|
|
51
|
+
workingHours: `${start} - ${end}`,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}
|
package/src/credential-store.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Locale } from 'zhin.js/i18n';
|
|
2
|
+
import type { JsonSerializable, JsonValue } from 'zhin.js';
|
|
2
3
|
/**
|
|
3
4
|
* Persists OAuth refresh tokens in the plugin's database state (never in .env).
|
|
4
5
|
*/
|
|
@@ -7,19 +8,19 @@ import type { OAuthProviderKind, RefreshTokenStore } from "./token-manager.js";
|
|
|
7
8
|
/** The subset of zhin's PluginStateStore used by the calendar plugin. */
|
|
8
9
|
export interface CalendarStateStore {
|
|
9
10
|
get<T>(key: string): Promise<T | undefined>;
|
|
10
|
-
set(key: string, value:
|
|
11
|
+
set<T>(key: string, value: T & JsonSerializable<T>): Promise<void>;
|
|
11
12
|
delete(key: string): Promise<void>;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
/** Who completed the chat authorization and where to notify them later. */
|
|
15
|
-
export interface CredentialOwner<Target =
|
|
16
|
+
export interface CredentialOwner<Target = JsonValue> {
|
|
16
17
|
readonly sender_id: string;
|
|
17
18
|
/** Fixed when authorization starts; token rotation preserves it. */
|
|
18
19
|
readonly locale?: Locale;
|
|
19
20
|
readonly target: Target;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
export interface StoredCredential<Target =
|
|
23
|
+
export interface StoredCredential<Target = JsonValue> {
|
|
23
24
|
readonly refresh_token: string;
|
|
24
25
|
readonly authorized_at: string;
|
|
25
26
|
readonly authorized_by: CredentialOwner<Target> | null;
|
|
@@ -58,7 +59,7 @@ export class CalendarCredentialStore {
|
|
|
58
59
|
authorized_at: new Date().toISOString(),
|
|
59
60
|
authorized_by: authorizedBy,
|
|
60
61
|
};
|
|
61
|
-
await this.#state.set(credentialKey(provider), credential
|
|
62
|
+
await this.#state.set(credentialKey(provider), credential);
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
async delete(provider: OAuthProviderKind): Promise<void> {
|
package/src/index.ts
CHANGED
|
@@ -28,6 +28,7 @@ export {
|
|
|
28
28
|
} from "./config.js";
|
|
29
29
|
export { cleanSecret } from "./secrets.js";
|
|
30
30
|
export { calendarRuntimeToken, type CalendarRuntime } from "./runtime.js";
|
|
31
|
+
export { createCalendarConsoleRpc } from "./console.js";
|
|
31
32
|
export {
|
|
32
33
|
OAuthTokenManager,
|
|
33
34
|
OAuthTokenError,
|
package/src/runtime.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { definePluginStore } from "zhin.js";
|
|
2
2
|
import type { CalendarConfig } from "./config.js";
|
|
3
3
|
import type { CalendarProvider } from "./types.js";
|
|
4
4
|
import type { CalendarAuthService } from "./chat-auth.js";
|
|
@@ -10,7 +10,8 @@ export interface CalendarRuntime {
|
|
|
10
10
|
readonly auth: CalendarAuthService<unknown>;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export const
|
|
13
|
+
export const calendarRuntimeStore = definePluginStore<CalendarRuntime>(
|
|
14
14
|
"zhin.calendar.runtime",
|
|
15
15
|
"Owner-scoped calendar provider and config"
|
|
16
16
|
);
|
|
17
|
+
export const calendarRuntimeToken = calendarRuntimeStore;
|