Starts us down the path of fixing https://github.com/the-draupnir-project/Draupnir/issues/1023
This PR gets us Zero Touch Provisioning support for AS mode and Bot mode. If your env can take usr and pswd and turn it into access tokens or however you want to do that then well we dont need to do PSWD Auth at all.
If you dont PSWD auth is useful for this and is probably what i will resort to in mdad for Zero Touch Provisioning.
Draft as this PR is very much not even mx-tested because mx-tester decided to say nope cat.
* Zero Touch Provisioning Support
* Update Account data keys to Gnuxie Suggested Values
Co-authored-by: Gnuxie <50846879+Gnuxie@users.noreply.github.com>
* Refine ZTD
Co-authored-by: Gnuxie <Gnuxie@users.noreply.github.com>
* Refine Config validation
* Run Prettier
* Fix Test Linting
* Refine ZTD Branch by removing leftover config values.
* Remove fallback management room value as it breaks ZTP
* Fix config validation having Truthy problems
* Fix dangling import.
* Fix config validation error.
* Revert "Fix config validation error."
This reverts commit c313dcbb52.
* Remove fake cast on config.initialManager
* note only available in develop while we fix shit
* Stop tests from accessing config.managementRoom directly.
---------
Co-authored-by: Gnuxie <50846879+Gnuxie@users.noreply.github.com>
Co-authored-by: Gnuxie <Gnuxie@users.noreply.github.com>
Co-authored-by: gnuxie <Gnuxie@protonmail.com>
* Add Avatar Command to bot mode and AS mode
* Add changesets
* Move MXC URI validation to matrix basic types
* Fix MediaID being mixed case when its exempt from usual case rules.
* Update changeset
* Integrate Gnuxie Review Feedback
* Fix linting errors
* Fix having forgotten to run prettier.
* Integrate Gnuxie review feedback.
* Fix version.txt.tmp files
* Tighten ActionException wrapping to only accept Error.
For months we had a bug where the "exception kind" enum was being
provided as the error instead of the wrapped error in bot sdk wrapper
code. This exception kind enum was optional in the factory method
being used for the MatrixException type and so this resulted in
draupnir reporting simply `undefined` when there were errors. Which
was a major issue because not only did it make it difficult to track
problems down, but it made the software look like shit. Remarkably we
were still able to remotely diagnose problems essentially blind here.
But it was caused by the ActionException accepting `unknown` for Error
in order to tolerate a number of causes. We figure that this is
unacceptable because it allows for these kinds of bugs and also that
it delays finding out where we are calling broken apis.
Closes https://github.com/the-draupnir-project/Draupnir/issues/759.
Closes https://github.com/the-draupnir-project/planning/issues/137.
* Flakey test idk.
* Make Appservice register and setup basic profile information.
Basic Profile information being setting a display name if none exists.
* Add changeset information
* Relocate Profile logic to after initialisation.
* Clean up Appservice Bot Reg and Profile Set code
Co-authored-by: Gnuxie <Gnuxie@users.noreply.github.com>
* Workaround bug with ensureRegistered in matrix-appservice-bridge.
https://github.com/matrix-org/matrix-appservice-bridge/issues/525
* Clarify that this is mostly dead code
---------
Co-authored-by: Gnuxie <Gnuxie@users.noreply.github.com>
* Be more precise about licensing.
I've added a root LICENSE file describing the use of multiple licenses
in the repository, especially given that it is now monorepo.
This does not change any licensing terms or introduce new requirements
It makes the existing setup more explicit and easier to understand for
users and downstream distributors. And reflects the existing REUSE
compliant setup.
* Be more comprehensive in our description.
* Add Version command to AS mode admin room
This replicates the status command output giving version string data in a convenient format to AS Admins.
* Add Provision Limit and Force Provision Command
* Add SelfServiceProvisioning Config Flag that defaults to False
This defaults to false due to the currently known problem where Self Service Provisioning ACLs are broken.
So this config exists to allow that codepath to be disabled while we work on fixing it.
* Add Copyright Headers
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Split Version Command integration test out into new file.
* Fix Self Service Provision Message
Co-authored-by: Gnuxie <50846879+Gnuxie@users.noreply.github.com>
* FIx AS.TS
* Clean up Cat's tests
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Gnuxie <50846879+Gnuxie@users.noreply.github.com>
Co-authored-by: gnuxie <Gnuxie@protonmail.com>
We had to move it but it has virtually no effect downstream as we
distribute the news on the filesystem too.
If something critical happens we can just put a shim on the repo in
the old spot.
Closes https://github.com/the-draupnir-project/planning/issues/111
Looks like this:
```
TypeError: Could not create Draupnir
caused by: @mjolnir:localhost:9999 doesn't have the power level required to send state events in the management room. Please make the Draupnir user an administrator
at ResultError.toExpectError (/home/user/experiments/Draupnir/node_modules/@gnuxie/typescript-result/src/Result.ts:200:12)
at ExpectError (/home/user/experiments/Draupnir/node_modules/@gnuxie/typescript-result/src/Result.ts:128:24)
at Object.expect (/home/user/experiments/Draupnir/node_modules/@gnuxie/typescript-result/src/Result.ts:137:10)
at makeBotModeToggle (/home/user/experiments/Draupnir/apps/draupnir/test/integration/mjolnirSetupUtils.ts:194:5)
at processTicksAndRejections (node:internal/process/task_queues:104:5)
at async /home/user/experiments/Draupnir/apps/draupnir/test/integration/manualLaunchScript.ts:23:18
```
Fixes https://github.com/the-draupnir-project/Draupnir/issues/1025
Closes https://github.com/the-draupnir-project/planning/issues/108
* Fix test:manual deleting the prior management room
The old behaviour of leaving any stale management
room active was intentional, to be able to inspect
failed tests and restart the bot quickly to check
changes.
* Check Draupnir can send state to the management room at startup.
Fixes https://github.com/the-draupnir-project/Draupnir/issues/1025
Part of https://github.com/the-draupnir-project/planning/issues/108
* Fix small bug in PowerLevelsMirror.
It was checking the wrong entries for regular events.
Discovered as part of https://github.com/the-draupnir-project/planning/issues/108
* Fix typos in privileged creator APIs
Fixed during https://github.com/the-draupnir-project/planning/issues/108
* Notify management room of lack of state_default permission.
* Move src to apps/draupnir/src
https://github.com/the-draupnir-project/planning/issues/100
* Move package.json
https://github.com/the-draupnir-project/planning/issues/100
* Add matrix-basic-types to monorepo.
Get everything working including linting and prettier :3
https://github.com/the-draupnir-project/planning/issues/100
* Add interface-manager to monorepo.
This was a bitch because apparently we forgot to delete node_modules
before creating the workspace package.json. So it had linked a bunch
of local stuff like was in node_modules for Draupnir...
Anyways i think we're still on track.
https://github.com/the-draupnir-project/planning/issues/100
* idk why there are prettier changes in apps but there are.
* Add matrix-protection-suite to monorepo.
https://github.com/the-draupnir-project/planning/issues/100
* Add matrix-protection-suite-for-matrix-bot-sdk
https://github.com/the-draupnir-project/planning/issues/100
We will need to add the real upstreams and versions and remove the
file links as we publish the packages.
* Move mps-interface-adaptor into monorepo
https://github.com/the-draupnir-project/planning/issues/100
Wohoo, i think only draupnir is left now?
* Move Draupnir test files to draupnir directory smh smh smh.
https://github.com/the-draupnir-project/planning/issues/100
* Fix typescript config for tests and eslint.
Now we get proper linting and type checking of tests.
https://github.com/the-draupnir-project/planning/issues/100
* WIP Integrating draupnir into monorepo tooling...
https://github.com/the-draupnir-project/planning/issues/100
We need to stop aliasing bot-sdk but we should first check that
upstream is using a consistent name too.
* Remove matrix-bot-sdk alias for vector fork.
https://github.com/the-draupnir-project/planning/issues/100
* Add top command description type and weave through API.
A more recent version of typescript meant that the exectutor's
contravariance got checked which destroyed the API so we had to make a
top type for command descriptions and parametrise some of the API.
https://github.com/the-draupnir-project/planning/issues/100
* Fix typescript errors related to class property initialisation changes.
https://www.typescriptlang.org/tsconfig/#useDefineForClassFields
Seems like they were using defineProperty before which meant
properites were initialised after the constructor ran.
Honestly i like that more but we're going to stick with what they
intend to be the default.
https://github.com/the-draupnir-project/planning/issues/100
* Fix tests lacking fixtures context.
https://github.com/the-draupnir-project/planning/issues/100
* Fix typescript errors related to error destructuring in tests.
https://github.com/the-draupnir-project/planning/issues/100
* Pin postgres package to workaround upstream issue
https://github.com/porsager/postgres/issues/1150
Documented in DEPENDENCIES.md
https://github.com/the-draupnir-project/planning/issues/100
* Fix contravariance issue in hash store helper.
Part of the TS 5.9 upgrade fallout.
https://github.com/the-draupnir-project/planning/issues/100
* Fix minor typescript 5.9 migration issuess
All typescript errors finished, yay.
* Fix REUSE missing headers.
* Fix assets script in draupnir app.
* Add Draupnir to eslint scope
* Remove the appservice web API.
There are too many eslint errors here to do with unsafe parsing of
properties from the body etc. And there's actually no consumers to
this API. It's also a widget API, and all it does is provision the bot
and nothing more.
* Fix eslint config for DeadDocumentJSX.
It wasn't working well with the jsx templates.
We should probably delete the tsconfig.eslint.json shite now.
* Update src/utils.ts for eslint.
This shit is legacy i hate it.
* Fix eslint errors in config.
Really this is paint over rot since the config doesn't have a schema,
and we can't really make one either.
* Fix eslint issues in ReportManager.
This code is diabolical. It hasn't really been fixed that will take
refactoring and making sure people don't write this sorts of bad code
ever again. Which thankfully we have process in place for.
* Fix clientHelper eslint issues.
* Fix eslint for ImportCommand.
* Grinding eslint fml.
* Fix miscellaneous eslint issues.
* allow no-deprecate for logMessage.
shit's being annoying.
* Fix remaining eslint issues...
We also deleted one of the scripts used to evaluate the performance of
various endpoints, which we were not using.
* Give bot toggle asyncDispose for code consistency.
* Fix package.json access issues.
* Adjust Docker and CI for new app location in monorepo.
* Fix broken integration tests.
* Remove prepare script from matrix-protection-suite package.
Isn't needed anymore
* Fix build:all script missing base files.
* Remove test script from matrix-protection-suite-for-matrix-bot-sdk
It doesn't have any tests :/
* Order of setup is wrong in integration test workflows.
* Fix mps interface adaptor doesn't have any tests.
* Fix appservice registration for test harness.
* Fix matrix-basic-types jest configuration
* Fix no build step in mjolnir.yaml
* Transfer common dev dependencies to the workspace root.
They were just wrong.