@deepseek-ai/dsh-wecom 0.0.0-stage → 0.2.3-alpha.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.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.i18n.yaml +88 -0
  3. package/README.md +177 -2
  4. package/README.zh.md +178 -0
  5. package/cordis.patch.yml +3 -0
  6. package/docs/DETAIL.md +1 -0
  7. package/docs/DETAIL.zh.md +1 -0
  8. package/docs/preview.svg +1 -0
  9. package/docs/preview.zh.svg +1 -0
  10. package/icon.svg +1 -0
  11. package/lib/index.js +590 -0
  12. package/lib/types/account.d.ts +19 -0
  13. package/lib/types/account.d.ts.map +1 -0
  14. package/lib/types/account.js.map +1 -0
  15. package/lib/types/directory.d.ts +17 -0
  16. package/lib/types/directory.d.ts.map +1 -0
  17. package/lib/types/directory.js.map +1 -0
  18. package/lib/types/index.d.ts +30 -0
  19. package/lib/types/index.d.ts.map +1 -0
  20. package/lib/types/index.js.map +1 -0
  21. package/lib/types/locales.d.ts +93 -0
  22. package/lib/types/locales.d.ts.map +1 -0
  23. package/lib/types/locales.js.map +1 -0
  24. package/lib/types/presentation.d.ts +29 -0
  25. package/lib/types/presentation.d.ts.map +1 -0
  26. package/lib/types/presentation.js.map +1 -0
  27. package/lib/types/skills.d.ts +7 -0
  28. package/lib/types/skills.d.ts.map +1 -0
  29. package/lib/types/skills.js.map +1 -0
  30. package/lib/types/types.d.ts +20 -0
  31. package/lib/types/types.d.ts.map +1 -0
  32. package/lib/types/types.js.map +1 -0
  33. package/locale/de.json +7 -0
  34. package/locale/en.json +7 -0
  35. package/locale/es.json +7 -0
  36. package/locale/fr.json +7 -0
  37. package/locale/ja.json +7 -0
  38. package/locale/pt.json +7 -0
  39. package/locale/ru.json +7 -0
  40. package/locale/zh.json +7 -0
  41. package/package.json +62 -3
  42. package/skills/wecom/SKILL.md +40 -0
  43. package/src/account.ts +69 -0
  44. package/src/directory.ts +43 -0
  45. package/src/index.ts +66 -0
  46. package/src/locales.ts +279 -0
  47. package/src/presentation.ts +116 -0
  48. package/src/skills.ts +18 -0
  49. package/src/types.ts +25 -0
