@objectstack/runtime 10.3.0 → 11.1.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/LICENSE +202 -93
- package/README.md +3 -3
- package/dist/index.cjs +483 -232
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -6
- package/dist/index.d.ts +60 -6
- package/dist/index.js +491 -237
- package/dist/index.js.map +1 -1
- package/package.json +21 -21
package/dist/index.d.cts
CHANGED
|
@@ -918,12 +918,16 @@ interface HttpDispatcherOptions {
|
|
|
918
918
|
scopeManager?: EnvironmentScopeManager;
|
|
919
919
|
}
|
|
920
920
|
/**
|
|
921
|
-
*
|
|
922
|
-
*
|
|
923
|
-
*
|
|
924
|
-
*
|
|
925
|
-
*
|
|
926
|
-
*
|
|
921
|
+
* The HTTP dispatch engine — translates an inbound (method, path, body, ctx)
|
|
922
|
+
* request into a kernel response. Used directly by the framework's HTTP adapters
|
|
923
|
+
* (express / fastify / nextjs / nestjs / nuxt / sveltekit / hono) and plugin-msw,
|
|
924
|
+
* which need a *callable* dispatcher.
|
|
925
|
+
*
|
|
926
|
+
* NOTE: `createDispatcherPlugin()` is a different thing — a kernel plugin that
|
|
927
|
+
* registers routes on a kernel-hosted HTTP server. It is NOT a drop-in for
|
|
928
|
+
* adapters. Retiring this public class behind a `createHttpDispatcher()` factory
|
|
929
|
+
* is tracked in #2380 (a deliberate adapter-API change, not yet done) — so this
|
|
930
|
+
* is intentionally NOT marked `@deprecated` while no working replacement exists.
|
|
927
931
|
*/
|
|
928
932
|
declare class HttpDispatcher {
|
|
929
933
|
private kernel;
|
|
@@ -1014,6 +1018,49 @@ declare class HttpDispatcher {
|
|
|
1014
1018
|
* engine access.
|
|
1015
1019
|
*/
|
|
1016
1020
|
private buildMcpBridge;
|
|
1021
|
+
/**
|
|
1022
|
+
* [ADR-0066 D4] Shared capability gate for an action invocation. Returns a
|
|
1023
|
+
* human-readable error string when the caller's `systemPermissions` don't
|
|
1024
|
+
* cover the action's declared `requiredPermissions`, or `null` when allowed.
|
|
1025
|
+
* System/engine self-invocation (`isSystem`) bypasses; an action without
|
|
1026
|
+
* `requiredPermissions` is ungated. Single-sourced so the REST `/actions/...`
|
|
1027
|
+
* route and the MCP `run_action` bridge enforce the SAME declaration.
|
|
1028
|
+
*/
|
|
1029
|
+
private actionPermissionError;
|
|
1030
|
+
/**
|
|
1031
|
+
* Whether an action has a headless invocation path (so MCP can run it).
|
|
1032
|
+
* Mirrors the supported-type set of the (now cloud-side) action-tools
|
|
1033
|
+
* bridge: `script` needs a handler binding (`target`) or an inline `body`;
|
|
1034
|
+
* `flow` needs a `target` and an automation service. UI-only types
|
|
1035
|
+
* (`url`, `modal`, `form`) and `api` have no server dispatch here.
|
|
1036
|
+
*/
|
|
1037
|
+
private isHeadlessInvokableAction;
|
|
1038
|
+
/** True when an action is destructive by author signal/heuristic (HITL hint). */
|
|
1039
|
+
private actionLooksDestructive;
|
|
1040
|
+
/** Project an action's declarative metadata into a lean MCP summary. */
|
|
1041
|
+
private summarizeAction;
|
|
1042
|
+
/** Map an ObjectStack field type to a JSON-Schema primitive (conservative). */
|
|
1043
|
+
private jsonTypeOf;
|
|
1044
|
+
/** Resolve an action's params into LLM-facing summaries (field-backed types resolved). */
|
|
1045
|
+
private summarizeActionParams;
|
|
1046
|
+
/** Slim engine facade matching the ActionContext.engine shape handlers expect. */
|
|
1047
|
+
private buildActionEngineFacade;
|
|
1048
|
+
/**
|
|
1049
|
+
* Resolve + invoke a business action by its declarative name for the MCP
|
|
1050
|
+
* `run_action` tool. Enforces the ADR-0066 D4 capability gate and RLS as the
|
|
1051
|
+
* caller, loads the subject record under RLS for row-context actions, and
|
|
1052
|
+
* dispatches through the framework's `engine.executeAction` (script/body) or
|
|
1053
|
+
* automation flow runner (flow). Throws on denial / not-found / handler
|
|
1054
|
+
* failure so the tool surfaces a clean tool-error. No service-ai dependency.
|
|
1055
|
+
*/
|
|
1056
|
+
private invokeBusinessAction;
|
|
1057
|
+
/**
|
|
1058
|
+
* Find an action's declarative definition by name across object metadata,
|
|
1059
|
+
* optionally scoped to a single object. Returns the action plus its owning
|
|
1060
|
+
* object name, or `null`. Throws when the name is ambiguous across objects
|
|
1061
|
+
* and no `objectName` was supplied (so `run_action` can ask for one).
|
|
1062
|
+
*/
|
|
1063
|
+
private resolveActionByName;
|
|
1017
1064
|
/**
|
|
1018
1065
|
* Generate a `sys_api_key` and return the raw secret EXACTLY ONCE
|
|
1019
1066
|
* (`POST /keys`). This is the only mint path — the raw key is never stored
|
|
@@ -1077,6 +1124,13 @@ declare class HttpDispatcher {
|
|
|
1077
1124
|
* response object that callers should surface directly — no further
|
|
1078
1125
|
* dispatch happens.
|
|
1079
1126
|
*/
|
|
1127
|
+
/**
|
|
1128
|
+
* ADR-0069 — returns a 403 response when the resolved session is blocked by
|
|
1129
|
+
* an auth-policy gate (expired password / required MFA) on a non-allow-listed
|
|
1130
|
+
* path, else null. Mirrors the REST `enforceAuth` seam so REST + dispatcher
|
|
1131
|
+
* (MCP, GraphQL) enforce consistently. Fails open on any lookup error.
|
|
1132
|
+
*/
|
|
1133
|
+
private enforceAuthGate;
|
|
1080
1134
|
private enforceProjectMembership;
|
|
1081
1135
|
/**
|
|
1082
1136
|
* Generates the discovery JSON response for the API root.
|
package/dist/index.d.ts
CHANGED
|
@@ -918,12 +918,16 @@ interface HttpDispatcherOptions {
|
|
|
918
918
|
scopeManager?: EnvironmentScopeManager;
|
|
919
919
|
}
|
|
920
920
|
/**
|
|
921
|
-
*
|
|
922
|
-
*
|
|
923
|
-
*
|
|
924
|
-
*
|
|
925
|
-
*
|
|
926
|
-
*
|
|
921
|
+
* The HTTP dispatch engine — translates an inbound (method, path, body, ctx)
|
|
922
|
+
* request into a kernel response. Used directly by the framework's HTTP adapters
|
|
923
|
+
* (express / fastify / nextjs / nestjs / nuxt / sveltekit / hono) and plugin-msw,
|
|
924
|
+
* which need a *callable* dispatcher.
|
|
925
|
+
*
|
|
926
|
+
* NOTE: `createDispatcherPlugin()` is a different thing — a kernel plugin that
|
|
927
|
+
* registers routes on a kernel-hosted HTTP server. It is NOT a drop-in for
|
|
928
|
+
* adapters. Retiring this public class behind a `createHttpDispatcher()` factory
|
|
929
|
+
* is tracked in #2380 (a deliberate adapter-API change, not yet done) — so this
|
|
930
|
+
* is intentionally NOT marked `@deprecated` while no working replacement exists.
|
|
927
931
|
*/
|
|
928
932
|
declare class HttpDispatcher {
|
|
929
933
|
private kernel;
|
|
@@ -1014,6 +1018,49 @@ declare class HttpDispatcher {
|
|
|
1014
1018
|
* engine access.
|
|
1015
1019
|
*/
|
|
1016
1020
|
private buildMcpBridge;
|
|
1021
|
+
/**
|
|
1022
|
+
* [ADR-0066 D4] Shared capability gate for an action invocation. Returns a
|
|
1023
|
+
* human-readable error string when the caller's `systemPermissions` don't
|
|
1024
|
+
* cover the action's declared `requiredPermissions`, or `null` when allowed.
|
|
1025
|
+
* System/engine self-invocation (`isSystem`) bypasses; an action without
|
|
1026
|
+
* `requiredPermissions` is ungated. Single-sourced so the REST `/actions/...`
|
|
1027
|
+
* route and the MCP `run_action` bridge enforce the SAME declaration.
|
|
1028
|
+
*/
|
|
1029
|
+
private actionPermissionError;
|
|
1030
|
+
/**
|
|
1031
|
+
* Whether an action has a headless invocation path (so MCP can run it).
|
|
1032
|
+
* Mirrors the supported-type set of the (now cloud-side) action-tools
|
|
1033
|
+
* bridge: `script` needs a handler binding (`target`) or an inline `body`;
|
|
1034
|
+
* `flow` needs a `target` and an automation service. UI-only types
|
|
1035
|
+
* (`url`, `modal`, `form`) and `api` have no server dispatch here.
|
|
1036
|
+
*/
|
|
1037
|
+
private isHeadlessInvokableAction;
|
|
1038
|
+
/** True when an action is destructive by author signal/heuristic (HITL hint). */
|
|
1039
|
+
private actionLooksDestructive;
|
|
1040
|
+
/** Project an action's declarative metadata into a lean MCP summary. */
|
|
1041
|
+
private summarizeAction;
|
|
1042
|
+
/** Map an ObjectStack field type to a JSON-Schema primitive (conservative). */
|
|
1043
|
+
private jsonTypeOf;
|
|
1044
|
+
/** Resolve an action's params into LLM-facing summaries (field-backed types resolved). */
|
|
1045
|
+
private summarizeActionParams;
|
|
1046
|
+
/** Slim engine facade matching the ActionContext.engine shape handlers expect. */
|
|
1047
|
+
private buildActionEngineFacade;
|
|
1048
|
+
/**
|
|
1049
|
+
* Resolve + invoke a business action by its declarative name for the MCP
|
|
1050
|
+
* `run_action` tool. Enforces the ADR-0066 D4 capability gate and RLS as the
|
|
1051
|
+
* caller, loads the subject record under RLS for row-context actions, and
|
|
1052
|
+
* dispatches through the framework's `engine.executeAction` (script/body) or
|
|
1053
|
+
* automation flow runner (flow). Throws on denial / not-found / handler
|
|
1054
|
+
* failure so the tool surfaces a clean tool-error. No service-ai dependency.
|
|
1055
|
+
*/
|
|
1056
|
+
private invokeBusinessAction;
|
|
1057
|
+
/**
|
|
1058
|
+
* Find an action's declarative definition by name across object metadata,
|
|
1059
|
+
* optionally scoped to a single object. Returns the action plus its owning
|
|
1060
|
+
* object name, or `null`. Throws when the name is ambiguous across objects
|
|
1061
|
+
* and no `objectName` was supplied (so `run_action` can ask for one).
|
|
1062
|
+
*/
|
|
1063
|
+
private resolveActionByName;
|
|
1017
1064
|
/**
|
|
1018
1065
|
* Generate a `sys_api_key` and return the raw secret EXACTLY ONCE
|
|
1019
1066
|
* (`POST /keys`). This is the only mint path — the raw key is never stored
|
|
@@ -1077,6 +1124,13 @@ declare class HttpDispatcher {
|
|
|
1077
1124
|
* response object that callers should surface directly — no further
|
|
1078
1125
|
* dispatch happens.
|
|
1079
1126
|
*/
|
|
1127
|
+
/**
|
|
1128
|
+
* ADR-0069 — returns a 403 response when the resolved session is blocked by
|
|
1129
|
+
* an auth-policy gate (expired password / required MFA) on a non-allow-listed
|
|
1130
|
+
* path, else null. Mirrors the REST `enforceAuth` seam so REST + dispatcher
|
|
1131
|
+
* (MCP, GraphQL) enforce consistently. Fails open on any lookup error.
|
|
1132
|
+
*/
|
|
1133
|
+
private enforceAuthGate;
|
|
1080
1134
|
private enforceProjectMembership;
|
|
1081
1135
|
/**
|
|
1082
1136
|
* Generates the discovery JSON response for the API root.
|