Commit 831ee7d
fix(runtime,cli): resolve optional capability packages from the host app context (#1573)
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: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 2ee72d3 commit 831ee7d
2 files changed
Lines changed: 48 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1348 | 1348 | | |
1349 | 1349 | | |
1350 | 1350 | | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
1351 | 1368 | | |
1352 | 1369 | | |
1353 | 1370 | | |
1354 | | - | |
| 1371 | + | |
1355 | 1372 | | |
1356 | 1373 | | |
1357 | 1374 | | |
| |||
1379 | 1396 | | |
1380 | 1397 | | |
1381 | 1398 | | |
1382 | | - | |
| 1399 | + | |
1383 | 1400 | | |
1384 | 1401 | | |
1385 | 1402 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
22 | 49 | | |
23 | 50 | | |
24 | 51 | | |
| |||
161 | 188 | | |
162 | 189 | | |
163 | 190 | | |
164 | | - | |
| 191 | + | |
165 | 192 | | |
166 | 193 | | |
167 | 194 | | |
| |||
187 | 214 | | |
188 | 215 | | |
189 | 216 | | |
190 | | - | |
| 217 | + | |
191 | 218 | | |
192 | 219 | | |
193 | 220 | | |
| |||
0 commit comments