@fabricorg/platform-host 3.0.0 → 4.0.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/CHANGELOG.md +14 -0
- package/README.md +5 -4
- package/dist/index.cjs +11 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +12 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @fabricorg/platform-host
|
|
2
2
|
|
|
3
|
+
## 4.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Make the capability runtime vertical-neutral and instance-scoped. Move experience and display
|
|
8
|
+
semantics into a namespaced companion package, require explicit host registries, replace privacy
|
|
9
|
+
field defaults with caller-owned policy, add PostgreSQL projection adapters, and generate executable
|
|
10
|
+
ProjectionHost read and PlatformHost mutation seams.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @fabricorg/platform@1.0.0
|
|
16
|
+
|
|
3
17
|
## 3.0.0
|
|
4
18
|
|
|
5
19
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
The canonical host for the `@fabricorg/platform` mutation pipeline.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
pnpm add @fabricorg/platform@^0.
|
|
6
|
+
pnpm add @fabricorg/platform@^1.0.0 @fabricorg/platform-host@^4.0.0
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
## AI agent integration boundary
|
|
@@ -15,7 +15,7 @@ registration, and submit stable idempotent commands. The gateway derives tenant
|
|
|
15
15
|
calls `submitAction()`; an agent must never call handlers, adapters, workflow internals, or database
|
|
16
16
|
writes directly.
|
|
17
17
|
|
|
18
|
-
See the [Platform Host
|
|
18
|
+
See the [Platform Host 4.x agent integration
|
|
19
19
|
guide](https://platform.fabric.pro/docs/platform/reference/platform-host) for application wiring,
|
|
20
20
|
execution-time authorization, the PostgreSQL transaction binder, recovery semantics, and the external
|
|
21
21
|
gateway contract.
|
|
@@ -32,8 +32,8 @@ Actor → ActionInvocation → Schema → Agent HITL → PolicyEvaluation → St
|
|
|
32
32
|
worker entry point. With no dispatcher the host executes inline, which is intended for tests and local
|
|
33
33
|
development only.
|
|
34
34
|
|
|
35
|
-
Applications
|
|
36
|
-
|
|
35
|
+
Applications construct a `createModuleRegistry()` per runtime and pass it as `registry`; a narrow
|
|
36
|
+
`resolveAction` function remains available for adapters. No process-wide platform registry exists. A custom `extractEvents` implementation can pair with
|
|
37
37
|
`eventResultFields` so its event carrier is removed from the durable invocation result. Domain events
|
|
38
38
|
without an explicit `eventSchemaVersion` inherit the action version, while host lifecycle events stay
|
|
39
39
|
at version 1. Emitted domain events must appear in the action's `emitsEvents` declaration. The
|
|
@@ -81,6 +81,7 @@ by default; `outbox.includeProvenance` is the explicit classification-aware over
|
|
|
81
81
|
```ts
|
|
82
82
|
const host = createGovernedActionHost({
|
|
83
83
|
store,
|
|
84
|
+
registry,
|
|
84
85
|
authorization: {
|
|
85
86
|
checkEntitlement,
|
|
86
87
|
authorize: authorizeSubmission,
|
package/dist/index.cjs
CHANGED
|
@@ -31,10 +31,10 @@ function digestParameters(parameters) {
|
|
|
31
31
|
return crypto.createHash("sha256").update(canonicalJson(parameters)).digest("hex");
|
|
32
32
|
}
|
|
33
33
|
var ATTRIBUTE_NAME = /^[a-z][a-z0-9-]*(?:\.[A-Za-z][A-Za-z0-9_-]*)+$/;
|
|
34
|
-
var
|
|
34
|
+
var INVOCATION_SOURCE = /^(?:ui|sdui|api|agent|worker|system|[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)+)$/;
|
|
35
35
|
function normalizeProvenance(input, options) {
|
|
36
36
|
if (!input) return void 0;
|
|
37
|
-
if (!
|
|
37
|
+
if (!INVOCATION_SOURCE.test(input.source)) throw new Error(`Invalid invocation provenance source: ${input.source}`);
|
|
38
38
|
const maxAttributes = options?.maxAttributes ?? 16;
|
|
39
39
|
const maxValueLength = options?.maxValueLength ?? 256;
|
|
40
40
|
const allowlist = new Set(options?.auditAttributeAllowlist ?? []);
|
|
@@ -83,7 +83,10 @@ function createGovernedActionHost(options) {
|
|
|
83
83
|
for (const adapter of options.adapters ?? []) adapters.register(adapter);
|
|
84
84
|
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
85
85
|
const extractEvents = options.extractEvents ?? DEFAULT_EXTRACT_EVENTS;
|
|
86
|
-
const
|
|
86
|
+
const configuredActionResolver = options.resolveAction ?? options.registry?.resolveAction;
|
|
87
|
+
if (!configuredActionResolver) throw new Error("Platform Host requires an explicit module registry or resolveAction function.");
|
|
88
|
+
const actionResolver = configuredActionResolver;
|
|
89
|
+
const stateMachineResolver = options.registry?.resolveStateMachine ?? (() => void 0);
|
|
87
90
|
const eventResultFields = options.eventResultFields ?? ["_events"];
|
|
88
91
|
async function submitAction(input) {
|
|
89
92
|
if (input.executionReason && !["initial", "offline_replay"].includes(input.executionReason)) {
|
|
@@ -388,6 +391,7 @@ function createGovernedActionHost(options) {
|
|
|
388
391
|
parameters: parsed.data,
|
|
389
392
|
db: options.store.db,
|
|
390
393
|
services: options.services,
|
|
394
|
+
resolveCodePolicy: options.registry?.resolvePolicy,
|
|
391
395
|
mode: "execute",
|
|
392
396
|
now: now()
|
|
393
397
|
});
|
|
@@ -440,10 +444,11 @@ function createGovernedActionHost(options) {
|
|
|
440
444
|
spaceId,
|
|
441
445
|
binding.entityType,
|
|
442
446
|
entityId
|
|
443
|
-
) ?? initialState(binding.entityType) : initialState(binding.entityType);
|
|
447
|
+
) ?? initialState(stateMachineResolver(binding.entityType)) : initialState(stateMachineResolver(binding.entityType));
|
|
444
448
|
const targetState = typeof binding.targetState === "function" ? binding.targetState(parsed.data) : binding.targetState;
|
|
445
449
|
if (targetState !== "") {
|
|
446
|
-
const transition = platform.
|
|
450
|
+
const transition = platform.validateStateMachineTransition(
|
|
451
|
+
stateMachineResolver(binding.entityType),
|
|
447
452
|
binding.entityType,
|
|
448
453
|
currentState,
|
|
449
454
|
targetState,
|
|
@@ -929,8 +934,7 @@ function declaredPolicies(policyIds) {
|
|
|
929
934
|
codeEvaluatorPolicyId: policyId
|
|
930
935
|
}));
|
|
931
936
|
}
|
|
932
|
-
function initialState(
|
|
933
|
-
const machine = platform.resolveStateMachine(entityType);
|
|
937
|
+
function initialState(machine) {
|
|
934
938
|
return Object.values(machine?.states ?? {}).find((state) => state.stateClass === "initial")?.id ?? "none";
|
|
935
939
|
}
|
|
936
940
|
function isTerminal(status) {
|