@fabricorg/platform-host 8.9.0 → 8.10.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 +12 -0
- package/README.md +23 -2
- package/dist/index.cjs +391 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +120 -72
- package/dist/index.d.ts +120 -72
- package/dist/index.js +390 -124
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,79 @@
|
|
|
1
1
|
import { ActionDefinition, ActionId, ActionStatus, ActorType, AdapterCircuitBreakerProvider, AdapterImplementation, AgentActionPolicyContext, AgentActionPolicyDecision, AgentActionRiskTier, AgentActionRoute, AssetEventEnvelope, EvidencePacketReference, ExecutionAttestation, ExecutionPrincipal, ExternalReconciliation, FabricRuntimeServices, GovernanceRuntimeEvidence, ModuleRegistry, MutationFootprint, MutationGovernanceResolver, PolicyObligation, PolicyObligationStatus, PolicyOutcome, RuntimePolicyDefinition, StagedInvocationRequest, canonicalJson } from "@fabricorg/platform";
|
|
2
2
|
import { AssemblyLockfile } from "@fabricorg/assembly";
|
|
3
|
+
//#region src/erasure-types.d.ts
|
|
4
|
+
type StoredRecordErasureTarget = {
|
|
5
|
+
readonly kind: "invocation";
|
|
6
|
+
readonly invocationId: string;
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: "event";
|
|
9
|
+
readonly eventId: string;
|
|
10
|
+
};
|
|
11
|
+
interface ErasurePayloadFields {
|
|
12
|
+
invocation: "parameters" | "result" | "error" | "provenance" | "authorizationBinding" | "authorizationReconciliation" | "adapterReconciliation" | "hitlReason" | "approvalDecision" | "mutationFootprint" | "executionPrincipal" | "runtimeEvidence" | "pendingCompletion" | "externalCompletion" | "pendingStateTransition" | "finalizationCheckpoint" | "approvalExpiry" | "agentProposal" | "submissionRefusal";
|
|
13
|
+
adapter: "input" | "output" | "error" | "reconciliation";
|
|
14
|
+
staged: "parameters" | "lastError";
|
|
15
|
+
policy_evaluation: "outcome";
|
|
16
|
+
policy_obligation: "description" | "evidenceReferences" | "metadata";
|
|
17
|
+
execution_attestation: "attestation";
|
|
18
|
+
external_reconciliation: "reconciliation";
|
|
19
|
+
event: "payload" | "provenance";
|
|
20
|
+
outbox: "lastError" | "traceContext" | "payload" | "provenance";
|
|
21
|
+
outbox_requeue: "reason" | "priorLastError";
|
|
22
|
+
}
|
|
23
|
+
type ErasureRecordKind = keyof ErasurePayloadFields;
|
|
24
|
+
/** Protected nested keys are omitted from the callback; stores restore structure and overwrite payload digests. */
|
|
25
|
+
type StoredRecordErasureView = { [K in ErasureRecordKind]: {
|
|
26
|
+
readonly kind: K;
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly tenantId: string;
|
|
29
|
+
readonly spaceId: string;
|
|
30
|
+
readonly invocationId?: string;
|
|
31
|
+
readonly eventId?: string;
|
|
32
|
+
readonly eventType?: string;
|
|
33
|
+
fields: Partial<Record<ErasurePayloadFields[K], unknown>>;
|
|
34
|
+
}; }[ErasureRecordKind];
|
|
35
|
+
/** Validated identifying facts sent to the application authorizer; no stored payload or callback. */
|
|
36
|
+
interface StoredRecordErasureAuthorizationInput {
|
|
37
|
+
/** Trusted operator identity supplied by the authenticated application session. */
|
|
38
|
+
readonly actorId: string;
|
|
39
|
+
readonly actorType: ActorType;
|
|
40
|
+
readonly tenantId: string;
|
|
41
|
+
readonly spaceId: string;
|
|
42
|
+
readonly requestId: string;
|
|
43
|
+
readonly targets: readonly StoredRecordErasureTarget[];
|
|
44
|
+
}
|
|
45
|
+
interface EraseStoredRecordsInput extends StoredRecordErasureAuthorizationInput {
|
|
46
|
+
/** Target-lock acquisition budget in milliseconds, 1–60000; default 250. */
|
|
47
|
+
readonly lockTimeoutMs?: number;
|
|
48
|
+
/** Rewrite work budget in milliseconds, 1–60000; default 5000. */
|
|
49
|
+
readonly workTimeoutMs?: number;
|
|
50
|
+
/** Synchronous JSON-data transformation. A thrown error or invalid result rolls back the batch. */
|
|
51
|
+
readonly redact: (record: StoredRecordErasureView) => StoredRecordErasureView;
|
|
52
|
+
}
|
|
53
|
+
type StoredRecordErasureOutcome = "erased" | "already_erased" | "active" | "not_found";
|
|
54
|
+
interface EraseStoredRecordsResult {
|
|
55
|
+
targets: Array<StoredRecordErasureTarget & {
|
|
56
|
+
outcome: StoredRecordErasureOutcome;
|
|
57
|
+
}>;
|
|
58
|
+
/** Records processed, including records processed again by repeat erasure. */
|
|
59
|
+
counts: Partial<Record<ErasureRecordKind, number>>;
|
|
60
|
+
}
|
|
61
|
+
interface ErasablePlatformHostStore<TDb> extends PlatformHostStore<TDb> {
|
|
62
|
+
/**
|
|
63
|
+
* Unauthenticated storage port, not an authorization boundary; callers must enforce authorization.
|
|
64
|
+
* Atomic rewrite/marker/audit operation. The audit retains actorId/actorType as identifying metadata.
|
|
65
|
+
* Invocation reads expose storedRecordsErased after commit.
|
|
66
|
+
*/
|
|
67
|
+
eraseStoredRecords(input: EraseStoredRecordsInput): Promise<EraseStoredRecordsResult>;
|
|
68
|
+
}
|
|
69
|
+
interface StoredRecordErasureHost {
|
|
70
|
+
/** Throws StoredRecordErasureAuthorizationError (not_authorized) before store access on authorization refusal. */
|
|
71
|
+
eraseStoredRecords(input: EraseStoredRecordsInput): Promise<EraseStoredRecordsResult>;
|
|
72
|
+
}
|
|
73
|
+
export declare const HOST_RECORDS_ERASED_EVENT: "HostRecordsErased";
|
|
74
|
+
/** Sentinel replacing required payload digests after stored-record erasure. */
|
|
75
|
+
export declare const ERASED_DIGEST: "erased";
|
|
76
|
+
//#endregion
|
|
3
77
|
//#region src/observability.d.ts
|
|
4
78
|
/** Version of the vendor-neutral health/readiness contract. */
|
|
5
79
|
export declare const PLATFORM_HOST_HEALTH_CONTRACT_VERSION: 1;
|
|
@@ -641,6 +715,7 @@ export interface AdapterInvocationWriteInput {
|
|
|
641
715
|
};
|
|
642
716
|
}
|
|
643
717
|
export interface PlatformHostStore<TDb> {
|
|
718
|
+
getSubmissionOutcomeByKey?(key: Readonly<SubmissionOutcomeKey>): Promise<StoredSubmissionOutcomeRecord | undefined>;
|
|
644
719
|
readonly db: TDb;
|
|
645
720
|
/**
|
|
646
721
|
* Run against the store's domain handle. This base seam does not promise a
|
|
@@ -1949,83 +2024,41 @@ export interface OutboxRequeueHost {
|
|
|
1949
2024
|
*/
|
|
1950
2025
|
requeueOutboxDeadLetter(input: RequeueOutboxDeadLetterInput): Promise<RequeueOutboxDeadLetterResult>;
|
|
1951
2026
|
}
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
readonly kind: "event";
|
|
1959
|
-
readonly eventId: string;
|
|
1960
|
-
};
|
|
1961
|
-
interface ErasurePayloadFields {
|
|
1962
|
-
invocation: "parameters" | "result" | "error" | "provenance" | "authorizationBinding" | "authorizationReconciliation" | "adapterReconciliation" | "hitlReason" | "approvalDecision" | "mutationFootprint" | "executionPrincipal" | "runtimeEvidence" | "pendingCompletion" | "externalCompletion" | "pendingStateTransition" | "finalizationCheckpoint" | "approvalExpiry" | "agentProposal" | "submissionRefusal";
|
|
1963
|
-
adapter: "input" | "output" | "error" | "reconciliation";
|
|
1964
|
-
staged: "parameters" | "lastError";
|
|
1965
|
-
policy_evaluation: "outcome";
|
|
1966
|
-
policy_obligation: "description" | "evidenceReferences" | "metadata";
|
|
1967
|
-
execution_attestation: "attestation";
|
|
1968
|
-
external_reconciliation: "reconciliation";
|
|
1969
|
-
event: "payload" | "provenance";
|
|
1970
|
-
outbox: "lastError" | "traceContext" | "payload" | "provenance";
|
|
1971
|
-
outbox_requeue: "reason" | "priorLastError";
|
|
1972
|
-
}
|
|
1973
|
-
type ErasureRecordKind = keyof ErasurePayloadFields;
|
|
1974
|
-
/** Protected nested keys are omitted from the callback; stores restore structure and overwrite payload digests. */
|
|
1975
|
-
type StoredRecordErasureView = { [K in ErasureRecordKind]: {
|
|
1976
|
-
readonly kind: K;
|
|
1977
|
-
readonly id: string;
|
|
1978
|
-
readonly tenantId: string;
|
|
1979
|
-
readonly spaceId: string;
|
|
1980
|
-
readonly invocationId?: string;
|
|
1981
|
-
readonly eventId?: string;
|
|
1982
|
-
readonly eventType?: string;
|
|
1983
|
-
fields: Partial<Record<ErasurePayloadFields[K], unknown>>;
|
|
1984
|
-
}; }[ErasureRecordKind];
|
|
1985
|
-
/** Validated identifying facts sent to the application authorizer; no stored payload or callback. */
|
|
1986
|
-
interface StoredRecordErasureAuthorizationInput {
|
|
1987
|
-
/** Trusted operator identity supplied by the authenticated application session. */
|
|
1988
|
-
readonly actorId: string;
|
|
1989
|
-
readonly actorType: ActorType;
|
|
1990
|
-
readonly tenantId: string;
|
|
1991
|
-
readonly spaceId: string;
|
|
1992
|
-
readonly requestId: string;
|
|
1993
|
-
readonly targets: readonly StoredRecordErasureTarget[];
|
|
1994
|
-
}
|
|
1995
|
-
interface EraseStoredRecordsInput extends StoredRecordErasureAuthorizationInput {
|
|
1996
|
-
/** Target-lock acquisition budget in milliseconds, 1–60000; default 250. */
|
|
1997
|
-
readonly lockTimeoutMs?: number;
|
|
1998
|
-
/** Rewrite work budget in milliseconds, 1–60000; default 5000. */
|
|
1999
|
-
readonly workTimeoutMs?: number;
|
|
2000
|
-
/** Synchronous JSON-data transformation. A thrown error or invalid result rolls back the batch. */
|
|
2001
|
-
readonly redact: (record: StoredRecordErasureView) => StoredRecordErasureView;
|
|
2002
|
-
}
|
|
2003
|
-
type StoredRecordErasureOutcome = "erased" | "already_erased" | "active" | "not_found";
|
|
2004
|
-
interface EraseStoredRecordsResult {
|
|
2005
|
-
targets: Array<StoredRecordErasureTarget & {
|
|
2006
|
-
outcome: StoredRecordErasureOutcome;
|
|
2007
|
-
}>;
|
|
2008
|
-
/** Records processed, including records processed again by repeat erasure. */
|
|
2009
|
-
counts: Partial<Record<ErasureRecordKind, number>>;
|
|
2027
|
+
/** Exact durable key scope; an empty idempotency key is valid. */
|
|
2028
|
+
export interface SubmissionOutcomeKey {
|
|
2029
|
+
tenantId: string;
|
|
2030
|
+
spaceId: string;
|
|
2031
|
+
actionId: ActionId;
|
|
2032
|
+
idempotencyKey: string;
|
|
2010
2033
|
}
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
*/
|
|
2017
|
-
eraseStoredRecords(input: EraseStoredRecordsInput): Promise<EraseStoredRecordsResult>;
|
|
2034
|
+
export type StoredSubmissionOutcomeRecord = Readonly<SubmissionOutcomeKey & Pick<ActionInvocationRecord, "id" | "actionVersion" | "actorId" | "actorType" | "authorizationBindingId" | "idempotencyActorId" | "idempotencyAuthorizationBindingId" | "status" | "submissionRefusal" | "storedRecordsErased">>;
|
|
2035
|
+
export interface ReadSubmissionOutcomeInput extends SubmissionOutcomeKey {
|
|
2036
|
+
actorId: string;
|
|
2037
|
+
actorType: ActorType;
|
|
2038
|
+
authorizationBindingId?: string;
|
|
2018
2039
|
}
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2040
|
+
type ReceiptIdentity = {
|
|
2041
|
+
actionInvocationId: string;
|
|
2042
|
+
actionVersion: number;
|
|
2043
|
+
};
|
|
2044
|
+
export type ReadSubmissionOutcomeResult = {
|
|
2045
|
+
kind: "no_record";
|
|
2046
|
+
} | (ReceiptIdentity & {
|
|
2047
|
+
kind: "submission_refused";
|
|
2048
|
+
submissionRefusal: SubmissionRefusalDescriptor;
|
|
2049
|
+
}) | (ReceiptIdentity & {
|
|
2050
|
+
kind: "invocation";
|
|
2051
|
+
status: Exclude<ActionStatus, "submission_refused">;
|
|
2052
|
+
}) | (ReceiptIdentity & {
|
|
2053
|
+
kind: "records_erased";
|
|
2054
|
+
recordedStatus: ActionStatus;
|
|
2055
|
+
});
|
|
2056
|
+
export interface SubmissionOutcomeReader {
|
|
2057
|
+
readSubmissionOutcome(input: Readonly<ReadSubmissionOutcomeInput>): Promise<ReadSubmissionOutcomeResult>;
|
|
2022
2058
|
}
|
|
2023
|
-
export declare const HOST_RECORDS_ERASED_EVENT: "HostRecordsErased";
|
|
2024
|
-
/** Sentinel replacing required payload digests after stored-record erasure. */
|
|
2025
|
-
export declare const ERASED_DIGEST: "erased";
|
|
2026
2059
|
//#endregion
|
|
2027
2060
|
//#region src/host.d.ts
|
|
2028
|
-
export declare function createGovernedActionHost<TDb>(options: PlatformHostOptions<TDb>): GovernedActionHost & OutboxRequeueHost & ApprovalExpiryHost & ApprovalDecisionRecordingHost & StoredRecordErasureHost;
|
|
2061
|
+
export declare function createGovernedActionHost<TDb>(options: PlatformHostOptions<TDb>): SubmissionOutcomeReader & GovernedActionHost & OutboxRequeueHost & ApprovalExpiryHost & ApprovalDecisionRecordingHost & StoredRecordErasureHost;
|
|
2029
2062
|
//#endregion
|
|
2030
2063
|
//#region src/memory-store.d.ts
|
|
2031
2064
|
/**
|
|
@@ -2040,6 +2073,7 @@ export interface MemoryPlatformHostTransactionProvider<TDb> {
|
|
|
2040
2073
|
}
|
|
2041
2074
|
export declare class MemoryPlatformHostStore<TDb> implements ErasablePlatformHostStore<TDb>, RecoverablePlatformHostStore<TDb>, ApprovalPlatformHostStore<TDb>, GovernancePlatformHostStore<TDb>, OutboxPlatformHostStore<TDb>, OutboxRequeuePlatformHostStore<TDb>, StagedInvocationPlatformHostStore<TDb> {
|
|
2042
2075
|
readonly db: TDb;
|
|
2076
|
+
getSubmissionOutcomeByKey(key: Readonly<SubmissionOutcomeKey>): Promise<StoredSubmissionOutcomeRecord | undefined>;
|
|
2043
2077
|
readonly transactionalOutbox: boolean;
|
|
2044
2078
|
readonly transactionalApprovalLifecycle: boolean;
|
|
2045
2079
|
readonly transactionalApprovalAuthorization = true;
|
|
@@ -2291,6 +2325,7 @@ export declare class PostgresPlatformHostStore<TDb> implements ErasablePlatformH
|
|
|
2291
2325
|
ensureSchema(): Promise<void>;
|
|
2292
2326
|
eraseStoredRecords(request: EraseStoredRecordsInput): Promise<EraseStoredRecordsResult>;
|
|
2293
2327
|
transaction<TResult>(run: (db: TDb) => Promise<TResult>): Promise<TResult>;
|
|
2328
|
+
getSubmissionOutcomeByKey(key: Readonly<SubmissionOutcomeKey>): Promise<StoredSubmissionOutcomeRecord | undefined>;
|
|
2294
2329
|
createActionInvocation(input: CreateActionInvocationInput): Promise<ActionInvocationRecord>;
|
|
2295
2330
|
recordSubmissionRefusal(input: RecordSubmissionRefusalInput): Promise<ActionInvocationRecord>;
|
|
2296
2331
|
createActionInvocationForStagedLease(input: CreateStagedActionInvocationInput): Promise<CreateStagedActionInvocationResult>;
|
|
@@ -2925,4 +2960,17 @@ export declare function isConfirmedTransactionRollback(error: unknown): error is
|
|
|
2925
2960
|
/** Inspect up to 16 errors, failing closed on cycles or unreadable properties. Intended for handlerRetry.classify. */
|
|
2926
2961
|
export declare function isTransientPostgresTransactionError(error: unknown): boolean;
|
|
2927
2962
|
//#endregion
|
|
2963
|
+
//#region src/submission-outcome.d.ts
|
|
2964
|
+
export declare class SubmissionOutcomeUnsupportedError extends Error {
|
|
2965
|
+
constructor();
|
|
2966
|
+
}
|
|
2967
|
+
//#endregion
|
|
2968
|
+
//#region src/submission-outcome-conformance.d.ts
|
|
2969
|
+
/**
|
|
2970
|
+
* Isolated destructive probe with fresh identities and timestamps from new Date().
|
|
2971
|
+
* Refusal and erasure sections run only with their respective store capabilities;
|
|
2972
|
+
* returned evidence identifies each unexercised optional section with `skipped:`.
|
|
2973
|
+
*/
|
|
2974
|
+
export declare function checkSubmissionOutcomeStore(store: PlatformHostStore<unknown>): Promise<string[]>;
|
|
2975
|
+
//#endregion
|
|
2928
2976
|
export { type ErasablePlatformHostStore, type EraseStoredRecordsInput, type EraseStoredRecordsResult, type ErasurePayloadFields, type ErasureRecordKind, type StoredRecordErasureAuthorizationInput, type StoredRecordErasureHost, type StoredRecordErasureOutcome, type StoredRecordErasureTarget, type StoredRecordErasureView, canonicalJson };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,79 @@
|
|
|
1
1
|
import { ActionDefinition, ActionId, ActionStatus, ActorType, AdapterCircuitBreakerProvider, AdapterImplementation, AgentActionPolicyContext, AgentActionPolicyDecision, AgentActionRiskTier, AgentActionRoute, AssetEventEnvelope, EvidencePacketReference, ExecutionAttestation, ExecutionPrincipal, ExternalReconciliation, FabricRuntimeServices, GovernanceRuntimeEvidence, ModuleRegistry, MutationFootprint, MutationGovernanceResolver, PolicyObligation, PolicyObligationStatus, PolicyOutcome, RuntimePolicyDefinition, StagedInvocationRequest, canonicalJson } from "@fabricorg/platform";
|
|
2
2
|
import { AssemblyLockfile } from "@fabricorg/assembly";
|
|
3
|
+
//#region src/erasure-types.d.ts
|
|
4
|
+
type StoredRecordErasureTarget = {
|
|
5
|
+
readonly kind: "invocation";
|
|
6
|
+
readonly invocationId: string;
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: "event";
|
|
9
|
+
readonly eventId: string;
|
|
10
|
+
};
|
|
11
|
+
interface ErasurePayloadFields {
|
|
12
|
+
invocation: "parameters" | "result" | "error" | "provenance" | "authorizationBinding" | "authorizationReconciliation" | "adapterReconciliation" | "hitlReason" | "approvalDecision" | "mutationFootprint" | "executionPrincipal" | "runtimeEvidence" | "pendingCompletion" | "externalCompletion" | "pendingStateTransition" | "finalizationCheckpoint" | "approvalExpiry" | "agentProposal" | "submissionRefusal";
|
|
13
|
+
adapter: "input" | "output" | "error" | "reconciliation";
|
|
14
|
+
staged: "parameters" | "lastError";
|
|
15
|
+
policy_evaluation: "outcome";
|
|
16
|
+
policy_obligation: "description" | "evidenceReferences" | "metadata";
|
|
17
|
+
execution_attestation: "attestation";
|
|
18
|
+
external_reconciliation: "reconciliation";
|
|
19
|
+
event: "payload" | "provenance";
|
|
20
|
+
outbox: "lastError" | "traceContext" | "payload" | "provenance";
|
|
21
|
+
outbox_requeue: "reason" | "priorLastError";
|
|
22
|
+
}
|
|
23
|
+
type ErasureRecordKind = keyof ErasurePayloadFields;
|
|
24
|
+
/** Protected nested keys are omitted from the callback; stores restore structure and overwrite payload digests. */
|
|
25
|
+
type StoredRecordErasureView = { [K in ErasureRecordKind]: {
|
|
26
|
+
readonly kind: K;
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly tenantId: string;
|
|
29
|
+
readonly spaceId: string;
|
|
30
|
+
readonly invocationId?: string;
|
|
31
|
+
readonly eventId?: string;
|
|
32
|
+
readonly eventType?: string;
|
|
33
|
+
fields: Partial<Record<ErasurePayloadFields[K], unknown>>;
|
|
34
|
+
}; }[ErasureRecordKind];
|
|
35
|
+
/** Validated identifying facts sent to the application authorizer; no stored payload or callback. */
|
|
36
|
+
interface StoredRecordErasureAuthorizationInput {
|
|
37
|
+
/** Trusted operator identity supplied by the authenticated application session. */
|
|
38
|
+
readonly actorId: string;
|
|
39
|
+
readonly actorType: ActorType;
|
|
40
|
+
readonly tenantId: string;
|
|
41
|
+
readonly spaceId: string;
|
|
42
|
+
readonly requestId: string;
|
|
43
|
+
readonly targets: readonly StoredRecordErasureTarget[];
|
|
44
|
+
}
|
|
45
|
+
interface EraseStoredRecordsInput extends StoredRecordErasureAuthorizationInput {
|
|
46
|
+
/** Target-lock acquisition budget in milliseconds, 1–60000; default 250. */
|
|
47
|
+
readonly lockTimeoutMs?: number;
|
|
48
|
+
/** Rewrite work budget in milliseconds, 1–60000; default 5000. */
|
|
49
|
+
readonly workTimeoutMs?: number;
|
|
50
|
+
/** Synchronous JSON-data transformation. A thrown error or invalid result rolls back the batch. */
|
|
51
|
+
readonly redact: (record: StoredRecordErasureView) => StoredRecordErasureView;
|
|
52
|
+
}
|
|
53
|
+
type StoredRecordErasureOutcome = "erased" | "already_erased" | "active" | "not_found";
|
|
54
|
+
interface EraseStoredRecordsResult {
|
|
55
|
+
targets: Array<StoredRecordErasureTarget & {
|
|
56
|
+
outcome: StoredRecordErasureOutcome;
|
|
57
|
+
}>;
|
|
58
|
+
/** Records processed, including records processed again by repeat erasure. */
|
|
59
|
+
counts: Partial<Record<ErasureRecordKind, number>>;
|
|
60
|
+
}
|
|
61
|
+
interface ErasablePlatformHostStore<TDb> extends PlatformHostStore<TDb> {
|
|
62
|
+
/**
|
|
63
|
+
* Unauthenticated storage port, not an authorization boundary; callers must enforce authorization.
|
|
64
|
+
* Atomic rewrite/marker/audit operation. The audit retains actorId/actorType as identifying metadata.
|
|
65
|
+
* Invocation reads expose storedRecordsErased after commit.
|
|
66
|
+
*/
|
|
67
|
+
eraseStoredRecords(input: EraseStoredRecordsInput): Promise<EraseStoredRecordsResult>;
|
|
68
|
+
}
|
|
69
|
+
interface StoredRecordErasureHost {
|
|
70
|
+
/** Throws StoredRecordErasureAuthorizationError (not_authorized) before store access on authorization refusal. */
|
|
71
|
+
eraseStoredRecords(input: EraseStoredRecordsInput): Promise<EraseStoredRecordsResult>;
|
|
72
|
+
}
|
|
73
|
+
export declare const HOST_RECORDS_ERASED_EVENT: "HostRecordsErased";
|
|
74
|
+
/** Sentinel replacing required payload digests after stored-record erasure. */
|
|
75
|
+
export declare const ERASED_DIGEST: "erased";
|
|
76
|
+
//#endregion
|
|
3
77
|
//#region src/observability.d.ts
|
|
4
78
|
/** Version of the vendor-neutral health/readiness contract. */
|
|
5
79
|
export declare const PLATFORM_HOST_HEALTH_CONTRACT_VERSION: 1;
|
|
@@ -641,6 +715,7 @@ export interface AdapterInvocationWriteInput {
|
|
|
641
715
|
};
|
|
642
716
|
}
|
|
643
717
|
export interface PlatformHostStore<TDb> {
|
|
718
|
+
getSubmissionOutcomeByKey?(key: Readonly<SubmissionOutcomeKey>): Promise<StoredSubmissionOutcomeRecord | undefined>;
|
|
644
719
|
readonly db: TDb;
|
|
645
720
|
/**
|
|
646
721
|
* Run against the store's domain handle. This base seam does not promise a
|
|
@@ -1949,83 +2024,41 @@ export interface OutboxRequeueHost {
|
|
|
1949
2024
|
*/
|
|
1950
2025
|
requeueOutboxDeadLetter(input: RequeueOutboxDeadLetterInput): Promise<RequeueOutboxDeadLetterResult>;
|
|
1951
2026
|
}
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
readonly kind: "event";
|
|
1959
|
-
readonly eventId: string;
|
|
1960
|
-
};
|
|
1961
|
-
interface ErasurePayloadFields {
|
|
1962
|
-
invocation: "parameters" | "result" | "error" | "provenance" | "authorizationBinding" | "authorizationReconciliation" | "adapterReconciliation" | "hitlReason" | "approvalDecision" | "mutationFootprint" | "executionPrincipal" | "runtimeEvidence" | "pendingCompletion" | "externalCompletion" | "pendingStateTransition" | "finalizationCheckpoint" | "approvalExpiry" | "agentProposal" | "submissionRefusal";
|
|
1963
|
-
adapter: "input" | "output" | "error" | "reconciliation";
|
|
1964
|
-
staged: "parameters" | "lastError";
|
|
1965
|
-
policy_evaluation: "outcome";
|
|
1966
|
-
policy_obligation: "description" | "evidenceReferences" | "metadata";
|
|
1967
|
-
execution_attestation: "attestation";
|
|
1968
|
-
external_reconciliation: "reconciliation";
|
|
1969
|
-
event: "payload" | "provenance";
|
|
1970
|
-
outbox: "lastError" | "traceContext" | "payload" | "provenance";
|
|
1971
|
-
outbox_requeue: "reason" | "priorLastError";
|
|
1972
|
-
}
|
|
1973
|
-
type ErasureRecordKind = keyof ErasurePayloadFields;
|
|
1974
|
-
/** Protected nested keys are omitted from the callback; stores restore structure and overwrite payload digests. */
|
|
1975
|
-
type StoredRecordErasureView = { [K in ErasureRecordKind]: {
|
|
1976
|
-
readonly kind: K;
|
|
1977
|
-
readonly id: string;
|
|
1978
|
-
readonly tenantId: string;
|
|
1979
|
-
readonly spaceId: string;
|
|
1980
|
-
readonly invocationId?: string;
|
|
1981
|
-
readonly eventId?: string;
|
|
1982
|
-
readonly eventType?: string;
|
|
1983
|
-
fields: Partial<Record<ErasurePayloadFields[K], unknown>>;
|
|
1984
|
-
}; }[ErasureRecordKind];
|
|
1985
|
-
/** Validated identifying facts sent to the application authorizer; no stored payload or callback. */
|
|
1986
|
-
interface StoredRecordErasureAuthorizationInput {
|
|
1987
|
-
/** Trusted operator identity supplied by the authenticated application session. */
|
|
1988
|
-
readonly actorId: string;
|
|
1989
|
-
readonly actorType: ActorType;
|
|
1990
|
-
readonly tenantId: string;
|
|
1991
|
-
readonly spaceId: string;
|
|
1992
|
-
readonly requestId: string;
|
|
1993
|
-
readonly targets: readonly StoredRecordErasureTarget[];
|
|
1994
|
-
}
|
|
1995
|
-
interface EraseStoredRecordsInput extends StoredRecordErasureAuthorizationInput {
|
|
1996
|
-
/** Target-lock acquisition budget in milliseconds, 1–60000; default 250. */
|
|
1997
|
-
readonly lockTimeoutMs?: number;
|
|
1998
|
-
/** Rewrite work budget in milliseconds, 1–60000; default 5000. */
|
|
1999
|
-
readonly workTimeoutMs?: number;
|
|
2000
|
-
/** Synchronous JSON-data transformation. A thrown error or invalid result rolls back the batch. */
|
|
2001
|
-
readonly redact: (record: StoredRecordErasureView) => StoredRecordErasureView;
|
|
2002
|
-
}
|
|
2003
|
-
type StoredRecordErasureOutcome = "erased" | "already_erased" | "active" | "not_found";
|
|
2004
|
-
interface EraseStoredRecordsResult {
|
|
2005
|
-
targets: Array<StoredRecordErasureTarget & {
|
|
2006
|
-
outcome: StoredRecordErasureOutcome;
|
|
2007
|
-
}>;
|
|
2008
|
-
/** Records processed, including records processed again by repeat erasure. */
|
|
2009
|
-
counts: Partial<Record<ErasureRecordKind, number>>;
|
|
2027
|
+
/** Exact durable key scope; an empty idempotency key is valid. */
|
|
2028
|
+
export interface SubmissionOutcomeKey {
|
|
2029
|
+
tenantId: string;
|
|
2030
|
+
spaceId: string;
|
|
2031
|
+
actionId: ActionId;
|
|
2032
|
+
idempotencyKey: string;
|
|
2010
2033
|
}
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
*/
|
|
2017
|
-
eraseStoredRecords(input: EraseStoredRecordsInput): Promise<EraseStoredRecordsResult>;
|
|
2034
|
+
export type StoredSubmissionOutcomeRecord = Readonly<SubmissionOutcomeKey & Pick<ActionInvocationRecord, "id" | "actionVersion" | "actorId" | "actorType" | "authorizationBindingId" | "idempotencyActorId" | "idempotencyAuthorizationBindingId" | "status" | "submissionRefusal" | "storedRecordsErased">>;
|
|
2035
|
+
export interface ReadSubmissionOutcomeInput extends SubmissionOutcomeKey {
|
|
2036
|
+
actorId: string;
|
|
2037
|
+
actorType: ActorType;
|
|
2038
|
+
authorizationBindingId?: string;
|
|
2018
2039
|
}
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2040
|
+
type ReceiptIdentity = {
|
|
2041
|
+
actionInvocationId: string;
|
|
2042
|
+
actionVersion: number;
|
|
2043
|
+
};
|
|
2044
|
+
export type ReadSubmissionOutcomeResult = {
|
|
2045
|
+
kind: "no_record";
|
|
2046
|
+
} | (ReceiptIdentity & {
|
|
2047
|
+
kind: "submission_refused";
|
|
2048
|
+
submissionRefusal: SubmissionRefusalDescriptor;
|
|
2049
|
+
}) | (ReceiptIdentity & {
|
|
2050
|
+
kind: "invocation";
|
|
2051
|
+
status: Exclude<ActionStatus, "submission_refused">;
|
|
2052
|
+
}) | (ReceiptIdentity & {
|
|
2053
|
+
kind: "records_erased";
|
|
2054
|
+
recordedStatus: ActionStatus;
|
|
2055
|
+
});
|
|
2056
|
+
export interface SubmissionOutcomeReader {
|
|
2057
|
+
readSubmissionOutcome(input: Readonly<ReadSubmissionOutcomeInput>): Promise<ReadSubmissionOutcomeResult>;
|
|
2022
2058
|
}
|
|
2023
|
-
export declare const HOST_RECORDS_ERASED_EVENT: "HostRecordsErased";
|
|
2024
|
-
/** Sentinel replacing required payload digests after stored-record erasure. */
|
|
2025
|
-
export declare const ERASED_DIGEST: "erased";
|
|
2026
2059
|
//#endregion
|
|
2027
2060
|
//#region src/host.d.ts
|
|
2028
|
-
export declare function createGovernedActionHost<TDb>(options: PlatformHostOptions<TDb>): GovernedActionHost & OutboxRequeueHost & ApprovalExpiryHost & ApprovalDecisionRecordingHost & StoredRecordErasureHost;
|
|
2061
|
+
export declare function createGovernedActionHost<TDb>(options: PlatformHostOptions<TDb>): SubmissionOutcomeReader & GovernedActionHost & OutboxRequeueHost & ApprovalExpiryHost & ApprovalDecisionRecordingHost & StoredRecordErasureHost;
|
|
2029
2062
|
//#endregion
|
|
2030
2063
|
//#region src/memory-store.d.ts
|
|
2031
2064
|
/**
|
|
@@ -2040,6 +2073,7 @@ export interface MemoryPlatformHostTransactionProvider<TDb> {
|
|
|
2040
2073
|
}
|
|
2041
2074
|
export declare class MemoryPlatformHostStore<TDb> implements ErasablePlatformHostStore<TDb>, RecoverablePlatformHostStore<TDb>, ApprovalPlatformHostStore<TDb>, GovernancePlatformHostStore<TDb>, OutboxPlatformHostStore<TDb>, OutboxRequeuePlatformHostStore<TDb>, StagedInvocationPlatformHostStore<TDb> {
|
|
2042
2075
|
readonly db: TDb;
|
|
2076
|
+
getSubmissionOutcomeByKey(key: Readonly<SubmissionOutcomeKey>): Promise<StoredSubmissionOutcomeRecord | undefined>;
|
|
2043
2077
|
readonly transactionalOutbox: boolean;
|
|
2044
2078
|
readonly transactionalApprovalLifecycle: boolean;
|
|
2045
2079
|
readonly transactionalApprovalAuthorization = true;
|
|
@@ -2291,6 +2325,7 @@ export declare class PostgresPlatformHostStore<TDb> implements ErasablePlatformH
|
|
|
2291
2325
|
ensureSchema(): Promise<void>;
|
|
2292
2326
|
eraseStoredRecords(request: EraseStoredRecordsInput): Promise<EraseStoredRecordsResult>;
|
|
2293
2327
|
transaction<TResult>(run: (db: TDb) => Promise<TResult>): Promise<TResult>;
|
|
2328
|
+
getSubmissionOutcomeByKey(key: Readonly<SubmissionOutcomeKey>): Promise<StoredSubmissionOutcomeRecord | undefined>;
|
|
2294
2329
|
createActionInvocation(input: CreateActionInvocationInput): Promise<ActionInvocationRecord>;
|
|
2295
2330
|
recordSubmissionRefusal(input: RecordSubmissionRefusalInput): Promise<ActionInvocationRecord>;
|
|
2296
2331
|
createActionInvocationForStagedLease(input: CreateStagedActionInvocationInput): Promise<CreateStagedActionInvocationResult>;
|
|
@@ -2925,4 +2960,17 @@ export declare function isConfirmedTransactionRollback(error: unknown): error is
|
|
|
2925
2960
|
/** Inspect up to 16 errors, failing closed on cycles or unreadable properties. Intended for handlerRetry.classify. */
|
|
2926
2961
|
export declare function isTransientPostgresTransactionError(error: unknown): boolean;
|
|
2927
2962
|
//#endregion
|
|
2963
|
+
//#region src/submission-outcome.d.ts
|
|
2964
|
+
export declare class SubmissionOutcomeUnsupportedError extends Error {
|
|
2965
|
+
constructor();
|
|
2966
|
+
}
|
|
2967
|
+
//#endregion
|
|
2968
|
+
//#region src/submission-outcome-conformance.d.ts
|
|
2969
|
+
/**
|
|
2970
|
+
* Isolated destructive probe with fresh identities and timestamps from new Date().
|
|
2971
|
+
* Refusal and erasure sections run only with their respective store capabilities;
|
|
2972
|
+
* returned evidence identifies each unexercised optional section with `skipped:`.
|
|
2973
|
+
*/
|
|
2974
|
+
export declare function checkSubmissionOutcomeStore(store: PlatformHostStore<unknown>): Promise<string[]>;
|
|
2975
|
+
//#endregion
|
|
2928
2976
|
export { type ErasablePlatformHostStore, type EraseStoredRecordsInput, type EraseStoredRecordsResult, type ErasurePayloadFields, type ErasureRecordKind, type StoredRecordErasureAuthorizationInput, type StoredRecordErasureHost, type StoredRecordErasureOutcome, type StoredRecordErasureTarget, type StoredRecordErasureView, canonicalJson };
|