@objectstack/types 15.1.1 → 16.0.0-rc.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.mts +80 -5
- package/dist/index.d.ts +80 -5
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -71,12 +71,43 @@ declare function resolveAllowDegradedTenancy(): boolean;
|
|
|
71
71
|
* re-reading the env, so the served route, the advertised route, and the
|
|
72
72
|
* authorization track can never disagree.
|
|
73
73
|
*
|
|
74
|
-
* Note the asymmetry with the MCP plugin's *stdio* auto-start
|
|
75
|
-
* opt-in
|
|
76
|
-
*
|
|
77
|
-
* while the HTTP surface is served
|
|
74
|
+
* Note the asymmetry with the MCP plugin's *stdio* auto-start
|
|
75
|
+
* ({@link resolveMcpStdioAutoStart}), which stays opt-in and is gated by a
|
|
76
|
+
* SEPARATE switch: attaching a long-lived stdio transport to every process is
|
|
77
|
+
* a side effect no default should impose, while the HTTP surface is served
|
|
78
|
+
* statelessly per-request.
|
|
78
79
|
*/
|
|
79
80
|
declare function isMcpServerEnabled(): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* SINGLE decision point for "should the MCP plugin auto-start a long-lived
|
|
83
|
+
* (stdio) transport?" — distinct from {@link isMcpServerEnabled}, which governs
|
|
84
|
+
* the stateless HTTP surface.
|
|
85
|
+
*
|
|
86
|
+
* The stdio transport is a different, stricter posture: the plugin bridges the
|
|
87
|
+
* RAW metadata service + data engine onto the long-lived server with NO
|
|
88
|
+
* per-request principal (unscoped — see the `mcp-stdio-authority` conformance
|
|
89
|
+
* row), so it is safe only as a single-operator LOCAL tool and MUST stay
|
|
90
|
+
* opt-in. It defaults OFF.
|
|
91
|
+
*
|
|
92
|
+
* Canonical switch: `OS_MCP_STDIO_ENABLED` (truthy). The plugin also starts it
|
|
93
|
+
* when constructed with `{ autoStart: true }` (that path is checked by the
|
|
94
|
+
* caller, not here).
|
|
95
|
+
*
|
|
96
|
+
* DEPRECATED alias: `OS_MCP_SERVER_ENABLED=true` historically ALSO started
|
|
97
|
+
* stdio — overloading the very var that gates the HTTP surface, so an operator
|
|
98
|
+
* setting it to "make sure MCP is on" silently attached an unscoped transport.
|
|
99
|
+
* That trigger still works (with a one-time warning from the caller) for one
|
|
100
|
+
* release; prefer the dedicated var. Note `OS_MCP_SERVER_ENABLED=false` only
|
|
101
|
+
* ever gated the HTTP surface and never started stdio, so it is unaffected.
|
|
102
|
+
*
|
|
103
|
+
* @returns `enabled` — whether stdio auto-start is requested by the env; and
|
|
104
|
+
* `viaDeprecatedAlias` — whether it came through the legacy
|
|
105
|
+
* `OS_MCP_SERVER_ENABLED=true` trigger (so the caller can warn once).
|
|
106
|
+
*/
|
|
107
|
+
declare function resolveMcpStdioAutoStart(): {
|
|
108
|
+
enabled: boolean;
|
|
109
|
+
viaDeprecatedAlias: boolean;
|
|
110
|
+
};
|
|
80
111
|
/**
|
|
81
112
|
* Maximum number of organizations a single user may CREATE, from `OS_ORG_LIMIT`.
|
|
82
113
|
* The auth plugin forwards this as better-auth's `organizationLimit` in function
|
|
@@ -117,6 +148,34 @@ declare function resolveOrgLimit(): number | undefined;
|
|
|
117
148
|
declare function resolveSearchPinyinEnabled(opts?: {
|
|
118
149
|
locales?: readonly string[];
|
|
119
150
|
}): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* SINGLE decision point for a sandbox script-runner DEFAULT (ms), resolved from
|
|
153
|
+
* the environment (framework#3259 / ADR-0102).
|
|
154
|
+
*
|
|
155
|
+
* The QuickJS sandbox meters each hook/action invocation against a per-invocation
|
|
156
|
+
* budget. Two dimensions are env-tunable:
|
|
157
|
+
* - the **CPU-time budget** for hooks / actions — how much *VM-active* time a
|
|
158
|
+
* body may burn (built-in 250ms hooks / 5000ms actions); and
|
|
159
|
+
* - the **wall-clock ceiling** — the backstop bounding a body parked forever on
|
|
160
|
+
* a host call that never settles (built-in 30_000ms).
|
|
161
|
+
*
|
|
162
|
+
* The built-in defaults suit a warm, idle host; a heavily loaded or slow host
|
|
163
|
+
* (an oversubscribed CI runner, constrained production hardware) may need a
|
|
164
|
+
* higher floor. This lets an operator raise it once, deployment-wide, instead of
|
|
165
|
+
* re-tuning every call site.
|
|
166
|
+
*
|
|
167
|
+
* Canonical vars (OS_{DOMAIN}_{NAME}, DOMAIN=SANDBOX):
|
|
168
|
+
* - hook → `OS_SANDBOX_HOOK_TIMEOUT_MS`
|
|
169
|
+
* - action → `OS_SANDBOX_ACTION_TIMEOUT_MS`
|
|
170
|
+
* - wallCeiling → `OS_SANDBOX_WALL_CEILING_MS`
|
|
171
|
+
*
|
|
172
|
+
* Only a positive integer is honored; unset / empty / non-numeric / non-positive
|
|
173
|
+
* falls back to `fallback`, so behaviour is byte-for-byte unchanged when the var
|
|
174
|
+
* is absent. This is a FALLBACK default ONLY: an explicit constructor option
|
|
175
|
+
* still wins over it, and (for the CPU budget) a body's own declared `timeoutMs`
|
|
176
|
+
* still wins over the resolved default per the runner's resolution rule.
|
|
177
|
+
*/
|
|
178
|
+
declare function resolveSandboxTimeoutMs(kind: 'hook' | 'action' | 'wallCeiling', fallback: number): number;
|
|
120
179
|
/**
|
|
121
180
|
* Internal: clear the dedupe set. Test-only; exposed so suite-wide
|
|
122
181
|
* deprecation warnings don't bleed between tests.
|
|
@@ -125,6 +184,22 @@ declare function resolveSearchPinyinEnabled(opts?: {
|
|
|
125
184
|
*/
|
|
126
185
|
declare function _resetEnvDeprecationWarnings(): void;
|
|
127
186
|
|
|
187
|
+
/**
|
|
188
|
+
* True when a dynamic `import()` / `require.resolve()` failed because the
|
|
189
|
+
* module is simply NOT INSTALLED — as opposed to the module being present but
|
|
190
|
+
* throwing while it loads (a real crash). Checking `err.code` FIRST matters:
|
|
191
|
+
* ESM reports a missing package as `err.code === 'ERR_MODULE_NOT_FOUND'` with
|
|
192
|
+
* the human message `Cannot find package '...'`; matching only the older
|
|
193
|
+
* `Cannot find module` string mis-classifies that as a crash (framework#1595).
|
|
194
|
+
*
|
|
195
|
+
* Single shared owner for this classification (framework#3265): the CLI's
|
|
196
|
+
* optional-plugin guards and `requires` capability resolver delegate here, and
|
|
197
|
+
* cloud's `objectos-runtime` capability loader is expected to adopt it at its
|
|
198
|
+
* next framework pin bump — so the parallel loaders cannot drift apart and
|
|
199
|
+
* re-introduce the #1595 false-alarm class.
|
|
200
|
+
*/
|
|
201
|
+
declare function isModuleNotFoundError(err: unknown): boolean;
|
|
202
|
+
|
|
128
203
|
interface IKernel {
|
|
129
204
|
ql?: any;
|
|
130
205
|
start(): Promise<void>;
|
|
@@ -139,4 +214,4 @@ interface RuntimePlugin {
|
|
|
139
214
|
onStart?: (ctx: RuntimeContext) => void | Promise<void>;
|
|
140
215
|
}
|
|
141
216
|
|
|
142
|
-
export { type IKernel, type RuntimeContext, type RuntimePlugin, _resetEnvDeprecationWarnings, isMcpServerEnabled, readEnvWithDeprecation, resolveAllowDegradedTenancy, resolveMultiOrgEnabled, resolveOrgLimit, resolveSearchPinyinEnabled };
|
|
217
|
+
export { type IKernel, type RuntimeContext, type RuntimePlugin, _resetEnvDeprecationWarnings, isMcpServerEnabled, isModuleNotFoundError, readEnvWithDeprecation, resolveAllowDegradedTenancy, resolveMcpStdioAutoStart, resolveMultiOrgEnabled, resolveOrgLimit, resolveSandboxTimeoutMs, resolveSearchPinyinEnabled };
|
package/dist/index.d.ts
CHANGED
|
@@ -71,12 +71,43 @@ declare function resolveAllowDegradedTenancy(): boolean;
|
|
|
71
71
|
* re-reading the env, so the served route, the advertised route, and the
|
|
72
72
|
* authorization track can never disagree.
|
|
73
73
|
*
|
|
74
|
-
* Note the asymmetry with the MCP plugin's *stdio* auto-start
|
|
75
|
-
* opt-in
|
|
76
|
-
*
|
|
77
|
-
* while the HTTP surface is served
|
|
74
|
+
* Note the asymmetry with the MCP plugin's *stdio* auto-start
|
|
75
|
+
* ({@link resolveMcpStdioAutoStart}), which stays opt-in and is gated by a
|
|
76
|
+
* SEPARATE switch: attaching a long-lived stdio transport to every process is
|
|
77
|
+
* a side effect no default should impose, while the HTTP surface is served
|
|
78
|
+
* statelessly per-request.
|
|
78
79
|
*/
|
|
79
80
|
declare function isMcpServerEnabled(): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* SINGLE decision point for "should the MCP plugin auto-start a long-lived
|
|
83
|
+
* (stdio) transport?" — distinct from {@link isMcpServerEnabled}, which governs
|
|
84
|
+
* the stateless HTTP surface.
|
|
85
|
+
*
|
|
86
|
+
* The stdio transport is a different, stricter posture: the plugin bridges the
|
|
87
|
+
* RAW metadata service + data engine onto the long-lived server with NO
|
|
88
|
+
* per-request principal (unscoped — see the `mcp-stdio-authority` conformance
|
|
89
|
+
* row), so it is safe only as a single-operator LOCAL tool and MUST stay
|
|
90
|
+
* opt-in. It defaults OFF.
|
|
91
|
+
*
|
|
92
|
+
* Canonical switch: `OS_MCP_STDIO_ENABLED` (truthy). The plugin also starts it
|
|
93
|
+
* when constructed with `{ autoStart: true }` (that path is checked by the
|
|
94
|
+
* caller, not here).
|
|
95
|
+
*
|
|
96
|
+
* DEPRECATED alias: `OS_MCP_SERVER_ENABLED=true` historically ALSO started
|
|
97
|
+
* stdio — overloading the very var that gates the HTTP surface, so an operator
|
|
98
|
+
* setting it to "make sure MCP is on" silently attached an unscoped transport.
|
|
99
|
+
* That trigger still works (with a one-time warning from the caller) for one
|
|
100
|
+
* release; prefer the dedicated var. Note `OS_MCP_SERVER_ENABLED=false` only
|
|
101
|
+
* ever gated the HTTP surface and never started stdio, so it is unaffected.
|
|
102
|
+
*
|
|
103
|
+
* @returns `enabled` — whether stdio auto-start is requested by the env; and
|
|
104
|
+
* `viaDeprecatedAlias` — whether it came through the legacy
|
|
105
|
+
* `OS_MCP_SERVER_ENABLED=true` trigger (so the caller can warn once).
|
|
106
|
+
*/
|
|
107
|
+
declare function resolveMcpStdioAutoStart(): {
|
|
108
|
+
enabled: boolean;
|
|
109
|
+
viaDeprecatedAlias: boolean;
|
|
110
|
+
};
|
|
80
111
|
/**
|
|
81
112
|
* Maximum number of organizations a single user may CREATE, from `OS_ORG_LIMIT`.
|
|
82
113
|
* The auth plugin forwards this as better-auth's `organizationLimit` in function
|
|
@@ -117,6 +148,34 @@ declare function resolveOrgLimit(): number | undefined;
|
|
|
117
148
|
declare function resolveSearchPinyinEnabled(opts?: {
|
|
118
149
|
locales?: readonly string[];
|
|
119
150
|
}): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* SINGLE decision point for a sandbox script-runner DEFAULT (ms), resolved from
|
|
153
|
+
* the environment (framework#3259 / ADR-0102).
|
|
154
|
+
*
|
|
155
|
+
* The QuickJS sandbox meters each hook/action invocation against a per-invocation
|
|
156
|
+
* budget. Two dimensions are env-tunable:
|
|
157
|
+
* - the **CPU-time budget** for hooks / actions — how much *VM-active* time a
|
|
158
|
+
* body may burn (built-in 250ms hooks / 5000ms actions); and
|
|
159
|
+
* - the **wall-clock ceiling** — the backstop bounding a body parked forever on
|
|
160
|
+
* a host call that never settles (built-in 30_000ms).
|
|
161
|
+
*
|
|
162
|
+
* The built-in defaults suit a warm, idle host; a heavily loaded or slow host
|
|
163
|
+
* (an oversubscribed CI runner, constrained production hardware) may need a
|
|
164
|
+
* higher floor. This lets an operator raise it once, deployment-wide, instead of
|
|
165
|
+
* re-tuning every call site.
|
|
166
|
+
*
|
|
167
|
+
* Canonical vars (OS_{DOMAIN}_{NAME}, DOMAIN=SANDBOX):
|
|
168
|
+
* - hook → `OS_SANDBOX_HOOK_TIMEOUT_MS`
|
|
169
|
+
* - action → `OS_SANDBOX_ACTION_TIMEOUT_MS`
|
|
170
|
+
* - wallCeiling → `OS_SANDBOX_WALL_CEILING_MS`
|
|
171
|
+
*
|
|
172
|
+
* Only a positive integer is honored; unset / empty / non-numeric / non-positive
|
|
173
|
+
* falls back to `fallback`, so behaviour is byte-for-byte unchanged when the var
|
|
174
|
+
* is absent. This is a FALLBACK default ONLY: an explicit constructor option
|
|
175
|
+
* still wins over it, and (for the CPU budget) a body's own declared `timeoutMs`
|
|
176
|
+
* still wins over the resolved default per the runner's resolution rule.
|
|
177
|
+
*/
|
|
178
|
+
declare function resolveSandboxTimeoutMs(kind: 'hook' | 'action' | 'wallCeiling', fallback: number): number;
|
|
120
179
|
/**
|
|
121
180
|
* Internal: clear the dedupe set. Test-only; exposed so suite-wide
|
|
122
181
|
* deprecation warnings don't bleed between tests.
|
|
@@ -125,6 +184,22 @@ declare function resolveSearchPinyinEnabled(opts?: {
|
|
|
125
184
|
*/
|
|
126
185
|
declare function _resetEnvDeprecationWarnings(): void;
|
|
127
186
|
|
|
187
|
+
/**
|
|
188
|
+
* True when a dynamic `import()` / `require.resolve()` failed because the
|
|
189
|
+
* module is simply NOT INSTALLED — as opposed to the module being present but
|
|
190
|
+
* throwing while it loads (a real crash). Checking `err.code` FIRST matters:
|
|
191
|
+
* ESM reports a missing package as `err.code === 'ERR_MODULE_NOT_FOUND'` with
|
|
192
|
+
* the human message `Cannot find package '...'`; matching only the older
|
|
193
|
+
* `Cannot find module` string mis-classifies that as a crash (framework#1595).
|
|
194
|
+
*
|
|
195
|
+
* Single shared owner for this classification (framework#3265): the CLI's
|
|
196
|
+
* optional-plugin guards and `requires` capability resolver delegate here, and
|
|
197
|
+
* cloud's `objectos-runtime` capability loader is expected to adopt it at its
|
|
198
|
+
* next framework pin bump — so the parallel loaders cannot drift apart and
|
|
199
|
+
* re-introduce the #1595 false-alarm class.
|
|
200
|
+
*/
|
|
201
|
+
declare function isModuleNotFoundError(err: unknown): boolean;
|
|
202
|
+
|
|
128
203
|
interface IKernel {
|
|
129
204
|
ql?: any;
|
|
130
205
|
start(): Promise<void>;
|
|
@@ -139,4 +214,4 @@ interface RuntimePlugin {
|
|
|
139
214
|
onStart?: (ctx: RuntimeContext) => void | Promise<void>;
|
|
140
215
|
}
|
|
141
216
|
|
|
142
|
-
export { type IKernel, type RuntimeContext, type RuntimePlugin, _resetEnvDeprecationWarnings, isMcpServerEnabled, readEnvWithDeprecation, resolveAllowDegradedTenancy, resolveMultiOrgEnabled, resolveOrgLimit, resolveSearchPinyinEnabled };
|
|
217
|
+
export { type IKernel, type RuntimeContext, type RuntimePlugin, _resetEnvDeprecationWarnings, isMcpServerEnabled, isModuleNotFoundError, readEnvWithDeprecation, resolveAllowDegradedTenancy, resolveMcpStdioAutoStart, resolveMultiOrgEnabled, resolveOrgLimit, resolveSandboxTimeoutMs, resolveSearchPinyinEnabled };
|
package/dist/index.js
CHANGED
|
@@ -22,10 +22,13 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
_resetEnvDeprecationWarnings: () => _resetEnvDeprecationWarnings,
|
|
24
24
|
isMcpServerEnabled: () => isMcpServerEnabled,
|
|
25
|
+
isModuleNotFoundError: () => isModuleNotFoundError,
|
|
25
26
|
readEnvWithDeprecation: () => readEnvWithDeprecation,
|
|
26
27
|
resolveAllowDegradedTenancy: () => resolveAllowDegradedTenancy,
|
|
28
|
+
resolveMcpStdioAutoStart: () => resolveMcpStdioAutoStart,
|
|
27
29
|
resolveMultiOrgEnabled: () => resolveMultiOrgEnabled,
|
|
28
30
|
resolveOrgLimit: () => resolveOrgLimit,
|
|
31
|
+
resolveSandboxTimeoutMs: () => resolveSandboxTimeoutMs,
|
|
29
32
|
resolveSearchPinyinEnabled: () => resolveSearchPinyinEnabled
|
|
30
33
|
});
|
|
31
34
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -73,6 +76,17 @@ function isMcpServerEnabled() {
|
|
|
73
76
|
if (raw == null) return true;
|
|
74
77
|
return !["0", "false", "off", "no"].includes(raw.trim().toLowerCase());
|
|
75
78
|
}
|
|
79
|
+
function resolveMcpStdioAutoStart() {
|
|
80
|
+
const stdio = readEnvWithDeprecation("OS_MCP_STDIO_ENABLED", [], { silent: true });
|
|
81
|
+
if (stdio != null && ["1", "true", "on", "yes"].includes(stdio.trim().toLowerCase())) {
|
|
82
|
+
return { enabled: true, viaDeprecatedAlias: false };
|
|
83
|
+
}
|
|
84
|
+
const legacy = readEnvWithDeprecation("OS_MCP_SERVER_ENABLED", "MCP_SERVER_ENABLED", { silent: true });
|
|
85
|
+
if (legacy != null && legacy.trim().toLowerCase() === "true") {
|
|
86
|
+
return { enabled: true, viaDeprecatedAlias: true };
|
|
87
|
+
}
|
|
88
|
+
return { enabled: false, viaDeprecatedAlias: false };
|
|
89
|
+
}
|
|
76
90
|
function resolveOrgLimit() {
|
|
77
91
|
const raw = readEnvWithDeprecation("OS_ORG_LIMIT", [], { silent: true });
|
|
78
92
|
if (raw == null || String(raw).trim() === "") return void 0;
|
|
@@ -86,17 +100,35 @@ function resolveSearchPinyinEnabled(opts) {
|
|
|
86
100
|
}
|
|
87
101
|
return (opts?.locales ?? []).some((l) => /^zh([-_]|$)/i.test(String(l ?? "").trim()));
|
|
88
102
|
}
|
|
103
|
+
function resolveSandboxTimeoutMs(kind, fallback) {
|
|
104
|
+
const name = kind === "hook" ? "OS_SANDBOX_HOOK_TIMEOUT_MS" : kind === "action" ? "OS_SANDBOX_ACTION_TIMEOUT_MS" : "OS_SANDBOX_WALL_CEILING_MS";
|
|
105
|
+
const raw = readEnvWithDeprecation(name, [], { silent: true });
|
|
106
|
+
if (raw == null || String(raw).trim() === "") return fallback;
|
|
107
|
+
const n = Number.parseInt(String(raw).trim(), 10);
|
|
108
|
+
return Number.isFinite(n) && n > 0 ? n : fallback;
|
|
109
|
+
}
|
|
89
110
|
function _resetEnvDeprecationWarnings() {
|
|
90
111
|
_warnedKeys.clear();
|
|
91
112
|
}
|
|
113
|
+
|
|
114
|
+
// src/module-not-found.ts
|
|
115
|
+
function isModuleNotFoundError(err) {
|
|
116
|
+
const code = err?.code;
|
|
117
|
+
if (code === "ERR_MODULE_NOT_FOUND" || code === "MODULE_NOT_FOUND") return true;
|
|
118
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
119
|
+
return msg.includes("Cannot find module") || msg.includes("Cannot find package");
|
|
120
|
+
}
|
|
92
121
|
// Annotate the CommonJS export names for ESM import in node:
|
|
93
122
|
0 && (module.exports = {
|
|
94
123
|
_resetEnvDeprecationWarnings,
|
|
95
124
|
isMcpServerEnabled,
|
|
125
|
+
isModuleNotFoundError,
|
|
96
126
|
readEnvWithDeprecation,
|
|
97
127
|
resolveAllowDegradedTenancy,
|
|
128
|
+
resolveMcpStdioAutoStart,
|
|
98
129
|
resolveMultiOrgEnabled,
|
|
99
130
|
resolveOrgLimit,
|
|
131
|
+
resolveSandboxTimeoutMs,
|
|
100
132
|
resolveSearchPinyinEnabled
|
|
101
133
|
});
|
|
102
134
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/env.ts"],"sourcesContent":["// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nexport * from './env.js';\n\n// Placeholder for Kernel interface to avoid circular dependency\n// The actual Kernel implementation will satisfy this interface.\nexport interface IKernel {\n // We can add specific methods here that plugins are allowed to call\n // forcing a stricter contract than exposing the whole class.\n ql?: any; // ObjectQL instance (optional to support initialization phase)\n start(): Promise<void>;\n // ... expose other needed public methods\n [key: string]: any; \n}\n\nexport interface RuntimeContext {\n engine: IKernel;\n}\n\nexport interface RuntimePlugin {\n name: string;\n install?: (ctx: RuntimeContext) => void | Promise<void>;\n onStart?: (ctx: RuntimeContext) => void | Promise<void>;\n}\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\n/**\n * Environment-variable helpers shared across `@objectstack/*` packages.\n *\n * The framework standardises on `OS_*` prefixed env vars (see AGENTS.md\n * \"Environment Variables\" section). Some historical names predate this\n * convention — `AUTH_SECRET`, `ROOT_DOMAIN`, `OBJECTSTACK_*`, …\n *\n * To migrate without breaking user `.env` files mid-release, call\n * {@link readEnvWithDeprecation} at every legacy read site:\n *\n * const v = readEnvWithDeprecation('OS_AUTH_SECRET', 'AUTH_SECRET');\n *\n * If only the legacy name is set, the value is still returned but a\n * one-shot `console.warn` fires (per-process per-variable) telling\n * operators to rename it.\n */\n\nconst _warnedKeys = new Set<string>();\n\n/**\n * Read an env var, preferring the canonical `OS_*` name and falling\n * back to one or more legacy aliases.\n *\n * When only a legacy alias is set, emits a one-shot deprecation warning.\n * The warning is process-wide deduplicated: identical (preferred, legacy)\n * pairs will only warn once even if read from multiple call sites.\n *\n * Legacy aliases are checked in order; the first one with a defined\n * value wins (and triggers the warning for that specific alias).\n *\n * Safe to call from environments where `process` is unavailable (returns\n * `undefined`); the warning is suppressed when running outside Node-like\n * runtimes that lack `console.warn`.\n *\n * @param preferred Canonical OS_*-prefixed env var name.\n * @param legacy Older name (or array of older names) to fall back on.\n * @param options Optional behaviour flags. Set `silent: true` for aliases\n * that remain accepted conventions rather than true legacy\n * names — e.g. `PORT`, which PaaS platforms (Render, Railway,\n * Heroku, Fly, …) inject automatically. Warning on those\n * would nag operators about env they never set.\n * @returns The resolved value, or `undefined` if neither is set.\n */\nexport function readEnvWithDeprecation(\n preferred: string,\n legacy: string | readonly string[],\n options?: { silent?: boolean },\n): string | undefined {\n const env = (globalThis as { process?: { env?: Record<string, string | undefined> } })\n .process?.env;\n if (!env) return undefined;\n\n const preferredValue = env[preferred];\n if (preferredValue !== undefined) return preferredValue;\n\n const legacyList = typeof legacy === 'string' ? [legacy] : legacy;\n for (const legacyName of legacyList) {\n const legacyValue = env[legacyName];\n if (legacyValue !== undefined) {\n const dedupeKey = `${preferred}|${legacyName}`;\n if (!options?.silent && !_warnedKeys.has(dedupeKey)) {\n _warnedKeys.add(dedupeKey);\n const consoleRef = (globalThis as { console?: { warn?: (msg: string) => void } }).console;\n try {\n consoleRef?.warn?.(\n `[ObjectStack] Env var \\`${legacyName}\\` is deprecated; rename it to \\`${preferred}\\`. ` +\n `The legacy name still works for now but will be removed in a future major release.`,\n );\n } catch {\n /* `console.warn` unavailable (exotic runtime) — ignore */\n }\n }\n return legacyValue;\n }\n }\n\n return undefined;\n}\n\n/**\n * Resolve whether the deployment runs in multi-org (a.k.a. multi-tenant) mode.\n *\n * Single source of truth for the `OS_MULTI_ORG_ENABLED` flag. Resolution: the\n * canonical `OS_MULTI_ORG_ENABLED`; else `false`. Any value other than a\n * case-insensitive `'false'` enables it. (The legacy `OS_MULTI_TENANT` alias was\n * removed in 11.0.)\n *\n * Every site that needs to know \"is this multi-org?\" — the SQL driver's\n * tenant-audit gate, the auth manager's `/auth/config` feature flag and\n * org-create guard, the CLI / dev / runtime org-scoping plugin wiring — MUST\n * call this instead of re-reading the env, so the driver, the security layer,\n * and the UI can never disagree about the mode. Previously each site inlined\n * its own `String(... ?? 'false').toLowerCase() !== 'false'` (and the SQL\n * driver read `process.env` directly, skipping the deprecation warning).\n *\n * Reads `process.env` live on each call; memoise at the call site if the\n * result must be stable for the process lifetime.\n */\nexport function resolveMultiOrgEnabled(): boolean {\n const raw = readEnvWithDeprecation('OS_MULTI_ORG_ENABLED', []);\n return String(raw ?? 'false').toLowerCase() !== 'false';\n}\n\n/**\n * Escape hatch for the degraded-tenancy boot guard (ADR-0093 D5).\n *\n * When `OS_MULTI_ORG_ENABLED=true` but the enterprise `@objectstack/organizations`\n * package cannot provide tenant isolation, the platform refuses to boot — a\n * deployment that asked for tenant isolation must not serve traffic pretending\n * to have it (ADR-0049 at the deployment layer). Setting this to a truthy value\n * (`true`/`1`/`on`/`yes`, case-insensitive) boots anyway in an explicitly\n * *degraded* state that is branded everywhere an operator looks. Defaults OFF —\n * an unset flag means \"fail fast\".\n */\nexport function resolveAllowDegradedTenancy(): boolean {\n const raw = readEnvWithDeprecation('OS_ALLOW_DEGRADED_TENANCY', [], { silent: true });\n if (raw == null) return false;\n return ['1', 'true', 'on', 'yes'].includes(String(raw).trim().toLowerCase());\n}\n\n/**\n * SINGLE decision point for \"is the MCP HTTP surface (`/api/v1/mcp`) on?\".\n *\n * MCP is a core platform capability and defaults ON: an unset\n * `OS_MCP_SERVER_ENABLED` means the surface is served. Operators opt OUT with\n * an explicit falsy value (`false`/`0`/`off`/`no`, case-insensitive); any\n * other value — including the historical `true` — keeps it on.\n *\n * Every consumer of the flag — the runtime dispatcher's `/mcp` route gate,\n * the CLI's MCP plugin auto-load, the REST `/discovery` advertisement, and\n * the auth service's OAuth/DCR follow-defaults — MUST call this instead of\n * re-reading the env, so the served route, the advertised route, and the\n * authorization track can never disagree.\n *\n * Note the asymmetry with the MCP plugin's *stdio* auto-start, which stays\n * opt-in (explicit `true` / `autoStart`): attaching a long-lived stdio\n * transport to every process is a side effect no default should impose,\n * while the HTTP surface is served statelessly per-request.\n */\nexport function isMcpServerEnabled(): boolean {\n const raw = readEnvWithDeprecation('OS_MCP_SERVER_ENABLED', 'MCP_SERVER_ENABLED', {\n silent: true,\n });\n if (raw == null) return true;\n return !['0', 'false', 'off', 'no'].includes(raw.trim().toLowerCase());\n}\n\n/**\n * Maximum number of organizations a single user may CREATE, from `OS_ORG_LIMIT`.\n * The auth plugin forwards this as better-auth's `organizationLimit` in function\n * form, counting only the caller's `role=owner` memberships — so it caps\n * self-created orgs (each of which can auto-provision a free environment on the\n * cloud control plane) without penalising a user invited into many orgs.\n *\n * Only meaningful when multi-org is enabled ({@link resolveMultiOrgEnabled}).\n * Returns `undefined` when unset or non-positive → no limit (better-auth treats\n * an absent `organizationLimit` as unlimited), preserving self-host behaviour.\n * Deployments that let users self-create orgs SHOULD set a generous cap.\n */\nexport function resolveOrgLimit(): number | undefined {\n const raw = readEnvWithDeprecation('OS_ORG_LIMIT', [], { silent: true });\n if (raw == null || String(raw).trim() === '') return undefined;\n const n = Number.parseInt(String(raw), 10);\n return Number.isFinite(n) && n > 0 ? n : undefined;\n}\n\n/**\n * SINGLE decision point for \"is pinyin search recall on?\" (#2486).\n *\n * Pinyin search is a deployment/locale-level capability, not field metadata:\n * Chinese deployments want it, pure-Japanese/English deployments don't. The\n * flag gates the whole feature end-to-end — the SchemaRegistry's compile-time\n * `__search` companion-column seam AND the `plugin-pinyin-search` populate\n * hooks — so there is no half-state where a column exists but nobody fills it\n * (ADR-0049: no declared-but-unenforced capability).\n *\n * Resolution:\n * 1. An explicit `OS_SEARCH_PINYIN_ENABLED` always wins — truthy\n * (`1`/`true`/`on`/`yes`) enables, anything else disables.\n * 2. When unset, the default derives from the deployment's configured\n * locales (`opts.locales`, e.g. the stack's `i18n.defaultLocale` +\n * `supportedLocales`): any `zh-*` locale turns it on.\n * 3. No env var and no `zh-*` locale → off. OSS / non-Chinese deployments\n * never load `pinyin-pro` and pay zero compute cost.\n *\n * Hosts that know the stack's i18n config (the CLI `serve` boot path) resolve\n * once with locales and stamp the decision back into the env, so downstream\n * consumers constructed without config access (per-engine SchemaRegistry)\n * read the same answer via the no-arg form.\n */\nexport function resolveSearchPinyinEnabled(opts?: { locales?: readonly string[] }): boolean {\n const raw = readEnvWithDeprecation('OS_SEARCH_PINYIN_ENABLED', [], { silent: true });\n if (raw != null && String(raw).trim() !== '') {\n return ['1', 'true', 'on', 'yes'].includes(String(raw).trim().toLowerCase());\n }\n return (opts?.locales ?? []).some((l) => /^zh([-_]|$)/i.test(String(l ?? '').trim()));\n}\n\n/**\n * Internal: clear the dedupe set. Test-only; exposed so suite-wide\n * deprecation warnings don't bleed between tests.\n *\n * @internal\n */\nexport function _resetEnvDeprecationWarnings(): void {\n _warnedKeys.clear();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBA,IAAM,cAAc,oBAAI,IAAY;AA0B7B,SAAS,uBACd,WACA,QACA,SACoB;AACpB,QAAM,MAAO,WACV,SAAS;AACZ,MAAI,CAAC,IAAK,QAAO;AAEjB,QAAM,iBAAiB,IAAI,SAAS;AACpC,MAAI,mBAAmB,OAAW,QAAO;AAEzC,QAAM,aAAa,OAAO,WAAW,WAAW,CAAC,MAAM,IAAI;AAC3D,aAAW,cAAc,YAAY;AACnC,UAAM,cAAc,IAAI,UAAU;AAClC,QAAI,gBAAgB,QAAW;AAC7B,YAAM,YAAY,GAAG,SAAS,IAAI,UAAU;AAC5C,UAAI,CAAC,SAAS,UAAU,CAAC,YAAY,IAAI,SAAS,GAAG;AACnD,oBAAY,IAAI,SAAS;AACzB,cAAM,aAAc,WAA8D;AAClF,YAAI;AACF,sBAAY;AAAA,YACV,2BAA2B,UAAU,oCAAoC,SAAS;AAAA,UAEpF;AAAA,QACF,QAAQ;AAAA,QAER;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;AAqBO,SAAS,yBAAkC;AAChD,QAAM,MAAM,uBAAuB,wBAAwB,CAAC,CAAC;AAC7D,SAAO,OAAO,OAAO,OAAO,EAAE,YAAY,MAAM;AAClD;AAaO,SAAS,8BAAuC;AACrD,QAAM,MAAM,uBAAuB,6BAA6B,CAAC,GAAG,EAAE,QAAQ,KAAK,CAAC;AACpF,MAAI,OAAO,KAAM,QAAO;AACxB,SAAO,CAAC,KAAK,QAAQ,MAAM,KAAK,EAAE,SAAS,OAAO,GAAG,EAAE,KAAK,EAAE,YAAY,CAAC;AAC7E;AAqBO,SAAS,qBAA8B;AAC5C,QAAM,MAAM,uBAAuB,yBAAyB,sBAAsB;AAAA,IAChF,QAAQ;AAAA,EACV,CAAC;AACD,MAAI,OAAO,KAAM,QAAO;AACxB,SAAO,CAAC,CAAC,KAAK,SAAS,OAAO,IAAI,EAAE,SAAS,IAAI,KAAK,EAAE,YAAY,CAAC;AACvE;AAcO,SAAS,kBAAsC;AACpD,QAAM,MAAM,uBAAuB,gBAAgB,CAAC,GAAG,EAAE,QAAQ,KAAK,CAAC;AACvE,MAAI,OAAO,QAAQ,OAAO,GAAG,EAAE,KAAK,MAAM,GAAI,QAAO;AACrD,QAAM,IAAI,OAAO,SAAS,OAAO,GAAG,GAAG,EAAE;AACzC,SAAO,OAAO,SAAS,CAAC,KAAK,IAAI,IAAI,IAAI;AAC3C;AA0BO,SAAS,2BAA2B,MAAiD;AAC1F,QAAM,MAAM,uBAAuB,4BAA4B,CAAC,GAAG,EAAE,QAAQ,KAAK,CAAC;AACnF,MAAI,OAAO,QAAQ,OAAO,GAAG,EAAE,KAAK,MAAM,IAAI;AAC5C,WAAO,CAAC,KAAK,QAAQ,MAAM,KAAK,EAAE,SAAS,OAAO,GAAG,EAAE,KAAK,EAAE,YAAY,CAAC;AAAA,EAC7E;AACA,UAAQ,MAAM,WAAW,CAAC,GAAG,KAAK,CAAC,MAAM,eAAe,KAAK,OAAO,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;AACtF;AAQO,SAAS,+BAAqC;AACnD,cAAY,MAAM;AACpB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/env.ts","../src/module-not-found.ts"],"sourcesContent":["// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nexport * from './env.js';\nexport * from './module-not-found.js';\n\n// Placeholder for Kernel interface to avoid circular dependency\n// The actual Kernel implementation will satisfy this interface.\nexport interface IKernel {\n // We can add specific methods here that plugins are allowed to call\n // forcing a stricter contract than exposing the whole class.\n ql?: any; // ObjectQL instance (optional to support initialization phase)\n start(): Promise<void>;\n // ... expose other needed public methods\n [key: string]: any; \n}\n\nexport interface RuntimeContext {\n engine: IKernel;\n}\n\nexport interface RuntimePlugin {\n name: string;\n install?: (ctx: RuntimeContext) => void | Promise<void>;\n onStart?: (ctx: RuntimeContext) => void | Promise<void>;\n}\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\n/**\n * Environment-variable helpers shared across `@objectstack/*` packages.\n *\n * The framework standardises on `OS_*` prefixed env vars (see AGENTS.md\n * \"Environment Variables\" section). Some historical names predate this\n * convention — `AUTH_SECRET`, `ROOT_DOMAIN`, `OBJECTSTACK_*`, …\n *\n * To migrate without breaking user `.env` files mid-release, call\n * {@link readEnvWithDeprecation} at every legacy read site:\n *\n * const v = readEnvWithDeprecation('OS_AUTH_SECRET', 'AUTH_SECRET');\n *\n * If only the legacy name is set, the value is still returned but a\n * one-shot `console.warn` fires (per-process per-variable) telling\n * operators to rename it.\n */\n\nconst _warnedKeys = new Set<string>();\n\n/**\n * Read an env var, preferring the canonical `OS_*` name and falling\n * back to one or more legacy aliases.\n *\n * When only a legacy alias is set, emits a one-shot deprecation warning.\n * The warning is process-wide deduplicated: identical (preferred, legacy)\n * pairs will only warn once even if read from multiple call sites.\n *\n * Legacy aliases are checked in order; the first one with a defined\n * value wins (and triggers the warning for that specific alias).\n *\n * Safe to call from environments where `process` is unavailable (returns\n * `undefined`); the warning is suppressed when running outside Node-like\n * runtimes that lack `console.warn`.\n *\n * @param preferred Canonical OS_*-prefixed env var name.\n * @param legacy Older name (or array of older names) to fall back on.\n * @param options Optional behaviour flags. Set `silent: true` for aliases\n * that remain accepted conventions rather than true legacy\n * names — e.g. `PORT`, which PaaS platforms (Render, Railway,\n * Heroku, Fly, …) inject automatically. Warning on those\n * would nag operators about env they never set.\n * @returns The resolved value, or `undefined` if neither is set.\n */\nexport function readEnvWithDeprecation(\n preferred: string,\n legacy: string | readonly string[],\n options?: { silent?: boolean },\n): string | undefined {\n const env = (globalThis as { process?: { env?: Record<string, string | undefined> } })\n .process?.env;\n if (!env) return undefined;\n\n const preferredValue = env[preferred];\n if (preferredValue !== undefined) return preferredValue;\n\n const legacyList = typeof legacy === 'string' ? [legacy] : legacy;\n for (const legacyName of legacyList) {\n const legacyValue = env[legacyName];\n if (legacyValue !== undefined) {\n const dedupeKey = `${preferred}|${legacyName}`;\n if (!options?.silent && !_warnedKeys.has(dedupeKey)) {\n _warnedKeys.add(dedupeKey);\n const consoleRef = (globalThis as { console?: { warn?: (msg: string) => void } }).console;\n try {\n consoleRef?.warn?.(\n `[ObjectStack] Env var \\`${legacyName}\\` is deprecated; rename it to \\`${preferred}\\`. ` +\n `The legacy name still works for now but will be removed in a future major release.`,\n );\n } catch {\n /* `console.warn` unavailable (exotic runtime) — ignore */\n }\n }\n return legacyValue;\n }\n }\n\n return undefined;\n}\n\n/**\n * Resolve whether the deployment runs in multi-org (a.k.a. multi-tenant) mode.\n *\n * Single source of truth for the `OS_MULTI_ORG_ENABLED` flag. Resolution: the\n * canonical `OS_MULTI_ORG_ENABLED`; else `false`. Any value other than a\n * case-insensitive `'false'` enables it. (The legacy `OS_MULTI_TENANT` alias was\n * removed in 11.0.)\n *\n * Every site that needs to know \"is this multi-org?\" — the SQL driver's\n * tenant-audit gate, the auth manager's `/auth/config` feature flag and\n * org-create guard, the CLI / dev / runtime org-scoping plugin wiring — MUST\n * call this instead of re-reading the env, so the driver, the security layer,\n * and the UI can never disagree about the mode. Previously each site inlined\n * its own `String(... ?? 'false').toLowerCase() !== 'false'` (and the SQL\n * driver read `process.env` directly, skipping the deprecation warning).\n *\n * Reads `process.env` live on each call; memoise at the call site if the\n * result must be stable for the process lifetime.\n */\nexport function resolveMultiOrgEnabled(): boolean {\n const raw = readEnvWithDeprecation('OS_MULTI_ORG_ENABLED', []);\n return String(raw ?? 'false').toLowerCase() !== 'false';\n}\n\n/**\n * Escape hatch for the degraded-tenancy boot guard (ADR-0093 D5).\n *\n * When `OS_MULTI_ORG_ENABLED=true` but the enterprise `@objectstack/organizations`\n * package cannot provide tenant isolation, the platform refuses to boot — a\n * deployment that asked for tenant isolation must not serve traffic pretending\n * to have it (ADR-0049 at the deployment layer). Setting this to a truthy value\n * (`true`/`1`/`on`/`yes`, case-insensitive) boots anyway in an explicitly\n * *degraded* state that is branded everywhere an operator looks. Defaults OFF —\n * an unset flag means \"fail fast\".\n */\nexport function resolveAllowDegradedTenancy(): boolean {\n const raw = readEnvWithDeprecation('OS_ALLOW_DEGRADED_TENANCY', [], { silent: true });\n if (raw == null) return false;\n return ['1', 'true', 'on', 'yes'].includes(String(raw).trim().toLowerCase());\n}\n\n/**\n * SINGLE decision point for \"is the MCP HTTP surface (`/api/v1/mcp`) on?\".\n *\n * MCP is a core platform capability and defaults ON: an unset\n * `OS_MCP_SERVER_ENABLED` means the surface is served. Operators opt OUT with\n * an explicit falsy value (`false`/`0`/`off`/`no`, case-insensitive); any\n * other value — including the historical `true` — keeps it on.\n *\n * Every consumer of the flag — the runtime dispatcher's `/mcp` route gate,\n * the CLI's MCP plugin auto-load, the REST `/discovery` advertisement, and\n * the auth service's OAuth/DCR follow-defaults — MUST call this instead of\n * re-reading the env, so the served route, the advertised route, and the\n * authorization track can never disagree.\n *\n * Note the asymmetry with the MCP plugin's *stdio* auto-start\n * ({@link resolveMcpStdioAutoStart}), which stays opt-in and is gated by a\n * SEPARATE switch: attaching a long-lived stdio transport to every process is\n * a side effect no default should impose, while the HTTP surface is served\n * statelessly per-request.\n */\nexport function isMcpServerEnabled(): boolean {\n const raw = readEnvWithDeprecation('OS_MCP_SERVER_ENABLED', 'MCP_SERVER_ENABLED', {\n silent: true,\n });\n if (raw == null) return true;\n return !['0', 'false', 'off', 'no'].includes(raw.trim().toLowerCase());\n}\n\n/**\n * SINGLE decision point for \"should the MCP plugin auto-start a long-lived\n * (stdio) transport?\" — distinct from {@link isMcpServerEnabled}, which governs\n * the stateless HTTP surface.\n *\n * The stdio transport is a different, stricter posture: the plugin bridges the\n * RAW metadata service + data engine onto the long-lived server with NO\n * per-request principal (unscoped — see the `mcp-stdio-authority` conformance\n * row), so it is safe only as a single-operator LOCAL tool and MUST stay\n * opt-in. It defaults OFF.\n *\n * Canonical switch: `OS_MCP_STDIO_ENABLED` (truthy). The plugin also starts it\n * when constructed with `{ autoStart: true }` (that path is checked by the\n * caller, not here).\n *\n * DEPRECATED alias: `OS_MCP_SERVER_ENABLED=true` historically ALSO started\n * stdio — overloading the very var that gates the HTTP surface, so an operator\n * setting it to \"make sure MCP is on\" silently attached an unscoped transport.\n * That trigger still works (with a one-time warning from the caller) for one\n * release; prefer the dedicated var. Note `OS_MCP_SERVER_ENABLED=false` only\n * ever gated the HTTP surface and never started stdio, so it is unaffected.\n *\n * @returns `enabled` — whether stdio auto-start is requested by the env; and\n * `viaDeprecatedAlias` — whether it came through the legacy\n * `OS_MCP_SERVER_ENABLED=true` trigger (so the caller can warn once).\n */\nexport function resolveMcpStdioAutoStart(): { enabled: boolean; viaDeprecatedAlias: boolean } {\n const stdio = readEnvWithDeprecation('OS_MCP_STDIO_ENABLED', [], { silent: true });\n if (stdio != null && ['1', 'true', 'on', 'yes'].includes(stdio.trim().toLowerCase())) {\n return { enabled: true, viaDeprecatedAlias: false };\n }\n // Legacy trigger: only the literal `true` ever started stdio (preserved\n // exactly). `OS_MCP_SERVER_ENABLED=false`/other values never did.\n const legacy = readEnvWithDeprecation('OS_MCP_SERVER_ENABLED', 'MCP_SERVER_ENABLED', { silent: true });\n if (legacy != null && legacy.trim().toLowerCase() === 'true') {\n return { enabled: true, viaDeprecatedAlias: true };\n }\n return { enabled: false, viaDeprecatedAlias: false };\n}\n\n/**\n * Maximum number of organizations a single user may CREATE, from `OS_ORG_LIMIT`.\n * The auth plugin forwards this as better-auth's `organizationLimit` in function\n * form, counting only the caller's `role=owner` memberships — so it caps\n * self-created orgs (each of which can auto-provision a free environment on the\n * cloud control plane) without penalising a user invited into many orgs.\n *\n * Only meaningful when multi-org is enabled ({@link resolveMultiOrgEnabled}).\n * Returns `undefined` when unset or non-positive → no limit (better-auth treats\n * an absent `organizationLimit` as unlimited), preserving self-host behaviour.\n * Deployments that let users self-create orgs SHOULD set a generous cap.\n */\nexport function resolveOrgLimit(): number | undefined {\n const raw = readEnvWithDeprecation('OS_ORG_LIMIT', [], { silent: true });\n if (raw == null || String(raw).trim() === '') return undefined;\n const n = Number.parseInt(String(raw), 10);\n return Number.isFinite(n) && n > 0 ? n : undefined;\n}\n\n/**\n * SINGLE decision point for \"is pinyin search recall on?\" (#2486).\n *\n * Pinyin search is a deployment/locale-level capability, not field metadata:\n * Chinese deployments want it, pure-Japanese/English deployments don't. The\n * flag gates the whole feature end-to-end — the SchemaRegistry's compile-time\n * `__search` companion-column seam AND the `plugin-pinyin-search` populate\n * hooks — so there is no half-state where a column exists but nobody fills it\n * (ADR-0049: no declared-but-unenforced capability).\n *\n * Resolution:\n * 1. An explicit `OS_SEARCH_PINYIN_ENABLED` always wins — truthy\n * (`1`/`true`/`on`/`yes`) enables, anything else disables.\n * 2. When unset, the default derives from the deployment's configured\n * locales (`opts.locales`, e.g. the stack's `i18n.defaultLocale` +\n * `supportedLocales`): any `zh-*` locale turns it on.\n * 3. No env var and no `zh-*` locale → off. OSS / non-Chinese deployments\n * never load `pinyin-pro` and pay zero compute cost.\n *\n * Hosts that know the stack's i18n config (the CLI `serve` boot path) resolve\n * once with locales and stamp the decision back into the env, so downstream\n * consumers constructed without config access (per-engine SchemaRegistry)\n * read the same answer via the no-arg form.\n */\nexport function resolveSearchPinyinEnabled(opts?: { locales?: readonly string[] }): boolean {\n const raw = readEnvWithDeprecation('OS_SEARCH_PINYIN_ENABLED', [], { silent: true });\n if (raw != null && String(raw).trim() !== '') {\n return ['1', 'true', 'on', 'yes'].includes(String(raw).trim().toLowerCase());\n }\n return (opts?.locales ?? []).some((l) => /^zh([-_]|$)/i.test(String(l ?? '').trim()));\n}\n\n/**\n * SINGLE decision point for a sandbox script-runner DEFAULT (ms), resolved from\n * the environment (framework#3259 / ADR-0102).\n *\n * The QuickJS sandbox meters each hook/action invocation against a per-invocation\n * budget. Two dimensions are env-tunable:\n * - the **CPU-time budget** for hooks / actions — how much *VM-active* time a\n * body may burn (built-in 250ms hooks / 5000ms actions); and\n * - the **wall-clock ceiling** — the backstop bounding a body parked forever on\n * a host call that never settles (built-in 30_000ms).\n *\n * The built-in defaults suit a warm, idle host; a heavily loaded or slow host\n * (an oversubscribed CI runner, constrained production hardware) may need a\n * higher floor. This lets an operator raise it once, deployment-wide, instead of\n * re-tuning every call site.\n *\n * Canonical vars (OS_{DOMAIN}_{NAME}, DOMAIN=SANDBOX):\n * - hook → `OS_SANDBOX_HOOK_TIMEOUT_MS`\n * - action → `OS_SANDBOX_ACTION_TIMEOUT_MS`\n * - wallCeiling → `OS_SANDBOX_WALL_CEILING_MS`\n *\n * Only a positive integer is honored; unset / empty / non-numeric / non-positive\n * falls back to `fallback`, so behaviour is byte-for-byte unchanged when the var\n * is absent. This is a FALLBACK default ONLY: an explicit constructor option\n * still wins over it, and (for the CPU budget) a body's own declared `timeoutMs`\n * still wins over the resolved default per the runner's resolution rule.\n */\nexport function resolveSandboxTimeoutMs(\n kind: 'hook' | 'action' | 'wallCeiling',\n fallback: number,\n): number {\n const name =\n kind === 'hook'\n ? 'OS_SANDBOX_HOOK_TIMEOUT_MS'\n : kind === 'action'\n ? 'OS_SANDBOX_ACTION_TIMEOUT_MS'\n : 'OS_SANDBOX_WALL_CEILING_MS';\n const raw = readEnvWithDeprecation(name, [], { silent: true });\n if (raw == null || String(raw).trim() === '') return fallback;\n const n = Number.parseInt(String(raw).trim(), 10);\n return Number.isFinite(n) && n > 0 ? n : fallback;\n}\n\n/**\n * Internal: clear the dedupe set. Test-only; exposed so suite-wide\n * deprecation warnings don't bleed between tests.\n *\n * @internal\n */\nexport function _resetEnvDeprecationWarnings(): void {\n _warnedKeys.clear();\n}\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\n/**\n * True when a dynamic `import()` / `require.resolve()` failed because the\n * module is simply NOT INSTALLED — as opposed to the module being present but\n * throwing while it loads (a real crash). Checking `err.code` FIRST matters:\n * ESM reports a missing package as `err.code === 'ERR_MODULE_NOT_FOUND'` with\n * the human message `Cannot find package '...'`; matching only the older\n * `Cannot find module` string mis-classifies that as a crash (framework#1595).\n *\n * Single shared owner for this classification (framework#3265): the CLI's\n * optional-plugin guards and `requires` capability resolver delegate here, and\n * cloud's `objectos-runtime` capability loader is expected to adopt it at its\n * next framework pin bump — so the parallel loaders cannot drift apart and\n * re-introduce the #1595 false-alarm class.\n */\nexport function isModuleNotFoundError(err: unknown): boolean {\n const code = (err as { code?: string } | null | undefined)?.code;\n if (code === 'ERR_MODULE_NOT_FOUND' || code === 'MODULE_NOT_FOUND') return true;\n const msg = err instanceof Error ? err.message : String(err);\n return msg.includes('Cannot find module') || msg.includes('Cannot find package');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBA,IAAM,cAAc,oBAAI,IAAY;AA0B7B,SAAS,uBACd,WACA,QACA,SACoB;AACpB,QAAM,MAAO,WACV,SAAS;AACZ,MAAI,CAAC,IAAK,QAAO;AAEjB,QAAM,iBAAiB,IAAI,SAAS;AACpC,MAAI,mBAAmB,OAAW,QAAO;AAEzC,QAAM,aAAa,OAAO,WAAW,WAAW,CAAC,MAAM,IAAI;AAC3D,aAAW,cAAc,YAAY;AACnC,UAAM,cAAc,IAAI,UAAU;AAClC,QAAI,gBAAgB,QAAW;AAC7B,YAAM,YAAY,GAAG,SAAS,IAAI,UAAU;AAC5C,UAAI,CAAC,SAAS,UAAU,CAAC,YAAY,IAAI,SAAS,GAAG;AACnD,oBAAY,IAAI,SAAS;AACzB,cAAM,aAAc,WAA8D;AAClF,YAAI;AACF,sBAAY;AAAA,YACV,2BAA2B,UAAU,oCAAoC,SAAS;AAAA,UAEpF;AAAA,QACF,QAAQ;AAAA,QAER;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;AAqBO,SAAS,yBAAkC;AAChD,QAAM,MAAM,uBAAuB,wBAAwB,CAAC,CAAC;AAC7D,SAAO,OAAO,OAAO,OAAO,EAAE,YAAY,MAAM;AAClD;AAaO,SAAS,8BAAuC;AACrD,QAAM,MAAM,uBAAuB,6BAA6B,CAAC,GAAG,EAAE,QAAQ,KAAK,CAAC;AACpF,MAAI,OAAO,KAAM,QAAO;AACxB,SAAO,CAAC,KAAK,QAAQ,MAAM,KAAK,EAAE,SAAS,OAAO,GAAG,EAAE,KAAK,EAAE,YAAY,CAAC;AAC7E;AAsBO,SAAS,qBAA8B;AAC5C,QAAM,MAAM,uBAAuB,yBAAyB,sBAAsB;AAAA,IAChF,QAAQ;AAAA,EACV,CAAC;AACD,MAAI,OAAO,KAAM,QAAO;AACxB,SAAO,CAAC,CAAC,KAAK,SAAS,OAAO,IAAI,EAAE,SAAS,IAAI,KAAK,EAAE,YAAY,CAAC;AACvE;AA4BO,SAAS,2BAA8E;AAC5F,QAAM,QAAQ,uBAAuB,wBAAwB,CAAC,GAAG,EAAE,QAAQ,KAAK,CAAC;AACjF,MAAI,SAAS,QAAQ,CAAC,KAAK,QAAQ,MAAM,KAAK,EAAE,SAAS,MAAM,KAAK,EAAE,YAAY,CAAC,GAAG;AACpF,WAAO,EAAE,SAAS,MAAM,oBAAoB,MAAM;AAAA,EACpD;AAGA,QAAM,SAAS,uBAAuB,yBAAyB,sBAAsB,EAAE,QAAQ,KAAK,CAAC;AACrG,MAAI,UAAU,QAAQ,OAAO,KAAK,EAAE,YAAY,MAAM,QAAQ;AAC5D,WAAO,EAAE,SAAS,MAAM,oBAAoB,KAAK;AAAA,EACnD;AACA,SAAO,EAAE,SAAS,OAAO,oBAAoB,MAAM;AACrD;AAcO,SAAS,kBAAsC;AACpD,QAAM,MAAM,uBAAuB,gBAAgB,CAAC,GAAG,EAAE,QAAQ,KAAK,CAAC;AACvE,MAAI,OAAO,QAAQ,OAAO,GAAG,EAAE,KAAK,MAAM,GAAI,QAAO;AACrD,QAAM,IAAI,OAAO,SAAS,OAAO,GAAG,GAAG,EAAE;AACzC,SAAO,OAAO,SAAS,CAAC,KAAK,IAAI,IAAI,IAAI;AAC3C;AA0BO,SAAS,2BAA2B,MAAiD;AAC1F,QAAM,MAAM,uBAAuB,4BAA4B,CAAC,GAAG,EAAE,QAAQ,KAAK,CAAC;AACnF,MAAI,OAAO,QAAQ,OAAO,GAAG,EAAE,KAAK,MAAM,IAAI;AAC5C,WAAO,CAAC,KAAK,QAAQ,MAAM,KAAK,EAAE,SAAS,OAAO,GAAG,EAAE,KAAK,EAAE,YAAY,CAAC;AAAA,EAC7E;AACA,UAAQ,MAAM,WAAW,CAAC,GAAG,KAAK,CAAC,MAAM,eAAe,KAAK,OAAO,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;AACtF;AA6BO,SAAS,wBACd,MACA,UACQ;AACR,QAAM,OACJ,SAAS,SACL,+BACA,SAAS,WACP,iCACA;AACR,QAAM,MAAM,uBAAuB,MAAM,CAAC,GAAG,EAAE,QAAQ,KAAK,CAAC;AAC7D,MAAI,OAAO,QAAQ,OAAO,GAAG,EAAE,KAAK,MAAM,GAAI,QAAO;AACrD,QAAM,IAAI,OAAO,SAAS,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE;AAChD,SAAO,OAAO,SAAS,CAAC,KAAK,IAAI,IAAI,IAAI;AAC3C;AAQO,SAAS,+BAAqC;AACnD,cAAY,MAAM;AACpB;;;ACpRO,SAAS,sBAAsB,KAAuB;AAC3D,QAAM,OAAQ,KAA8C;AAC5D,MAAI,SAAS,0BAA0B,SAAS,mBAAoB,QAAO;AAC3E,QAAM,MAAM,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC3D,SAAO,IAAI,SAAS,oBAAoB,KAAK,IAAI,SAAS,qBAAqB;AACjF;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -41,6 +41,17 @@ function isMcpServerEnabled() {
|
|
|
41
41
|
if (raw == null) return true;
|
|
42
42
|
return !["0", "false", "off", "no"].includes(raw.trim().toLowerCase());
|
|
43
43
|
}
|
|
44
|
+
function resolveMcpStdioAutoStart() {
|
|
45
|
+
const stdio = readEnvWithDeprecation("OS_MCP_STDIO_ENABLED", [], { silent: true });
|
|
46
|
+
if (stdio != null && ["1", "true", "on", "yes"].includes(stdio.trim().toLowerCase())) {
|
|
47
|
+
return { enabled: true, viaDeprecatedAlias: false };
|
|
48
|
+
}
|
|
49
|
+
const legacy = readEnvWithDeprecation("OS_MCP_SERVER_ENABLED", "MCP_SERVER_ENABLED", { silent: true });
|
|
50
|
+
if (legacy != null && legacy.trim().toLowerCase() === "true") {
|
|
51
|
+
return { enabled: true, viaDeprecatedAlias: true };
|
|
52
|
+
}
|
|
53
|
+
return { enabled: false, viaDeprecatedAlias: false };
|
|
54
|
+
}
|
|
44
55
|
function resolveOrgLimit() {
|
|
45
56
|
const raw = readEnvWithDeprecation("OS_ORG_LIMIT", [], { silent: true });
|
|
46
57
|
if (raw == null || String(raw).trim() === "") return void 0;
|
|
@@ -54,16 +65,34 @@ function resolveSearchPinyinEnabled(opts) {
|
|
|
54
65
|
}
|
|
55
66
|
return (opts?.locales ?? []).some((l) => /^zh([-_]|$)/i.test(String(l ?? "").trim()));
|
|
56
67
|
}
|
|
68
|
+
function resolveSandboxTimeoutMs(kind, fallback) {
|
|
69
|
+
const name = kind === "hook" ? "OS_SANDBOX_HOOK_TIMEOUT_MS" : kind === "action" ? "OS_SANDBOX_ACTION_TIMEOUT_MS" : "OS_SANDBOX_WALL_CEILING_MS";
|
|
70
|
+
const raw = readEnvWithDeprecation(name, [], { silent: true });
|
|
71
|
+
if (raw == null || String(raw).trim() === "") return fallback;
|
|
72
|
+
const n = Number.parseInt(String(raw).trim(), 10);
|
|
73
|
+
return Number.isFinite(n) && n > 0 ? n : fallback;
|
|
74
|
+
}
|
|
57
75
|
function _resetEnvDeprecationWarnings() {
|
|
58
76
|
_warnedKeys.clear();
|
|
59
77
|
}
|
|
78
|
+
|
|
79
|
+
// src/module-not-found.ts
|
|
80
|
+
function isModuleNotFoundError(err) {
|
|
81
|
+
const code = err?.code;
|
|
82
|
+
if (code === "ERR_MODULE_NOT_FOUND" || code === "MODULE_NOT_FOUND") return true;
|
|
83
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
84
|
+
return msg.includes("Cannot find module") || msg.includes("Cannot find package");
|
|
85
|
+
}
|
|
60
86
|
export {
|
|
61
87
|
_resetEnvDeprecationWarnings,
|
|
62
88
|
isMcpServerEnabled,
|
|
89
|
+
isModuleNotFoundError,
|
|
63
90
|
readEnvWithDeprecation,
|
|
64
91
|
resolveAllowDegradedTenancy,
|
|
92
|
+
resolveMcpStdioAutoStart,
|
|
65
93
|
resolveMultiOrgEnabled,
|
|
66
94
|
resolveOrgLimit,
|
|
95
|
+
resolveSandboxTimeoutMs,
|
|
67
96
|
resolveSearchPinyinEnabled
|
|
68
97
|
};
|
|
69
98
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/env.ts"],"sourcesContent":["// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\n/**\n * Environment-variable helpers shared across `@objectstack/*` packages.\n *\n * The framework standardises on `OS_*` prefixed env vars (see AGENTS.md\n * \"Environment Variables\" section). Some historical names predate this\n * convention — `AUTH_SECRET`, `ROOT_DOMAIN`, `OBJECTSTACK_*`, …\n *\n * To migrate without breaking user `.env` files mid-release, call\n * {@link readEnvWithDeprecation} at every legacy read site:\n *\n * const v = readEnvWithDeprecation('OS_AUTH_SECRET', 'AUTH_SECRET');\n *\n * If only the legacy name is set, the value is still returned but a\n * one-shot `console.warn` fires (per-process per-variable) telling\n * operators to rename it.\n */\n\nconst _warnedKeys = new Set<string>();\n\n/**\n * Read an env var, preferring the canonical `OS_*` name and falling\n * back to one or more legacy aliases.\n *\n * When only a legacy alias is set, emits a one-shot deprecation warning.\n * The warning is process-wide deduplicated: identical (preferred, legacy)\n * pairs will only warn once even if read from multiple call sites.\n *\n * Legacy aliases are checked in order; the first one with a defined\n * value wins (and triggers the warning for that specific alias).\n *\n * Safe to call from environments where `process` is unavailable (returns\n * `undefined`); the warning is suppressed when running outside Node-like\n * runtimes that lack `console.warn`.\n *\n * @param preferred Canonical OS_*-prefixed env var name.\n * @param legacy Older name (or array of older names) to fall back on.\n * @param options Optional behaviour flags. Set `silent: true` for aliases\n * that remain accepted conventions rather than true legacy\n * names — e.g. `PORT`, which PaaS platforms (Render, Railway,\n * Heroku, Fly, …) inject automatically. Warning on those\n * would nag operators about env they never set.\n * @returns The resolved value, or `undefined` if neither is set.\n */\nexport function readEnvWithDeprecation(\n preferred: string,\n legacy: string | readonly string[],\n options?: { silent?: boolean },\n): string | undefined {\n const env = (globalThis as { process?: { env?: Record<string, string | undefined> } })\n .process?.env;\n if (!env) return undefined;\n\n const preferredValue = env[preferred];\n if (preferredValue !== undefined) return preferredValue;\n\n const legacyList = typeof legacy === 'string' ? [legacy] : legacy;\n for (const legacyName of legacyList) {\n const legacyValue = env[legacyName];\n if (legacyValue !== undefined) {\n const dedupeKey = `${preferred}|${legacyName}`;\n if (!options?.silent && !_warnedKeys.has(dedupeKey)) {\n _warnedKeys.add(dedupeKey);\n const consoleRef = (globalThis as { console?: { warn?: (msg: string) => void } }).console;\n try {\n consoleRef?.warn?.(\n `[ObjectStack] Env var \\`${legacyName}\\` is deprecated; rename it to \\`${preferred}\\`. ` +\n `The legacy name still works for now but will be removed in a future major release.`,\n );\n } catch {\n /* `console.warn` unavailable (exotic runtime) — ignore */\n }\n }\n return legacyValue;\n }\n }\n\n return undefined;\n}\n\n/**\n * Resolve whether the deployment runs in multi-org (a.k.a. multi-tenant) mode.\n *\n * Single source of truth for the `OS_MULTI_ORG_ENABLED` flag. Resolution: the\n * canonical `OS_MULTI_ORG_ENABLED`; else `false`. Any value other than a\n * case-insensitive `'false'` enables it. (The legacy `OS_MULTI_TENANT` alias was\n * removed in 11.0.)\n *\n * Every site that needs to know \"is this multi-org?\" — the SQL driver's\n * tenant-audit gate, the auth manager's `/auth/config` feature flag and\n * org-create guard, the CLI / dev / runtime org-scoping plugin wiring — MUST\n * call this instead of re-reading the env, so the driver, the security layer,\n * and the UI can never disagree about the mode. Previously each site inlined\n * its own `String(... ?? 'false').toLowerCase() !== 'false'` (and the SQL\n * driver read `process.env` directly, skipping the deprecation warning).\n *\n * Reads `process.env` live on each call; memoise at the call site if the\n * result must be stable for the process lifetime.\n */\nexport function resolveMultiOrgEnabled(): boolean {\n const raw = readEnvWithDeprecation('OS_MULTI_ORG_ENABLED', []);\n return String(raw ?? 'false').toLowerCase() !== 'false';\n}\n\n/**\n * Escape hatch for the degraded-tenancy boot guard (ADR-0093 D5).\n *\n * When `OS_MULTI_ORG_ENABLED=true` but the enterprise `@objectstack/organizations`\n * package cannot provide tenant isolation, the platform refuses to boot — a\n * deployment that asked for tenant isolation must not serve traffic pretending\n * to have it (ADR-0049 at the deployment layer). Setting this to a truthy value\n * (`true`/`1`/`on`/`yes`, case-insensitive) boots anyway in an explicitly\n * *degraded* state that is branded everywhere an operator looks. Defaults OFF —\n * an unset flag means \"fail fast\".\n */\nexport function resolveAllowDegradedTenancy(): boolean {\n const raw = readEnvWithDeprecation('OS_ALLOW_DEGRADED_TENANCY', [], { silent: true });\n if (raw == null) return false;\n return ['1', 'true', 'on', 'yes'].includes(String(raw).trim().toLowerCase());\n}\n\n/**\n * SINGLE decision point for \"is the MCP HTTP surface (`/api/v1/mcp`) on?\".\n *\n * MCP is a core platform capability and defaults ON: an unset\n * `OS_MCP_SERVER_ENABLED` means the surface is served. Operators opt OUT with\n * an explicit falsy value (`false`/`0`/`off`/`no`, case-insensitive); any\n * other value — including the historical `true` — keeps it on.\n *\n * Every consumer of the flag — the runtime dispatcher's `/mcp` route gate,\n * the CLI's MCP plugin auto-load, the REST `/discovery` advertisement, and\n * the auth service's OAuth/DCR follow-defaults — MUST call this instead of\n * re-reading the env, so the served route, the advertised route, and the\n * authorization track can never disagree.\n *\n * Note the asymmetry with the MCP plugin's *stdio* auto-start, which stays\n * opt-in (explicit `true` / `autoStart`): attaching a long-lived stdio\n * transport to every process is a side effect no default should impose,\n * while the HTTP surface is served statelessly per-request.\n */\nexport function isMcpServerEnabled(): boolean {\n const raw = readEnvWithDeprecation('OS_MCP_SERVER_ENABLED', 'MCP_SERVER_ENABLED', {\n silent: true,\n });\n if (raw == null) return true;\n return !['0', 'false', 'off', 'no'].includes(raw.trim().toLowerCase());\n}\n\n/**\n * Maximum number of organizations a single user may CREATE, from `OS_ORG_LIMIT`.\n * The auth plugin forwards this as better-auth's `organizationLimit` in function\n * form, counting only the caller's `role=owner` memberships — so it caps\n * self-created orgs (each of which can auto-provision a free environment on the\n * cloud control plane) without penalising a user invited into many orgs.\n *\n * Only meaningful when multi-org is enabled ({@link resolveMultiOrgEnabled}).\n * Returns `undefined` when unset or non-positive → no limit (better-auth treats\n * an absent `organizationLimit` as unlimited), preserving self-host behaviour.\n * Deployments that let users self-create orgs SHOULD set a generous cap.\n */\nexport function resolveOrgLimit(): number | undefined {\n const raw = readEnvWithDeprecation('OS_ORG_LIMIT', [], { silent: true });\n if (raw == null || String(raw).trim() === '') return undefined;\n const n = Number.parseInt(String(raw), 10);\n return Number.isFinite(n) && n > 0 ? n : undefined;\n}\n\n/**\n * SINGLE decision point for \"is pinyin search recall on?\" (#2486).\n *\n * Pinyin search is a deployment/locale-level capability, not field metadata:\n * Chinese deployments want it, pure-Japanese/English deployments don't. The\n * flag gates the whole feature end-to-end — the SchemaRegistry's compile-time\n * `__search` companion-column seam AND the `plugin-pinyin-search` populate\n * hooks — so there is no half-state where a column exists but nobody fills it\n * (ADR-0049: no declared-but-unenforced capability).\n *\n * Resolution:\n * 1. An explicit `OS_SEARCH_PINYIN_ENABLED` always wins — truthy\n * (`1`/`true`/`on`/`yes`) enables, anything else disables.\n * 2. When unset, the default derives from the deployment's configured\n * locales (`opts.locales`, e.g. the stack's `i18n.defaultLocale` +\n * `supportedLocales`): any `zh-*` locale turns it on.\n * 3. No env var and no `zh-*` locale → off. OSS / non-Chinese deployments\n * never load `pinyin-pro` and pay zero compute cost.\n *\n * Hosts that know the stack's i18n config (the CLI `serve` boot path) resolve\n * once with locales and stamp the decision back into the env, so downstream\n * consumers constructed without config access (per-engine SchemaRegistry)\n * read the same answer via the no-arg form.\n */\nexport function resolveSearchPinyinEnabled(opts?: { locales?: readonly string[] }): boolean {\n const raw = readEnvWithDeprecation('OS_SEARCH_PINYIN_ENABLED', [], { silent: true });\n if (raw != null && String(raw).trim() !== '') {\n return ['1', 'true', 'on', 'yes'].includes(String(raw).trim().toLowerCase());\n }\n return (opts?.locales ?? []).some((l) => /^zh([-_]|$)/i.test(String(l ?? '').trim()));\n}\n\n/**\n * Internal: clear the dedupe set. Test-only; exposed so suite-wide\n * deprecation warnings don't bleed between tests.\n *\n * @internal\n */\nexport function _resetEnvDeprecationWarnings(): void {\n _warnedKeys.clear();\n}\n"],"mappings":";AAmBA,IAAM,cAAc,oBAAI,IAAY;AA0B7B,SAAS,uBACd,WACA,QACA,SACoB;AACpB,QAAM,MAAO,WACV,SAAS;AACZ,MAAI,CAAC,IAAK,QAAO;AAEjB,QAAM,iBAAiB,IAAI,SAAS;AACpC,MAAI,mBAAmB,OAAW,QAAO;AAEzC,QAAM,aAAa,OAAO,WAAW,WAAW,CAAC,MAAM,IAAI;AAC3D,aAAW,cAAc,YAAY;AACnC,UAAM,cAAc,IAAI,UAAU;AAClC,QAAI,gBAAgB,QAAW;AAC7B,YAAM,YAAY,GAAG,SAAS,IAAI,UAAU;AAC5C,UAAI,CAAC,SAAS,UAAU,CAAC,YAAY,IAAI,SAAS,GAAG;AACnD,oBAAY,IAAI,SAAS;AACzB,cAAM,aAAc,WAA8D;AAClF,YAAI;AACF,sBAAY;AAAA,YACV,2BAA2B,UAAU,oCAAoC,SAAS;AAAA,UAEpF;AAAA,QACF,QAAQ;AAAA,QAER;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;AAqBO,SAAS,yBAAkC;AAChD,QAAM,MAAM,uBAAuB,wBAAwB,CAAC,CAAC;AAC7D,SAAO,OAAO,OAAO,OAAO,EAAE,YAAY,MAAM;AAClD;AAaO,SAAS,8BAAuC;AACrD,QAAM,MAAM,uBAAuB,6BAA6B,CAAC,GAAG,EAAE,QAAQ,KAAK,CAAC;AACpF,MAAI,OAAO,KAAM,QAAO;AACxB,SAAO,CAAC,KAAK,QAAQ,MAAM,KAAK,EAAE,SAAS,OAAO,GAAG,EAAE,KAAK,EAAE,YAAY,CAAC;AAC7E;AAqBO,SAAS,qBAA8B;AAC5C,QAAM,MAAM,uBAAuB,yBAAyB,sBAAsB;AAAA,IAChF,QAAQ;AAAA,EACV,CAAC;AACD,MAAI,OAAO,KAAM,QAAO;AACxB,SAAO,CAAC,CAAC,KAAK,SAAS,OAAO,IAAI,EAAE,SAAS,IAAI,KAAK,EAAE,YAAY,CAAC;AACvE;AAcO,SAAS,kBAAsC;AACpD,QAAM,MAAM,uBAAuB,gBAAgB,CAAC,GAAG,EAAE,QAAQ,KAAK,CAAC;AACvE,MAAI,OAAO,QAAQ,OAAO,GAAG,EAAE,KAAK,MAAM,GAAI,QAAO;AACrD,QAAM,IAAI,OAAO,SAAS,OAAO,GAAG,GAAG,EAAE;AACzC,SAAO,OAAO,SAAS,CAAC,KAAK,IAAI,IAAI,IAAI;AAC3C;AA0BO,SAAS,2BAA2B,MAAiD;AAC1F,QAAM,MAAM,uBAAuB,4BAA4B,CAAC,GAAG,EAAE,QAAQ,KAAK,CAAC;AACnF,MAAI,OAAO,QAAQ,OAAO,GAAG,EAAE,KAAK,MAAM,IAAI;AAC5C,WAAO,CAAC,KAAK,QAAQ,MAAM,KAAK,EAAE,SAAS,OAAO,GAAG,EAAE,KAAK,EAAE,YAAY,CAAC;AAAA,EAC7E;AACA,UAAQ,MAAM,WAAW,CAAC,GAAG,KAAK,CAAC,MAAM,eAAe,KAAK,OAAO,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;AACtF;AAQO,SAAS,+BAAqC;AACnD,cAAY,MAAM;AACpB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/env.ts","../src/module-not-found.ts"],"sourcesContent":["// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\n/**\n * Environment-variable helpers shared across `@objectstack/*` packages.\n *\n * The framework standardises on `OS_*` prefixed env vars (see AGENTS.md\n * \"Environment Variables\" section). Some historical names predate this\n * convention — `AUTH_SECRET`, `ROOT_DOMAIN`, `OBJECTSTACK_*`, …\n *\n * To migrate without breaking user `.env` files mid-release, call\n * {@link readEnvWithDeprecation} at every legacy read site:\n *\n * const v = readEnvWithDeprecation('OS_AUTH_SECRET', 'AUTH_SECRET');\n *\n * If only the legacy name is set, the value is still returned but a\n * one-shot `console.warn` fires (per-process per-variable) telling\n * operators to rename it.\n */\n\nconst _warnedKeys = new Set<string>();\n\n/**\n * Read an env var, preferring the canonical `OS_*` name and falling\n * back to one or more legacy aliases.\n *\n * When only a legacy alias is set, emits a one-shot deprecation warning.\n * The warning is process-wide deduplicated: identical (preferred, legacy)\n * pairs will only warn once even if read from multiple call sites.\n *\n * Legacy aliases are checked in order; the first one with a defined\n * value wins (and triggers the warning for that specific alias).\n *\n * Safe to call from environments where `process` is unavailable (returns\n * `undefined`); the warning is suppressed when running outside Node-like\n * runtimes that lack `console.warn`.\n *\n * @param preferred Canonical OS_*-prefixed env var name.\n * @param legacy Older name (or array of older names) to fall back on.\n * @param options Optional behaviour flags. Set `silent: true` for aliases\n * that remain accepted conventions rather than true legacy\n * names — e.g. `PORT`, which PaaS platforms (Render, Railway,\n * Heroku, Fly, …) inject automatically. Warning on those\n * would nag operators about env they never set.\n * @returns The resolved value, or `undefined` if neither is set.\n */\nexport function readEnvWithDeprecation(\n preferred: string,\n legacy: string | readonly string[],\n options?: { silent?: boolean },\n): string | undefined {\n const env = (globalThis as { process?: { env?: Record<string, string | undefined> } })\n .process?.env;\n if (!env) return undefined;\n\n const preferredValue = env[preferred];\n if (preferredValue !== undefined) return preferredValue;\n\n const legacyList = typeof legacy === 'string' ? [legacy] : legacy;\n for (const legacyName of legacyList) {\n const legacyValue = env[legacyName];\n if (legacyValue !== undefined) {\n const dedupeKey = `${preferred}|${legacyName}`;\n if (!options?.silent && !_warnedKeys.has(dedupeKey)) {\n _warnedKeys.add(dedupeKey);\n const consoleRef = (globalThis as { console?: { warn?: (msg: string) => void } }).console;\n try {\n consoleRef?.warn?.(\n `[ObjectStack] Env var \\`${legacyName}\\` is deprecated; rename it to \\`${preferred}\\`. ` +\n `The legacy name still works for now but will be removed in a future major release.`,\n );\n } catch {\n /* `console.warn` unavailable (exotic runtime) — ignore */\n }\n }\n return legacyValue;\n }\n }\n\n return undefined;\n}\n\n/**\n * Resolve whether the deployment runs in multi-org (a.k.a. multi-tenant) mode.\n *\n * Single source of truth for the `OS_MULTI_ORG_ENABLED` flag. Resolution: the\n * canonical `OS_MULTI_ORG_ENABLED`; else `false`. Any value other than a\n * case-insensitive `'false'` enables it. (The legacy `OS_MULTI_TENANT` alias was\n * removed in 11.0.)\n *\n * Every site that needs to know \"is this multi-org?\" — the SQL driver's\n * tenant-audit gate, the auth manager's `/auth/config` feature flag and\n * org-create guard, the CLI / dev / runtime org-scoping plugin wiring — MUST\n * call this instead of re-reading the env, so the driver, the security layer,\n * and the UI can never disagree about the mode. Previously each site inlined\n * its own `String(... ?? 'false').toLowerCase() !== 'false'` (and the SQL\n * driver read `process.env` directly, skipping the deprecation warning).\n *\n * Reads `process.env` live on each call; memoise at the call site if the\n * result must be stable for the process lifetime.\n */\nexport function resolveMultiOrgEnabled(): boolean {\n const raw = readEnvWithDeprecation('OS_MULTI_ORG_ENABLED', []);\n return String(raw ?? 'false').toLowerCase() !== 'false';\n}\n\n/**\n * Escape hatch for the degraded-tenancy boot guard (ADR-0093 D5).\n *\n * When `OS_MULTI_ORG_ENABLED=true` but the enterprise `@objectstack/organizations`\n * package cannot provide tenant isolation, the platform refuses to boot — a\n * deployment that asked for tenant isolation must not serve traffic pretending\n * to have it (ADR-0049 at the deployment layer). Setting this to a truthy value\n * (`true`/`1`/`on`/`yes`, case-insensitive) boots anyway in an explicitly\n * *degraded* state that is branded everywhere an operator looks. Defaults OFF —\n * an unset flag means \"fail fast\".\n */\nexport function resolveAllowDegradedTenancy(): boolean {\n const raw = readEnvWithDeprecation('OS_ALLOW_DEGRADED_TENANCY', [], { silent: true });\n if (raw == null) return false;\n return ['1', 'true', 'on', 'yes'].includes(String(raw).trim().toLowerCase());\n}\n\n/**\n * SINGLE decision point for \"is the MCP HTTP surface (`/api/v1/mcp`) on?\".\n *\n * MCP is a core platform capability and defaults ON: an unset\n * `OS_MCP_SERVER_ENABLED` means the surface is served. Operators opt OUT with\n * an explicit falsy value (`false`/`0`/`off`/`no`, case-insensitive); any\n * other value — including the historical `true` — keeps it on.\n *\n * Every consumer of the flag — the runtime dispatcher's `/mcp` route gate,\n * the CLI's MCP plugin auto-load, the REST `/discovery` advertisement, and\n * the auth service's OAuth/DCR follow-defaults — MUST call this instead of\n * re-reading the env, so the served route, the advertised route, and the\n * authorization track can never disagree.\n *\n * Note the asymmetry with the MCP plugin's *stdio* auto-start\n * ({@link resolveMcpStdioAutoStart}), which stays opt-in and is gated by a\n * SEPARATE switch: attaching a long-lived stdio transport to every process is\n * a side effect no default should impose, while the HTTP surface is served\n * statelessly per-request.\n */\nexport function isMcpServerEnabled(): boolean {\n const raw = readEnvWithDeprecation('OS_MCP_SERVER_ENABLED', 'MCP_SERVER_ENABLED', {\n silent: true,\n });\n if (raw == null) return true;\n return !['0', 'false', 'off', 'no'].includes(raw.trim().toLowerCase());\n}\n\n/**\n * SINGLE decision point for \"should the MCP plugin auto-start a long-lived\n * (stdio) transport?\" — distinct from {@link isMcpServerEnabled}, which governs\n * the stateless HTTP surface.\n *\n * The stdio transport is a different, stricter posture: the plugin bridges the\n * RAW metadata service + data engine onto the long-lived server with NO\n * per-request principal (unscoped — see the `mcp-stdio-authority` conformance\n * row), so it is safe only as a single-operator LOCAL tool and MUST stay\n * opt-in. It defaults OFF.\n *\n * Canonical switch: `OS_MCP_STDIO_ENABLED` (truthy). The plugin also starts it\n * when constructed with `{ autoStart: true }` (that path is checked by the\n * caller, not here).\n *\n * DEPRECATED alias: `OS_MCP_SERVER_ENABLED=true` historically ALSO started\n * stdio — overloading the very var that gates the HTTP surface, so an operator\n * setting it to \"make sure MCP is on\" silently attached an unscoped transport.\n * That trigger still works (with a one-time warning from the caller) for one\n * release; prefer the dedicated var. Note `OS_MCP_SERVER_ENABLED=false` only\n * ever gated the HTTP surface and never started stdio, so it is unaffected.\n *\n * @returns `enabled` — whether stdio auto-start is requested by the env; and\n * `viaDeprecatedAlias` — whether it came through the legacy\n * `OS_MCP_SERVER_ENABLED=true` trigger (so the caller can warn once).\n */\nexport function resolveMcpStdioAutoStart(): { enabled: boolean; viaDeprecatedAlias: boolean } {\n const stdio = readEnvWithDeprecation('OS_MCP_STDIO_ENABLED', [], { silent: true });\n if (stdio != null && ['1', 'true', 'on', 'yes'].includes(stdio.trim().toLowerCase())) {\n return { enabled: true, viaDeprecatedAlias: false };\n }\n // Legacy trigger: only the literal `true` ever started stdio (preserved\n // exactly). `OS_MCP_SERVER_ENABLED=false`/other values never did.\n const legacy = readEnvWithDeprecation('OS_MCP_SERVER_ENABLED', 'MCP_SERVER_ENABLED', { silent: true });\n if (legacy != null && legacy.trim().toLowerCase() === 'true') {\n return { enabled: true, viaDeprecatedAlias: true };\n }\n return { enabled: false, viaDeprecatedAlias: false };\n}\n\n/**\n * Maximum number of organizations a single user may CREATE, from `OS_ORG_LIMIT`.\n * The auth plugin forwards this as better-auth's `organizationLimit` in function\n * form, counting only the caller's `role=owner` memberships — so it caps\n * self-created orgs (each of which can auto-provision a free environment on the\n * cloud control plane) without penalising a user invited into many orgs.\n *\n * Only meaningful when multi-org is enabled ({@link resolveMultiOrgEnabled}).\n * Returns `undefined` when unset or non-positive → no limit (better-auth treats\n * an absent `organizationLimit` as unlimited), preserving self-host behaviour.\n * Deployments that let users self-create orgs SHOULD set a generous cap.\n */\nexport function resolveOrgLimit(): number | undefined {\n const raw = readEnvWithDeprecation('OS_ORG_LIMIT', [], { silent: true });\n if (raw == null || String(raw).trim() === '') return undefined;\n const n = Number.parseInt(String(raw), 10);\n return Number.isFinite(n) && n > 0 ? n : undefined;\n}\n\n/**\n * SINGLE decision point for \"is pinyin search recall on?\" (#2486).\n *\n * Pinyin search is a deployment/locale-level capability, not field metadata:\n * Chinese deployments want it, pure-Japanese/English deployments don't. The\n * flag gates the whole feature end-to-end — the SchemaRegistry's compile-time\n * `__search` companion-column seam AND the `plugin-pinyin-search` populate\n * hooks — so there is no half-state where a column exists but nobody fills it\n * (ADR-0049: no declared-but-unenforced capability).\n *\n * Resolution:\n * 1. An explicit `OS_SEARCH_PINYIN_ENABLED` always wins — truthy\n * (`1`/`true`/`on`/`yes`) enables, anything else disables.\n * 2. When unset, the default derives from the deployment's configured\n * locales (`opts.locales`, e.g. the stack's `i18n.defaultLocale` +\n * `supportedLocales`): any `zh-*` locale turns it on.\n * 3. No env var and no `zh-*` locale → off. OSS / non-Chinese deployments\n * never load `pinyin-pro` and pay zero compute cost.\n *\n * Hosts that know the stack's i18n config (the CLI `serve` boot path) resolve\n * once with locales and stamp the decision back into the env, so downstream\n * consumers constructed without config access (per-engine SchemaRegistry)\n * read the same answer via the no-arg form.\n */\nexport function resolveSearchPinyinEnabled(opts?: { locales?: readonly string[] }): boolean {\n const raw = readEnvWithDeprecation('OS_SEARCH_PINYIN_ENABLED', [], { silent: true });\n if (raw != null && String(raw).trim() !== '') {\n return ['1', 'true', 'on', 'yes'].includes(String(raw).trim().toLowerCase());\n }\n return (opts?.locales ?? []).some((l) => /^zh([-_]|$)/i.test(String(l ?? '').trim()));\n}\n\n/**\n * SINGLE decision point for a sandbox script-runner DEFAULT (ms), resolved from\n * the environment (framework#3259 / ADR-0102).\n *\n * The QuickJS sandbox meters each hook/action invocation against a per-invocation\n * budget. Two dimensions are env-tunable:\n * - the **CPU-time budget** for hooks / actions — how much *VM-active* time a\n * body may burn (built-in 250ms hooks / 5000ms actions); and\n * - the **wall-clock ceiling** — the backstop bounding a body parked forever on\n * a host call that never settles (built-in 30_000ms).\n *\n * The built-in defaults suit a warm, idle host; a heavily loaded or slow host\n * (an oversubscribed CI runner, constrained production hardware) may need a\n * higher floor. This lets an operator raise it once, deployment-wide, instead of\n * re-tuning every call site.\n *\n * Canonical vars (OS_{DOMAIN}_{NAME}, DOMAIN=SANDBOX):\n * - hook → `OS_SANDBOX_HOOK_TIMEOUT_MS`\n * - action → `OS_SANDBOX_ACTION_TIMEOUT_MS`\n * - wallCeiling → `OS_SANDBOX_WALL_CEILING_MS`\n *\n * Only a positive integer is honored; unset / empty / non-numeric / non-positive\n * falls back to `fallback`, so behaviour is byte-for-byte unchanged when the var\n * is absent. This is a FALLBACK default ONLY: an explicit constructor option\n * still wins over it, and (for the CPU budget) a body's own declared `timeoutMs`\n * still wins over the resolved default per the runner's resolution rule.\n */\nexport function resolveSandboxTimeoutMs(\n kind: 'hook' | 'action' | 'wallCeiling',\n fallback: number,\n): number {\n const name =\n kind === 'hook'\n ? 'OS_SANDBOX_HOOK_TIMEOUT_MS'\n : kind === 'action'\n ? 'OS_SANDBOX_ACTION_TIMEOUT_MS'\n : 'OS_SANDBOX_WALL_CEILING_MS';\n const raw = readEnvWithDeprecation(name, [], { silent: true });\n if (raw == null || String(raw).trim() === '') return fallback;\n const n = Number.parseInt(String(raw).trim(), 10);\n return Number.isFinite(n) && n > 0 ? n : fallback;\n}\n\n/**\n * Internal: clear the dedupe set. Test-only; exposed so suite-wide\n * deprecation warnings don't bleed between tests.\n *\n * @internal\n */\nexport function _resetEnvDeprecationWarnings(): void {\n _warnedKeys.clear();\n}\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\n/**\n * True when a dynamic `import()` / `require.resolve()` failed because the\n * module is simply NOT INSTALLED — as opposed to the module being present but\n * throwing while it loads (a real crash). Checking `err.code` FIRST matters:\n * ESM reports a missing package as `err.code === 'ERR_MODULE_NOT_FOUND'` with\n * the human message `Cannot find package '...'`; matching only the older\n * `Cannot find module` string mis-classifies that as a crash (framework#1595).\n *\n * Single shared owner for this classification (framework#3265): the CLI's\n * optional-plugin guards and `requires` capability resolver delegate here, and\n * cloud's `objectos-runtime` capability loader is expected to adopt it at its\n * next framework pin bump — so the parallel loaders cannot drift apart and\n * re-introduce the #1595 false-alarm class.\n */\nexport function isModuleNotFoundError(err: unknown): boolean {\n const code = (err as { code?: string } | null | undefined)?.code;\n if (code === 'ERR_MODULE_NOT_FOUND' || code === 'MODULE_NOT_FOUND') return true;\n const msg = err instanceof Error ? err.message : String(err);\n return msg.includes('Cannot find module') || msg.includes('Cannot find package');\n}\n"],"mappings":"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","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/types",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.0-rc.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Shared interfaces describing the ObjectStack Runtime environment",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@objectstack/spec": "
|
|
16
|
+
"@objectstack/spec": "16.0.0-rc.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"typescript": "^6.0.3",
|