@shepai/cli 1.155.0-pr482.ac79b36 → 1.155.0-pr484.1619afe
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/README.md +117 -113
- package/apis/json-schema/Settings.yaml +0 -3
- package/dist/packages/core/src/domain/generated/output.d.ts +0 -82
- package/dist/packages/core/src/domain/generated/output.d.ts.map +1 -1
- package/dist/packages/core/src/domain/generated/output.js +0 -9
- package/dist/packages/core/src/infrastructure/di/container.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/di/container.js +1 -12
- package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.d.ts +0 -14
- package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.js +0 -34
- package/dist/packages/core/src/infrastructure/services/notifications/notification.service.d.ts +1 -9
- package/dist/packages/core/src/infrastructure/services/notifications/notification.service.d.ts.map +1 -1
- package/dist/packages/core/src/infrastructure/services/notifications/notification.service.js +1 -40
- package/dist/src/presentation/cli/commands/settings/index.d.ts +0 -1
- package/dist/src/presentation/cli/commands/settings/index.d.ts.map +1 -1
- package/dist/src/presentation/cli/commands/settings/index.js +1 -4
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/fallback-build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +3 -3
- package/web/.next/required-server-files.js +1 -1
- package/web/.next/required-server-files.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/chat/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/@drawer/chat/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/chat/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +29 -29
- package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/chat/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +29 -29
- package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/_not-found/page/server-reference-manifest.json +5 -5
- package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/settings/page/server-reference-manifest.json +8 -8
- package/web/.next/server/app/settings/page.js.nft.json +1 -1
- package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/skills/page/server-reference-manifest.json +10 -10
- package/web/.next/server/app/skills/page.js.nft.json +1 -1
- package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/tools/page/server-reference-manifest.json +10 -10
- package/web/.next/server/app/tools/page.js.nft.json +1 -1
- package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/version/page/server-reference-manifest.json +5 -5
- package/web/.next/server/app/version/page.js.nft.json +1 -1
- package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__beda892a._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__beda892a._.js.map +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__cd67a84c._.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__cd67a84c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js +2 -2
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__0b150ddf._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__17ed7ed1._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__17ed7ed1._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__28d0d265._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__28d0d265._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__357d99f9._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__42bf1807._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__42bf1807._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__56b70465._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__56b70465._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__88f7e8e6._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__88f7e8e6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__8b0aac03._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__c30f1f82._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__c30f1f82._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__f80bfc75._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__f80bfc75._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__f8dd4422._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__f8dd4422._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_05c23ad9._.js +1 -1
- package/web/.next/server/chunks/ssr/_05c23ad9._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_08f3fd21._.js +3 -0
- package/web/.next/server/chunks/ssr/{_912552dd._.js.map → _08f3fd21._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_16eb4fec._.js +1 -1
- package/web/.next/server/chunks/ssr/_16eb4fec._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_3a0b989f._.js +2 -2
- package/web/.next/server/chunks/ssr/_3a0b989f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_002d7e8d._.js → _4601ff05._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_002d7e8d._.js.map → _4601ff05._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_56b9d60f._.js +1 -1
- package/web/.next/server/chunks/ssr/_56b9d60f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_5f69c13f._.js +1 -1
- package/web/.next/server/chunks/ssr/_5f69c13f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_7c5b97c6._.js +1 -1
- package/web/.next/server/chunks/ssr/_7c5b97c6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_82c57f10._.js +1 -1
- package/web/.next/server/chunks/ssr/_82c57f10._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_9495d50b._.js +1 -1
- package/web/.next/server/chunks/ssr/_9495d50b._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_a0e3f7e4._.js +1 -1
- package/web/.next/server/chunks/ssr/_a0e3f7e4._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_ac4a3873._.js +1 -1
- package/web/.next/server/chunks/ssr/_ca0aa7f0._.js +1 -1
- package/web/.next/server/chunks/ssr/_ca0aa7f0._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_cb5a021e._.js +1 -1
- package/web/.next/server/chunks/ssr/_cb5a021e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_d4b20e29._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_d86175ae._.js +1 -1
- package/web/.next/server/chunks/ssr/_d86175ae._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_d8bedf13._.js +1 -1
- package/web/.next/server/chunks/ssr/_d8bedf13._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_97486b47._.js → _d957c7f8._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_97486b47._.js.map → _d957c7f8._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_fa7efce3._.js +2 -2
- package/web/.next/server/chunks/ssr/_fa7efce3._.js.map +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_cdc632e3.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_cdc632e3.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_39ca0924.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_39ca0924.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_357e3eb0._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_357e3eb0._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
- package/web/.next/server/pages/500.html +2 -2
- package/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/server/server-reference-manifest.json +45 -45
- package/web/.next/static/chunks/{b6fc216cfa8fa52a.js → 04cb9cede104b5f8.js} +2 -2
- package/web/.next/static/chunks/{8208e717057eedd0.js → 190cb2b91443b7a2.js} +1 -1
- package/web/.next/static/chunks/{a07d5cbafca0277c.js → 232221de97ee02ee.js} +1 -1
- package/web/.next/static/chunks/{d5cbc603b8bb904d.js → 5ea1d031a4327efd.js} +1 -1
- package/web/.next/static/chunks/{ad67307f6b0c1490.js → 639776981e3c0300.js} +1 -1
- package/web/.next/static/chunks/{e664cd5c9c0f4fd4.js → 6bef26d1ebd38687.js} +1 -1
- package/web/.next/static/chunks/{b4e5c56e14e63cb0.js → 7bdd3f51e4993fb6.js} +2 -2
- package/web/.next/static/chunks/{6c5e7b36525b3532.js → 9207c052206225b2.js} +2 -2
- package/web/.next/static/chunks/{13d4e516b0ecf5f0.js → b224651a2324c8f7.js} +1 -1
- package/web/.next/static/chunks/{d1c58b0747b10ae5.js → c3a9b33826b0e541.js} +1 -1
- package/web/.next/static/chunks/{818689ed2c41772b.js → e1b6fd86f641261d.js} +1 -1
- package/web/.next/static/chunks/{deef7f0b5f7981e8.js → e3339b33db2768bd.js} +1 -1
- package/apis/json-schema/TelegramCommandType.yaml +0 -11
- package/apis/json-schema/TelegramConfig.yaml +0 -21
- package/apis/json-schema/TelegramNotifyEvents.yaml +0 -61
- package/dist/packages/core/src/application/ports/output/services/telegram-service.interface.d.ts +0 -92
- package/dist/packages/core/src/application/ports/output/services/telegram-service.interface.d.ts.map +0 -1
- package/dist/packages/core/src/application/ports/output/services/telegram-service.interface.js +0 -37
- package/dist/packages/core/src/application/use-cases/telegram/configure-telegram.use-case.d.ts +0 -42
- package/dist/packages/core/src/application/use-cases/telegram/configure-telegram.use-case.d.ts.map +0 -1
- package/dist/packages/core/src/application/use-cases/telegram/configure-telegram.use-case.js +0 -108
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/049-add-telegram-settings.d.ts +0 -17
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/049-add-telegram-settings.d.ts.map +0 -1
- package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/049-add-telegram-settings.js +0 -40
- package/dist/packages/core/src/infrastructure/services/telegram/telegram.service.d.ts +0 -22
- package/dist/packages/core/src/infrastructure/services/telegram/telegram.service.d.ts.map +0 -1
- package/dist/packages/core/src/infrastructure/services/telegram/telegram.service.js +0 -128
- package/dist/src/presentation/cli/commands/settings/telegram.command.d.ts +0 -18
- package/dist/src/presentation/cli/commands/settings/telegram.command.d.ts.map +0 -1
- package/dist/src/presentation/cli/commands/settings/telegram.command.js +0 -158
- package/web/.next/server/chunks/ssr/_912552dd._.js +0 -3
- /package/web/.next/static/{fX8_4OoVzGj6K0VH9X7nb → SnRLSukTe4qbiJHXHhXVW}/_buildManifest.js +0 -0
- /package/web/.next/static/{fX8_4OoVzGj6K0VH9X7nb → SnRLSukTe4qbiJHXHhXVW}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{fX8_4OoVzGj6K0VH9X7nb → SnRLSukTe4qbiJHXHhXVW}/_ssgManifest.js +0 -0
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
$schema: https://json-schema.org/draft/2020-12/schema
|
|
2
|
-
$id: TelegramNotifyEvents.yaml
|
|
3
|
-
type: object
|
|
4
|
-
properties:
|
|
5
|
-
agentStarted:
|
|
6
|
-
type: boolean
|
|
7
|
-
default: false
|
|
8
|
-
description: Notify when agent starts running
|
|
9
|
-
phaseCompleted:
|
|
10
|
-
type: boolean
|
|
11
|
-
default: false
|
|
12
|
-
description: Notify when agent completes a workflow phase
|
|
13
|
-
waitingApproval:
|
|
14
|
-
type: boolean
|
|
15
|
-
default: true
|
|
16
|
-
description: Notify when agent is waiting for human approval
|
|
17
|
-
agentCompleted:
|
|
18
|
-
type: boolean
|
|
19
|
-
default: true
|
|
20
|
-
description: Notify when agent completes successfully
|
|
21
|
-
agentFailed:
|
|
22
|
-
type: boolean
|
|
23
|
-
default: true
|
|
24
|
-
description: Notify when agent execution fails
|
|
25
|
-
prMerged:
|
|
26
|
-
type: boolean
|
|
27
|
-
default: true
|
|
28
|
-
description: Notify when a pull request is merged on GitHub
|
|
29
|
-
prClosed:
|
|
30
|
-
type: boolean
|
|
31
|
-
default: false
|
|
32
|
-
description: Notify when a pull request is closed without merging on GitHub
|
|
33
|
-
prChecksPassed:
|
|
34
|
-
type: boolean
|
|
35
|
-
default: false
|
|
36
|
-
description: Notify when pull request CI checks pass
|
|
37
|
-
prChecksFailed:
|
|
38
|
-
type: boolean
|
|
39
|
-
default: true
|
|
40
|
-
description: Notify when pull request CI checks fail
|
|
41
|
-
prBlocked:
|
|
42
|
-
type: boolean
|
|
43
|
-
default: true
|
|
44
|
-
description: Notify when pull request has merge conflicts
|
|
45
|
-
mergeReviewReady:
|
|
46
|
-
type: boolean
|
|
47
|
-
default: true
|
|
48
|
-
description: Notify when feature is ready for merge review
|
|
49
|
-
required:
|
|
50
|
-
- agentStarted
|
|
51
|
-
- phaseCompleted
|
|
52
|
-
- waitingApproval
|
|
53
|
-
- agentCompleted
|
|
54
|
-
- agentFailed
|
|
55
|
-
- prMerged
|
|
56
|
-
- prClosed
|
|
57
|
-
- prChecksPassed
|
|
58
|
-
- prChecksFailed
|
|
59
|
-
- prBlocked
|
|
60
|
-
- mergeReviewReady
|
|
61
|
-
description: Telegram notification event type filters
|
package/dist/packages/core/src/application/ports/output/services/telegram-service.interface.d.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Telegram Service Interface
|
|
3
|
-
*
|
|
4
|
-
* Output port for interacting with the Telegram Bot API.
|
|
5
|
-
* Infrastructure layer provides concrete implementation.
|
|
6
|
-
*
|
|
7
|
-
* Following Clean Architecture:
|
|
8
|
-
* - Application layer depends on this interface
|
|
9
|
-
* - Infrastructure layer provides concrete implementation (TelegramService)
|
|
10
|
-
*/
|
|
11
|
-
import type { NotificationEvent } from '../../../../domain/generated/output.js';
|
|
12
|
-
/**
|
|
13
|
-
* Result of validating a bot token against the Telegram API.
|
|
14
|
-
*/
|
|
15
|
-
export interface TelegramBotInfo {
|
|
16
|
-
/** Bot's unique ID */
|
|
17
|
-
id: number;
|
|
18
|
-
/** Bot's display name */
|
|
19
|
-
firstName: string;
|
|
20
|
-
/** Bot's @username */
|
|
21
|
-
username: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Result of resolving the chat ID from recent bot updates.
|
|
25
|
-
*/
|
|
26
|
-
export interface TelegramChatResolution {
|
|
27
|
-
/** Resolved chat ID from the first /start message */
|
|
28
|
-
chatId: string;
|
|
29
|
-
/** Display name of the user who started the chat */
|
|
30
|
-
firstName: string;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Port interface for Telegram Bot API interactions.
|
|
34
|
-
*
|
|
35
|
-
* Implementations must:
|
|
36
|
-
* - Use the Telegram Bot HTTP API (no SDK dependency required)
|
|
37
|
-
* - Handle network errors gracefully (log, don't crash the host process)
|
|
38
|
-
* - Respect the enabled/disabled toggle in TelegramConfig
|
|
39
|
-
*/
|
|
40
|
-
export interface ITelegramService {
|
|
41
|
-
/**
|
|
42
|
-
* Validate a bot token by calling getMe on the Telegram Bot API.
|
|
43
|
-
*
|
|
44
|
-
* @param botToken - The bot token to validate
|
|
45
|
-
* @returns Bot info if valid
|
|
46
|
-
* @throws TelegramAuthError if the token is invalid
|
|
47
|
-
*/
|
|
48
|
-
validateBotToken(botToken: string): Promise<TelegramBotInfo>;
|
|
49
|
-
/**
|
|
50
|
-
* Resolve the chat ID by polling getUpdates for a /start message.
|
|
51
|
-
*
|
|
52
|
-
* @param botToken - The bot token to use
|
|
53
|
-
* @returns Chat resolution with the chat ID and sender name
|
|
54
|
-
* @throws TelegramNoChatError if no /start message is found
|
|
55
|
-
*/
|
|
56
|
-
resolveChatId(botToken: string): Promise<TelegramChatResolution>;
|
|
57
|
-
/**
|
|
58
|
-
* Send a plain text message to the configured Telegram chat.
|
|
59
|
-
*
|
|
60
|
-
* @param botToken - The bot token to use
|
|
61
|
-
* @param chatId - The chat ID to send to
|
|
62
|
-
* @param text - The message text (supports Telegram MarkdownV2)
|
|
63
|
-
*/
|
|
64
|
-
sendMessage(botToken: string, chatId: string, text: string): Promise<void>;
|
|
65
|
-
/**
|
|
66
|
-
* Format and send a notification event to Telegram.
|
|
67
|
-
*
|
|
68
|
-
* @param botToken - The bot token to use
|
|
69
|
-
* @param chatId - The chat ID to send to
|
|
70
|
-
* @param event - The notification event to format and send
|
|
71
|
-
*/
|
|
72
|
-
sendNotification(botToken: string, chatId: string, event: NotificationEvent): Promise<void>;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Error thrown when a Telegram bot token is invalid or expired.
|
|
76
|
-
*/
|
|
77
|
-
export declare class TelegramAuthError extends Error {
|
|
78
|
-
constructor(message: string);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Error thrown when no /start message is found in recent bot updates.
|
|
82
|
-
*/
|
|
83
|
-
export declare class TelegramNoChatError extends Error {
|
|
84
|
-
constructor(message: string);
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Error thrown when sending a Telegram message fails.
|
|
88
|
-
*/
|
|
89
|
-
export declare class TelegramSendError extends Error {
|
|
90
|
-
constructor(message: string);
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=telegram-service.interface.d.ts.map
|
package/dist/packages/core/src/application/ports/output/services/telegram-service.interface.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telegram-service.interface.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/core/src/application/ports/output/services/telegram-service.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OAMG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE7D;;;;;;OAMG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAEjE;;;;;;OAMG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3E;;;;;;OAMG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7F;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI5B"}
|
package/dist/packages/core/src/application/ports/output/services/telegram-service.interface.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Telegram Service Interface
|
|
3
|
-
*
|
|
4
|
-
* Output port for interacting with the Telegram Bot API.
|
|
5
|
-
* Infrastructure layer provides concrete implementation.
|
|
6
|
-
*
|
|
7
|
-
* Following Clean Architecture:
|
|
8
|
-
* - Application layer depends on this interface
|
|
9
|
-
* - Infrastructure layer provides concrete implementation (TelegramService)
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Error thrown when a Telegram bot token is invalid or expired.
|
|
13
|
-
*/
|
|
14
|
-
export class TelegramAuthError extends Error {
|
|
15
|
-
constructor(message) {
|
|
16
|
-
super(message);
|
|
17
|
-
this.name = 'TelegramAuthError';
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Error thrown when no /start message is found in recent bot updates.
|
|
22
|
-
*/
|
|
23
|
-
export class TelegramNoChatError extends Error {
|
|
24
|
-
constructor(message) {
|
|
25
|
-
super(message);
|
|
26
|
-
this.name = 'TelegramNoChatError';
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Error thrown when sending a Telegram message fails.
|
|
31
|
-
*/
|
|
32
|
-
export class TelegramSendError extends Error {
|
|
33
|
-
constructor(message) {
|
|
34
|
-
super(message);
|
|
35
|
-
this.name = 'TelegramSendError';
|
|
36
|
-
}
|
|
37
|
-
}
|
package/dist/packages/core/src/application/use-cases/telegram/configure-telegram.use-case.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configure Telegram Use Case
|
|
3
|
-
*
|
|
4
|
-
* Validates the Telegram bot token, resolves the chat ID, and
|
|
5
|
-
* persists the Telegram configuration to settings.
|
|
6
|
-
*
|
|
7
|
-
* Business Rules:
|
|
8
|
-
* - Bot token must be valid (verified via Telegram API getMe)
|
|
9
|
-
* - Chat ID is resolved automatically from recent /start messages
|
|
10
|
-
* - If both token and chatId are provided, skip auto-resolution
|
|
11
|
-
* - Disabling clears only the enabled flag (preserves token + chatId for re-enable)
|
|
12
|
-
*/
|
|
13
|
-
import type { Settings, TelegramNotifyEvents } from '../../../domain/generated/output.js';
|
|
14
|
-
import type { ISettingsRepository } from '../../ports/output/repositories/settings.repository.interface.js';
|
|
15
|
-
import type { ITelegramService, TelegramBotInfo, TelegramChatResolution } from '../../ports/output/services/telegram-service.interface.js';
|
|
16
|
-
export interface ConfigureTelegramInput {
|
|
17
|
-
/** Enable or disable Telegram integration */
|
|
18
|
-
enabled: boolean;
|
|
19
|
-
/** Bot API token from @BotFather (required when enabling) */
|
|
20
|
-
botToken?: string;
|
|
21
|
-
/** Chat ID to send notifications to (optional, auto-resolved if omitted) */
|
|
22
|
-
chatId?: string;
|
|
23
|
-
/** Notification event type filters (optional, uses defaults if omitted) */
|
|
24
|
-
notifyEvents?: Partial<TelegramNotifyEvents>;
|
|
25
|
-
}
|
|
26
|
-
export interface ConfigureTelegramResult {
|
|
27
|
-
/** Updated settings */
|
|
28
|
-
settings: Settings;
|
|
29
|
-
/** Bot info (only when enabling with a new token) */
|
|
30
|
-
botInfo?: TelegramBotInfo;
|
|
31
|
-
/** Chat resolution info (only when auto-resolving chat ID) */
|
|
32
|
-
chatResolution?: TelegramChatResolution;
|
|
33
|
-
}
|
|
34
|
-
export declare class ConfigureTelegramUseCase {
|
|
35
|
-
private readonly settingsRepository;
|
|
36
|
-
private readonly telegramService;
|
|
37
|
-
constructor(settingsRepository: ISettingsRepository, telegramService: ITelegramService);
|
|
38
|
-
execute(input: ConfigureTelegramInput): Promise<ConfigureTelegramResult>;
|
|
39
|
-
private getDefaultTelegramConfig;
|
|
40
|
-
private getDefaultNotifyEvents;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=configure-telegram.use-case.d.ts.map
|
package/dist/packages/core/src/application/use-cases/telegram/configure-telegram.use-case.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configure-telegram.use-case.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/application/use-cases/telegram/configure-telegram.use-case.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EACV,QAAQ,EAER,oBAAoB,EACrB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kEAAkE,CAAC;AAC5G,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACvB,MAAM,2DAA2D,CAAC;AAEnE,MAAM,WAAW,sBAAsB;IACrC,6CAA6C;IAC7C,OAAO,EAAE,OAAO,CAAC;IACjB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,YAAY,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,uBAAuB;IACtC,uBAAuB;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,qDAAqD;IACrD,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,8DAA8D;IAC9D,cAAc,CAAC,EAAE,sBAAsB,CAAC;CACzC;AAED,qBACa,wBAAwB;IAGjC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IAEnC,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAFf,kBAAkB,EAAE,mBAAmB,EAEvC,eAAe,EAAE,gBAAgB;IAG9C,OAAO,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IA8D9E,OAAO,CAAC,wBAAwB;IAOhC,OAAO,CAAC,sBAAsB;CAe/B"}
|
package/dist/packages/core/src/application/use-cases/telegram/configure-telegram.use-case.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configure Telegram Use Case
|
|
3
|
-
*
|
|
4
|
-
* Validates the Telegram bot token, resolves the chat ID, and
|
|
5
|
-
* persists the Telegram configuration to settings.
|
|
6
|
-
*
|
|
7
|
-
* Business Rules:
|
|
8
|
-
* - Bot token must be valid (verified via Telegram API getMe)
|
|
9
|
-
* - Chat ID is resolved automatically from recent /start messages
|
|
10
|
-
* - If both token and chatId are provided, skip auto-resolution
|
|
11
|
-
* - Disabling clears only the enabled flag (preserves token + chatId for re-enable)
|
|
12
|
-
*/
|
|
13
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
14
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
17
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
|
-
};
|
|
19
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
21
|
-
};
|
|
22
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
23
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
24
|
-
};
|
|
25
|
-
import { injectable, inject } from 'tsyringe';
|
|
26
|
-
let ConfigureTelegramUseCase = class ConfigureTelegramUseCase {
|
|
27
|
-
settingsRepository;
|
|
28
|
-
telegramService;
|
|
29
|
-
constructor(settingsRepository, telegramService) {
|
|
30
|
-
this.settingsRepository = settingsRepository;
|
|
31
|
-
this.telegramService = telegramService;
|
|
32
|
-
}
|
|
33
|
-
async execute(input) {
|
|
34
|
-
const settings = await this.settingsRepository.load();
|
|
35
|
-
if (!settings) {
|
|
36
|
-
throw new Error('Settings not initialized');
|
|
37
|
-
}
|
|
38
|
-
const result = { settings };
|
|
39
|
-
if (!input.enabled) {
|
|
40
|
-
// Disable: preserve token and chatId for easy re-enable
|
|
41
|
-
settings.telegram = {
|
|
42
|
-
...this.getDefaultTelegramConfig(),
|
|
43
|
-
...settings.telegram,
|
|
44
|
-
enabled: false,
|
|
45
|
-
};
|
|
46
|
-
await this.settingsRepository.update(settings);
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
// Enabling: validate bot token
|
|
50
|
-
const botToken = input.botToken ?? settings.telegram?.botToken;
|
|
51
|
-
if (!botToken) {
|
|
52
|
-
throw new Error('Bot token is required when enabling Telegram integration');
|
|
53
|
-
}
|
|
54
|
-
const botInfo = await this.telegramService.validateBotToken(botToken);
|
|
55
|
-
result.botInfo = botInfo;
|
|
56
|
-
// Resolve chat ID if not provided
|
|
57
|
-
let chatId = input.chatId ?? settings.telegram?.chatId;
|
|
58
|
-
if (!chatId) {
|
|
59
|
-
const chatResolution = await this.telegramService.resolveChatId(botToken);
|
|
60
|
-
chatId = chatResolution.chatId;
|
|
61
|
-
result.chatResolution = chatResolution;
|
|
62
|
-
}
|
|
63
|
-
// Merge notify events with defaults
|
|
64
|
-
const currentEvents = settings.telegram?.notifyEvents ?? this.getDefaultNotifyEvents();
|
|
65
|
-
const notifyEvents = {
|
|
66
|
-
...currentEvents,
|
|
67
|
-
...input.notifyEvents,
|
|
68
|
-
};
|
|
69
|
-
settings.telegram = {
|
|
70
|
-
enabled: true,
|
|
71
|
-
botToken,
|
|
72
|
-
chatId,
|
|
73
|
-
notifyEvents,
|
|
74
|
-
};
|
|
75
|
-
await this.settingsRepository.update(settings);
|
|
76
|
-
// Send a test message to confirm the connection works
|
|
77
|
-
await this.telegramService.sendMessage(botToken, chatId, `\u2705 <b>Shep connected!</b>\nBot: @${botInfo.username}\nNotifications will appear here.`);
|
|
78
|
-
return result;
|
|
79
|
-
}
|
|
80
|
-
getDefaultTelegramConfig() {
|
|
81
|
-
return {
|
|
82
|
-
enabled: false,
|
|
83
|
-
notifyEvents: this.getDefaultNotifyEvents(),
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
getDefaultNotifyEvents() {
|
|
87
|
-
return {
|
|
88
|
-
agentStarted: false,
|
|
89
|
-
phaseCompleted: false,
|
|
90
|
-
waitingApproval: true,
|
|
91
|
-
agentCompleted: true,
|
|
92
|
-
agentFailed: true,
|
|
93
|
-
prMerged: true,
|
|
94
|
-
prClosed: false,
|
|
95
|
-
prChecksPassed: false,
|
|
96
|
-
prChecksFailed: true,
|
|
97
|
-
prBlocked: true,
|
|
98
|
-
mergeReviewReady: true,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
ConfigureTelegramUseCase = __decorate([
|
|
103
|
-
injectable(),
|
|
104
|
-
__param(0, inject('ISettingsRepository')),
|
|
105
|
-
__param(1, inject('ITelegramService')),
|
|
106
|
-
__metadata("design:paramtypes", [Object, Object])
|
|
107
|
-
], ConfigureTelegramUseCase);
|
|
108
|
-
export { ConfigureTelegramUseCase };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Migration 049: Add Telegram remote control settings columns to the settings table.
|
|
3
|
-
*
|
|
4
|
-
* Adds columns for the Telegram Bot integration configuration:
|
|
5
|
-
* - telegram_enabled (INTEGER DEFAULT 0): whether Telegram integration is active
|
|
6
|
-
* - telegram_bot_token (TEXT): Bot API token from @BotFather
|
|
7
|
-
* - telegram_chat_id (TEXT): Paired chat ID
|
|
8
|
-
* - telegram_notify_* (INTEGER DEFAULT 0/1): per-event-type notification filters
|
|
9
|
-
*
|
|
10
|
-
* Default values are applied via column defaults so no existing rows need updating.
|
|
11
|
-
* Guards against duplicate column errors using table_info pragma.
|
|
12
|
-
*/
|
|
13
|
-
import type { MigrationParams } from 'umzug';
|
|
14
|
-
import type Database from 'better-sqlite3';
|
|
15
|
-
export declare function up({ context: db }: MigrationParams<Database.Database>): Promise<void>;
|
|
16
|
-
export declare function down({ context: db }: MigrationParams<Database.Database>): Promise<void>;
|
|
17
|
-
//# sourceMappingURL=049-add-telegram-settings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"049-add-telegram-settings.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/core/src/infrastructure/persistence/sqlite/migrations/049-add-telegram-settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAmB3C,wBAAsB,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAS3F;AAED,wBAAsB,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7F"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Migration 049: Add Telegram remote control settings columns to the settings table.
|
|
3
|
-
*
|
|
4
|
-
* Adds columns for the Telegram Bot integration configuration:
|
|
5
|
-
* - telegram_enabled (INTEGER DEFAULT 0): whether Telegram integration is active
|
|
6
|
-
* - telegram_bot_token (TEXT): Bot API token from @BotFather
|
|
7
|
-
* - telegram_chat_id (TEXT): Paired chat ID
|
|
8
|
-
* - telegram_notify_* (INTEGER DEFAULT 0/1): per-event-type notification filters
|
|
9
|
-
*
|
|
10
|
-
* Default values are applied via column defaults so no existing rows need updating.
|
|
11
|
-
* Guards against duplicate column errors using table_info pragma.
|
|
12
|
-
*/
|
|
13
|
-
const COLUMNS = [
|
|
14
|
-
{ name: 'telegram_enabled', sql: 'INTEGER NOT NULL DEFAULT 0' },
|
|
15
|
-
{ name: 'telegram_bot_token', sql: 'TEXT' },
|
|
16
|
-
{ name: 'telegram_chat_id', sql: 'TEXT' },
|
|
17
|
-
{ name: 'telegram_notify_agent_started', sql: 'INTEGER NOT NULL DEFAULT 0' },
|
|
18
|
-
{ name: 'telegram_notify_phase_completed', sql: 'INTEGER NOT NULL DEFAULT 0' },
|
|
19
|
-
{ name: 'telegram_notify_waiting_approval', sql: 'INTEGER NOT NULL DEFAULT 1' },
|
|
20
|
-
{ name: 'telegram_notify_agent_completed', sql: 'INTEGER NOT NULL DEFAULT 1' },
|
|
21
|
-
{ name: 'telegram_notify_agent_failed', sql: 'INTEGER NOT NULL DEFAULT 1' },
|
|
22
|
-
{ name: 'telegram_notify_pr_merged', sql: 'INTEGER NOT NULL DEFAULT 1' },
|
|
23
|
-
{ name: 'telegram_notify_pr_closed', sql: 'INTEGER NOT NULL DEFAULT 0' },
|
|
24
|
-
{ name: 'telegram_notify_pr_checks_passed', sql: 'INTEGER NOT NULL DEFAULT 0' },
|
|
25
|
-
{ name: 'telegram_notify_pr_checks_failed', sql: 'INTEGER NOT NULL DEFAULT 1' },
|
|
26
|
-
{ name: 'telegram_notify_pr_blocked', sql: 'INTEGER NOT NULL DEFAULT 1' },
|
|
27
|
-
{ name: 'telegram_notify_merge_review_ready', sql: 'INTEGER NOT NULL DEFAULT 1' },
|
|
28
|
-
];
|
|
29
|
-
export async function up({ context: db }) {
|
|
30
|
-
const columns = db.pragma('table_info(settings)');
|
|
31
|
-
const existing = new Set(columns.map((c) => c.name));
|
|
32
|
-
for (const col of COLUMNS) {
|
|
33
|
-
if (!existing.has(col.name)) {
|
|
34
|
-
db.exec(`ALTER TABLE settings ADD COLUMN ${col.name} ${col.sql}`);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
export async function down({ context: db }) {
|
|
39
|
-
void db;
|
|
40
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Telegram Service Implementation
|
|
3
|
-
*
|
|
4
|
-
* Implements the ITelegramService port using the Telegram Bot HTTP API.
|
|
5
|
-
* Uses native `fetch` (available in Node 18+) — no external SDK required.
|
|
6
|
-
*
|
|
7
|
-
* All methods are stateless; bot token and chat ID are passed as parameters
|
|
8
|
-
* so the service can be used for validation before persisting config.
|
|
9
|
-
*/
|
|
10
|
-
import type { NotificationEvent } from '../../../domain/generated/output.js';
|
|
11
|
-
import type { ITelegramService, TelegramBotInfo, TelegramChatResolution } from '../../../application/ports/output/services/telegram-service.interface.js';
|
|
12
|
-
export declare class TelegramService implements ITelegramService {
|
|
13
|
-
validateBotToken(botToken: string): Promise<TelegramBotInfo>;
|
|
14
|
-
resolveChatId(botToken: string): Promise<TelegramChatResolution>;
|
|
15
|
-
sendMessage(botToken: string, chatId: string, text: string): Promise<void>;
|
|
16
|
-
sendNotification(botToken: string, chatId: string, event: NotificationEvent): Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* Escape HTML special characters for Telegram's HTML parse mode.
|
|
19
|
-
*/
|
|
20
|
-
private escapeHtml;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=telegram.service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telegram.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/telegram/telegram.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACvB,MAAM,0EAA0E,CAAC;AA2ClF,qBAAa,eAAgB,YAAW,gBAAgB;IAChD,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IA6B5D,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IA0ChE,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA8B1E,gBAAgB,CACpB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,IAAI,CAAC;IAgBhB;;OAEG;IACH,OAAO,CAAC,UAAU;CAGnB"}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Telegram Service Implementation
|
|
3
|
-
*
|
|
4
|
-
* Implements the ITelegramService port using the Telegram Bot HTTP API.
|
|
5
|
-
* Uses native `fetch` (available in Node 18+) — no external SDK required.
|
|
6
|
-
*
|
|
7
|
-
* All methods are stateless; bot token and chat ID are passed as parameters
|
|
8
|
-
* so the service can be used for validation before persisting config.
|
|
9
|
-
*/
|
|
10
|
-
import { NotificationEventType } from '../../../domain/generated/output.js';
|
|
11
|
-
import { TelegramAuthError, TelegramNoChatError, TelegramSendError, } from '../../../application/ports/output/services/telegram-service.interface.js';
|
|
12
|
-
const TELEGRAM_API_BASE = 'https://api.telegram.org/bot';
|
|
13
|
-
/**
|
|
14
|
-
* Human-readable labels for notification event types.
|
|
15
|
-
*/
|
|
16
|
-
const EVENT_LABELS = {
|
|
17
|
-
[NotificationEventType.AgentStarted]: 'Agent Started',
|
|
18
|
-
[NotificationEventType.PhaseCompleted]: 'Phase Completed',
|
|
19
|
-
[NotificationEventType.WaitingApproval]: 'Waiting for Approval',
|
|
20
|
-
[NotificationEventType.AgentCompleted]: 'Agent Completed',
|
|
21
|
-
[NotificationEventType.AgentFailed]: 'Agent Failed',
|
|
22
|
-
[NotificationEventType.PrMerged]: 'PR Merged',
|
|
23
|
-
[NotificationEventType.PrClosed]: 'PR Closed',
|
|
24
|
-
[NotificationEventType.PrChecksPassed]: 'PR Checks Passed',
|
|
25
|
-
[NotificationEventType.PrChecksFailed]: 'PR Checks Failed',
|
|
26
|
-
[NotificationEventType.PrBlocked]: 'PR Blocked',
|
|
27
|
-
[NotificationEventType.MergeReviewReady]: 'Merge Review Ready',
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Emoji indicators for notification event types.
|
|
31
|
-
*/
|
|
32
|
-
const EVENT_EMOJI = {
|
|
33
|
-
[NotificationEventType.AgentStarted]: '\u{1F680}',
|
|
34
|
-
[NotificationEventType.PhaseCompleted]: '\u2705',
|
|
35
|
-
[NotificationEventType.WaitingApproval]: '\u23F3',
|
|
36
|
-
[NotificationEventType.AgentCompleted]: '\u{1F389}',
|
|
37
|
-
[NotificationEventType.AgentFailed]: '\u274C',
|
|
38
|
-
[NotificationEventType.PrMerged]: '\u{1F7E2}',
|
|
39
|
-
[NotificationEventType.PrClosed]: '\u{1F534}',
|
|
40
|
-
[NotificationEventType.PrChecksPassed]: '\u2705',
|
|
41
|
-
[NotificationEventType.PrChecksFailed]: '\u274C',
|
|
42
|
-
[NotificationEventType.PrBlocked]: '\u26A0\uFE0F',
|
|
43
|
-
[NotificationEventType.MergeReviewReady]: '\u{1F4CB}',
|
|
44
|
-
};
|
|
45
|
-
export class TelegramService {
|
|
46
|
-
async validateBotToken(botToken) {
|
|
47
|
-
const url = `${TELEGRAM_API_BASE}${botToken}/getMe`;
|
|
48
|
-
let response;
|
|
49
|
-
try {
|
|
50
|
-
response = await fetch(url);
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
throw new TelegramAuthError(`Failed to connect to Telegram API: ${error instanceof Error ? error.message : String(error)}`);
|
|
54
|
-
}
|
|
55
|
-
const body = (await response.json());
|
|
56
|
-
if (!body.ok || !body.result) {
|
|
57
|
-
throw new TelegramAuthError(body.description ?? 'Invalid bot token');
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
id: body.result.id,
|
|
61
|
-
firstName: body.result.first_name,
|
|
62
|
-
username: body.result.username,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
async resolveChatId(botToken) {
|
|
66
|
-
const url = `${TELEGRAM_API_BASE}${botToken}/getUpdates?limit=10&allowed_updates=["message"]`;
|
|
67
|
-
let response;
|
|
68
|
-
try {
|
|
69
|
-
response = await fetch(url);
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
throw new TelegramNoChatError(`Failed to connect to Telegram API: ${error instanceof Error ? error.message : String(error)}`);
|
|
73
|
-
}
|
|
74
|
-
const body = (await response.json());
|
|
75
|
-
if (!body.ok || !body.result) {
|
|
76
|
-
throw new TelegramNoChatError('Failed to fetch bot updates');
|
|
77
|
-
}
|
|
78
|
-
// Look for a /start message
|
|
79
|
-
const startUpdate = body.result.find((update) => update.message?.text === '/start');
|
|
80
|
-
if (!startUpdate?.message) {
|
|
81
|
-
throw new TelegramNoChatError('No /start message found. Please send /start to your bot on Telegram first, then retry.');
|
|
82
|
-
}
|
|
83
|
-
return {
|
|
84
|
-
chatId: String(startUpdate.message.chat.id),
|
|
85
|
-
firstName: startUpdate.message.from?.first_name ?? 'Unknown',
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
async sendMessage(botToken, chatId, text) {
|
|
89
|
-
const url = `${TELEGRAM_API_BASE}${botToken}/sendMessage`;
|
|
90
|
-
let response;
|
|
91
|
-
try {
|
|
92
|
-
response = await fetch(url, {
|
|
93
|
-
method: 'POST',
|
|
94
|
-
headers: { 'Content-Type': 'application/json' },
|
|
95
|
-
body: JSON.stringify({
|
|
96
|
-
chat_id: chatId,
|
|
97
|
-
text,
|
|
98
|
-
parse_mode: 'HTML',
|
|
99
|
-
}),
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
throw new TelegramSendError(`Failed to send Telegram message: ${error instanceof Error ? error.message : String(error)}`);
|
|
104
|
-
}
|
|
105
|
-
const body = (await response.json());
|
|
106
|
-
if (!body.ok) {
|
|
107
|
-
throw new TelegramSendError(`Telegram API error: ${body.description ?? 'Unknown error'}`);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
async sendNotification(botToken, chatId, event) {
|
|
111
|
-
const emoji = EVENT_EMOJI[event.eventType] ?? '';
|
|
112
|
-
const label = EVENT_LABELS[event.eventType] ?? event.eventType;
|
|
113
|
-
const lines = [
|
|
114
|
-
`${emoji} <b>${label}</b>`,
|
|
115
|
-
`Feature: ${this.escapeHtml(event.featureName)}`,
|
|
116
|
-
];
|
|
117
|
-
if (event.message) {
|
|
118
|
-
lines.push(`\n${this.escapeHtml(event.message)}`);
|
|
119
|
-
}
|
|
120
|
-
await this.sendMessage(botToken, chatId, lines.join('\n'));
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Escape HTML special characters for Telegram's HTML parse mode.
|
|
124
|
-
*/
|
|
125
|
-
escapeHtml(text) {
|
|
126
|
-
return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
127
|
-
}
|
|
128
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Telegram Configuration Command
|
|
3
|
-
*
|
|
4
|
-
* Configures the Telegram Bot integration for remote control and notifications.
|
|
5
|
-
*
|
|
6
|
-
* Usage:
|
|
7
|
-
* shep settings telegram # Interactive setup
|
|
8
|
-
* shep settings telegram --bot-token <token> # Set token + auto-pair
|
|
9
|
-
* shep settings telegram --bot-token <token> --chat-id 123 # Set token + explicit chat
|
|
10
|
-
* shep settings telegram --disable # Disable Telegram
|
|
11
|
-
* shep settings telegram --status # Show current status
|
|
12
|
-
*/
|
|
13
|
-
import { Command } from 'commander';
|
|
14
|
-
/**
|
|
15
|
-
* Create the Telegram configuration command.
|
|
16
|
-
*/
|
|
17
|
-
export declare function createTelegramCommand(): Command;
|
|
18
|
-
//# sourceMappingURL=telegram.command.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telegram.command.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/cli/commands/settings/telegram.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmBpC;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CAsD/C"}
|