Skip to content

feat(apps): apps-engine split, dynamic import apps#40185

Draft
d-gubert wants to merge 8 commits intofeat/apps-engine-split--pr2a-copy-to-appsfrom
feat/apps-engine-split--pr2b-dynamic-import-map
Draft

feat(apps): apps-engine split, dynamic import apps#40185
d-gubert wants to merge 8 commits intofeat/apps-engine-split--pr2a-copy-to-appsfrom
feat/apps-engine-split--pr2b-dynamic-import-map

Conversation

@d-gubert
Copy link
Copy Markdown
Member

@d-gubert d-gubert commented Apr 16, 2026

Proposed changes (including videos or screenshots)

  • refactor(apps): remove AppManager dependency from deno-runtime Room class
  • feat(apps): generate deno-runtime config with resolved apps-engine path at spawn time

Issue(s)

Steps to test or reproduce

Further comments

Related to the "Apps-Engine split" stack:

d-gubert and others added 8 commits April 16, 2026 13:15
Copies src/server/ from @rocket.chat/apps-engine verbatim, then
rewrites all relative definition/ imports to package imports
(`@rocket.chat/apps-engine/definition/...`).

apps-engine still contains its server code at this point — this is an
additive copy only. The deletion happens in a later PR once @packages/apps
is confirmed working independently.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copies src/client/ (AppClientManager, AppsEngineUIHost, AppsEngineUIClient)
from @rocket.chat/apps-engine, rewriting relative definition/ imports to
package imports.

This code is a known rough edge: browser-side UI host logic does not
semantically belong in a server orchestration package. It is consolidated
here for pragmatic simplicity during the apps-engine split. A future
@rocket.chat/apps-client package is tracked in the TODO comment added to
src/client/index.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copies deno-runtime/ verbatim from @rocket.chat/apps-engine.

The import map in deno.jsonc still points to ./../src/ which is only
valid in the current location (apps-engine). Making the import map
location-independent (using a runtime-generated map) is handled in a
dedicated follow-up PR to keep the diff focused.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… directly

The old src/bridges/IListenerBridge.ts used module augmentation
(`declare module '@rocket.chat/apps-engine/server/bridges'`) to extend
IListenerBridge with core-typings-specific overloads. Now that
IListenerBridge lives in this package, the augmentation workaround is no
longer needed. The extra overload signatures are merged directly into
src/server/bridges/IListenerBridge.ts and the augmentation file is deleted.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- package.json: add all runtime deps from apps-engine (msgpack, adm-zip,
  esbuild, jose, semver, etc.), deno-related devDeps (npm-run-all,
  rimraf, ts-node), build/test scripts, and include deno-runtime/ and
  scripts/ in published files
- tsconfig.json: enable experimentalDecorators and emitDecoratorMetadata
  required by the incoming server code
- turbo.json: declare build outputs (dist/, deno-runtime/, .deno-cache/)
- scripts/deno-cache.js: copied from apps-engine; validates Deno version
  and pre-caches deno-runtime dependencies

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Installs runtime and dev dependencies added to @rocket.chat/apps in the
previous commit (adm-zip, debug, esbuild, jose, jsonrpc-lite,
lodash.clonedeep, msgpack, semver, stack-trace, uuid, npm-run-all,
rimraf, ts-node).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lass

room.ts previously imported `AppManager` from the server layer
(`@rocket.chat/apps-engine/server/AppManager.ts`) solely to type the
private [PrivateManager] symbol field that backs the deprecated
`usernames` getter. This created a cross-boundary import from the
Deno subprocess into the Node.js host.

Replace with a minimal inline `IRoomManager` interface that exposes only
the one method actually called:
  getBridges().getInternalBridge().doGetUsernamesOfRoomById()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…th at spawn time

The static deno.jsonc used `"@rocket.chat/apps-engine/": "./../src/"` — a
relative path that only works when deno-runtime/ and apps-engine/src/ are
siblings in the same package. Now that deno-runtime lives in @rocket.chat/apps
and the definition source lives in @rocket.chat/apps-engine, the relative path
would resolve to the wrong location.

Solution: generate a `deno_runtime.jsonc` into the temp directory before each
Deno subprocess spawn. The generated config copies all settings from the static
deno.jsonc and injects `@rocket.chat/apps-engine/` as an absolute `file:` URL
resolved via `require.resolve('@rocket.chat/apps-engine/package.json')`. This
works correctly in any environment (monorepo dev, Meteor bundle, CI) without
assumptions about directory layout.

Changes:
- `getAppsEngineSourceDir()`: resolves apps-engine src/ via require.resolve
- `generateRuntimeDenoConfig()`: reads static config, injects resolved path,
  writes to tempDir/deno_runtime.jsonc, returns the path
- `spawnProcess()`: calls generateRuntimeDenoConfig, uses the generated config,
  adds appsEngineSrcDir to --allow-read
- deno.jsonc: remove the now-redundant static @rocket.chat/apps-engine/ entry

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented Apr 16, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR has conflicts, please resolve them before merging
  • This PR is missing the 'stat: QA assured' label
  • This PR is not mergeable
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 16, 2026

⚠️ No Changeset found

Latest commit: 969ce6b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 16, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 02846edc-3b29-440f-9abf-ecb43ae5cc3c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant