@fabricorg/platform-host 0.5.0 → 0.6.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 +10 -0
- package/README.md +18 -2
- package/dist/index.cjs +21 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +22 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { ActorType, ActionId, ActionStatus, AgentActionRoute, AgentActionRiskTier, MutationFootprint, ExecutionPrincipal, PolicyOutcome, AssetEventEnvelope, ExecutionAttestation, ExternalReconciliation, PolicyObligation, PolicyObligationStatus, ActionDefinition, AdapterImplementation, FabricRuntimeServices, AgentActionPolicyEvaluator, MutationGovernanceResolver, RuntimePolicyDefinition } from '@fabricorg/platform';
|
|
1
|
+
import { ActorType, ActionId, ActionStatus, AgentActionRoute, AgentActionRiskTier, MutationFootprint, ExecutionPrincipal, GovernanceRuntimeEvidence, PolicyOutcome, AssetEventEnvelope, ExecutionAttestation, ExternalReconciliation, PolicyObligation, PolicyObligationStatus, ActionDefinition, AdapterImplementation, FabricRuntimeServices, AgentActionPolicyEvaluator, MutationGovernanceResolver, RuntimePolicyDefinition } from '@fabricorg/platform';
|
|
2
2
|
|
|
3
|
+
/** Durable Host lifecycle generation, independent from the npm package version. */
|
|
4
|
+
declare const PLATFORM_HOST_CONTRACT_VERSION: 1;
|
|
3
5
|
interface PendingAssetEvent {
|
|
4
6
|
eventType: string;
|
|
5
7
|
subjectType: string;
|
|
@@ -31,6 +33,7 @@ interface ActionInvocationRecord {
|
|
|
31
33
|
approvalDecision?: PersistedActionApprovalDecision;
|
|
32
34
|
mutationFootprint?: MutationFootprint;
|
|
33
35
|
executionPrincipal?: ExecutionPrincipal;
|
|
36
|
+
runtimeEvidence?: GovernanceRuntimeEvidence;
|
|
34
37
|
error?: string;
|
|
35
38
|
createdAt: Date;
|
|
36
39
|
updatedAt: Date;
|
|
@@ -274,10 +277,14 @@ interface PlatformHostOptions<TDb> {
|
|
|
274
277
|
adapterType: string;
|
|
275
278
|
operation: string;
|
|
276
279
|
vendor: string;
|
|
280
|
+
/** Audit-safe adapter input after redactAdapterInput has been applied. */
|
|
281
|
+
input: Record<string, unknown>;
|
|
277
282
|
startedAt: Date;
|
|
278
283
|
completedAt: Date;
|
|
279
284
|
output: Record<string, unknown>;
|
|
280
285
|
}) => Promise<ExecutionAttestation | undefined> | ExecutionAttestation | undefined;
|
|
286
|
+
/** Package/provider/ruleset generations persisted with every newly created invocation. */
|
|
287
|
+
runtimeEvidence?: Partial<GovernanceRuntimeEvidence>;
|
|
281
288
|
/** Lease held while an approved invocation resumes; defaults to five minutes. */
|
|
282
289
|
approvalResumeLeaseDurationMs?: number;
|
|
283
290
|
/** Remove forbidden/sensitive fields before durable invocation persistence. */
|
|
@@ -394,4 +401,4 @@ declare function runPlatformActionWorkerCycle<TDb>(options: PlatformActionWorker
|
|
|
394
401
|
/** Poll until aborted. Each iteration is bounded and waits without busy-spinning. */
|
|
395
402
|
declare function runPlatformActionWorker<TDb>(options: PlatformActionWorkerOptions<TDb>): Promise<void>;
|
|
396
403
|
|
|
397
|
-
export { type ActionApprovalDecision, type ActionAuthorizationInput, type ActionInvocationRecord, type AdapterInvocationRecord, type AdapterInvocationStatus, type ApprovalDecisionTransitionResult, type ApprovalPlatformHostStore, type BeginApprovalDecisionInput, type ClaimActionInvocationsInput, type CreateActionInvocationInput, type DispatchActionInput, type DispatchActionResult, type ExecuteActionResult, type ExecuteInvocationOptions, type ExecutionAttestationRecord, type ExternalReconciliationRecord, type GovernancePlatformHostStore, type GovernedActionHost, type HitlDecisionEvidence, type ListActionInvocationsInput, MemoryPlatformHostStore, type PendingAssetEvent, type PersistedActionApprovalDecision, type PlatformActionDispatcher, type PlatformActionWorkerCycleResult, type PlatformActionWorkerOptions, type PlatformHostAuthorization, type PlatformHostOptions, type PlatformHostSqlClient, type PlatformHostSqlResult, type PlatformHostStore, type PolicyEvaluationRecord, type PolicyObligationRecord, PostgresPlatformHostStore, type RecoverablePlatformHostStore, type SubmitActionInput, type SubmitActionResult, createGovernedActionHost, createStoreBackedActionDispatcher, runPlatformActionWorker, runPlatformActionWorkerCycle };
|
|
404
|
+
export { type ActionApprovalDecision, type ActionAuthorizationInput, type ActionInvocationRecord, type AdapterInvocationRecord, type AdapterInvocationStatus, type ApprovalDecisionTransitionResult, type ApprovalPlatformHostStore, type BeginApprovalDecisionInput, type ClaimActionInvocationsInput, type CreateActionInvocationInput, type DispatchActionInput, type DispatchActionResult, type ExecuteActionResult, type ExecuteInvocationOptions, type ExecutionAttestationRecord, type ExternalReconciliationRecord, type GovernancePlatformHostStore, type GovernedActionHost, type HitlDecisionEvidence, type ListActionInvocationsInput, MemoryPlatformHostStore, PLATFORM_HOST_CONTRACT_VERSION, type PendingAssetEvent, type PersistedActionApprovalDecision, type PlatformActionDispatcher, type PlatformActionWorkerCycleResult, type PlatformActionWorkerOptions, type PlatformHostAuthorization, type PlatformHostOptions, type PlatformHostSqlClient, type PlatformHostSqlResult, type PlatformHostStore, type PolicyEvaluationRecord, type PolicyObligationRecord, PostgresPlatformHostStore, type RecoverablePlatformHostStore, type SubmitActionInput, type SubmitActionResult, createGovernedActionHost, createStoreBackedActionDispatcher, runPlatformActionWorker, runPlatformActionWorkerCycle };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { ActorType, ActionId, ActionStatus, AgentActionRoute, AgentActionRiskTier, MutationFootprint, ExecutionPrincipal, PolicyOutcome, AssetEventEnvelope, ExecutionAttestation, ExternalReconciliation, PolicyObligation, PolicyObligationStatus, ActionDefinition, AdapterImplementation, FabricRuntimeServices, AgentActionPolicyEvaluator, MutationGovernanceResolver, RuntimePolicyDefinition } from '@fabricorg/platform';
|
|
1
|
+
import { ActorType, ActionId, ActionStatus, AgentActionRoute, AgentActionRiskTier, MutationFootprint, ExecutionPrincipal, GovernanceRuntimeEvidence, PolicyOutcome, AssetEventEnvelope, ExecutionAttestation, ExternalReconciliation, PolicyObligation, PolicyObligationStatus, ActionDefinition, AdapterImplementation, FabricRuntimeServices, AgentActionPolicyEvaluator, MutationGovernanceResolver, RuntimePolicyDefinition } from '@fabricorg/platform';
|
|
2
2
|
|
|
3
|
+
/** Durable Host lifecycle generation, independent from the npm package version. */
|
|
4
|
+
declare const PLATFORM_HOST_CONTRACT_VERSION: 1;
|
|
3
5
|
interface PendingAssetEvent {
|
|
4
6
|
eventType: string;
|
|
5
7
|
subjectType: string;
|
|
@@ -31,6 +33,7 @@ interface ActionInvocationRecord {
|
|
|
31
33
|
approvalDecision?: PersistedActionApprovalDecision;
|
|
32
34
|
mutationFootprint?: MutationFootprint;
|
|
33
35
|
executionPrincipal?: ExecutionPrincipal;
|
|
36
|
+
runtimeEvidence?: GovernanceRuntimeEvidence;
|
|
34
37
|
error?: string;
|
|
35
38
|
createdAt: Date;
|
|
36
39
|
updatedAt: Date;
|
|
@@ -274,10 +277,14 @@ interface PlatformHostOptions<TDb> {
|
|
|
274
277
|
adapterType: string;
|
|
275
278
|
operation: string;
|
|
276
279
|
vendor: string;
|
|
280
|
+
/** Audit-safe adapter input after redactAdapterInput has been applied. */
|
|
281
|
+
input: Record<string, unknown>;
|
|
277
282
|
startedAt: Date;
|
|
278
283
|
completedAt: Date;
|
|
279
284
|
output: Record<string, unknown>;
|
|
280
285
|
}) => Promise<ExecutionAttestation | undefined> | ExecutionAttestation | undefined;
|
|
286
|
+
/** Package/provider/ruleset generations persisted with every newly created invocation. */
|
|
287
|
+
runtimeEvidence?: Partial<GovernanceRuntimeEvidence>;
|
|
281
288
|
/** Lease held while an approved invocation resumes; defaults to five minutes. */
|
|
282
289
|
approvalResumeLeaseDurationMs?: number;
|
|
283
290
|
/** Remove forbidden/sensitive fields before durable invocation persistence. */
|
|
@@ -394,4 +401,4 @@ declare function runPlatformActionWorkerCycle<TDb>(options: PlatformActionWorker
|
|
|
394
401
|
/** Poll until aborted. Each iteration is bounded and waits without busy-spinning. */
|
|
395
402
|
declare function runPlatformActionWorker<TDb>(options: PlatformActionWorkerOptions<TDb>): Promise<void>;
|
|
396
403
|
|
|
397
|
-
export { type ActionApprovalDecision, type ActionAuthorizationInput, type ActionInvocationRecord, type AdapterInvocationRecord, type AdapterInvocationStatus, type ApprovalDecisionTransitionResult, type ApprovalPlatformHostStore, type BeginApprovalDecisionInput, type ClaimActionInvocationsInput, type CreateActionInvocationInput, type DispatchActionInput, type DispatchActionResult, type ExecuteActionResult, type ExecuteInvocationOptions, type ExecutionAttestationRecord, type ExternalReconciliationRecord, type GovernancePlatformHostStore, type GovernedActionHost, type HitlDecisionEvidence, type ListActionInvocationsInput, MemoryPlatformHostStore, type PendingAssetEvent, type PersistedActionApprovalDecision, type PlatformActionDispatcher, type PlatformActionWorkerCycleResult, type PlatformActionWorkerOptions, type PlatformHostAuthorization, type PlatformHostOptions, type PlatformHostSqlClient, type PlatformHostSqlResult, type PlatformHostStore, type PolicyEvaluationRecord, type PolicyObligationRecord, PostgresPlatformHostStore, type RecoverablePlatformHostStore, type SubmitActionInput, type SubmitActionResult, createGovernedActionHost, createStoreBackedActionDispatcher, runPlatformActionWorker, runPlatformActionWorkerCycle };
|
|
404
|
+
export { type ActionApprovalDecision, type ActionAuthorizationInput, type ActionInvocationRecord, type AdapterInvocationRecord, type AdapterInvocationStatus, type ApprovalDecisionTransitionResult, type ApprovalPlatformHostStore, type BeginApprovalDecisionInput, type ClaimActionInvocationsInput, type CreateActionInvocationInput, type DispatchActionInput, type DispatchActionResult, type ExecuteActionResult, type ExecuteInvocationOptions, type ExecutionAttestationRecord, type ExternalReconciliationRecord, type GovernancePlatformHostStore, type GovernedActionHost, type HitlDecisionEvidence, type ListActionInvocationsInput, MemoryPlatformHostStore, PLATFORM_HOST_CONTRACT_VERSION, type PendingAssetEvent, type PersistedActionApprovalDecision, type PlatformActionDispatcher, type PlatformActionWorkerCycleResult, type PlatformActionWorkerOptions, type PlatformHostAuthorization, type PlatformHostOptions, type PlatformHostSqlClient, type PlatformHostSqlResult, type PlatformHostStore, type PolicyEvaluationRecord, type PolicyObligationRecord, PostgresPlatformHostStore, type RecoverablePlatformHostStore, type SubmitActionInput, type SubmitActionResult, createGovernedActionHost, createStoreBackedActionDispatcher, runPlatformActionWorker, runPlatformActionWorkerCycle };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { AdapterRegistry, resolveAction, createFabricId, assertMutationGovernanceContext, evaluatePolicyDefinitions, aggregatePolicyOutcomes, validateTransition, executeWithAdapterRetry, resolveStateMachine } from '@fabricorg/platform';
|
|
1
|
+
import { AdapterRegistry, resolveAction, createFabricId, assertGovernanceRuntimeEvidence, FABRIC_GOVERNANCE_CONTRACT_VERSION, assertMutationGovernanceContext, evaluatePolicyDefinitions, aggregatePolicyOutcomes, validateTransition, executeWithAdapterRetry, resolveStateMachine } from '@fabricorg/platform';
|
|
2
|
+
|
|
3
|
+
// src/host.ts
|
|
4
|
+
|
|
5
|
+
// src/types.ts
|
|
6
|
+
var PLATFORM_HOST_CONTRACT_VERSION = 1;
|
|
2
7
|
|
|
3
8
|
// src/host.ts
|
|
4
9
|
var DEFAULT_EXTRACT_EVENTS = (data) => {
|
|
@@ -25,6 +30,12 @@ function createGovernedActionHost(options) {
|
|
|
25
30
|
const actionInvocationId = createFabricId("act");
|
|
26
31
|
const correlationId = input.correlationId ?? createFabricId("corr");
|
|
27
32
|
const durableParameters = options.redactActionParameters ? options.redactActionParameters(input.actionId, input.parameters) : input.parameters;
|
|
33
|
+
const runtimeEvidence = {
|
|
34
|
+
governanceContractVersion: FABRIC_GOVERNANCE_CONTRACT_VERSION,
|
|
35
|
+
hostContractVersion: PLATFORM_HOST_CONTRACT_VERSION,
|
|
36
|
+
...options.runtimeEvidence
|
|
37
|
+
};
|
|
38
|
+
assertGovernanceRuntimeEvidence(runtimeEvidence);
|
|
28
39
|
const durableInvocation = await options.store.createActionInvocation({
|
|
29
40
|
id: actionInvocationId,
|
|
30
41
|
tenantId: input.tenantId,
|
|
@@ -36,6 +47,7 @@ function createGovernedActionHost(options) {
|
|
|
36
47
|
status: "pending",
|
|
37
48
|
parameters: durableParameters,
|
|
38
49
|
result: {},
|
|
50
|
+
runtimeEvidence,
|
|
39
51
|
correlationId,
|
|
40
52
|
...input.causationId ? { causationId: input.causationId } : {},
|
|
41
53
|
...input.idempotencyKey ? { idempotencyKey: input.idempotencyKey } : {}
|
|
@@ -416,6 +428,7 @@ function createGovernedActionHost(options) {
|
|
|
416
428
|
adapterType: step.adapterType,
|
|
417
429
|
operation: step.operation,
|
|
418
430
|
vendor: adapter.vendor,
|
|
431
|
+
input: recordedInput,
|
|
419
432
|
startedAt,
|
|
420
433
|
completedAt: now(),
|
|
421
434
|
output
|
|
@@ -870,7 +883,7 @@ var PostgresPlatformHostStore = class {
|
|
|
870
883
|
attempt_count integer NOT NULL DEFAULT 0, lease_owner text,
|
|
871
884
|
lease_expires_at timestamptz, hitl_route text, hitl_risk_tier text,
|
|
872
885
|
hitl_reason text, hitl_policy_version text, approval_decision jsonb,
|
|
873
|
-
mutation_footprint jsonb, execution_principal jsonb,
|
|
886
|
+
mutation_footprint jsonb, execution_principal jsonb, runtime_evidence jsonb,
|
|
874
887
|
created_at timestamptz NOT NULL, updated_at timestamptz NOT NULL
|
|
875
888
|
);
|
|
876
889
|
ALTER TABLE fabric_platform.action_invocations
|
|
@@ -884,7 +897,8 @@ var PostgresPlatformHostStore = class {
|
|
|
884
897
|
ADD COLUMN IF NOT EXISTS hitl_policy_version text,
|
|
885
898
|
ADD COLUMN IF NOT EXISTS approval_decision jsonb,
|
|
886
899
|
ADD COLUMN IF NOT EXISTS mutation_footprint jsonb,
|
|
887
|
-
ADD COLUMN IF NOT EXISTS execution_principal jsonb
|
|
900
|
+
ADD COLUMN IF NOT EXISTS execution_principal jsonb,
|
|
901
|
+
ADD COLUMN IF NOT EXISTS runtime_evidence jsonb;
|
|
888
902
|
CREATE UNIQUE INDEX IF NOT EXISTS action_invocations_idempotency_idx
|
|
889
903
|
ON fabric_platform.action_invocations
|
|
890
904
|
(tenant_id, space_id, action_id, idempotency_key)
|
|
@@ -948,8 +962,8 @@ var PostgresPlatformHostStore = class {
|
|
|
948
962
|
const result = await this.sql.query(
|
|
949
963
|
`INSERT INTO fabric_platform.action_invocations
|
|
950
964
|
(id,tenant_id,space_id,action_id,action_version,actor_id,actor_type,status,
|
|
951
|
-
|
|
952
|
-
|
|
965
|
+
parameters,result,correlation_id,causation_id,idempotency_key,error,runtime_evidence,created_at,updated_at)
|
|
966
|
+
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9::jsonb,$10::jsonb,$11,$12,$13,$14,$15::jsonb,$16,$16)
|
|
953
967
|
ON CONFLICT (tenant_id,space_id,action_id,idempotency_key)
|
|
954
968
|
WHERE idempotency_key IS NOT NULL DO UPDATE SET id=fabric_platform.action_invocations.id
|
|
955
969
|
RETURNING *`,
|
|
@@ -968,6 +982,7 @@ var PostgresPlatformHostStore = class {
|
|
|
968
982
|
input.causationId ?? null,
|
|
969
983
|
input.idempotencyKey ?? null,
|
|
970
984
|
input.error ?? null,
|
|
985
|
+
input.runtimeEvidence ? JSON.stringify(input.runtimeEvidence) : null,
|
|
971
986
|
now
|
|
972
987
|
]
|
|
973
988
|
);
|
|
@@ -1339,6 +1354,7 @@ function toActionRecord(row) {
|
|
|
1339
1354
|
...row.approval_decision ? { approvalDecision: toApprovalDecision(row.approval_decision) } : {},
|
|
1340
1355
|
...row.mutation_footprint ? { mutationFootprint: row.mutation_footprint } : {},
|
|
1341
1356
|
...row.execution_principal ? { executionPrincipal: row.execution_principal } : {},
|
|
1357
|
+
...row.runtime_evidence ? { runtimeEvidence: row.runtime_evidence } : {},
|
|
1342
1358
|
...row.error ? { error: String(row.error) } : {},
|
|
1343
1359
|
createdAt: new Date(row.created_at),
|
|
1344
1360
|
updatedAt: new Date(row.updated_at)
|
|
@@ -1472,6 +1488,6 @@ async function abortableDelay(milliseconds, signal) {
|
|
|
1472
1488
|
});
|
|
1473
1489
|
}
|
|
1474
1490
|
|
|
1475
|
-
export { MemoryPlatformHostStore, PostgresPlatformHostStore, createGovernedActionHost, createStoreBackedActionDispatcher, runPlatformActionWorker, runPlatformActionWorkerCycle };
|
|
1491
|
+
export { MemoryPlatformHostStore, PLATFORM_HOST_CONTRACT_VERSION, PostgresPlatformHostStore, createGovernedActionHost, createStoreBackedActionDispatcher, runPlatformActionWorker, runPlatformActionWorkerCycle };
|
|
1476
1492
|
//# sourceMappingURL=index.js.map
|
|
1477
1493
|
//# sourceMappingURL=index.js.map
|