@run402/runtime-kernel 0.1.3 → 0.1.5

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/errors.js CHANGED
@@ -1,3 +1,15 @@
1
+ export class RuntimeKernelTypedError extends Error {
2
+ code;
3
+ status;
4
+ details;
5
+ constructor(code, status, message, details = {}) {
6
+ super(message);
7
+ this.code = code;
8
+ this.status = status;
9
+ this.name = "RuntimeKernelTypedError";
10
+ this.details = details;
11
+ }
12
+ }
1
13
  export class UnsupportedCapabilityError extends Error {
2
14
  code = "unsupported_capability";
3
15
  status = 422;
@@ -15,4 +27,87 @@ export function unsupportedCapabilityEnvelope(error) {
15
27
  capability: error.details.capability,
16
28
  };
17
29
  }
30
+ export class MissingRequiredSecretError extends RuntimeKernelTypedError {
31
+ constructor(secretName, functionName) {
32
+ super("missing_required_secret", 422, `Missing required secret: ${secretName}`, {
33
+ secret_name: secretName,
34
+ ...(functionName ? { function_name: functionName } : {}),
35
+ });
36
+ this.name = "MissingRequiredSecretError";
37
+ }
38
+ }
39
+ export class FunctionBundleValidationError extends RuntimeKernelTypedError {
40
+ constructor(code, message, details = {}) {
41
+ super(code, 422, message, details);
42
+ this.name = "FunctionBundleValidationError";
43
+ }
44
+ }
45
+ export class AstroSsrUnsupportedFeatureError extends RuntimeKernelTypedError {
46
+ constructor(feature, message = `Unsupported Astro SSR feature: ${feature}`, details = {}) {
47
+ super("astro_ssr_unsupported_feature", 422, message, {
48
+ feature,
49
+ ...details,
50
+ });
51
+ this.name = "AstroSsrUnsupportedFeatureError";
52
+ }
53
+ }
54
+ export class DependencyInstallRejectedError extends RuntimeKernelTypedError {
55
+ constructor(message, details = {}) {
56
+ super("dependency_install_rejected", 422, message, details);
57
+ this.name = "DependencyInstallRejectedError";
58
+ }
59
+ }
60
+ export class DependencyInstallFailedError extends RuntimeKernelTypedError {
61
+ constructor(message, details = {}) {
62
+ super("dependency_install_failed", 422, message, details);
63
+ this.name = "DependencyInstallFailedError";
64
+ }
65
+ }
66
+ export class DynamicRuntimeUnavailableError extends RuntimeKernelTypedError {
67
+ constructor(message = "Run402 Core dynamic functions runtime is not configured.", details = {}) {
68
+ super("dynamic_runtime_unavailable", 503, message, details);
69
+ this.name = "DynamicRuntimeUnavailableError";
70
+ }
71
+ }
72
+ export class DynamicRuntimeTimeoutError extends RuntimeKernelTypedError {
73
+ constructor(message = "Run402 Core dynamic runtime invocation timed out.", details = {}) {
74
+ super("dynamic_runtime_timeout", 504, message, details);
75
+ this.name = "DynamicRuntimeTimeoutError";
76
+ }
77
+ }
78
+ export class DynamicRuntimeBusyError extends RuntimeKernelTypedError {
79
+ constructor(message = "Run402 Core dynamic runtime is busy.", details = {}) {
80
+ super("dynamic_runtime_busy", 503, message, details);
81
+ this.name = "DynamicRuntimeBusyError";
82
+ }
83
+ }
84
+ export class RequestBodyTooLargeError extends RuntimeKernelTypedError {
85
+ constructor(limitBytes) {
86
+ super("request_body_too_large", 413, `Request body exceeds ${limitBytes} bytes.`, {
87
+ limit_bytes: limitBytes,
88
+ });
89
+ this.name = "RequestBodyTooLargeError";
90
+ }
91
+ }
92
+ export class ResponseBodyTooLargeError extends RuntimeKernelTypedError {
93
+ constructor(limitBytes) {
94
+ super("response_body_too_large", 502, `Function response body exceeds ${limitBytes} bytes.`, {
95
+ limit_bytes: limitBytes,
96
+ });
97
+ this.name = "ResponseBodyTooLargeError";
98
+ }
99
+ }
100
+ export class LocalExecutorError extends RuntimeKernelTypedError {
101
+ constructor(message, details = {}) {
102
+ super("local_executor_failed", 500, message, details);
103
+ this.name = "LocalExecutorError";
104
+ }
105
+ }
106
+ export function runtimeKernelErrorEnvelope(error) {
107
+ return {
108
+ error: error.code,
109
+ message: error.message,
110
+ ...(Object.keys(error.details).length > 0 ? { details: error.details } : {}),
111
+ };
112
+ }
18
113
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":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,uBAAuB;IACpE,YAAY,UAAkB;QAC5B,KAAK,CAAC,yBAAyB,EAAE,GAAG,EAAE,kCAAkC,UAAU,SAAS,EAAE;YAC3F,WAAW,EAAE,UAAU;SACxB,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,uBAAuB;IAC7D,YAAY,OAAe,EAAE,UAA0C,EAAE;QACvE,KAAK,CAAC,uBAAuB,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED,MAAM,UAAU,0BAA0B,CAAC,KAA8B;IAKvE,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,IAAI;QACjB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,192 @@
1
+ import type { RoutedHttpRequestV1, RoutedHttpResponseV1 } from "@run402/functions";
2
+ import type { ContentRefHex, FunctionSpec, HttpMethod, PortableFunctionEntry, RoleGateSpec, RouteEntry } from "@run402/release";
3
+ export declare const CORE_FUNCTION_RUNTIME_MATURITY: "developer_preview";
4
+ export declare const CORE_FUNCTION_SECURITY_PROFILE: "trusted_local_code";
5
+ export declare const CORE_FUNCTION_DEFAULT_EXECUTOR: "docker_compose_worker";
6
+ export declare const CORE_FUNCTION_DEPENDENCY_MODE: "prebundled_no_external_deps";
7
+ export declare const CORE_ASTRO_SSR_OUTPUT_CONTRACT_VERSION: "astro.ssr.v1";
8
+ export declare const CORE_ASTRO_SSR_FALLBACK_PATTERN: "/*";
9
+ export declare const CORE_FUNCTION_RESOURCE_DEFAULTS: {
10
+ readonly requestBodyLimitBytes: number;
11
+ readonly responseBodyLimitBytes: number;
12
+ readonly invocationTimeoutMs: 10000;
13
+ readonly startupTimeoutMs: 5000;
14
+ readonly dependencyInstallTimeoutMs: 120000;
15
+ readonly maxConcurrentInvocationsPerProject: 4;
16
+ readonly maxPendingInvocationQueue: 16;
17
+ readonly stdoutStderrLimitBytes: number;
18
+ readonly maxLogLineBytes: number;
19
+ readonly localLogRetentionBytes: number;
20
+ readonly localLogRetentionMs: number;
21
+ readonly workerMemoryLimitBytes: number;
22
+ readonly tempDirLimitBytes: number;
23
+ readonly nodeModulesLimitBytes: number;
24
+ };
25
+ export declare const CORE_FUNCTION_FILESYSTEM_LAYOUT: {
26
+ readonly bundleStagingDir: "functions/staging";
27
+ readonly activeBundleDir: "functions/active";
28
+ readonly dependencyCacheDir: "functions/deps";
29
+ readonly tempDir: "functions/tmp";
30
+ readonly logDir: "functions/logs";
31
+ };
32
+ export declare const CORE_FUNCTION_KNOWN_EXCLUSIONS: readonly ["hostile_code_isolation", "public_multi_tenant_hosting", "cloud_grade_sandbox", "external_npm_dependencies", "lockfile_npm_install", "lifecycle_scripts", "native_postinstall_builds", "file_link_workspace_dependencies", "git_or_tarball_dependencies", "private_registries", "websockets", "streaming_to_client", "scheduled_functions", "background_jobs", "managed_jobs", "managed_kms", "cloudwatch_logs", "cloud_quota_enforcement", "cloud_billing", "cloud_abuse_controls"];
33
+ export declare const CORE_ASTRO_SSR_KNOWN_EXCLUSIONS: readonly ["full_astro_support", "arbitrary_astro_adapters", "streaming_to_client", "websockets", "http_upgrade", "isr_cache", "edge_runtime", "cloud_globals", "cloud_routing_hooks", "cloudwatch_logs", "cloud_quota_enforcement", "cloud_billing", "cloud_abuse_controls"];
34
+ export interface CoreFunctionIsolationProfile {
35
+ maturity: typeof CORE_FUNCTION_RUNTIME_MATURITY;
36
+ security_profile: typeof CORE_FUNCTION_SECURITY_PROFILE;
37
+ hostile_code_isolation: false;
38
+ default_executor: typeof CORE_FUNCTION_DEFAULT_EXECUTOR;
39
+ app_code_runs_in_gateway_process: false;
40
+ environment_policy: "explicit_allowlist";
41
+ host_environment_inherited: false;
42
+ gateway_secrets_visible_by_default: false;
43
+ filesystem_policy: "project_worker_scoped";
44
+ network_policy: "developer_preview_not_hardened";
45
+ }
46
+ export declare const CORE_FUNCTION_ISOLATION_PROFILE: CoreFunctionIsolationProfile;
47
+ export interface CoreFunctionDependencyPolicy {
48
+ mode: typeof CORE_FUNCTION_DEPENDENCY_MODE;
49
+ npm_install_supported: false;
50
+ platform_packages: ["@run402/functions"];
51
+ rejected_dependency_spec_kinds: readonly string[];
52
+ future_lockfile_install_command: readonly string[];
53
+ }
54
+ export declare const CORE_FUNCTION_DEPENDENCY_POLICY: CoreFunctionDependencyPolicy;
55
+ export interface CoreFunctionRuntimeCapability {
56
+ capability: "core-functions";
57
+ status: "supported";
58
+ maturity: typeof CORE_FUNCTION_RUNTIME_MATURITY;
59
+ security_profile: typeof CORE_FUNCTION_SECURITY_PROFILE;
60
+ hostile_code_isolation: false;
61
+ default_executor: typeof CORE_FUNCTION_DEFAULT_EXECUTOR;
62
+ dependency_policy: CoreFunctionDependencyPolicy;
63
+ resource_defaults: typeof CORE_FUNCTION_RESOURCE_DEFAULTS;
64
+ filesystem_layout: typeof CORE_FUNCTION_FILESYSTEM_LAYOUT;
65
+ supported_output: {
66
+ runtime: "node22";
67
+ artifact: "prebundled_source_ref";
68
+ envelope: "run402.routed_http.v1";
69
+ };
70
+ known_exclusions: Array<(typeof CORE_FUNCTION_KNOWN_EXCLUSIONS)[number]>;
71
+ }
72
+ export interface CoreAstroSsrRuntimeCapability {
73
+ capability: "core-astro-ssr";
74
+ status: "supported";
75
+ maturity: typeof CORE_FUNCTION_RUNTIME_MATURITY;
76
+ output_contract_version: typeof CORE_ASTRO_SSR_OUTPUT_CONTRACT_VERSION;
77
+ supported_output: {
78
+ runtime: "node22";
79
+ module_format: "esm";
80
+ request: "web_request";
81
+ response: "web_response_buffered";
82
+ route: "fallback";
83
+ };
84
+ fallback: {
85
+ pattern: typeof CORE_ASTRO_SSR_FALLBACK_PATTERN;
86
+ precedence: readonly [
87
+ "explicit_static_alias",
88
+ "public_static_asset_path",
89
+ "prerendered_static_html",
90
+ "dynamic_function_route",
91
+ "astro_ssr_fallback",
92
+ "not_found"
93
+ ];
94
+ };
95
+ inherits_from_functions_runtime: true;
96
+ resource_defaults: typeof CORE_FUNCTION_RESOURCE_DEFAULTS;
97
+ isolation_profile: CoreFunctionIsolationProfile;
98
+ known_exclusions: Array<(typeof CORE_ASTRO_SSR_KNOWN_EXCLUSIONS)[number]>;
99
+ }
100
+ export interface CoreFunctionBundleMetadata {
101
+ name: string;
102
+ runtime: "node22";
103
+ entrypoint: string;
104
+ source: ContentRefHex;
105
+ bundle_sha256: string;
106
+ bundle_size_bytes: number;
107
+ dependency_mode: typeof CORE_FUNCTION_DEPENDENCY_MODE;
108
+ dependency_lock_digest: null;
109
+ deps: [];
110
+ required_secrets: string[];
111
+ timeout_ms: number;
112
+ memory_bytes: number;
113
+ require_auth: boolean;
114
+ require_role: RoleGateSpec | null;
115
+ class: "standard" | "ssr";
116
+ capabilities: string[];
117
+ }
118
+ export interface CoreDynamicFunctionRoute {
119
+ pattern: string;
120
+ kind: RouteEntry["kind"];
121
+ prefix: string | null;
122
+ methods: HttpMethod[] | null;
123
+ function_name: string;
124
+ }
125
+ export interface CoreFunctionApplyEffects {
126
+ bundles: CoreFunctionBundleMetadata[];
127
+ dynamic_routes: CoreDynamicFunctionRoute[];
128
+ astro_ssr_fallback: {
129
+ function_name: string;
130
+ output_contract_version: typeof CORE_ASTRO_SSR_OUTPUT_CONTRACT_VERSION;
131
+ pattern: typeof CORE_ASTRO_SSR_FALLBACK_PATTERN;
132
+ } | null;
133
+ required_secrets: string[];
134
+ dependency_mode: typeof CORE_FUNCTION_DEPENDENCY_MODE;
135
+ noop: boolean;
136
+ }
137
+ export interface CoreFunctionInvocationInput {
138
+ projectId: string;
139
+ releaseId: string | null;
140
+ functionName: string;
141
+ invocationKind: "routed_http" | "direct";
142
+ requestId: string;
143
+ actor?: CoreFunctionActorContext | null;
144
+ request?: RoutedHttpRequestV1;
145
+ }
146
+ export interface CoreFunctionActorContext {
147
+ id: string;
148
+ role: string | null;
149
+ }
150
+ export interface CoreFunctionInvocationResult {
151
+ requestId: string;
152
+ response: RoutedHttpResponseV1;
153
+ }
154
+ export type CoreFunctionInvocationStatus = "succeeded" | "failed";
155
+ export interface CoreFunctionInvocationRecord {
156
+ request_id: string;
157
+ project_id: string;
158
+ release_id: string | null;
159
+ function_name: string;
160
+ invocation_kind: CoreFunctionInvocationInput["invocationKind"];
161
+ status: CoreFunctionInvocationStatus;
162
+ started_at: string;
163
+ finished_at: string;
164
+ duration_ms: number;
165
+ error_code: string | null;
166
+ }
167
+ export interface CoreFunctionLogEntry {
168
+ timestamp: string;
169
+ request_id: string;
170
+ project_id: string;
171
+ release_id: string | null;
172
+ function_name: string;
173
+ stream: "platform" | "stdout" | "stderr";
174
+ level: "debug" | "info" | "warn" | "error";
175
+ message: string;
176
+ redacted: boolean;
177
+ }
178
+ export interface CoreFunctionSecretMetadata {
179
+ project_id: string;
180
+ name: string;
181
+ scope: "project" | "release" | "function";
182
+ function_name: string | null;
183
+ created_at: string;
184
+ updated_at: string;
185
+ }
186
+ export declare function coreFunctionRuntimeCapability(): CoreFunctionRuntimeCapability;
187
+ export declare function coreAstroSsrRuntimeCapability(): CoreAstroSsrRuntimeCapability;
188
+ export declare function emptyFunctionApplyEffects(): CoreFunctionApplyEffects;
189
+ export declare function isAstroSsrFunction(entry: Pick<PortableFunctionEntry, "class" | "capabilities">): boolean;
190
+ export declare function normalizeFunctionEntrypoint(spec: FunctionSpec): string;
191
+ export declare function functionMemoryBytes(entry: Pick<PortableFunctionEntry, "memory_mb">): number;
192
+ //# sourceMappingURL=functions-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions-run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AE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACzC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IAC1C,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,6BAA6B,IAAI,6BAA6B,CAkB7E;AAED,wBAAgB,6BAA6B,IAAI,6BAA6B,CA6B7E;AAED,wBAAgB,yBAAyB,IAAI,wBAAwB,CASpE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE,OAAO,GAAG,cAAc,CAAC,GAAG,OAAO,CAIxG;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAEtE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE,WAAW,CAAC,GAAG,MAAM,CAE3F"}
@@ -0,0 +1,176 @@
1
+ export const CORE_FUNCTION_RUNTIME_MATURITY = "developer_preview";
2
+ export const CORE_FUNCTION_SECURITY_PROFILE = "trusted_local_code";
3
+ export const CORE_FUNCTION_DEFAULT_EXECUTOR = "docker_compose_worker";
4
+ export const CORE_FUNCTION_DEPENDENCY_MODE = "prebundled_no_external_deps";
5
+ export const CORE_ASTRO_SSR_OUTPUT_CONTRACT_VERSION = "astro.ssr.v1";
6
+ export const CORE_ASTRO_SSR_FALLBACK_PATTERN = "/*";
7
+ export const CORE_FUNCTION_RESOURCE_DEFAULTS = {
8
+ requestBodyLimitBytes: 6 * 1024 * 1024,
9
+ responseBodyLimitBytes: 6 * 1024 * 1024,
10
+ invocationTimeoutMs: 10_000,
11
+ startupTimeoutMs: 5_000,
12
+ dependencyInstallTimeoutMs: 120_000,
13
+ maxConcurrentInvocationsPerProject: 4,
14
+ maxPendingInvocationQueue: 16,
15
+ stdoutStderrLimitBytes: 64 * 1024,
16
+ maxLogLineBytes: 16 * 1024,
17
+ localLogRetentionBytes: 10 * 1024 * 1024,
18
+ localLogRetentionMs: 24 * 60 * 60 * 1000,
19
+ workerMemoryLimitBytes: 512 * 1024 * 1024,
20
+ tempDirLimitBytes: 512 * 1024 * 1024,
21
+ nodeModulesLimitBytes: 256 * 1024 * 1024,
22
+ };
23
+ export const CORE_FUNCTION_FILESYSTEM_LAYOUT = {
24
+ bundleStagingDir: "functions/staging",
25
+ activeBundleDir: "functions/active",
26
+ dependencyCacheDir: "functions/deps",
27
+ tempDir: "functions/tmp",
28
+ logDir: "functions/logs",
29
+ };
30
+ export const CORE_FUNCTION_KNOWN_EXCLUSIONS = [
31
+ "hostile_code_isolation",
32
+ "public_multi_tenant_hosting",
33
+ "cloud_grade_sandbox",
34
+ "external_npm_dependencies",
35
+ "lockfile_npm_install",
36
+ "lifecycle_scripts",
37
+ "native_postinstall_builds",
38
+ "file_link_workspace_dependencies",
39
+ "git_or_tarball_dependencies",
40
+ "private_registries",
41
+ "websockets",
42
+ "streaming_to_client",
43
+ "scheduled_functions",
44
+ "background_jobs",
45
+ "managed_jobs",
46
+ "managed_kms",
47
+ "cloudwatch_logs",
48
+ "cloud_quota_enforcement",
49
+ "cloud_billing",
50
+ "cloud_abuse_controls",
51
+ ];
52
+ export const CORE_ASTRO_SSR_KNOWN_EXCLUSIONS = [
53
+ "full_astro_support",
54
+ "arbitrary_astro_adapters",
55
+ "streaming_to_client",
56
+ "websockets",
57
+ "http_upgrade",
58
+ "isr_cache",
59
+ "edge_runtime",
60
+ "cloud_globals",
61
+ "cloud_routing_hooks",
62
+ "cloudwatch_logs",
63
+ "cloud_quota_enforcement",
64
+ "cloud_billing",
65
+ "cloud_abuse_controls",
66
+ ];
67
+ export const CORE_FUNCTION_ISOLATION_PROFILE = {
68
+ maturity: CORE_FUNCTION_RUNTIME_MATURITY,
69
+ security_profile: CORE_FUNCTION_SECURITY_PROFILE,
70
+ hostile_code_isolation: false,
71
+ default_executor: CORE_FUNCTION_DEFAULT_EXECUTOR,
72
+ app_code_runs_in_gateway_process: false,
73
+ environment_policy: "explicit_allowlist",
74
+ host_environment_inherited: false,
75
+ gateway_secrets_visible_by_default: false,
76
+ filesystem_policy: "project_worker_scoped",
77
+ network_policy: "developer_preview_not_hardened",
78
+ };
79
+ export const CORE_FUNCTION_DEPENDENCY_POLICY = {
80
+ mode: CORE_FUNCTION_DEPENDENCY_MODE,
81
+ npm_install_supported: false,
82
+ platform_packages: ["@run402/functions"],
83
+ rejected_dependency_spec_kinds: [
84
+ "semver_without_lockfile",
85
+ "file",
86
+ "link",
87
+ "workspace",
88
+ "git",
89
+ "http_tarball",
90
+ "https_tarball",
91
+ "local_path",
92
+ "private_registry",
93
+ "npm_alias",
94
+ "lifecycle_script_required",
95
+ "native_postinstall_required",
96
+ ],
97
+ future_lockfile_install_command: [
98
+ "npm",
99
+ "ci",
100
+ "--ignore-scripts",
101
+ "--omit=dev",
102
+ "--no-audit",
103
+ "--no-fund",
104
+ ],
105
+ };
106
+ export function coreFunctionRuntimeCapability() {
107
+ return {
108
+ capability: "core-functions",
109
+ status: "supported",
110
+ maturity: CORE_FUNCTION_RUNTIME_MATURITY,
111
+ security_profile: CORE_FUNCTION_SECURITY_PROFILE,
112
+ hostile_code_isolation: false,
113
+ default_executor: CORE_FUNCTION_DEFAULT_EXECUTOR,
114
+ dependency_policy: CORE_FUNCTION_DEPENDENCY_POLICY,
115
+ resource_defaults: CORE_FUNCTION_RESOURCE_DEFAULTS,
116
+ filesystem_layout: CORE_FUNCTION_FILESYSTEM_LAYOUT,
117
+ supported_output: {
118
+ runtime: "node22",
119
+ artifact: "prebundled_source_ref",
120
+ envelope: "run402.routed_http.v1",
121
+ },
122
+ known_exclusions: [...CORE_FUNCTION_KNOWN_EXCLUSIONS],
123
+ };
124
+ }
125
+ export function coreAstroSsrRuntimeCapability() {
126
+ return {
127
+ capability: "core-astro-ssr",
128
+ status: "supported",
129
+ maturity: CORE_FUNCTION_RUNTIME_MATURITY,
130
+ output_contract_version: CORE_ASTRO_SSR_OUTPUT_CONTRACT_VERSION,
131
+ supported_output: {
132
+ runtime: "node22",
133
+ module_format: "esm",
134
+ request: "web_request",
135
+ response: "web_response_buffered",
136
+ route: "fallback",
137
+ },
138
+ fallback: {
139
+ pattern: CORE_ASTRO_SSR_FALLBACK_PATTERN,
140
+ precedence: [
141
+ "explicit_static_alias",
142
+ "public_static_asset_path",
143
+ "prerendered_static_html",
144
+ "dynamic_function_route",
145
+ "astro_ssr_fallback",
146
+ "not_found",
147
+ ],
148
+ },
149
+ inherits_from_functions_runtime: true,
150
+ resource_defaults: CORE_FUNCTION_RESOURCE_DEFAULTS,
151
+ isolation_profile: CORE_FUNCTION_ISOLATION_PROFILE,
152
+ known_exclusions: [...CORE_ASTRO_SSR_KNOWN_EXCLUSIONS],
153
+ };
154
+ }
155
+ export function emptyFunctionApplyEffects() {
156
+ return {
157
+ bundles: [],
158
+ dynamic_routes: [],
159
+ astro_ssr_fallback: null,
160
+ required_secrets: [],
161
+ dependency_mode: CORE_FUNCTION_DEPENDENCY_MODE,
162
+ noop: true,
163
+ };
164
+ }
165
+ export function isAstroSsrFunction(entry) {
166
+ return entry.class === "ssr" &&
167
+ Array.isArray(entry.capabilities) &&
168
+ entry.capabilities.includes(CORE_ASTRO_SSR_OUTPUT_CONTRACT_VERSION);
169
+ }
170
+ export function normalizeFunctionEntrypoint(spec) {
171
+ return spec.entrypoint ?? "default";
172
+ }
173
+ export function functionMemoryBytes(entry) {
174
+ return entry.memory_mb * 1024 * 1024;
175
+ }
176
+ //# sourceMappingURL=functions-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions-runtime.js","sourceRoot":"","sources":["../src/functions-runtime.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,8BAA8B,GAAG,mBAA4B,CAAC;AAC3E,MAAM,CAAC,MAAM,8BAA8B,GAAG,oBAA6B,CAAC;AAC5E,MAAM,CAAC,MAAM,8BAA8B,GAAG,uBAAgC,CAAC;AAC/E,MAAM,CAAC,MAAM,6BAA6B,GAAG,6BAAsC,CAAC;AACpF,MAAM,CAAC,MAAM,sCAAsC,GAAG,cAAuB,CAAC;AAC9E,MAAM,CAAC,MAAM,+BAA+B,GAAG,IAAa,CAAC;AAE7D,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,qBAAqB,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI;IACtC,sBAAsB,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI;IACvC,mBAAmB,EAAE,MAAM;IAC3B,gBAAgB,EAAE,KAAK;IACvB,0BAA0B,EAAE,OAAO;IACnC,kCAAkC,EAAE,CAAC;IACrC,yBAAyB,EAAE,EAAE;IAC7B,sBAAsB,EAAE,EAAE,GAAG,IAAI;IACjC,eAAe,EAAE,EAAE,GAAG,IAAI;IAC1B,sBAAsB,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;IACxC,mBAAmB,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IACxC,sBAAsB,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;IACzC,iBAAiB,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;IACpC,qBAAqB,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;CAChC,CAAC;AAEX,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,gBAAgB,EAAE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CAAC,GAAG,+BAA+B,CAAC;KACvD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,OAAO;QACL,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,EAAE;QAClB,kBAAkB,EAAE,IAAI;QACxB,gBAAgB,EAAE,EAAE;QACpB,eAAe,EAAE,6BAA6B;QAC9C,IAAI,EAAE,IAAI;KACX,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAA4D;IAC7F,OAAO,KAAK,CAAC,KAAK,KAAK,KAAK;QAC1B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC;QACjC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,sCAAsC,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,IAAkB;IAC5D,OAAO,IAAI,CAAC,UAAU,IAAI,SAAS,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAA+C;IACjF,OAAO,KAAK,CAAC,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;AACvC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./apply.js";
2
2
  export * from "./capabilities.js";
