@objectstack/runtime 9.0.0 → 9.0.1
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.cjs +32 -1229
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +67 -346
- package/dist/index.d.ts +67 -346
- package/dist/index.js +31 -1223
- package/dist/index.js.map +1 -1
- package/package.json +18 -18
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export { SeedLoaderService } from '@objectstack/objectql';
|
|
|
8
8
|
import { SchemaDiffEntry } from '@objectstack/spec/shared';
|
|
9
9
|
import { MetricsRegistry, ErrorReporter } from '@objectstack/observability';
|
|
10
10
|
export { CapturedError, ErrorReporter, InMemoryErrorReporter, InMemoryMetricsRegistry, MetricSample, MetricsRegistry, NoopErrorReporter, NoopMetricsRegistry, OBSERVABILITY_ERRORS_SERVICE, OBSERVABILITY_METRICS_SERVICE, RUNTIME_METRICS } from '@objectstack/observability';
|
|
11
|
-
import * as Contracts from '@objectstack/spec/contracts';
|
|
12
11
|
import { MiddlewareConfig, MiddlewareType } from '@objectstack/spec/system';
|
|
13
12
|
import { ExpressionBody, ScriptBody, HookBody, Hook } from '@objectstack/spec/data';
|
|
14
13
|
export { RestApiPluginConfig, RestServer, RouteEntry, RouteGroupBuilder, RouteManager, createRestApiPlugin } from '@objectstack/rest';
|
|
@@ -839,57 +838,6 @@ declare class HttpServer implements IHttpServer {
|
|
|
839
838
|
getMiddlewares(): Middleware[];
|
|
840
839
|
}
|
|
841
840
|
|
|
842
|
-
/**
|
|
843
|
-
* Per-project driver registry contract.
|
|
844
|
-
*
|
|
845
|
-
* Resolves a project (by hostname or ID) and produces an instantiated
|
|
846
|
-
* `IDataDriver` bound to that project's physical database. Concrete
|
|
847
|
-
* implementations sit on top of either:
|
|
848
|
-
* - the ObjectStack Cloud HTTP API (see {@link ArtifactEnvironmentRegistry})
|
|
849
|
-
* - a local file artifact (see {@link FileArtifactApiClient} +
|
|
850
|
-
* {@link ArtifactEnvironmentRegistry})
|
|
851
|
-
*
|
|
852
|
-
* The contract lives in `@objectstack/runtime` so the runtime can
|
|
853
|
-
* express "fetch artifact + boot per-project kernel" without taking a
|
|
854
|
-
* dependency on the cloud control plane.
|
|
855
|
-
*/
|
|
856
|
-
|
|
857
|
-
type IDataDriver = Contracts.IDataDriver;
|
|
858
|
-
/**
|
|
859
|
-
* Multi-tenant kernel router contract.
|
|
860
|
-
*
|
|
861
|
-
* The HTTP dispatcher uses this optional seam to resolve a per-environment
|
|
862
|
-
* kernel when serving a multi-tenant runtime. The framework only depends on
|
|
863
|
-
* the *interface* — the concrete LRU/TTL implementation (and everything else
|
|
864
|
-
* multi-tenant: hostname resolution, artifact fetching, per-env kernel
|
|
865
|
-
* construction) lives in the cloud distribution
|
|
866
|
-
* (`@objectstack/objectos-runtime`), not here.
|
|
867
|
-
*/
|
|
868
|
-
interface KernelManager {
|
|
869
|
-
/** Resolve (building + caching on first use) the kernel for an environment. */
|
|
870
|
-
getOrCreate(environmentId: string): Promise<ObjectKernel>;
|
|
871
|
-
}
|
|
872
|
-
interface EnvironmentDriverRegistry {
|
|
873
|
-
/** Resolve a project by hostname. Returns `null` when unknown. */
|
|
874
|
-
resolveByHostname(host: string): Promise<{
|
|
875
|
-
environmentId: string;
|
|
876
|
-
driver: IDataDriver;
|
|
877
|
-
} | null>;
|
|
878
|
-
/** Resolve a project's driver by ID. Returns `null` when unknown. */
|
|
879
|
-
resolveById(environmentId: string): Promise<IDataDriver | null>;
|
|
880
|
-
/**
|
|
881
|
-
* Look up the cached project row + driver by ID without triggering a
|
|
882
|
-
* remote/file fetch. Returns the full cached entry when fresh.
|
|
883
|
-
*/
|
|
884
|
-
peekById(environmentId: string): {
|
|
885
|
-
environmentId: string;
|
|
886
|
-
driver: IDataDriver;
|
|
887
|
-
project: any;
|
|
888
|
-
} | null;
|
|
889
|
-
/** Drop cached entries for the given project. */
|
|
890
|
-
invalidate(environmentId: string): void;
|
|
891
|
-
}
|
|
892
|
-
|
|
893
841
|
/** Minimal local interface — full EnvironmentScopeManager was removed in Phase R. */
|
|
894
842
|
interface EnvironmentScopeManager {
|
|
895
843
|
touch(environmentId: string): void;
|
|
@@ -899,6 +847,21 @@ interface HttpProtocolContext {
|
|
|
899
847
|
response?: any;
|
|
900
848
|
environmentId?: string;
|
|
901
849
|
dataDriver?: any;
|
|
850
|
+
/**
|
|
851
|
+
* Dispatcher-provided hint for the host's {@link KernelResolver}: the
|
|
852
|
+
* cleaned route path (API prefix stripped). Lets the resolver apply its
|
|
853
|
+
* own path policy (e.g. skip env resolution for control-plane routes)
|
|
854
|
+
* without re-deriving the dispatcher's URL handling.
|
|
855
|
+
*/
|
|
856
|
+
routePath?: string;
|
|
857
|
+
/**
|
|
858
|
+
* Dispatcher-provided hint for the host's {@link KernelResolver}: the
|
|
859
|
+
* UNVALIDATED environment-id candidate parsed from the scoped URL form
|
|
860
|
+
* (`/environments/:id/...`) or the router's `params.environmentId`.
|
|
861
|
+
* URL parsing is the dispatcher's routing convention, so it stays here;
|
|
862
|
+
* validation (registry lookup) is the resolver's job.
|
|
863
|
+
*/
|
|
864
|
+
urlEnvironmentId?: string;
|
|
902
865
|
/**
|
|
903
866
|
* Identity envelope resolved by `resolveExecutionContext` and threaded
|
|
904
867
|
* into every ObjectQL call so the SecurityPlugin middleware can apply
|
|
@@ -915,6 +878,31 @@ interface HttpDispatcherResult {
|
|
|
915
878
|
};
|
|
916
879
|
result?: any;
|
|
917
880
|
}
|
|
881
|
+
/**
|
|
882
|
+
* ADR-0006 generic kernel-resolution seam.
|
|
883
|
+
*
|
|
884
|
+
* A host (e.g. ObjectStack Cloud) injects a resolver to own per-request
|
|
885
|
+
* kernel selection. The framework ships NO multi-tenant implementation — all
|
|
886
|
+
* hostname→env strategy, the per-env kernel cache, and the control plane live
|
|
887
|
+
* in the host distribution (`@objectstack/objectos-runtime`). When no resolver
|
|
888
|
+
* is injected the dispatcher serves every request from its single
|
|
889
|
+
* `defaultKernel` (single-environment mode).
|
|
890
|
+
*
|
|
891
|
+
* Returning `undefined` routes the request to `defaultKernel` — resolvers use
|
|
892
|
+
* this for control-plane / unscoped / single-environment requests.
|
|
893
|
+
*
|
|
894
|
+
* As of ADR-0006 Phase 5 the resolver owns the ENTIRE per-request environment
|
|
895
|
+
* resolution, not just kernel selection: the dispatcher no longer performs any
|
|
896
|
+
* hostname / header / session → environment lookup of its own. The dispatcher
|
|
897
|
+
* provides parsing hints on the context (`routePath`, `urlEnvironmentId`) and
|
|
898
|
+
* expects the resolver to SET `context.environmentId` (and optionally
|
|
899
|
+
* `context.dataDriver`) for scoped requests — downstream dispatcher stages
|
|
900
|
+
* (project-membership enforcement, scope TTL touch, scoped service resolution)
|
|
901
|
+
* key off `context.environmentId`.
|
|
902
|
+
*/
|
|
903
|
+
interface KernelResolver {
|
|
904
|
+
resolveKernel(context: HttpProtocolContext, defaultKernel: ObjectKernel): Promise<ObjectKernel | undefined> | ObjectKernel | undefined;
|
|
905
|
+
}
|
|
918
906
|
/**
|
|
919
907
|
* Optional configuration passed to the dispatcher constructor. Supports the
|
|
920
908
|
* legacy `enforceProjectMembership` toggle plus the new multi-kernel
|
|
@@ -923,13 +911,16 @@ interface HttpDispatcherResult {
|
|
|
923
911
|
interface HttpDispatcherOptions {
|
|
924
912
|
enforceProjectMembership?: boolean;
|
|
925
913
|
/**
|
|
926
|
-
* Optional
|
|
927
|
-
*
|
|
928
|
-
*
|
|
929
|
-
*
|
|
930
|
-
*
|
|
914
|
+
* Optional generic kernel-resolution seam (ADR-0006). The SOLE
|
|
915
|
+
* multi-tenant hook: the host's resolver owns env resolution + kernel
|
|
916
|
+
* selection per request (see {@link KernelResolver}). Falls back to
|
|
917
|
+
* `resolveService('kernel-resolver')`. Hosts that register none run
|
|
918
|
+
* single-environment on `defaultKernel`. (The legacy `kernelManager`
|
|
919
|
+
* option and the dispatcher's built-in hostname/header/session
|
|
920
|
+
* resolution were removed in ADR-0006 Phase 5 — that strategy lives in
|
|
921
|
+
* the cloud distribution's resolver now.)
|
|
931
922
|
*/
|
|
932
|
-
|
|
923
|
+
kernelResolver?: KernelResolver;
|
|
933
924
|
/**
|
|
934
925
|
* Optional {@link EnvironmentScopeManager}. When present, `touch(environmentId)` is
|
|
935
926
|
* called on every scoped request so idle projects are evicted after TTL.
|
|
@@ -947,9 +938,8 @@ interface HttpDispatcherOptions {
|
|
|
947
938
|
declare class HttpDispatcher {
|
|
948
939
|
private kernel;
|
|
949
940
|
private defaultKernel;
|
|
950
|
-
private envRegistry?;
|
|
951
941
|
private defaultProject?;
|
|
952
|
-
private
|
|
942
|
+
private kernelResolver?;
|
|
953
943
|
private scopeManager?;
|
|
954
944
|
/**
|
|
955
945
|
* When `true`, scoped data-plane routes enforce a
|
|
@@ -971,7 +961,13 @@ declare class HttpDispatcher {
|
|
|
971
961
|
private static readonly SYSTEM_ENVIRONMENT_ID;
|
|
972
962
|
/** Well-known platform org id — members bypass project membership. */
|
|
973
963
|
private static readonly PLATFORM_ORG_ID;
|
|
974
|
-
|
|
964
|
+
/**
|
|
965
|
+
* @param _envRegistryIgnored — RETIRED (ADR-0006 Phase 5). Environment
|
|
966
|
+
* resolution moved behind the host's {@link KernelResolver}; the
|
|
967
|
+
* positional parameter is kept so existing 3-arg callers keep compiling,
|
|
968
|
+
* but its value is ignored.
|
|
969
|
+
*/
|
|
970
|
+
constructor(kernel: ObjectKernel, _envRegistryIgnored?: unknown, options?: HttpDispatcherOptions);
|
|
975
971
|
private resolveDefaultProject;
|
|
976
972
|
private success;
|
|
977
973
|
private error;
|
|
@@ -1055,24 +1051,17 @@ declare class HttpDispatcher {
|
|
|
1055
1051
|
*/
|
|
1056
1052
|
private extractEnvironmentIdFromPath;
|
|
1057
1053
|
/**
|
|
1058
|
-
*
|
|
1059
|
-
*
|
|
1060
|
-
* Precedence:
|
|
1061
|
-
* 0. URL path matches `/environments/:environmentId/...` OR request.params.environmentId set by router
|
|
1062
|
-
* → envRegistry.resolveById(id)
|
|
1063
|
-
* 1. request.headers.host → envRegistry.resolveByHostname(host)
|
|
1064
|
-
* 2. request.headers['x-environment-id'] → envRegistry.resolveById(id)
|
|
1065
|
-
* 3. session.activeEnvironmentId → envRegistry.resolveById(id)
|
|
1066
|
-
* 4. session.activeOrganizationId → find default project → envRegistry.resolveById(id)
|
|
1067
|
-
* 5. single-environment default (registered by `createSingleEnvironmentPlugin`)
|
|
1068
|
-
* → envRegistry.resolveById(defaultProject.environmentId). Lets bare
|
|
1069
|
-
* `/api/v1/data/...` URLs resolve to the lone project in
|
|
1070
|
-
* `cloudUrl: 'local'` deployments.
|
|
1054
|
+
* Attach the dispatcher's parsing hints for the host's
|
|
1055
|
+
* {@link KernelResolver} (ADR-0006 Phase 5).
|
|
1071
1056
|
*
|
|
1072
|
-
*
|
|
1073
|
-
*
|
|
1057
|
+
* Environment RESOLUTION (hostname / x-environment-id / session /
|
|
1058
|
+
* org-default / single-env-default → environment + driver) is owned by
|
|
1059
|
+
* the host's resolver — the dispatcher no longer touches an environment
|
|
1060
|
+
* registry. What stays here is pure URL parsing (the dispatcher's own
|
|
1061
|
+
* routing convention): the scoped-path environment-id candidate and the
|
|
1062
|
+
* cleaned route path, both UNVALIDATED.
|
|
1074
1063
|
*/
|
|
1075
|
-
private
|
|
1064
|
+
private prepareResolverHints;
|
|
1076
1065
|
/**
|
|
1077
1066
|
* Check whether the authenticated user is a member of
|
|
1078
1067
|
* `context.environmentId`. Runs after {@link resolveEnvironmentContext}
|
|
@@ -1711,274 +1700,6 @@ declare function readArtifactSource(pathOrUrl: string, opts?: {
|
|
|
1711
1700
|
declare function loadArtifactBundle(absArtifactPath: string, opts?: LoadArtifactBundleOptions): Promise<any | null>;
|
|
1712
1701
|
declare function mergeRuntimeModule(bundle: any, artifactAbsPath: string, tag?: string): Promise<void>;
|
|
1713
1702
|
|
|
1714
|
-
/**
|
|
1715
|
-
* MarketplaceProxyPlugin
|
|
1716
|
-
*
|
|
1717
|
-
* Forwards `GET /api/v1/marketplace/*` from a tenant ObjectOS runtime to
|
|
1718
|
-
* the configured ObjectStack Cloud control-plane URL. The cloud endpoint
|
|
1719
|
-
* is unauthenticated and only exposes packages whose owner has opted in
|
|
1720
|
-
* to the public catalog (`sys_package.marketplace_listed = true`) — so the
|
|
1721
|
-
* proxy passes through without any credentials.
|
|
1722
|
-
*
|
|
1723
|
-
* Why proxy instead of direct browser → cloud:
|
|
1724
|
-
* - The Console SPA stays on the tenant origin, so no CORS configuration
|
|
1725
|
-
* is required on the cloud side.
|
|
1726
|
-
* - Local-dev `os serve` works regardless of whether the developer's
|
|
1727
|
-
* browser has cookies for cloud.objectos.ai.
|
|
1728
|
-
* - Adds a single, easily auditable network seam between tenant and
|
|
1729
|
-
* control plane.
|
|
1730
|
-
*
|
|
1731
|
-
* Install is NOT proxied here. Installing a package mutates control-plane
|
|
1732
|
-
* state and requires a cloud session + active organization context — the
|
|
1733
|
-
* Console SPA performs install by opening the cloud's install dialog in a
|
|
1734
|
-
* new tab so the user authenticates against cloud directly. A future
|
|
1735
|
-
* iteration may introduce a delegated install token; until then, browse
|
|
1736
|
-
* here and install on cloud.
|
|
1737
|
-
*/
|
|
1738
|
-
|
|
1739
|
-
interface MarketplaceProxyPluginConfig {
|
|
1740
|
-
/**
|
|
1741
|
-
* Control-plane base URL (e.g. https://cloud.objectos.ai). When the
|
|
1742
|
-
* caller passes nothing AND the runtime has no OS_CLOUD_URL set, the
|
|
1743
|
-
* plugin falls back to the public ObjectStack-operated cloud so that
|
|
1744
|
-
* `objectstack dev` can browse the marketplace out of the box. Set
|
|
1745
|
-
* OS_CLOUD_URL=off (or `local`) to opt out — the plugin then mounts
|
|
1746
|
-
* a stub that responds 503 and the SPA renders an empty-state
|
|
1747
|
-
* explaining marketplace is unavailable in this runtime.
|
|
1748
|
-
*/
|
|
1749
|
-
controlPlaneUrl?: string;
|
|
1750
|
-
/**
|
|
1751
|
-
* Disable the in-memory response cache (testing / debugging).
|
|
1752
|
-
* Defaults to the value of `OS_MARKETPLACE_CACHE` (anything in
|
|
1753
|
-
* {"off","false","0","no"} disables).
|
|
1754
|
-
*/
|
|
1755
|
-
cacheDisabled?: boolean;
|
|
1756
|
-
/**
|
|
1757
|
-
* Override the LRU upper bound. Defaults to 200 entries.
|
|
1758
|
-
*/
|
|
1759
|
-
cacheMaxEntries?: number;
|
|
1760
|
-
/**
|
|
1761
|
-
* Public R2 base URL for marketplace snapshots. When set, GETs for
|
|
1762
|
-
* snapshot-backed paths (`/packages`, `/packages/:id`,
|
|
1763
|
-
* `/packages/:id/versions/:vid/manifest`) are fetched directly from
|
|
1764
|
-
* R2 (CF edge) — bypassing the cloud control plane entirely.
|
|
1765
|
-
* Defaults to the value of OS_MARKETPLACE_PUBLIC_BASE_URL. Empty
|
|
1766
|
-
* string disables the public fast-path (legacy cloud-proxy only).
|
|
1767
|
-
*/
|
|
1768
|
-
publicMarketplaceBaseUrl?: string;
|
|
1769
|
-
}
|
|
1770
|
-
declare class MarketplaceProxyPlugin implements Plugin {
|
|
1771
|
-
readonly name = "com.objectstack.runtime.marketplace-proxy";
|
|
1772
|
-
readonly version = "1.1.0";
|
|
1773
|
-
private readonly cloudUrl;
|
|
1774
|
-
private readonly publicBaseUrl;
|
|
1775
|
-
private readonly cache;
|
|
1776
|
-
constructor(config?: MarketplaceProxyPluginConfig);
|
|
1777
|
-
init: (_ctx: PluginContext) => Promise<void>;
|
|
1778
|
-
start: (ctx: PluginContext) => Promise<void>;
|
|
1779
|
-
}
|
|
1780
|
-
|
|
1781
|
-
interface MarketplaceInstallLocalPluginConfig {
|
|
1782
|
-
/** Cloud control-plane base URL. When unset, falls back to OS_CLOUD_URL
|
|
1783
|
-
* and then to the public ObjectStack cloud so a fresh `objectstack dev`
|
|
1784
|
-
* can install from the marketplace without configuration. Set
|
|
1785
|
-
* OS_CLOUD_URL=off to disable (the install endpoint then returns 503). */
|
|
1786
|
-
controlPlaneUrl?: string;
|
|
1787
|
-
/** Override the on-disk cache directory. Defaults to
|
|
1788
|
-
* `<cwd>/.objectstack/installed-packages`. */
|
|
1789
|
-
storageDir?: string;
|
|
1790
|
-
}
|
|
1791
|
-
declare class MarketplaceInstallLocalPlugin implements Plugin {
|
|
1792
|
-
readonly name = "com.objectstack.runtime.marketplace-install-local";
|
|
1793
|
-
readonly version = "1.0.0";
|
|
1794
|
-
private readonly cloudUrl;
|
|
1795
|
-
private readonly storageDir;
|
|
1796
|
-
constructor(config?: MarketplaceInstallLocalPluginConfig);
|
|
1797
|
-
init: (_ctx: PluginContext) => Promise<void>;
|
|
1798
|
-
start: (ctx: PluginContext) => Promise<void>;
|
|
1799
|
-
/**
|
|
1800
|
-
* Re-register every cached manifest with the kernel's manifest service.
|
|
1801
|
-
* Safe to call on a kernel that already has the same manifest_id (the
|
|
1802
|
-
* underlying ObjectQL registry overwrites by id, but we still warn so
|
|
1803
|
-
* a developer can spot the dev-time clash between their config.ts and
|
|
1804
|
-
* a marketplace package).
|
|
1805
|
-
*/
|
|
1806
|
-
private rehydrate;
|
|
1807
|
-
private handleInstall;
|
|
1808
|
-
private handleList;
|
|
1809
|
-
private handleUninstall;
|
|
1810
|
-
/**
|
|
1811
|
-
* Detect whether `manifestId` is already known to the kernel and classify
|
|
1812
|
-
* the source so we can refuse vs upgrade gracefully.
|
|
1813
|
-
*
|
|
1814
|
-
* 'none' — fresh install
|
|
1815
|
-
* 'marketplace' — previously installed by this plugin (allow upgrade)
|
|
1816
|
-
* 'user-code' — defined by AppPlugin from objectstack.config.ts
|
|
1817
|
-
* (refuse to avoid silently overwriting authored code)
|
|
1818
|
-
*/
|
|
1819
|
-
private findConflict;
|
|
1820
|
-
/**
|
|
1821
|
-
* Pull a userId out of the request's better-auth session, if any.
|
|
1822
|
-
* Returns null when there is no signed-in user. v1 does not check
|
|
1823
|
-
* admin role — UI gating + the auth requirement is sufficient for
|
|
1824
|
-
* dev / single-tenant runtimes. Stricter checks can be layered on
|
|
1825
|
-
* via a middleware in cloud-hosted multi-tenant deployments.
|
|
1826
|
-
*/
|
|
1827
|
-
/**
|
|
1828
|
-
* POST /api/v1/marketplace/install-local/:manifestId/reseed-sample-data
|
|
1829
|
-
*
|
|
1830
|
-
* Re-runs SeedLoaderService against the cached manifest's `data` arrays.
|
|
1831
|
-
* Idempotent (upsert by id). Useful when:
|
|
1832
|
-
* • The user installed an app and skipped sample data
|
|
1833
|
-
* • A purge was undone
|
|
1834
|
-
* • The user wants a clean baseline back after editing demo rows
|
|
1835
|
-
*
|
|
1836
|
-
* Multi-tenant: requires an active organization on the session (same
|
|
1837
|
-
* rule as install seed path).
|
|
1838
|
-
*/
|
|
1839
|
-
private handleReseed;
|
|
1840
|
-
/**
|
|
1841
|
-
* POST /api/v1/marketplace/install-local/:manifestId/purge-sample-data
|
|
1842
|
-
*
|
|
1843
|
-
* Deletes every record whose id is declared in the cached manifest's
|
|
1844
|
-
* seed datasets. Uses the `driver` service directly to bypass ACL /
|
|
1845
|
-
* lifecycle hooks (same pattern as cloud purge). User-created records
|
|
1846
|
-
* are never touched — only ids declared in the package's bundled
|
|
1847
|
-
* datasets are removed. Already-deleted rows count as `skipped`.
|
|
1848
|
-
*/
|
|
1849
|
-
private handlePurge;
|
|
1850
|
-
/**
|
|
1851
|
-
* Replicate the start-time side-effects that AppPlugin runs for
|
|
1852
|
-
* statically-declared apps but the `manifest` service does NOT:
|
|
1853
|
-
*
|
|
1854
|
-
* 1. Load `manifest.translations` (array of `Record<locale, data>`)
|
|
1855
|
-
* into the i18n service — auto-creating an in-memory fallback if
|
|
1856
|
-
* none is registered, matching AppPlugin's behaviour.
|
|
1857
|
-
*
|
|
1858
|
-
* 2. Merge `manifest.data` (an array of seed datasets) into the
|
|
1859
|
-
* kernel's `seed-datasets` service so SecurityPlugin's per-org
|
|
1860
|
-
* replay middleware picks them up on every future
|
|
1861
|
-
* sys_organization insert.
|
|
1862
|
-
*
|
|
1863
|
-
* 3. When `seedNow=true`, also run the seed immediately so the user
|
|
1864
|
-
* sees demo data without having to create a new org:
|
|
1865
|
-
* • single-tenant: run SeedLoaderService inline (mirrors
|
|
1866
|
-
* AppPlugin single-tenant branch)
|
|
1867
|
-
* • multi-tenant: invoke `seed-replayer` for the caller's
|
|
1868
|
-
* active org (resolved from the request session)
|
|
1869
|
-
*
|
|
1870
|
-
* Errors are logged but never thrown — install succeeds even if
|
|
1871
|
-
* post-register side-effects partially fail (the manifest itself is
|
|
1872
|
-
* already registered + cached). Returns a small summary for the
|
|
1873
|
-
* response envelope.
|
|
1874
|
-
*/
|
|
1875
|
-
private applySideEffects;
|
|
1876
|
-
/**
|
|
1877
|
-
* Best-effort active-org resolution. Reads the better-auth session
|
|
1878
|
-
* (same path as requireAuthenticatedUser) and returns
|
|
1879
|
-
* `session.activeOrganizationId`, falling back to the user's first
|
|
1880
|
-
* org membership.
|
|
1881
|
-
*/
|
|
1882
|
-
private resolveActiveOrgId;
|
|
1883
|
-
private requireAuthenticatedUser;
|
|
1884
|
-
private readAll;
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
/**
|
|
1888
|
-
* RuntimeConfigPlugin
|
|
1889
|
-
*
|
|
1890
|
-
* Serves `GET /api/v1/runtime/config` (and the legacy alias
|
|
1891
|
-
* `GET /api/v1/studio/runtime-config`) from a tenant ObjectOS runtime so
|
|
1892
|
-
* the Console / Studio SPA can learn the upstream cloud URL and capability
|
|
1893
|
-
* flags **at boot time**, instead of sniffing `window.location.hostname`
|
|
1894
|
-
* or reading Vite-time env vars.
|
|
1895
|
-
*
|
|
1896
|
-
* Response shape (mirrors cloud's `createStudioRuntimeConfigPlugin`):
|
|
1897
|
-
*
|
|
1898
|
-
* {
|
|
1899
|
-
* cloudUrl: string, // base URL of the upstream cloud
|
|
1900
|
-
* singleEnvironment: false, // multi-tenant runtime
|
|
1901
|
-
* features: {
|
|
1902
|
-
* installLocal: boolean, // false here — install-local is owned
|
|
1903
|
-
* // by CLI `serve` (single-tenant), not
|
|
1904
|
-
* // by createObjectOSStack
|
|
1905
|
-
* marketplace: boolean, // true — MarketplaceProxyPlugin mounts
|
|
1906
|
-
* // /api/v1/marketplace/*
|
|
1907
|
-
* }
|
|
1908
|
-
* }
|
|
1909
|
-
*
|
|
1910
|
-
* Registers its routes on the Hono raw app, parallel to MarketplaceProxy /
|
|
1911
|
-
* AuthProxy / MarketplaceInstallLocal plugins.
|
|
1912
|
-
*/
|
|
1913
|
-
|
|
1914
|
-
interface RuntimeConfigPluginConfig {
|
|
1915
|
-
/**
|
|
1916
|
-
* Upstream cloud base URL. Falls back to `resolveCloudUrl()` (reads
|
|
1917
|
-
* `OS_CLOUD_URL` / built-in default) when omitted. Pass an explicit
|
|
1918
|
-
* empty string to declare "this runtime IS the cloud" (same-origin
|
|
1919
|
-
* for marketplace + install).
|
|
1920
|
-
*/
|
|
1921
|
-
controlPlaneUrl?: string;
|
|
1922
|
-
/** Override the `features.installLocal` flag. Default: false. */
|
|
1923
|
-
installLocal?: boolean;
|
|
1924
|
-
/**
|
|
1925
|
-
* Override the `features.aiStudio` flag — whether the SPA should surface
|
|
1926
|
-
* AI-driven metadata authoring ("online development") affordances. Default:
|
|
1927
|
-
* true (the actual authoring capability is still gated server-side by the
|
|
1928
|
-
* presence of the `metadata_assistant` agent / @objectstack/service-ai-studio
|
|
1929
|
-
* package; set false to force-hide the authoring UI for a tier/deployment).
|
|
1930
|
-
*/
|
|
1931
|
-
aiStudio?: boolean;
|
|
1932
|
-
/**
|
|
1933
|
-
* Report this runtime as a single-environment deployment (CLI
|
|
1934
|
-
* `objectstack dev` / `os serve`). Defaults to `false` for
|
|
1935
|
-
* multi-tenant ObjectOS.
|
|
1936
|
-
*/
|
|
1937
|
-
singleEnvironment?: boolean;
|
|
1938
|
-
/**
|
|
1939
|
-
* Product name shown in browser title, splash screen, and other
|
|
1940
|
-
* client chrome. Operators can override per-deployment (white-label,
|
|
1941
|
-
* regional rebrands). Falls back to `OS_PRODUCT_NAME` env var, then
|
|
1942
|
-
* to the default `'ObjectOS'`.
|
|
1943
|
-
*/
|
|
1944
|
-
productName?: string;
|
|
1945
|
-
/** Short product name (PWA shortName, compact spots). Defaults to productName. */
|
|
1946
|
-
productShortName?: string;
|
|
1947
|
-
}
|
|
1948
|
-
declare class RuntimeConfigPlugin implements Plugin {
|
|
1949
|
-
readonly name = "com.objectstack.runtime.runtime-config";
|
|
1950
|
-
readonly version = "1.0.0";
|
|
1951
|
-
private readonly cloudUrl;
|
|
1952
|
-
private readonly installLocal;
|
|
1953
|
-
private readonly aiStudio;
|
|
1954
|
-
private readonly singleEnvironment;
|
|
1955
|
-
private readonly productName;
|
|
1956
|
-
private readonly productShortName;
|
|
1957
|
-
constructor(config?: RuntimeConfigPluginConfig);
|
|
1958
|
-
init: (_ctx: PluginContext) => Promise<void>;
|
|
1959
|
-
start: (ctx: PluginContext) => Promise<void>;
|
|
1960
|
-
destroy: () => Promise<void>;
|
|
1961
|
-
}
|
|
1962
|
-
|
|
1963
|
-
/**
|
|
1964
|
-
* Shared marketplace / cloud control-plane defaults.
|
|
1965
|
-
*
|
|
1966
|
-
* Centralised so every plugin + the CLI auto-inject path agree on
|
|
1967
|
-
* "what cloud URL do we mean when the user didn't set OS_CLOUD_URL?".
|
|
1968
|
-
* Until we have a competing public hosted cloud, this points at the
|
|
1969
|
-
* ObjectStack-operated control plane so a vanilla `objectstack dev` can
|
|
1970
|
-
* browse the marketplace out of the box.
|
|
1971
|
-
*/
|
|
1972
|
-
declare const DEFAULT_CLOUD_URL = "https://cloud.objectos.ai";
|
|
1973
|
-
/**
|
|
1974
|
-
* Resolve the effective control-plane URL from an explicit constructor
|
|
1975
|
-
* value, the OS_CLOUD_URL env var, or the default. Returns an empty
|
|
1976
|
-
* string when the caller explicitly disabled cloud with
|
|
1977
|
-
* `OS_CLOUD_URL=off` / `local` — callers should treat that as
|
|
1978
|
-
* "marketplace unavailable on this runtime".
|
|
1979
|
-
*/
|
|
1980
|
-
declare function resolveCloudUrl(explicit?: string | null): string;
|
|
1981
|
-
|
|
1982
1703
|
/**
|
|
1983
1704
|
* # Hook & Action Body Sandbox
|
|
1984
1705
|
*
|
|
@@ -2209,4 +1930,4 @@ declare function actionBodyRunnerFactory(runner: ScriptRunner, opts: FactoryOpti
|
|
|
2209
1930
|
timeoutMs?: number;
|
|
2210
1931
|
}) => ((actionCtx: any) => Promise<unknown>) | undefined;
|
|
2211
1932
|
|
|
2212
|
-
export { AppPlugin,
|
|
1933
|
+
export { AppPlugin, DEFAULT_RATE_LIMITS, type DefaultHostConfigOptions, type DefaultHostConfigResult, type DispatcherPluginConfig, DriverPlugin, type ExternalSchemaDriftEvent, ExternalValidationPlugin, HttpDispatcher, type HttpDispatcherResult, type HttpProtocolContext, HttpServer, type KernelResolver, type LoadArtifactBundleOptions, MiddlewareManager, ObservabilityServicePlugin, type ObservabilityServicePluginOptions, QuickJSScriptRunner, type QuickJSScriptRunnerOptions, type RateLimitBucketConfig, type RateLimitDecision, type RateLimitDefaults, type RateLimitStore, RateLimiter, Runtime, type RuntimeConfig, SYSTEM_ENVIRONMENT_ID, SandboxError, type ScriptContext, type ScriptOrigin, type ScriptResult, type ScriptRunOptions, type ScriptRunner, type SecurityHeadersOptions, type StandaloneStackConfig, type StandaloneStackResult, type SystemEnvironmentPluginConfig, type TraceContext, UnimplementedScriptRunner, actionBodyRunnerFactory, buildSecurityHeaders, collectBundleActions, collectBundleFunctions, collectBundleHooks, createDefaultHostConfig, createDispatcherPlugin, createExternalValidationPlugin, createStandaloneStack, createSystemEnvironmentPlugin, extractRequestId, formatTraceparent, generateRequestId, hookBodyRunnerFactory, isHttpUrl, loadArtifactBundle, mergeRuntimeModule, parseTraceparent, readArtifactSource, resolveDefaultArtifactPath, resolveErrorReporter, resolveMetrics, resolveObjectStackHome, resolveRequestId };
|