@fabricorg/platform-host 0.3.0 → 0.4.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 +52 -2
- package/dist/index.cjs +366 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +74 -5
- package/dist/index.d.ts +74 -5
- package/dist/index.js +366 -37
- package/dist/index.js.map +1 -1
- package/package.json +66 -62
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @fabricorg/platform-host
|
|
2
2
|
|
|
3
|
+
## 0.4.0 — 2026-07-19
|
|
4
|
+
|
|
5
|
+
- Add an optional agent-only HITL evaluator between schema validation and ordinary policies.
|
|
6
|
+
- Persist HITL route, risk tier, reason, and ruleset version as durable invocation evidence.
|
|
7
|
+
- Add authorized, atomic approval and rejection decisions with governed resume execution.
|
|
8
|
+
- Keep parked invocations out of worker claims and report worker-parked work separately from failures.
|
|
9
|
+
- Preserve existing behavior for hosts that do not configure HITL.
|
|
10
|
+
|
|
11
|
+
## 0.3.1 — 2026-07-19
|
|
12
|
+
|
|
13
|
+
- Make policy, event, and adapter checkpoints deterministic and replay-safe.
|
|
14
|
+
- Resume idempotent interrupted actions without repeating succeeded adapters.
|
|
15
|
+
- Fail stale non-idempotent work terminally for explicit operator reconciliation.
|
|
16
|
+
|
|
3
17
|
## 0.3.0 — 2026-07-19
|
|
4
18
|
|
|
5
19
|
- Add tenant-scoped stable command idempotency and terminal replay.
|
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.7.0 @fabricorg/platform-host@^0.
|
|
6
|
+
pnpm add @fabricorg/platform@^0.7.0 @fabricorg/platform-host@^0.4.0
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
Vertical packages register `FabricModule` definitions. Host applications provide tenant authorization,
|
|
@@ -11,7 +11,7 @@ module entitlements, persistence, projections, and an optional durable dispatche
|
|
|
11
11
|
ordering and lifecycle invariant:
|
|
12
12
|
|
|
13
13
|
```text
|
|
14
|
-
Actor → ActionInvocation → PolicyEvaluation → StateMachine → Handler → AssetEvent → AdapterInvocation → Projection
|
|
14
|
+
Actor → ActionInvocation → Schema → Agent HITL → PolicyEvaluation → StateMachine → Handler → AssetEvent → AdapterInvocation → Projection
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
`submitAction()` creates the durable `ActionInvocation` before dispatch. `executeInvocation()` is the
|
|
@@ -24,6 +24,56 @@ bounded batches with an atomic lease and `FOR UPDATE SKIP LOCKED`, and an expire
|
|
|
24
24
|
recoverable after interruption. Pass a stable `idempotencyKey` to `submitAction()` so retries resolve
|
|
25
25
|
to the original tenant-scoped invocation instead of creating another mutation.
|
|
26
26
|
|
|
27
|
+
Lifecycle records use deterministic checkpoint ids. Recovered idempotent actions do not repeat an
|
|
28
|
+
adapter that already reached `succeeded`, and event, policy, and adapter writes are append-safe. A
|
|
29
|
+
stale action that was not declared idempotent fails terminally for manual reconciliation instead of
|
|
30
|
+
silently rerunning unknown side effects.
|
|
31
|
+
|
|
32
|
+
## Agent HITL
|
|
33
|
+
|
|
34
|
+
Hosts can inject a vertical-owned `hitlEvaluator`. It runs only for `actorType: "agent"`, after schema
|
|
35
|
+
validation and before ordinary policies. Omitting it preserves the pre-0.4 behavior. The host owns the
|
|
36
|
+
durable lifecycle; the vertical continues to own the rules and risk classification.
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
const host = createGovernedActionHost({
|
|
40
|
+
store,
|
|
41
|
+
authorization,
|
|
42
|
+
hitlPolicyVersion: "gtm-rules.v7",
|
|
43
|
+
hitlEvaluator: async (context) => ({
|
|
44
|
+
route: context.actionId === "gtm.send_message" ? "needs-approval" : "auto-execute",
|
|
45
|
+
riskTier: context.actionId === "gtm.send_message" ? "high" : "low",
|
|
46
|
+
reason: "Vertical-owned prospect-touching rule",
|
|
47
|
+
}),
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The evaluator returns `auto-execute`, `needs-approval`, `escalate`, or `rejected`:
|
|
52
|
+
|
|
53
|
+
- `auto-execute` continues through policies, state validation, the handler, events, and adapters.
|
|
54
|
+
- `needs-approval` and `escalate` persist the route and risk evidence, clear any worker lease, and park
|
|
55
|
+
the invocation as `waiting_for_approval`. Polling workers never claim that status.
|
|
56
|
+
- `rejected` terminally fails before policies and mutation code run.
|
|
57
|
+
|
|
58
|
+
An approval workflow calls `resumeApprovedInvocation()` instead of invoking the handler directly. The
|
|
59
|
+
host authorizes the approver (using `authorizeApproval` when provided), then atomically persists the
|
|
60
|
+
decision and changes `waiting_for_approval` to either leased `running` or terminal `failed`. This keeps
|
|
61
|
+
the decision in the mutation ledger and prevents an approval/worker race.
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
await host.resumeApprovedInvocation(actionInvocationId, tenantId, spaceId, {
|
|
65
|
+
approved: true,
|
|
66
|
+
approverId: reviewer.id,
|
|
67
|
+
approverType: "natural_person",
|
|
68
|
+
reason: "Reviewed prospect-facing draft",
|
|
69
|
+
editsReference: "draft-revision-2",
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Custom stores remain source-compatible when HITL is unused. To enable HITL they must implement the
|
|
74
|
+
additive `ApprovalPlatformHostStore` capability. Both built-in stores implement it; Postgres users must
|
|
75
|
+
call `ensureSchema()` so the HITL evidence and approval-decision columns are added.
|
|
76
|
+
|
|
27
77
|
Sensitive values must not be passed as action parameters. Stage them in tenant-bound encrypted storage
|
|
28
78
|
and pass an opaque identifier instead; action parameters are intentionally durable audit evidence.
|
|
29
79
|
Hosts should additionally configure `redactActionParameters` as a fail-safe allowlist for actions
|