@helyx/bot 1.3.0 → 1.4.0

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 (83) hide show
  1. package/CHANGELOG.md +92 -28
  2. package/README.md +65 -11
  3. package/dist/cloud-connector.d.ts +11 -4
  4. package/dist/cloud-connector.js +52 -15
  5. package/dist/cloud-control-dispatcher.d.ts +8 -3
  6. package/dist/cloud-control-dispatcher.js +62 -4
  7. package/dist/control-errors.d.ts +4 -0
  8. package/dist/control-errors.js +8 -0
  9. package/dist/control-server-schemas.d.ts +84 -0
  10. package/dist/control-server-schemas.js +101 -0
  11. package/dist/control-server.d.ts +21 -7
  12. package/dist/control-server.js +88 -132
  13. package/dist/core-retention.d.ts +26 -0
  14. package/dist/core-retention.js +49 -0
  15. package/dist/creator-guild-join-service.d.ts +25 -0
  16. package/dist/creator-guild-join-service.js +218 -0
  17. package/dist/creator-invite-service.d.ts +37 -0
  18. package/dist/creator-invite-service.js +686 -0
  19. package/dist/creator-onboarding-control.d.ts +12 -0
  20. package/dist/creator-onboarding-control.js +65 -0
  21. package/dist/creator-onboarding-platform.d.ts +20 -0
  22. package/dist/creator-onboarding-platform.js +58 -0
  23. package/dist/dashboard-action-control.d.ts +2 -2
  24. package/dist/dashboard-action-control.js +2 -3
  25. package/dist/database-bootstrap.d.ts +36 -0
  26. package/dist/database-bootstrap.js +101 -0
  27. package/dist/developer-operations-module.d.ts +1 -0
  28. package/dist/developer-operations-module.js +34 -16
  29. package/dist/discord-owned-message-service.d.ts +1 -0
  30. package/dist/discord-owned-message-service.js +3 -0
  31. package/dist/guild-command-read-service.d.ts +8 -3
  32. package/dist/guild-command-read-service.js +14 -7
  33. package/dist/guild-command-release.d.ts +15 -8
  34. package/dist/guild-command-release.js +10 -3
  35. package/dist/guild-command-worker.d.ts +17 -4
  36. package/dist/guild-command-worker.js +17 -6
  37. package/dist/guilds.d.ts +24 -3
  38. package/dist/guilds.js +185 -64
  39. package/dist/hosted-server-moderation.d.ts +2 -2
  40. package/dist/hosted-server-moderation.js +10 -4
  41. package/dist/index.d.ts +1 -0
  42. package/dist/index.js +200 -81
  43. package/dist/interactions.js +16 -3
  44. package/dist/module-configuration.d.ts +1 -1
  45. package/dist/module-configuration.js +5 -2
  46. package/dist/module-logging.d.ts +8 -3
  47. package/dist/module-logging.js +13 -7
  48. package/dist/modules.d.ts +1 -0
  49. package/dist/modules.js +8 -1
  50. package/dist/mysql-runtime-persistence.d.ts +46 -0
  51. package/dist/mysql-runtime-persistence.js +91 -0
  52. package/dist/oauth-module.js +2 -2
  53. package/dist/oauth-service.d.ts +7 -0
  54. package/dist/oauth-service.js +3 -0
  55. package/dist/scheduled-task-runner.d.ts +9 -85
  56. package/dist/scheduled-task-runner.js +1 -1
  57. package/dist/shard-contracts.d.ts +135 -0
  58. package/dist/shard-contracts.js +13 -1
  59. package/dist/shard-router.d.ts +2 -1
  60. package/dist/shard-router.js +7 -0
  61. package/dist/shard-supervisor.js +43 -9
  62. package/dist/shard-worker.d.ts +5 -2
  63. package/dist/shard-worker.js +46 -5
  64. package/dist/supervisor-cloud-directory.d.ts +9 -3
  65. package/dist/supervisor-cloud-directory.js +8 -12
  66. package/dist/trivia-data-provider.d.ts +11 -0
  67. package/dist/trivia-data-provider.js +46 -26
  68. package/dist/verification-service.d.ts +2 -2
  69. package/dist/verification-service.js +6 -3
  70. package/documentation/README.md +5 -3
  71. package/documentation/examples/.env.example +15 -11
  72. package/documentation/guides/getting-started.md +29 -12
  73. package/documentation/guides/privacy-and-support.md +6 -5
  74. package/documentation/guides/self-hosting.md +16 -11
  75. package/documentation/modules/auto-moderation.md +7 -5
  76. package/documentation/modules/building-a-module.md +48 -2
  77. package/documentation/modules/moderation.md +5 -5
  78. package/documentation/modules/publishing-a-module.md +6 -4
  79. package/documentation/modules/testing-a-module.md +39 -4
  80. package/documentation/reference/environment.md +43 -9
  81. package/documentation/runbooks/backup-and-recovery.md +26 -7
  82. package/documentation/runbooks/installation-and-upgrades.md +97 -27
  83. package/package.json +20 -16
