Skip to content

fix(runtime,cli): resolve optional capability packages from host app context#1573

Merged
xuyushun441-sys merged 1 commit into
mainfrom
fix/capability-host-resolve
Jun 4, 2026
Merged

fix(runtime,cli): resolve optional capability packages from host app context#1573
xuyushun441-sys merged 1 commit into
mainfrom
fix/capability-host-resolve

Conversation

@xuyushun441-sys
Copy link
Copy Markdown
Contributor

loadCapabilities() (per-environment kernels, apps/objectos) and the CLI serve auto-register both did a bare dynamic import(pkg) of optional capability packages. A bare specifier resolves relative to the framework package's own location, so a private/optional package linked into the app's node_modules — e.g. @objectstack/service-ai-studio, which the framework itself does not depend on — is invisible. It failed with Cannot find package … imported from …/framework/…, so cloud tenants never actually loaded AI Studio despite apps/objectos declaring the dependency (and the same for enterprise objectos-ee).

Fix

Resolve via createRequire anchored at process.cwd() (the host app), import the resolved path, and fall back to a bare import for framework-owned packages.

  • packages/runtime/src/cloud/capability-loader.tsimportFromHost() helper used for the main provider + extras.
  • packages/cli/src/commands/serve.ts — same host-context resolution for the AI + AI Studio auto-register.

Verified

  • createRequire(<app>/package.json).resolve('@objectstack/service-ai-studio') → resolves to its dist; the old framework-relative resolution returns MODULE_NOT_FOUND.
  • runtime + cli build clean.

Unblocks the cloud multi-tenant path for @objectstack/service-ai-studio (and any private capability package). Enterprise objectos-ee already works via explicit plugins:[...] registration; this makes the auto-discovery path correct too.

🤖 Generated with Claude Code

…app context

loadCapabilities() and the CLI serve auto-register did a bare dynamic import
of capability packages (e.g. @objectstack/service-ai-studio), which resolves
relative to the framework package's own location. A private/optional package
linked into the *app's* node_modules (the tenant runtime apps/objectos, or an
enterprise objectos-ee install) is invisible there — it failed with
"Cannot find package … imported from …/framework/…", so cloud tenants never
loaded AI Studio despite declaring the dependency.

Resolve via createRequire anchored at process.cwd() (the host app), then import
the resolved path; fall back to a bare import for framework-owned packages.

Verified: createRequire from the app dir resolves @objectstack/service-ai-studio
to its dist; the old framework-relative resolution returns MODULE_NOT_FOUND.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 3, 2026 3:58pm

Request Review

@github-actions github-actions Bot added the size/s label Jun 3, 2026
@xuyushun441-sys xuyushun441-sys merged commit 831ee7d into main Jun 4, 2026
12 checks passed
@xuyushun441-sys xuyushun441-sys deleted the fix/capability-host-resolve branch June 4, 2026 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants