@objectstack/runtime 6.2.0 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1964,6 +1964,62 @@ declare class MarketplaceInstallLocalPlugin implements Plugin {
1964
1964
  private readAll;
1965
1965
  }
1966
1966
 
1967
+ /**
1968
+ * RuntimeConfigPlugin
1969
+ *
1970
+ * Serves `GET /api/v1/runtime/config` (and the legacy alias
1971
+ * `GET /api/v1/studio/runtime-config`) from a tenant ObjectOS runtime so
1972
+ * the Console / Studio SPA can learn the upstream cloud URL and capability
1973
+ * flags **at boot time**, instead of sniffing `window.location.hostname`
1974
+ * or reading Vite-time env vars.
1975
+ *
1976
+ * Response shape (mirrors cloud's `createStudioRuntimeConfigPlugin`):
1977
+ *
1978
+ * {
1979
+ * cloudUrl: string, // base URL of the upstream cloud
1980
+ * singleEnvironment: false, // multi-tenant runtime
1981
+ * features: {
1982
+ * installLocal: boolean, // false here — install-local is owned
1983
+ * // by CLI `serve` (single-tenant), not
1984
+ * // by createObjectOSStack
1985
+ * marketplace: boolean, // true — MarketplaceProxyPlugin mounts
1986
+ * // /api/v1/marketplace/*
1987
+ * }
1988
+ * }
1989
+ *
1990
+ * Registers its routes on the Hono raw app, parallel to MarketplaceProxy /
1991
+ * AuthProxy / MarketplaceInstallLocal plugins.
1992
+ */
1993
+
1994
+ interface RuntimeConfigPluginConfig {
1995
+ /**
1996
+ * Upstream cloud base URL. Falls back to `resolveCloudUrl()` (reads
1997
+ * `OS_CLOUD_URL` / built-in default) when omitted. Pass an explicit
1998
+ * empty string to declare "this runtime IS the cloud" (same-origin
1999
+ * for marketplace + install).
2000
+ */
2001
+ controlPlaneUrl?: string;
2002
+ /** Override the `features.installLocal` flag. Default: false. */
2003
+ installLocal?: boolean;
2004
+ /**
2005
+ * Report this runtime as a single-environment deployment (CLI
2006
+ * `objectstack dev` / `os serve`). Defaults to `false` for
2007
+ * multi-tenant ObjectOS.
2008
+ */
2009
+ singleEnvironment?: boolean;
2010
+ }
2011
+ declare class RuntimeConfigPlugin implements Plugin {
2012
+ readonly name = "com.objectstack.runtime.runtime-config";
2013
+ readonly version = "1.0.0";
2014
+ private readonly cloudUrl;
2015
+ private readonly installLocal;
2016
+ private readonly singleEnvironment;
2017
+ constructor(config?: RuntimeConfigPluginConfig);
2018
+ init: (_ctx: PluginContext) => Promise<void>;
2019
+ start: (ctx: PluginContext) => Promise<void>;
2020
+ destroy: () => Promise<void>;
2021
+ }
2022
+
1967
2023
  /**
1968
2024
  * Shared marketplace / cloud control-plane defaults.
1969
2025
  *
@@ -2465,4 +2521,4 @@ declare function actionBodyRunnerFactory(runner: ScriptRunner, opts: FactoryOpti
2465
2521
  timeoutMs?: number;
2466
2522
  }) => ((actionCtx: any) => Promise<unknown>) | undefined;
2467
2523
 
2468
- export { AppPlugin, ArtifactApiClient, type ArtifactApiClientConfig, ArtifactEnvironmentRegistry, type ArtifactEnvironmentRegistryConfig, ArtifactKernelFactory, type ArtifactKernelFactoryConfig, AuthProxyPlugin, type BackfillPlatformSsoClientsOptions, DEFAULT_CLOUD_URL, DEFAULT_RATE_LIMITS, type DefaultHostConfigOptions, type DefaultHostConfigResult, type DispatcherPluginConfig, DriverPlugin, type EnvironmentArtifactResponse, type EnvironmentDriverRegistry, type EnvironmentKernelFactory, type EnvironmentRuntimeConfig, FileArtifactApiClient, type FileArtifactApiClientConfig, HttpDispatcher, type HttpDispatcherResult, type HttpProtocolContext, HttpServer, KernelManager, type KernelManagerConfig, type LoadArtifactBundleOptions, MarketplaceInstallLocalPlugin, type MarketplaceInstallLocalPluginConfig, MarketplaceProxyPlugin, type MarketplaceProxyPluginConfig, MiddlewareManager, type ObjectOSStackConfig, type ObjectOSStackResult, ObservabilityServicePlugin, type ObservabilityServicePluginOptions, PLATFORM_SSO_PROVIDER_ID, QuickJSScriptRunner, type QuickJSScriptRunnerOptions, type RateLimitBucketConfig, type RateLimitDecision, type RateLimitDefaults, type RateLimitStore, RateLimiter, type ResolvedHostname, Runtime, type RuntimeConfig, SYSTEM_ENVIRONMENT_ID, SandboxError, type ScriptContext, type ScriptOrigin, type ScriptResult, type ScriptRunOptions, type ScriptRunner, type SecurityHeadersOptions, SeedLoaderService, type SeedPlatformSsoClientOptions, type StandaloneStackConfig, type StandaloneStackResult, type SystemEnvironmentPluginConfig, type TraceContext, UnimplementedScriptRunner, actionBodyRunnerFactory, backfillPlatformSsoClients, buildPlatformSsoRedirectUri, buildSecurityHeaders, collectBundleActions, collectBundleFunctions, collectBundleHooks, createDefaultHostConfig, createDispatcherPlugin, createObjectOSStack, createStandaloneStack, createSystemEnvironmentPlugin, derivePlatformSsoClientId, derivePlatformSsoClientSecret, extractRequestId, formatTraceparent, generateRequestId, hookBodyRunnerFactory, isHttpUrl, loadArtifactBundle, mergeRuntimeModule, parseTraceparent, readArtifactSource, resolveCloudUrl, resolveDefaultArtifactPath, resolveErrorReporter, resolveMetrics, resolveRequestId, seedPlatformSsoClient };
2524
+ export { AppPlugin, ArtifactApiClient, type ArtifactApiClientConfig, ArtifactEnvironmentRegistry, type ArtifactEnvironmentRegistryConfig, ArtifactKernelFactory, type ArtifactKernelFactoryConfig, AuthProxyPlugin, type BackfillPlatformSsoClientsOptions, DEFAULT_CLOUD_URL, DEFAULT_RATE_LIMITS, type DefaultHostConfigOptions, type DefaultHostConfigResult, type DispatcherPluginConfig, DriverPlugin, type EnvironmentArtifactResponse, type EnvironmentDriverRegistry, type EnvironmentKernelFactory, type EnvironmentRuntimeConfig, FileArtifactApiClient, type FileArtifactApiClientConfig, HttpDispatcher, type HttpDispatcherResult, type HttpProtocolContext, HttpServer, KernelManager, type KernelManagerConfig, type LoadArtifactBundleOptions, MarketplaceInstallLocalPlugin, type MarketplaceInstallLocalPluginConfig, MarketplaceProxyPlugin, type MarketplaceProxyPluginConfig, MiddlewareManager, type ObjectOSStackConfig, type ObjectOSStackResult, ObservabilityServicePlugin, type ObservabilityServicePluginOptions, PLATFORM_SSO_PROVIDER_ID, QuickJSScriptRunner, type QuickJSScriptRunnerOptions, type RateLimitBucketConfig, type RateLimitDecision, type RateLimitDefaults, type RateLimitStore, RateLimiter, type ResolvedHostname, Runtime, type RuntimeConfig, RuntimeConfigPlugin, type RuntimeConfigPluginConfig, SYSTEM_ENVIRONMENT_ID, SandboxError, type ScriptContext, type ScriptOrigin, type ScriptResult, type ScriptRunOptions, type ScriptRunner, type SecurityHeadersOptions, SeedLoaderService, type SeedPlatformSsoClientOptions, type StandaloneStackConfig, type StandaloneStackResult, type SystemEnvironmentPluginConfig, type TraceContext, UnimplementedScriptRunner, actionBodyRunnerFactory, backfillPlatformSsoClients, buildPlatformSsoRedirectUri, buildSecurityHeaders, collectBundleActions, collectBundleFunctions, collectBundleHooks, createDefaultHostConfig, createDispatcherPlugin, createObjectOSStack, createStandaloneStack, createSystemEnvironmentPlugin, derivePlatformSsoClientId, derivePlatformSsoClientSecret, extractRequestId, formatTraceparent, generateRequestId, hookBodyRunnerFactory, isHttpUrl, loadArtifactBundle, mergeRuntimeModule, parseTraceparent, readArtifactSource, resolveCloudUrl, resolveDefaultArtifactPath, resolveErrorReporter, resolveMetrics, resolveRequestId, seedPlatformSsoClient };
package/dist/index.d.ts CHANGED
@@ -1964,6 +1964,62 @@ declare class MarketplaceInstallLocalPlugin implements Plugin {
1964
1964
  private readAll;
1965
1965
  }
1966
1966
 
1967
+ /**
1968
+ * RuntimeConfigPlugin
1969
+ *
1970
+ * Serves `GET /api/v1/runtime/config` (and the legacy alias
1971
+ * `GET /api/v1/studio/runtime-config`) from a tenant ObjectOS runtime so
1972
+ * the Console / Studio SPA can learn the upstream cloud URL and capability
1973
+ * flags **at boot time**, instead of sniffing `window.location.hostname`
1974
+ * or reading Vite-time env vars.
1975
+ *
1976
+ * Response shape (mirrors cloud's `createStudioRuntimeConfigPlugin`):
1977
+ *
1978
+ * {
1979
+ * cloudUrl: string, // base URL of the upstream cloud
1980
+ * singleEnvironment: false, // multi-tenant runtime
1981
+ * features: {
1982
+ * installLocal: boolean, // false here — install-local is owned
1983
+ * // by CLI `serve` (single-tenant), not
1984
+ * // by createObjectOSStack
1985
+ * marketplace: boolean, // true — MarketplaceProxyPlugin mounts
1986
+ * // /api/v1/marketplace/*
1987
+ * }
1988
+ * }
1989
+ *
1990
+ * Registers its routes on the Hono raw app, parallel to MarketplaceProxy /
1991
+ * AuthProxy / MarketplaceInstallLocal plugins.
1992
+ */
1993
+
1994
+ interface RuntimeConfigPluginConfig {
1995
+ /**
1996
+ * Upstream cloud base URL. Falls back to `resolveCloudUrl()` (reads
1997
+ * `OS_CLOUD_URL` / built-in default) when omitted. Pass an explicit
1998
+ * empty string to declare "this runtime IS the cloud" (same-origin
1999
+ * for marketplace + install).
2000
+ */
2001
+ controlPlaneUrl?: string;
2002
+ /** Override the `features.installLocal` flag. Default: false. */
2003
+ installLocal?: boolean;
2004
+ /**
2005
+ * Report this runtime as a single-environment deployment (CLI
2006
+ * `objectstack dev` / `os serve`). Defaults to `false` for
2007
+ * multi-tenant ObjectOS.
2008
+ */
2009
+ singleEnvironment?: boolean;
2010
+ }
2011
+ declare class RuntimeConfigPlugin implements Plugin {
2012
+ readonly name = "com.objectstack.runtime.runtime-config";
2013
+ readonly version = "1.0.0";
2014
+ private readonly cloudUrl;
2015
+ private readonly installLocal;
2016
+ private readonly singleEnvironment;
2017
+ constructor(config?: RuntimeConfigPluginConfig);
2018
+ init: (_ctx: PluginContext) => Promise<void>;
2019
+ start: (ctx: PluginContext) => Promise<void>;
2020
+ destroy: () => Promise<void>;
2021
+ }
2022
+
1967
2023
  /**
1968
2024
  * Shared marketplace / cloud control-plane defaults.
1969
2025
  *
@@ -2465,4 +2521,4 @@ declare function actionBodyRunnerFactory(runner: ScriptRunner, opts: FactoryOpti
2465
2521
  timeoutMs?: number;
2466
2522
  }) => ((actionCtx: any) => Promise<unknown>) | undefined;
2467
2523
 
2468
- export { AppPlugin, ArtifactApiClient, type ArtifactApiClientConfig, ArtifactEnvironmentRegistry, type ArtifactEnvironmentRegistryConfig, ArtifactKernelFactory, type ArtifactKernelFactoryConfig, AuthProxyPlugin, type BackfillPlatformSsoClientsOptions, DEFAULT_CLOUD_URL, DEFAULT_RATE_LIMITS, type DefaultHostConfigOptions, type DefaultHostConfigResult, type DispatcherPluginConfig, DriverPlugin, type EnvironmentArtifactResponse, type EnvironmentDriverRegistry, type EnvironmentKernelFactory, type EnvironmentRuntimeConfig, FileArtifactApiClient, type FileArtifactApiClientConfig, HttpDispatcher, type HttpDispatcherResult, type HttpProtocolContext, HttpServer, KernelManager, type KernelManagerConfig, type LoadArtifactBundleOptions, MarketplaceInstallLocalPlugin, type MarketplaceInstallLocalPluginConfig, MarketplaceProxyPlugin, type MarketplaceProxyPluginConfig, MiddlewareManager, type ObjectOSStackConfig, type ObjectOSStackResult, ObservabilityServicePlugin, type ObservabilityServicePluginOptions, PLATFORM_SSO_PROVIDER_ID, QuickJSScriptRunner, type QuickJSScriptRunnerOptions, type RateLimitBucketConfig, type RateLimitDecision, type RateLimitDefaults, type RateLimitStore, RateLimiter, type ResolvedHostname, Runtime, type RuntimeConfig, SYSTEM_ENVIRONMENT_ID, SandboxError, type ScriptContext, type ScriptOrigin, type ScriptResult, type ScriptRunOptions, type ScriptRunner, type SecurityHeadersOptions, SeedLoaderService, type SeedPlatformSsoClientOptions, type StandaloneStackConfig, type StandaloneStackResult, type SystemEnvironmentPluginConfig, type TraceContext, UnimplementedScriptRunner, actionBodyRunnerFactory, backfillPlatformSsoClients, buildPlatformSsoRedirectUri, buildSecurityHeaders, collectBundleActions, collectBundleFunctions, collectBundleHooks, createDefaultHostConfig, createDispatcherPlugin, createObjectOSStack, createStandaloneStack, createSystemEnvironmentPlugin, derivePlatformSsoClientId, derivePlatformSsoClientSecret, extractRequestId, formatTraceparent, generateRequestId, hookBodyRunnerFactory, isHttpUrl, loadArtifactBundle, mergeRuntimeModule, parseTraceparent, readArtifactSource, resolveCloudUrl, resolveDefaultArtifactPath, resolveErrorReporter, resolveMetrics, resolveRequestId, seedPlatformSsoClient };
2524
+ export { AppPlugin, ArtifactApiClient, type ArtifactApiClientConfig, ArtifactEnvironmentRegistry, type ArtifactEnvironmentRegistryConfig, ArtifactKernelFactory, type ArtifactKernelFactoryConfig, AuthProxyPlugin, type BackfillPlatformSsoClientsOptions, DEFAULT_CLOUD_URL, DEFAULT_RATE_LIMITS, type DefaultHostConfigOptions, type DefaultHostConfigResult, type DispatcherPluginConfig, DriverPlugin, type EnvironmentArtifactResponse, type EnvironmentDriverRegistry, type EnvironmentKernelFactory, type EnvironmentRuntimeConfig, FileArtifactApiClient, type FileArtifactApiClientConfig, HttpDispatcher, type HttpDispatcherResult, type HttpProtocolContext, HttpServer, KernelManager, type KernelManagerConfig, type LoadArtifactBundleOptions, MarketplaceInstallLocalPlugin, type MarketplaceInstallLocalPluginConfig, MarketplaceProxyPlugin, type MarketplaceProxyPluginConfig, MiddlewareManager, type ObjectOSStackConfig, type ObjectOSStackResult, ObservabilityServicePlugin, type ObservabilityServicePluginOptions, PLATFORM_SSO_PROVIDER_ID, QuickJSScriptRunner, type QuickJSScriptRunnerOptions, type RateLimitBucketConfig, type RateLimitDecision, type RateLimitDefaults, type RateLimitStore, RateLimiter, type ResolvedHostname, Runtime, type RuntimeConfig, RuntimeConfigPlugin, type RuntimeConfigPluginConfig, SYSTEM_ENVIRONMENT_ID, SandboxError, type ScriptContext, type ScriptOrigin, type ScriptResult, type ScriptRunOptions, type ScriptRunner, type SecurityHeadersOptions, SeedLoaderService, type SeedPlatformSsoClientOptions, type StandaloneStackConfig, type StandaloneStackResult, type SystemEnvironmentPluginConfig, type TraceContext, UnimplementedScriptRunner, actionBodyRunnerFactory, backfillPlatformSsoClients, buildPlatformSsoRedirectUri, buildSecurityHeaders, collectBundleActions, collectBundleFunctions, collectBundleHooks, createDefaultHostConfig, createDispatcherPlugin, createObjectOSStack, createStandaloneStack, createSystemEnvironmentPlugin, derivePlatformSsoClientId, derivePlatformSsoClientSecret, extractRequestId, formatTraceparent, generateRequestId, hookBodyRunnerFactory, isHttpUrl, loadArtifactBundle, mergeRuntimeModule, parseTraceparent, readArtifactSource, resolveCloudUrl, resolveDefaultArtifactPath, resolveErrorReporter, resolveMetrics, resolveRequestId, seedPlatformSsoClient };
package/dist/index.js CHANGED
@@ -8026,6 +8026,52 @@ var MarketplaceProxyPlugin = class _MarketplaceProxyPlugin {
8026
8026
  }
8027
8027
  };
8028
8028
 
8029
+ // src/cloud/runtime-config-plugin.ts
8030
+ var RuntimeConfigPlugin = class {
8031
+ constructor(config = {}) {
8032
+ this.name = "com.objectstack.runtime.runtime-config";
8033
+ this.version = "1.0.0";
8034
+ this.init = async (_ctx) => {
8035
+ };
8036
+ this.start = async (ctx) => {
8037
+ ctx.hook("kernel:ready", async () => {
8038
+ let httpServer;
8039
+ try {
8040
+ httpServer = ctx.getService("http-server");
8041
+ } catch {
8042
+ ctx.logger?.warn?.("[RuntimeConfigPlugin] http-server not available \u2014 runtime/config not mounted");
8043
+ return;
8044
+ }
8045
+ if (!httpServer || typeof httpServer.getRawApp !== "function") {
8046
+ ctx.logger?.warn?.("[RuntimeConfigPlugin] http-server missing getRawApp() \u2014 runtime/config not mounted");
8047
+ return;
8048
+ }
8049
+ const rawApp = httpServer.getRawApp();
8050
+ const payload = {
8051
+ cloudUrl: this.cloudUrl,
8052
+ singleEnvironment: this.singleEnvironment,
8053
+ features: {
8054
+ installLocal: this.installLocal,
8055
+ marketplace: true
8056
+ }
8057
+ };
8058
+ const handler = (c) => c.json(payload);
8059
+ rawApp.get("/api/v1/runtime/config", handler);
8060
+ rawApp.get("/api/v1/studio/runtime-config", handler);
8061
+ ctx.logger?.info?.("[RuntimeConfigPlugin] mounted /api/v1/runtime/config", {
8062
+ cloudUrl: this.cloudUrl || "(empty)",
8063
+ installLocal: this.installLocal
8064
+ });
8065
+ });
8066
+ };
8067
+ this.destroy = async () => {
8068
+ };
8069
+ this.cloudUrl = config.controlPlaneUrl === "" ? "" : resolveCloudUrl(config.controlPlaneUrl) ?? "";
8070
+ this.installLocal = !!config.installLocal;
8071
+ this.singleEnvironment = !!config.singleEnvironment;
8072
+ }
8073
+ };
8074
+
8029
8075
  // src/cloud/file-artifact-api-client.ts
8030
8076
  import { readFile as readFile2, stat } from "fs/promises";
8031
8077
  import { resolve as resolvePath4 } from "path";
@@ -8252,7 +8298,7 @@ async function createObjectOSStack(config) {
8252
8298
  };
8253
8299
  const enginePlugins = await createHostEnginePlugins();
8254
8300
  return {
8255
- plugins: [...enginePlugins, new ObjectOSEnvironmentPlugin(merged), new AuthProxyPlugin(), new MarketplaceProxyPlugin({ controlPlaneUrl: merged.controlPlaneUrl === "file" ? void 0 : merged.controlPlaneUrl })],
8301
+ plugins: [...enginePlugins, new ObjectOSEnvironmentPlugin(merged), new AuthProxyPlugin(), new MarketplaceProxyPlugin({ controlPlaneUrl: merged.controlPlaneUrl === "file" ? void 0 : merged.controlPlaneUrl }), new RuntimeConfigPlugin({ controlPlaneUrl: merged.controlPlaneUrl === "file" ? void 0 : merged.controlPlaneUrl, installLocal: false })],
8256
8302
  api: {
8257
8303
  enableProjectScoping: true,
8258
8304
  projectResolution: "auto",
@@ -8787,6 +8833,7 @@ export {
8787
8833
  RouteGroupBuilder,
8788
8834
  RouteManager,
8789
8835
  Runtime,
8836
+ RuntimeConfigPlugin,
8790
8837
  SYSTEM_ENVIRONMENT_ID,
8791
8838
  SandboxError,
8792
8839
  SeedLoaderService,