Skip to content

Commit d4fdae3

Browse files
authored
Merge pull request #1723 from objectstack-ai/adr-0006-phase4-delete-cloud-plugins
feat(adr-0006)!: Phase 4 — remove cloud plugins from framework runtime + CLI
2 parents cf6e117 + 15fcd36 commit d4fdae3

9 files changed

Lines changed: 23 additions & 1959 deletions

packages/cli/src/commands/serve.ts

Lines changed: 11 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -945,85 +945,18 @@ export default class Serve extends Command {
945945
}
946946
}
947947

948-
// 5. Runtime-config signal.
948+
// 5 / 5b / 5b-ii — REMOVED (ADR-0006 Phase 4, cloud ADR-0007 ⑤).
949949
//
950-
// The built-in `RuntimeConfigPlugin` (auto-registered below at
951-
// step 5b-ii) responds to `GET /api/v1/runtime/config` with
952-
// `{ singleEnvironment, defaultOrgId, defaultEnvironmentId }` so
953-
// external UI consumers can discover the runtime shape. Cloud /
954-
// multi-environment hosts ship their own runtime-config plugin
955-
// in a separate distribution; if the user config carries one
956-
// already we skip injecting the default one further down.
957-
958-
// 5b. Auto-register MarketplaceProxyPlugin so the runtime console's
959-
// marketplace browse UI works in `objectstack dev` without manually
960-
// wiring the plugin into every user's objectstack.config.ts.
961-
//
962-
// The default control-plane URL is the public ObjectStack cloud —
963-
// users get a working marketplace out of the box. Override with
964-
// OS_CLOUD_URL=<your-cloud>, or opt out with OS_CLOUD_URL=off
965-
// / =local for fully air-gapped setups.
966-
const hasMarketplaceProxy = plugins.some(
967-
(p: any) => p?.name === 'com.objectstack.runtime.marketplace-proxy'
968-
|| p?.constructor?.name === 'MarketplaceProxyPlugin'
969-
);
970-
if (!hasMarketplaceProxy) {
971-
try {
972-
const runtimePkg = '@objectstack/runtime';
973-
const { MarketplaceProxyPlugin, MarketplaceInstallLocalPlugin, resolveCloudUrl } = await import(/* webpackIgnore: true */ runtimePkg);
974-
const effectiveCloudUrl = (typeof resolveCloudUrl === 'function'
975-
? resolveCloudUrl()
976-
: (process.env.OS_CLOUD_URL?.trim() || 'https://cloud.objectos.ai')) as string;
977-
if (effectiveCloudUrl) {
978-
await kernel.use(new MarketplaceProxyPlugin({ controlPlaneUrl: effectiveCloudUrl }));
979-
trackPlugin('MarketplaceProxy');
980-
// Pair the catalog proxy with the install-local handler. The two
981-
// share the same /api/v1/marketplace prefix; the proxy delegates
982-
// /install-local to this plugin (see proxy `next()` check).
983-
try {
984-
await kernel.use(new MarketplaceInstallLocalPlugin({ controlPlaneUrl: effectiveCloudUrl }));
985-
trackPlugin('MarketplaceInstallLocal');
986-
} catch (err: any) {
987-
console.warn(chalk.yellow(` ⚠ MarketplaceInstallLocalPlugin auto-inject failed: ${err?.message ?? err}`));
988-
}
989-
if (!process.env.OS_CLOUD_URL) {
990-
console.log(chalk.dim(` · Marketplace pointed at default cloud (${effectiveCloudUrl}). Override with OS_CLOUD_URL, or disable with OS_CLOUD_URL=off.`));
991-
}
992-
}
993-
// else: user disabled cloud via OS_CLOUD_URL=off/local — skip.
994-
} catch (err: any) {
995-
console.warn(chalk.yellow(` ⚠ MarketplaceProxyPlugin auto-inject failed: ${err?.message ?? err}`));
996-
}
997-
}
998-
999-
// 5b-ii. Auto-register RuntimeConfigPlugin so the Console SPA (and
1000-
// any external UI consumer) can fetch `/api/v1/runtime/config` at
1001-
// boot. Without it the SPA 404s on the endpoint, falls back to
1002-
// defaults (installLocal:false), and the marketplace Install
1003-
// button prompts "install to cloud" instead of installing into
1004-
// the local `objectstack dev` runtime.
1005-
//
1006-
// For a vanilla user stack (objectstack dev) this runtime IS the
1007-
// install target: cloudUrl='' (stay on same origin so the SPA hits
1008-
// the proxied marketplace) and installLocal=true.
1009-
const hasRuntimeConfig = plugins.some(
1010-
(p: any) => p?.name === 'com.objectstack.runtime.runtime-config'
1011-
|| p?.constructor?.name === 'RuntimeConfigPlugin'
1012-
);
1013-
if (!hasRuntimeConfig) {
1014-
try {
1015-
const runtimePkg = '@objectstack/runtime';
1016-
const { RuntimeConfigPlugin } = await import(/* webpackIgnore: true */ runtimePkg);
1017-
await kernel.use(new RuntimeConfigPlugin({
1018-
controlPlaneUrl: '',
1019-
singleEnvironment: true,
1020-
installLocal: true,
1021-
}));
1022-
trackPlugin('RuntimeConfig');
1023-
} catch (err: any) {
1024-
console.warn(chalk.yellow(` ⚠ RuntimeConfigPlugin auto-inject failed: ${err?.message ?? err}`));
1025-
}
1026-
}
950+
// The CLI used to auto-inject MarketplaceProxyPlugin,
951+
// MarketplaceInstallLocalPlugin and RuntimeConfigPlugin from
952+
// `@objectstack/runtime` here. Those were duplicates of the canonical
953+
// cloud implementations and are deleted from the framework in this
954+
// phase: marketplace browse/install and the runtime-config endpoint
955+
// are cloud-distribution features (`@objectstack/objectos-runtime`),
956+
// wired explicitly by hosts that want them (see the cloud repo's
957+
// apps/objectos-ee config for the single-env wiring). A vanilla
958+
// `objectstack dev` no longer mounts a marketplace; the Console SPA
959+
// falls back to its defaults when `/api/v1/runtime/config` is absent.
1027960

1028961
// 5c. Auto-register PlatformObjectsPlugin so platform-default
1029962
// translation bundles (Setup App + metadata-type configuration

packages/runtime/src/cloud/cloud-url.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)