package/src/locales.ts ADDED
@@ -0,0 +1,279 @@
1
+ /** The WeCom text the Plugins page shows; the browser resolves it in its active language. */
2
+
3
+ /** Chinese dictionary and key source. */
4
+ export const zh = {
5
+ 'section.title': '企业微信授权',
6
+ 'status.checking': '正在检查授权',
7
+ 'status.disconnected': '未授权',
8
+ 'status.unavailable': '暂时无法读取授权状态',
9
+ 'status.connected': '已授权',
10
+ 'step.authorizing': '等待扫码授权',
11
+ 'step.connecting': '正在确认授权',
12
+ 'detail.disconnected': '用企业微信扫码绑定一个智能机器人。授权后,可以在对话中通过这个机器人使用企业微信的文档、日程、会议、待办和消息等功能。',
13
+ 'detail.unavailable': '没能读取 wecom-cli 的授权状态,可以稍后重试。',
14
+ 'detail.connected': '可以在对话中直接请 Agent 使用企业微信。',
15
+ 'detail.authorizing': '在打开的页面中用企业微信扫码并确认,完成后回到这里查看结果。页面没有打开时,点击“打开扫码页面”。',
16
+ 'skills.downloading': '正在从 GitHub 下载企业微信技能,下载完成后即可在对话中使用。',
17
+ 'skills.failed': '企业微信技能没能下载,Agent 暂时用不了企业微信的子指南。请确认这台电脑能访问 GitHub,然后重试。',
18
+ hint: '授权与这台电脑终端里的 wecom-cli 共用;关闭插件不会解除授权。',
19
+ failed: '操作未完成,请重试',
20
+ 'action.connect': '连接企业微信',
21
+ 'action.rebind': '更换机器人',
22
+ 'rebind.title': '更换机器人?',
23
+ 'rebind.body': '将重新扫码绑定一个智能机器人,替换这台电脑上 wecom-cli 当前绑定的机器人,终端里的 wecom-cli 也一起更换。',
24
+ 'bot.bound': '已绑定机器人:{id}',
25
+ 'action.open': '打开扫码页面',
26
+ 'action.cancel': '取消',
27
+ 'action.retry': '重试',
28
+ 'badge.connected': '已授权',
29
+ 'badge.disconnected': '未授权',
30
+ 'badge.connecting': '授权中',
31
+ 'badge.unavailable': '待确认',
32
+ 'activation.title': '连接企业微信',
33
+ 'activation.body': '企业微信插件已开启。扫码授权后,就可以在对话中使用它。',
34
+ 'notice.connected': '企业微信已授权',
35
+ }
36
+
37
+ /** Every key of the WeCom text. */
38
+ export type WecomTextKey = keyof typeof zh
39
+
40
+ /** English dictionary. */
41
+ export const en: Record<WecomTextKey, string> = {
42
+ 'section.title': 'WeCom authorization',
43
+ 'status.checking': 'Checking authorization',
44
+ 'status.disconnected': 'Not authorized',
45
+ 'status.unavailable': 'Cannot read authorization right now',
46
+ 'status.connected': 'Authorized',
47
+ 'step.authorizing': 'Waiting for the QR code scan',
48
+ 'step.connecting': 'Confirming authorization',
49
+ 'detail.disconnected': 'Scan a QR code with WeCom to bind a smart bot. After that, you can use WeCom docs, calendar, meetings, to-dos, messages, and other features through this bot in conversations.',
50
+ 'detail.unavailable': 'The wecom-cli authorization could not be read. Try again later.',
51
+ 'detail.connected': 'Ask the agent to use WeCom directly in a conversation.',
52
+ 'detail.authorizing': 'Scan the QR code with WeCom on the page that opened and confirm, then come back here to see the result. If the page did not open, select Open QR code page.',
53
+ 'skills.downloading': 'Downloading the WeCom skills from GitHub. They become available in conversations when the download finishes.',
54
+ 'skills.failed': 'The WeCom skills could not be downloaded, so the agent cannot use the WeCom guides yet. Check that this computer can reach GitHub, then retry.',
55
+ hint: 'The authorization is shared with wecom-cli in this computer\'s terminal. Turning the plugin off does not revoke it.',
56
+ failed: 'The action did not finish. Try again.',
57
+ 'action.connect': 'Connect WeCom',
58
+ 'action.rebind': 'Change bot',
59
+ 'rebind.title': 'Change the bot?',
60
+ 'rebind.body': 'You will scan a QR code to bind another smart bot. It replaces the bot that wecom-cli on this computer is bound to, including the wecom-cli in your terminal.',
61
+ 'bot.bound': 'Bound bot: {id}',
62
+ 'action.open': 'Open QR code page',
63
+ 'action.cancel': 'Cancel',
64
+ 'action.retry': 'Retry',
65
+ 'badge.connected': 'Authorized',
66
+ 'badge.disconnected': 'Not authorized',
67
+ 'badge.connecting': 'Authorizing',
68
+ 'badge.unavailable': 'Unconfirmed',
69
+ 'activation.title': 'Connect WeCom',
70
+ 'activation.body': 'The WeCom plugin is on. Scan a QR code to authorize it, then use it in conversations.',
71
+ 'notice.connected': 'WeCom authorized',
72
+ }
73
+
74
+ /** Japanese dictionary. */
75
+ export const ja: Record<WecomTextKey, string> = {
76
+ 'section.title': 'WeCom の認可',
77
+ 'status.checking': '認可を確認中',
78
+ 'status.disconnected': '未認可',
79
+ 'status.unavailable': '現在認可状態を読み取れません',
80
+ 'status.connected': '認可済み',
81
+ 'step.authorizing': 'QR コードのスキャン待ち',
82
+ 'step.connecting': '認可を確定中',
83
+ 'detail.disconnected': 'WeCom で QR コードをスキャンしてスマートボットを紐付けます。その後、会話の中でこのボットを通じて WeCom のドキュメント、カレンダー、会議、ToDo、メッセージなどの機能を使用できます。',
84
+ 'detail.unavailable': 'wecom-cli の認可状態を読み取れませんでした。しばらくしてから再試行してください。',
85
+ 'detail.connected': '会話の中でエージェントに WeCom の使用を直接依頼できます。',
86
+ 'detail.authorizing': '開いたページで WeCom を使って QR コードをスキャンして確定し、完了したらここに戻って結果を確認してください。ページが開かない場合は、「QR コードページを開く」を選択してください。',
87
+ 'skills.downloading': 'GitHub から WeCom のスキルをダウンロードしています。ダウンロードが完了すると、会話の中で使用できます。',
88
+ 'skills.failed': 'WeCom のスキルをダウンロードできなかったため、エージェントはまだ WeCom のガイドを使用できません。このコンピューターから GitHub にアクセスできることを確認してから、再試行してください。',
89
+ hint: '認可は、このコンピューターのターミナルにある wecom-cli と共有されます。プラグインをオフにしても認可は解除されません。',
90
+ failed: '操作が完了しませんでした。もう一度お試しください。',
91
+ 'action.connect': 'WeCom を接続',
92
+ 'action.rebind': 'ボットを変更',
93
+ 'rebind.title': 'ボットを変更しますか?',
94
+ 'rebind.body': 'QR コードを再度スキャンして別のスマートボットをバインドします。このコンピューター上の wecom-cli が現在バインドしているボットは、ターミナルの wecom-cli も含めて置き換えられます。',
95
+ 'bot.bound': 'バインド済みボット:{id}',
96
+ 'action.open': 'QR コードページを開く',
97
+ 'action.cancel': 'キャンセル',
98
+ 'action.retry': '再試行',
99
+ 'badge.connected': '認可済み',
100
+ 'badge.disconnected': '未認可',
101
+ 'badge.connecting': '認可中',
102
+ 'badge.unavailable': '未確認',
103
+ 'activation.title': 'WeCom を接続',
104
+ 'activation.body': 'WeCom プラグインがオンになりました。QR コードをスキャンして認可すると、会話の中で使用できます。',
105
+ 'notice.connected': 'WeCom を認可しました',
106
+ }
107
+
108
+ /** Spanish dictionary. */
109
+ export const es: Record<WecomTextKey, string> = {
110
+ 'section.title': 'Autorización de WeCom',
111
+ 'status.checking': 'Comprobando la autorización',
112
+ 'status.disconnected': 'Sin autorizar',
113
+ 'status.unavailable': 'No se puede leer la autorización en este momento',
114
+ 'status.connected': 'Autorizado',
115
+ 'step.authorizing': 'Esperando el escaneo del código QR',
116
+ 'step.connecting': 'Confirmando la autorización',
117
+ 'detail.disconnected': 'Escanee un código QR con WeCom para vincular un bot inteligente. Después, podrá usar en las conversaciones, a través de este bot, los documentos, el calendario, las reuniones, las tareas pendientes, los mensajes y otras funciones de WeCom.',
118
+ 'detail.unavailable': 'No se pudo leer la autorización de wecom-cli. Inténtelo de nuevo más tarde.',
119
+ 'detail.connected': 'Pida al agente que use WeCom directamente en una conversación.',
120
+ 'detail.authorizing': 'Escanee el código QR con WeCom en la página que se abrió y confirme; luego vuelva aquí para ver el resultado. Si la página no se abrió, seleccione “Abrir página del código QR”.',
121
+ 'skills.downloading': 'Descargando las habilidades de WeCom desde GitHub. Estarán disponibles en las conversaciones cuando termine la descarga.',
122
+ 'skills.failed': 'No se pudieron descargar las habilidades de WeCom, por lo que el agente aún no puede usar las guías de WeCom. Compruebe que esta computadora puede acceder a GitHub y vuelva a intentarlo.',
123
+ hint: 'La autorización se comparte con wecom-cli en la terminal de esta computadora. Desactivar el complemento no la revoca.',
124
+ failed: 'La acción no se completó. Inténtelo de nuevo.',
125
+ 'action.connect': 'Conectar WeCom',
126
+ 'action.rebind': 'Cambiar bot',
127
+ 'rebind.title': '¿Cambiar el bot?',
128
+ 'rebind.body': 'Escaneará un código QR para vincular otro bot inteligente. Sustituye al bot al que está vinculado wecom-cli en este equipo, incluido el wecom-cli de su terminal.',
129
+ 'bot.bound': 'Bot vinculado: {id}',
130
+ 'action.open': 'Abrir página del código QR',
131
+ 'action.cancel': 'Cancelar',
132
+ 'action.retry': 'Reintentar',
133
+ 'badge.connected': 'Autorizado',
134
+ 'badge.disconnected': 'Sin autorizar',
135
+ 'badge.connecting': 'Autorizando',
136
+ 'badge.unavailable': 'Sin confirmar',
137
+ 'activation.title': 'Conectar WeCom',
138
+ 'activation.body': 'El complemento de WeCom está activado. Escanee un código QR para autorizarlo y luego úselo en las conversaciones.',
139
+ 'notice.connected': 'WeCom autorizado',
140
+ }
141
+
142
+ /** French dictionary. */
143
+ export const fr: Record<WecomTextKey, string> = {
144
+ 'section.title': 'Autorisation WeCom',
145
+ 'status.checking': 'Vérification de l’autorisation',
146
+ 'status.disconnected': 'Non autorisé',
147
+ 'status.unavailable': 'Impossible de lire l’autorisation pour le moment',
148
+ 'status.connected': 'Autorisé',
149
+ 'step.authorizing': 'En attente du scan du code QR',
150
+ 'step.connecting': 'Confirmation de l’autorisation',
151
+ 'detail.disconnected': 'Scannez un code QR avec WeCom pour lier un bot intelligent. Vous pourrez ensuite utiliser dans les conversations, via ce bot, les documents, le calendrier, les réunions, les tâches, les messages et les autres fonctionnalités de WeCom.',
152
+ 'detail.unavailable': 'Impossible de lire l’autorisation de wecom-cli. Réessayez plus tard.',
153
+ 'detail.connected': 'Demandez à l’agent d’utiliser WeCom directement dans une conversation.',
154
+ 'detail.authorizing': 'Scannez le code QR avec WeCom sur la page qui s’est ouverte et confirmez, puis revenez ici pour voir le résultat. Si la page ne s’est pas ouverte, sélectionnez « Ouvrir la page du code QR ».',
155
+ 'skills.downloading': 'Téléchargement des compétences WeCom depuis GitHub. Elles seront disponibles dans les conversations une fois le téléchargement terminé.',
156
+ 'skills.failed': 'Les compétences WeCom n’ont pas pu être téléchargées : l’agent ne peut donc pas encore utiliser les guides WeCom. Vérifiez que cet ordinateur peut accéder à GitHub, puis réessayez.',
157
+ hint: 'L’autorisation est partagée avec wecom-cli dans le terminal de cet ordinateur. Désactiver le plugin ne la révoque pas.',
158
+ failed: 'L’action n’a pas abouti. Réessayez.',
159
+ 'action.connect': 'Connecter WeCom',
160
+ 'action.rebind': 'Changer de bot',
161
+ 'rebind.title': 'Changer de bot ?',
162
+ 'rebind.body': 'Vous scannerez un QR code pour lier un autre bot intelligent. Il remplace le bot auquel wecom-cli est lié sur cet ordinateur, y compris le wecom-cli de votre terminal.',
163
+ 'bot.bound': 'Bot lié : {id}',
164
+ 'action.open': 'Ouvrir la page du code QR',
165
+ 'action.cancel': 'Annuler',
166
+ 'action.retry': 'Réessayer',
167
+ 'badge.connected': 'Autorisé',
168
+ 'badge.disconnected': 'Non autorisé',
169
+ 'badge.connecting': 'Autorisation en cours',
170
+ 'badge.unavailable': 'Non confirmé',
171
+ 'activation.title': 'Connecter WeCom',
172
+ 'activation.body': 'Le plugin WeCom est activé. Scannez un code QR pour l’autoriser, puis utilisez-le dans les conversations.',
173
+ 'notice.connected': 'WeCom autorisé',
174
+ }
175
+
176
+ /** German dictionary. */
177
+ export const de: Record<WecomTextKey, string> = {
178
+ 'section.title': 'WeCom-Autorisierung',
179
+ 'status.checking': 'Autorisierung wird geprüft',
180
+ 'status.disconnected': 'Nicht autorisiert',
181
+ 'status.unavailable': 'Autorisierung kann gerade nicht gelesen werden',
182
+ 'status.connected': 'Autorisiert',
183
+ 'step.authorizing': 'Warten auf das Scannen des QR-Codes',
184
+ 'step.connecting': 'Autorisierung wird bestätigt',
185
+ 'detail.disconnected': 'Scannen Sie mit WeCom einen QR-Code, um einen smarten Bot zu verknüpfen. Danach können Sie über diesen Bot Dokumente, Kalender, Besprechungen, Aufgaben, Nachrichten und weitere Funktionen von WeCom in Unterhaltungen verwenden.',
186
+ 'detail.unavailable': 'Die Autorisierung von wecom-cli konnte nicht gelesen werden. Versuchen Sie es später erneut.',
187
+ 'detail.connected': 'Bitten Sie den Agenten, WeCom direkt in einer Unterhaltung zu verwenden.',
188
+ 'detail.authorizing': 'Scannen Sie auf der geöffneten Seite den QR-Code mit WeCom, bestätigen Sie und kehren Sie dann hierher zurück, um das Ergebnis zu sehen. Falls sich die Seite nicht geöffnet hat, wählen Sie „QR-Code-Seite öffnen“.',
189
+ 'skills.downloading': 'Die Fertigkeiten von WeCom werden von GitHub heruntergeladen. Sie stehen in Unterhaltungen zur Verfügung, sobald der Download abgeschlossen ist.',
190
+ 'skills.failed': 'Die Fertigkeiten von WeCom konnten nicht heruntergeladen werden, daher kann der Agent die WeCom-Anleitungen noch nicht verwenden. Prüfen Sie, ob dieser Computer GitHub erreichen kann, und versuchen Sie es dann erneut.',
191
+ hint: 'Die Autorisierung wird mit wecom-cli im Terminal dieses Computers geteilt. Wenn Sie das Plugin deaktivieren, wird sie nicht widerrufen.',
192
+ failed: 'Die Aktion wurde nicht abgeschlossen. Versuchen Sie es erneut.',
193
+ 'action.connect': 'WeCom verbinden',
194
+ 'action.rebind': 'Bot wechseln',
195
+ 'rebind.title': 'Bot wechseln?',
196
+ 'rebind.body': 'Sie scannen einen QR-Code, um einen anderen Smart-Bot zu binden. Er ersetzt den Bot, an den wecom-cli auf diesem Computer gebunden ist, einschließlich des wecom-cli in Ihrem Terminal.',
197
+ 'bot.bound': 'Gebundener Bot: {id}',
198
+ 'action.open': 'QR-Code-Seite öffnen',
199
+ 'action.cancel': 'Abbrechen',
200
+ 'action.retry': 'Erneut versuchen',
201
+ 'badge.connected': 'Autorisiert',
202
+ 'badge.disconnected': 'Nicht autorisiert',
203
+ 'badge.connecting': 'Wird autorisiert',
204
+ 'badge.unavailable': 'Unbestätigt',
205
+ 'activation.title': 'WeCom verbinden',
206
+ 'activation.body': 'Das WeCom-Plugin ist aktiviert. Scannen Sie einen QR-Code, um es zu autorisieren, und verwenden Sie es dann in Unterhaltungen.',
207
+ 'notice.connected': 'WeCom autorisiert',
208
+ }
209
+
210
+ /** Russian dictionary. */
211
+ export const ru: Record<WecomTextKey, string> = {
212
+ 'section.title': 'Авторизация WeCom',
213
+ 'status.checking': 'Проверка авторизации',
214
+ 'status.disconnected': 'Не авторизовано',
215
+ 'status.unavailable': 'Сейчас не удаётся прочитать состояние авторизации',
216
+ 'status.connected': 'Авторизовано',
217
+ 'step.authorizing': 'Ожидание сканирования QR-кода',
218
+ 'step.connecting': 'Подтверждение авторизации',
219
+ 'detail.disconnected': 'Отсканируйте QR-код в WeCom, чтобы привязать умного бота. После этого в беседах через этого бота можно будет использовать документы, календарь, встречи, задачи, сообщения и другие функции WeCom.',
220
+ 'detail.unavailable': 'Не удалось прочитать авторизацию wecom-cli. Повторите попытку позже.',
221
+ 'detail.connected': 'Попросите агента использовать WeCom прямо в беседе.',
222
+ 'detail.authorizing': 'Отсканируйте QR-код в WeCom на открывшейся странице и подтвердите, затем вернитесь сюда, чтобы увидеть результат. Если страница не открылась, нажмите «Открыть страницу с QR-кодом».',
223
+ 'skills.downloading': 'Навыки WeCom загружаются с GitHub. Они станут доступны в беседах, когда загрузка завершится.',
224
+ 'skills.failed': 'Не удалось загрузить навыки WeCom, поэтому агент пока не может использовать руководства WeCom. Убедитесь, что этот компьютер может подключиться к GitHub, затем повторите попытку.',
225
+ hint: 'Авторизация общая с wecom-cli в терминале этого компьютера. Отключение плагина её не отменяет.',
226
+ failed: 'Действие не завершено. Повторите попытку.',
227
+ 'action.connect': 'Подключить WeCom',
228
+ 'action.rebind': 'Сменить бота',
229
+ 'rebind.title': 'Сменить бота?',
230
+ 'rebind.body': 'Вы отсканируете QR-код, чтобы привязать другого умного бота. Он заменит бота, к которому привязан wecom-cli на этом компьютере, включая wecom-cli в вашем терминале.',
231
+ 'bot.bound': 'Привязанный бот: {id}',
232
+ 'action.open': 'Открыть страницу с QR-кодом',
233
+ 'action.cancel': 'Отмена',
234
+ 'action.retry': 'Повторить',
235
+ 'badge.connected': 'Авторизовано',
236
+ 'badge.disconnected': 'Не авторизовано',
237
+ 'badge.connecting': 'Авторизация',
238
+ 'badge.unavailable': 'Не подтверждено',
239
+ 'activation.title': 'Подключить WeCom',
240
+ 'activation.body': 'Плагин WeCom включён. Отсканируйте QR-код, чтобы авторизовать его, и используйте его в беседах.',
241
+ 'notice.connected': 'WeCom авторизован',
242
+ }
243
+
244
+ /** Portuguese dictionary. */
245
+ export const pt: Record<WecomTextKey, string> = {
246
+ 'section.title': 'Autorização do WeCom',
247
+ 'status.checking': 'Verificando a autorização',
248
+ 'status.disconnected': 'Não autorizado',
249
+ 'status.unavailable': 'Não é possível ler a autorização no momento',
250
+ 'status.connected': 'Autorizado',
251
+ 'step.authorizing': 'Aguardando a leitura do código QR',
252
+ 'step.connecting': 'Confirmando a autorização',
253
+ 'detail.disconnected': 'Leia um código QR com o WeCom para vincular um bot inteligente. Depois disso, você poderá usar nas conversas, por meio desse bot, os documentos, a agenda, as reuniões, as tarefas, as mensagens e outros recursos do WeCom.',
254
+ 'detail.unavailable': 'Não foi possível ler a autorização do wecom-cli. Tente novamente mais tarde.',
255
+ 'detail.connected': 'Peça ao agente que use o WeCom diretamente em uma conversa.',
256
+ 'detail.authorizing': 'Leia o código QR com o WeCom na página que foi aberta e confirme; depois volte aqui para ver o resultado. Se a página não abriu, selecione “Abrir página do código QR”.',
257
+ 'skills.downloading': 'Baixando as habilidades do WeCom do GitHub. Elas ficarão disponíveis nas conversas quando o download terminar.',
258
+ 'skills.failed': 'Não foi possível baixar as habilidades do WeCom, então o agente ainda não pode usar os guias do WeCom. Verifique se este computador consegue acessar o GitHub e tente novamente.',
259
+ hint: 'A autorização é compartilhada com o wecom-cli no terminal deste computador. Desativar o plugin não a revoga.',
260
+ failed: 'A ação não foi concluída. Tente novamente.',
261
+ 'action.connect': 'Conectar WeCom',
262
+ 'action.rebind': 'Trocar bot',
263
+ 'rebind.title': 'Trocar o bot?',
264
+ 'rebind.body': 'Você vai escanear um QR code para vincular outro bot inteligente. Ele substitui o bot ao qual o wecom-cli está vinculado neste computador, incluindo o wecom-cli do seu terminal.',
265
+ 'bot.bound': 'Bot vinculado: {id}',
266
+ 'action.open': 'Abrir página do código QR',
267
+ 'action.cancel': 'Cancelar',
268
+ 'action.retry': 'Tentar novamente',
269
+ 'badge.connected': 'Autorizado',
270
+ 'badge.disconnected': 'Não autorizado',
271
+ 'badge.connecting': 'Autorizando',
272
+ 'badge.unavailable': 'Não confirmado',
273
+ 'activation.title': 'Conectar WeCom',
274
+ 'activation.body': 'O plugin do WeCom está ativado. Leia um código QR para autorizá-lo e depois use-o nas conversas.',
275
+ 'notice.connected': 'WeCom autorizado',
276
+ }
277
+
278
+ /** The dictionary of every shipped language. */
279
+ export const dictionaries = { zh, en, ja, es, fr, de, ru, pt }
@@ -0,0 +1,116 @@
1
+ /** The WeCom authorization section the Plugins page shows for each Host view. */
2
+ import type { CliAccountText } from '@deepseek-ai/dsh-cli-account/types'
3
+ import type {
4
+ ConnectorAccountButton, ConnectorAccountCopy, ConnectorAccountDisplay, ConnectorAccountFailure, ConnectorAccountNote,
5
+ ConnectorAccountOperation,
6
+ } from '@deepseek-ai/dsh-client-ui-connector-account/types'
7
+ import type { UpstreamSkillsState } from '@deepseek-ai/dsh-upstream-skills/types'
8
+ import { assertNever } from '@deepseek-ai/dsh-util-values'
9
+ import type { WecomTextKey } from './locales.ts'
10
+ import type { WecomOperationKind, WecomState } from './types.ts'
11
+
12
+ type Text = CliAccountText<WecomTextKey>
13
+
14
+ /** The npm package whose bundle page carries the authorization section. */
15
+ export const WECOM_PACKAGE = '@deepseek-ai/dsh-wecom'
16
+
17
+ /* jscpd:ignore-start -- CLI app plugins declare page operations, copy, and commands alike, each with its own text. */
18
+ /**
19
+ * List the operations the section's buttons start; binding a bot reports a notice in the browser that started it.
20
+ * @param text - writes a key of the WeCom text in every shipped language.
21
+ * @returns the operations with their notices.
22
+ */
23
+ export function operations(text: Text): readonly ConnectorAccountOperation<WecomOperationKind>[] {
24
+ return [
25
+ { kind: 'check' },
26
+ { kind: 'connect', notice: text('notice.connected') },
27
+ ]
28
+ }
29
+
30
+ /**
31
+ * Write the section's title and hint, and the prompt after the bundle is switched on while unauthorized.
32
+ * @param text - writes a key of the WeCom text in every shipped language.
33
+ * @returns the section's fixed text.
34
+ */
35
+ export function copy(text: Text): ConnectorAccountCopy {
36
+ return {
37
+ title: text('section.title'),
38
+ hint: text('hint'),
39
+ activation: { title: text('activation.title'), body: text('activation.body'), connect: text('action.connect') },
40
+ }
41
+ }
42
+
43
+ const CHECK = { kind: 'start', operation: 'check' } as const
44
+ const CONNECT = { kind: 'start', operation: 'connect' } as const
45
+ /* jscpd:ignore-end */
46
+
47
+ /* jscpd:ignore-start -- CLI app plugins whose guides download report the same states, each in its own text. */
48
+ /** The row that reports guides that are not in place yet; a failed download offers a check, which restarts it. */
49
+ function skillsNotes(skills: UpstreamSkillsState, text: Text): ConnectorAccountNote[] {
50
+ switch (skills) {
51
+ case 'installed': return []
52
+ case 'downloading': return [{ text: text('skills.downloading') }]
53
+ case 'failed': return [{ text: text('skills.failed'), button: { label: text('action.retry'), command: CHECK } }]
54
+ /* v8 ignore next -- closed skills state union */
55
+ default: return assertNever(skills)
56
+ }
57
+ }
58
+ /* jscpd:ignore-end */
59
+
60
+ /** The bound bot's QR-code page and the operation's cancel, while an authorization runs. */
61
+ function connectingButtons(operation: NonNullable<WecomState['operation']>, text: Text): ConnectorAccountButton[] {
62
+ const buttons: ConnectorAccountButton[] = []
63
+ if (operation.authorizationUrl !== undefined) buttons.push({ label: text('action.open'), command: { kind: 'open' }, variant: 'primary' })
64
+ if (operation.cancellable) buttons.push({ label: text('action.cancel'), command: { kind: 'cancel' }, variant: 'ghost' })
65
+ return buttons
66
+ }
67
+
68
+ /**
69
+ * The authorization section for one Host view.
70
+ * @param view - the authorization, the operation in progress, and the last result.
71
+ * @param text - writes a key of the WeCom text in every shipped language.
72
+ * @returns the phase, status, tag, buttons, detail, bound-bot and guide download rows, and failure guidance.
73
+ */
74
+ export function presentAccount(view: WecomState, text: Text): ConnectorAccountDisplay {
75
+ const notes = skillsNotes(view.account.skills, text)
76
+ const { operation } = view
77
+ if (operation?.kind === 'check') return { phase: 'checking', status: text('status.checking'), buttons: [], notes }
78
+ if (operation !== undefined) {
79
+ return {
80
+ phase: 'connecting', status: text(operation.phase === 'authorizing' ? 'step.authorizing' : 'step.connecting'),
81
+ badge: text('badge.connecting'), buttons: connectingButtons(operation, text), notes,
82
+ ...operation.authorizationUrl === undefined ? {} : { detail: text('detail.authorizing') },
83
+ }
84
+ }
85
+ const failed = view.result?.outcome === 'failed'
86
+ // The Service adds the failed command and its exit code.
87
+ const failure: { failure?: ConnectorAccountFailure } = failed ? { failure: { text: text('failed') } } : {}
88
+ switch (view.account.state) {
89
+ case 'unchecked':
90
+ if (!failed) return { phase: 'checking', status: text('status.checking'), buttons: [], notes }
91
+ return {
92
+ phase: 'unavailable', status: text('status.unavailable'), badge: text('badge.unavailable'),
93
+ buttons: [{ label: text('action.retry'), command: CHECK }], detail: text('detail.unavailable'), notes, ...failure,
94
+ }
95
+ case 'unauthorized':
96
+ return {
97
+ phase: 'disconnected', status: text('status.disconnected'), badge: text('badge.disconnected'),
98
+ buttons: [{ label: text('action.connect'), command: CONNECT, variant: 'primary' }], connect: CONNECT,
99
+ detail: text('detail.disconnected'), notes, ...failure,
100
+ }
101
+ case 'authorized':
102
+ return {
103
+ phase: 'connected', status: text('status.connected'), badge: text('badge.connected'),
104
+ // Binding again replaces the bot in the CLI's configuration, which the terminal shares, so it asks first.
105
+ buttons: [{
106
+ label: text('action.rebind'), command: CONNECT,
107
+ confirm: { title: text('rebind.title'), body: text('rebind.body'), label: text('action.rebind') },
108
+ }],
109
+ detail: text('detail.connected'),
110
+ notes: [...view.account.botId === undefined ? [] : [{ text: text('bot.bound', { id: view.account.botId }) }], ...notes],
111
+ ...failure,
112
+ }
113
+ /* v8 ignore next -- closed account state union */
114
+ default: return assertNever(view.account.state)
115
+ }
116
+ }
package/src/skills.ts ADDED
@@ -0,0 +1,18 @@
1
+ /** The packaged `wecom` entry skill and the upstream guides it indexes. */
2
+
3
+ import { fileURLToPath } from 'node:url'
4
+ import type { UpstreamSkillSet } from '@deepseek-ai/dsh-upstream-skills'
5
+
6
+ /** The packaged entry, whose index names each guide by its repository path `skills/<guide>/SKILL.md`. */
7
+ export const ENTRY = fileURLToPath(new URL('../skills/wecom/SKILL.md', import.meta.url))
8
+
9
+ /** Every skill of the official WeCom CLI repository, at the commit the entry's index and guidance were verified with. */
10
+ export const WECOM_SKILLS: UpstreamSkillSet = {
11
+ repository: 'WecomTeam/wecom-cli',
12
+ commit: '4c74ff28838d8fba267eaab5179d9d56f9ca61ae',
13
+ directory: 'skills',
14
+ exclude: [],
15
+ license: 'LICENSE',
16
+ bytes: 1_754_686,
17
+ sha256: 'c75045cc5297d5886c8a7ff01c993a782e50cbd4aa6f6559394b695157d52e10',
18
+ }
package/src/types.ts ADDED
@@ -0,0 +1,25 @@
1
+ /** Credential-free WeCom authorization and operation views the Plugins page presenter reads. */
2
+
3
+ import type { CliAccountView } from '@deepseek-ai/dsh-cli-account/types'
4
+ import type { UpstreamSkillsState } from '@deepseek-ai/dsh-upstream-skills/types'
5
+
6
+ /** The CLI's authorization as the latest `auth show` reported it, and where the upstream guides stand. */
7
+ export interface WecomAccountState {
8
+ readonly state: 'unchecked' | 'unauthorized' | 'authorized'
9
+ /** The bound bot's id, when the CLI reports one with an authorized state. */
10
+ readonly botId?: string
11
+ /** Whether the guides the `wecom` skill indexes are in place, downloading, or unavailable until a check retries them. */
12
+ readonly skills: UpstreamSkillsState
13
+ }
14
+
15
+ /** The operations the Plugins page starts. */
16
+ export type WecomOperationKind = 'check' | 'connect'
17
+
18
+ /** The WeCom step of an operation, besides the Service's `checking` and `cancelling`. */
19
+ export type WecomPhase = 'authorizing'
20
+
21
+ /** The wecom-cli commands an operation runs; a failed operation reports its last one with that command's exit code. */
22
+ export type WecomCommand = 'auth-init' | 'auth-status'
23
+
24
+ /** The complete WeCom view the presenter reads after each change. */
25
+ export type WecomState = CliAccountView<WecomAccountState, WecomOperationKind, WecomPhase, WecomCommand>