@@ -1,54 +1,124 @@
1
1
  # Installation and upgrade runbook
2
2
 
3
- Use this runbook for the first start of a generated project and for a reviewed
4
- release-set update that preserves the local environment and database.
3
+ Use this runbook from the root of a generated Helyx project. It covers first
4
+ start, compatible release-set updates and failed validation.
5
+
6
+ ## Check the release boundary first
7
+
8
+ This release uses consolidated fresh-install migration baselines. An existing
9
+ database with the earlier migration chain cannot use those baselines as an
10
+ ordinary in-place upgrade. Keep its matching packages and data and
11
+ [contact Helyx support](../guides/privacy-and-support.md#contact-support-safely)
12
+ before proceeding; no approved old-database transition is available yet.
13
+ Do not reset a database, remove its migration
14
+ history or change recorded checksums to make an update pass.
15
+
16
+ The updater changes project metadata; it does not verify or provide a
17
+ data-preserving migration path. A release described as fresh-install/reset-only
18
+ must not be applied to an existing database through the ordinary update steps
19
+ below.
5
20
 
6
21
  ## First installation
7
22
 
8
- 1. Generate the project with `helyx self-host init` and a reviewed build
9
- manifest.
10
- 2. Copy and complete `.env` with `helyx setup`.
11
- 3. Install dependencies with `npm ci` if they were not installed during
12
- generation.
13
- 4. Run `npm run doctor` and resolve every error.
14
- 5. Start the process and confirm database, Discord, and module health.
15
- 6. Exercise one low-risk command in a test server before production use.
23
+ 1. Download a starter ZIP, or generate it from the builder's reviewed manifest.
24
+ 2. Install its dependencies with `npm ci` unless generation used `--install`.
25
+ 3. Run `npm run setup`, then complete `.env`. A managed host may supply the
26
+ required values through its protected variables panel instead. Keep the
27
+ generated encryption key stable.
28
+ 4. Make the selected database reachable and run doctor through the matching
29
+ runtime path below. Resolve every error.
30
+ 5. Start Helyx and confirm database, Discord and module readiness. Exercise one
31
+ low-risk command in a private test server before production use.
32
+
33
+ The starter uses compiled npm packages: direct Node.js operation has no local
34
+ `npm run build` step. Docker builds the supplied image.
35
+
36
+ ## Run doctor in the right environment
37
+
38
+ - **Direct Node.js:** run `npm run doctor` after installation and configuration.
39
+ - **Docker Compose:** run `docker compose build bot`, start the included
40
+ PostgreSQL service with `docker compose up -d --wait database` if present,
41
+ then run
42
+ `docker compose run --rm bot node node_modules/@helyx/cli/dist/cli.js doctor`.
43
+ The MySQL Compose starter has no database service; its external database must
44
+ already be reachable. Use container doctor with container database addresses
45
+ such as `database`; that hostname normally cannot resolve from the host shell.
46
+ - **Managed hosting:** install the pinned dependencies, supply the production
47
+ variables and run `npm run doctor` through the provider's console or one-off
48
+ command facility before enabling its start process.
49
+
50
+ Doctor does not sign in to Discord, change the database or probe required server
51
+ capabilities. It inspects core migration history and validates selected packages
52
+ and engine compatibility. Module migration inspection runs only after no core
53
+ migrations remain pending. On a fresh database, pending migrations are expected;
54
+ normal startup applies core migrations, then module migrations, and probes
55
+ database capabilities. `npm run migrate` applies core migrations only and is not
56
+ a prerequisite before every start.
16
57
 
17
58
  ## Upgrade
18
59
 
19
- 1. Read the release notes and confirm the supported Node.js and npm versions.
20
- 2. Create a current PostgreSQL backup and preserve the existing project
60
+ 1. Read the release notes, confirm an ordinary upgrade is supported from your
61
+ installed database state, and check the supported Node.js and npm versions.
62
+ 2. Create a current backup of the selected database and preserve the existing project
21
63
  metadata and environment file.
22
- 3. Stop the Helyx process cleanly.
64
+ 3. Stop the bot cleanly. With Compose use `docker compose stop bot`, preserving
65
+ the database service and volume; on a managed host stop its application process.
23
66
  4. Preview the compatible release set:
24
67
 
25
68
  ```sh
26
- helyx self-host update --check
69
+ npm run update:check
27
70
  ```
28
71
 
29
72
  5. Apply it only after reviewing the complete change:
30
73
 
31
74
  ```sh
32
- helyx self-host update --confirm
33
- npm ci
34
- npm run doctor
75
+ npm run update
35
76
  ```
36
77
 
37
- 6. Start Helyx and verify health, command availability, and one representative
38
- workflow for every upgraded module.
39
-
40
- The updater backs up managed project metadata under `.helyx/backups` and does
41
- not change `.env` or customer database data. Database migrations can be
42
- forward-only. Never edit migration history or downgrade individual Helyx
43
- packages to simulate a rollback.
78
+ The generated `update` script runs `helyx self-host update --confirm` followed
79
+ by `npm ci`. The CLI command alone does not install the refreshed dependency
80
+ set. Older starters without these scripts can use
81
+ `npx --yes @helyx/cli@latest self-host update --check`, then the same command
82
+ with `--confirm`, followed by `npm ci`.
83
+
84
+ 6. Run doctor through the runtime path above. Docker users must rebuild the bot
85
+ image first, then recreate it with `docker compose up -d bot` after doctor
86
+ passes. Direct Node.js users start with `npm start`; managed hosts use their
87
+ configured start command.
88
+ 7. Verify health, command availability and one representative workflow for every
89
+ upgraded module.
90
+
91
+ The updater backs up `.gitignore`, `package.json`, `package-lock.json`,
92
+ `helyx.modules.json` and `SHA256SUMS` under `.helyx/backups/<timestamp>/`. It
93
+ refreshes exact Helyx dependencies and the lockfile together, leaving `.env` and
94
+ database data unchanged. This metadata backup is not a database backup or an
95
+ installed-dependency snapshot.
96
+
97
+ If metadata generation or lockfile validation fails inside `--confirm`, the
98
+ updater restores those managed files. That restoration does not cover a later
99
+ `npm ci`, doctor or startup failure. Database migrations can be forward-only.
100
+ Never downgrade individual Helyx packages to simulate a rollback.
101
+
102
+ `DATABASE_ENGINE` defaults to `postgresql`; use `mysql` only with the matching
103
+ adapter, database and module support. The setting is not a data-conversion tool.
104
+ Keep the selected engine unchanged during an ordinary update. Missing adapters,
105
+ an unsupported module/engine combination or an installation engine mismatch must
106
+ be resolved explicitly, not bypassed by falling back to another adapter.
107
+
108
+ Applied checksum mismatches or an interrupted MySQL DDL receipt are errors to
109
+ investigate before restarting, not fresh-install pending notices.
44
110
 
45
111
  ## Failed validation
46
112
 
47
113
  Leave the process stopped, retain sanitised logs, and determine whether the
48
114
  failure is configuration, package integrity, database connectivity, or module
49
- compatibility. If the updater restored managed files, rerun `npm ci` and
50
- `npm run doctor` before restarting the previous version. Restore data only from
51
- a tested backup and only when the incident specifically requires it.
115
+ compatibility. If the updater restored managed files before startup, rerun
116
+ `npm ci` and doctor against that restored set; Docker users rebuild and validate
117
+ the corresponding image. If startup or a manual migration already changed the
118
+ database, restoring project files does not reverse those changes. Check
119
+ package/schema compatibility and the backup recovery plan before restarting an
120
+ older release. Restore data only from a tested compatible backup when the
121
+ incident requires it.
52
122
 
53
123
  ## Troubleshooting
54
124
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helyx/bot",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Production Discord runtime for the modular Helyx platform.",
5
5
  "keywords": [
6
6
  "helyx",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public",
28
- "provenance": true
28
+ "provenance": false
29
29
  },
30
30
  "type": "module",
31
31
  "files": [
@@ -50,27 +50,31 @@
50
50
  "start": "node --env-file-if-exists=../../.env dist/index.js"
51
51
  },
52
52
  "dependencies": {
53
- "@helyx/config": ">=1.0.0 <2.0.0",
54
- "@helyx/control-protocol": ">=0.5.0 <0.6.0",
55
- "@helyx/core": ">=0.1.0 <0.2.0",
56
- "@helyx/database": ">=2.0.0 <3.0.0",
57
- "@helyx/framework": ">=0.1.0 <0.2.0",
58
- "@helyx/module-manifest": ">=0.11.0 <0.12.0",
59
- "@helyx/platform": ">=1.0.0 <2.0.0",
60
- "@helyx/sdk": ">=0.13.0 <0.14.0",
61
- "@helyx/status-client": ">=0.2.0 <0.3.0",
62
- "@helyx/verification-contracts": ">=0.3.0 <0.4.0",
53
+ "@helyx/config": ">=1.4.0 <2.0.0",
54
+ "@helyx/control-protocol": ">=0.7.0 <0.8.0",
55
+ "@helyx/core": ">=0.2.0 <0.3.0",
56
+ "@helyx/database": ">=2.4.0 <3.0.0",
57
+ "@helyx/database-contracts": ">=0.2.0 <0.3.0",
58
+ "@helyx/framework": ">=0.2.0 <0.3.0",
59
+ "@helyx/module-manifest": ">=0.13.0 <0.14.0",
60
+ "@helyx/platform": ">=1.3.0 <2.0.0",
61
+ "@helyx/sdk": ">=0.15.0 <0.16.0",
62
+ "@helyx/status-client": ">=0.3.0 <0.4.0",
63
+ "@helyx/verification-contracts": ">=0.4.0 <0.5.0",
63
64
  "discord.js": "14.27.0",
64
- "fastify": "5.12.3",
65
+ "fastify": "5.12.7",
65
66
  "pino": "10.3.1",
66
67
  "redis": "6.1.0",
67
- "undici": "6.28.0",
68
+ "undici": "6.29.0",
68
69
  "ws": "8.21.1",
69
70
  "zod": "4.4.3"
70
71
  },
72
+ "optionalDependencies": {
73
+ "@helyx/database-mysql": ">=0.2.0 <0.3.0"
74
+ },
71
75
  "peerDependencies": {
72
- "@helyx/module-automod": ">=1.0.0 <2.0.0",
73
- "@helyx/module-moderation": ">=1.0.0 <2.0.0"
76
+ "@helyx/module-automod": ">=1.1.0 <2.0.0",
77
+ "@helyx/module-moderation": ">=1.1.0 <2.0.0"
74
78
  },
75
79
  "peerDependenciesMeta": {
76
80
  "@helyx/module-automod": {