3
3
  export * from "./errors.js";
4
+ export * from "./functions-runtime.js";
4
5
  export * from "./health.js";
5
6
  export * from "./ports.js";
6
7
  export * from "./projects.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./apply.js";
2
2
  export * from "./capabilities.js";
3
3
  export * from "./errors.js";
4
+ export * from "./functions-runtime.js";
4
5
  export * from "./health.js";
5
6
  export * from "./ports.js";
6
7
  export * from "./projects.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
package/dist/ports.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { ContentRefHex, MaterializedRoutes, PortableReleaseState, StaticManifest } from "@run402/release";
2
2
  import type { RuntimeCapabilityDocument } from "./capabilities.js";
3
+ import type { CoreFunctionApplyEffects, CoreFunctionBundleMetadata, CoreFunctionInvocationInput, CoreFunctionInvocationResult, CoreFunctionInvocationRecord, CoreFunctionLogEntry, CoreFunctionSecretMetadata } from "./functions-runtime.js";
3
4
  export interface CoreProject {
4
5
  project_id: string;
5
6
  schema_slot: string;
@@ -43,6 +44,7 @@ export interface CoreApplyPlan {
43
44
  target_release_id: string;
44
45
  target_release_digest: string;
45
46
  storage_effects?: CoreStorageApplyEffects;
47
+ function_effects?: CoreFunctionApplyEffects;
46
48
  noop: boolean;
47
49
  status: "planned" | "committed";
48
50
  created_at: string;
@@ -58,6 +60,7 @@ export interface CoreApplyCommitContext {
58
60
  release_digest: string;
59
61
  target_release: PortableReleaseState;
60
62
  storage_effects?: CoreStorageApplyEffects;
63
+ function_effects?: CoreFunctionApplyEffects;
61
64
  }
62
65
  export interface CoreApplyDeferredResult {
63
66
  status: "deferred";
@@ -216,8 +219,75 @@ export interface CleanupResult {
216
219
  removed_objects: number;
217
220
  removed_versions: number;
218
221
  removed_cas_objects: number;
222
+ removed_function_bundles?: number;
223
+ removed_function_logs?: number;
219
224
  retained_live_sha256: string[];
220
225
  }
226
+ export interface FunctionRuntimePort {
227
+ stageBundles(input: {
228
+ projectId: string;
229
+ releaseId: string;
230
+ bundles: CoreFunctionBundleMetadata[];
231
+ }): Promise<void>;
232
+ activateRelease(input: {
233
+ projectId: string;
234
+ releaseId: string;
235
+ expectedBaseReleaseId: string | null;
236
+ effects: CoreFunctionApplyEffects;
237
+ }): Promise<void>;
238
+ invoke(input: CoreFunctionInvocationInput): Promise<CoreFunctionInvocationResult>;
239
+ listLogs(input: {
240
+ projectId: string;
241
+ functionName?: string;
242
+ requestId?: string;
243
+ since?: string;
244
+ tail?: number;
245
+ }): Promise<CoreFunctionLogEntry[]>;
246
+ listSecrets(input: {
247
+ projectId: string;
248
+ functionName?: string;
249
+ }): Promise<CoreFunctionSecretMetadata[]>;
250
+ cleanup(projectId?: string): Promise<{
251
+ removed_function_bundles: number;
252
+ removed_function_logs: number;
253
+ retained_live_sha256: string[];
254
+ }>;
255
+ }
256
+ export interface FunctionSecretPort {
257
+ setSecret(input: {
258
+ projectId: string;
259
+ name: string;
260
+ value: string;
261
+ scope?: "project" | "release" | "function";
262
+ functionName?: string | null;
263
+ }): Promise<CoreFunctionSecretMetadata>;
264
+ listSecrets(input: {
265
+ projectId: string;
266
+ functionName?: string;
267
+ }): Promise<CoreFunctionSecretMetadata[]>;
268
+ getSecretValues(input: {
269
+ projectId: string;
270
+ functionName: string;
271
+ names: string[];
272
+ }): Promise<Record<string, string>>;
273
+ }
274
+ export interface FunctionLogPort {
275
+ recordInvocation(input: {
276
+ invocation: CoreFunctionInvocationRecord;
277
+ logs: CoreFunctionLogEntry[];
278
+ retention?: {
279
+ maxAgeMs?: number;
280
+ maxBytes?: number;
281
+ };
282
+ }): Promise<void>;
283
+ listLogs(input: {
284
+ projectId: string;
285
+ functionName?: string;
286
+ requestId?: string;
287
+ since?: string;
288
+ tail?: number;
289
+ }): Promise<CoreFunctionLogEntry[]>;
290
+ }
221
291
  export interface StoragePort {
222
292
  createUploadSession(input: {
223
293
  projectId: string;
@@ -336,6 +406,8 @@ export interface RuntimeKernelPorts {
336
406
  signedReads?: SignedReadPort;
337
407
  routes?: RouteManifestPort;
338
408
  cleanup?: CleanupPort;
409
+ functions?: FunctionRuntimePort;
410
+ secrets?: FunctionSecretPort;
339
411
  migrations: MigrationPort;
340
412
  lifecycle?: ApplyLifecyclePort;
341
413
  }