@fabricorg/platform-host 8.5.0 → 8.7.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 +16 -0
- package/README.md +88 -12
- package/dist/index.cjs +178 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -4
- package/dist/index.d.ts +34 -4
- package/dist/index.js +179 -54
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionDefinition, ActionId, ActionStatus, ActorType, AdapterCircuitBreakerProvider, AdapterImplementation,
|
|
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
3
|
//#region src/observability.d.ts
|
|
4
4
|
/** Version of the vendor-neutral health/readiness contract. */
|
|
@@ -183,7 +183,7 @@ export interface IdempotencyConflict {
|
|
|
183
183
|
code: "IDEMPOTENCY_CONFLICT";
|
|
184
184
|
idempotencyKey: string;
|
|
185
185
|
existingInvocationId: string;
|
|
186
|
-
reasons: Array<"actor" | "authority_binding" | "action_version" | "parameters">;
|
|
186
|
+
reasons: Array<"actor" | "authority_binding" | "action_version" | "parameters" | "agent_proposal">;
|
|
187
187
|
}
|
|
188
188
|
export declare class IdempotencyConflictError extends Error {
|
|
189
189
|
readonly conflict: IdempotencyConflict;
|
|
@@ -275,8 +275,24 @@ export interface FinalizationCheckpoint {
|
|
|
275
275
|
export interface StagedInvocationOrigin {
|
|
276
276
|
parentInvocationId: string;
|
|
277
277
|
stageKey: string;
|
|
278
|
+
/** Host-registered principal name captured in the durable staged intent. */
|
|
279
|
+
principal?: string;
|
|
280
|
+
}
|
|
281
|
+
export interface AgentProposal {
|
|
282
|
+
confidence?: number;
|
|
283
|
+
riskTier?: AgentActionRiskTier;
|
|
284
|
+
agentSessionId?: string;
|
|
285
|
+
agentRunId?: string;
|
|
286
|
+
reason?: string;
|
|
287
|
+
evidence?: ApprovalEvidence;
|
|
288
|
+
}
|
|
289
|
+
export interface HostHitlEvaluatorContext extends AgentActionPolicyContext {
|
|
290
|
+
actionInvocationId: string;
|
|
291
|
+
/** The durable (post-redaction) invocation record as read before evaluation. */
|
|
292
|
+
invocation: Readonly<ActionInvocationRecord>;
|
|
278
293
|
}
|
|
279
294
|
export interface ActionInvocationRecord {
|
|
295
|
+
readonly agentProposal?: AgentProposal;
|
|
280
296
|
id: string;
|
|
281
297
|
tenantId: string;
|
|
282
298
|
spaceId: string;
|
|
@@ -743,6 +759,8 @@ export interface StagedInvocationRecord {
|
|
|
743
759
|
parentActionId: ActionId;
|
|
744
760
|
key: string;
|
|
745
761
|
actionId: ActionId;
|
|
762
|
+
/** Host-registered principal name selected by the parent action declaration. */
|
|
763
|
+
principal?: string;
|
|
746
764
|
expectedActionVersion: number;
|
|
747
765
|
parameters: Record<string, unknown>;
|
|
748
766
|
parameterDigest: string;
|
|
@@ -1335,9 +1353,12 @@ export interface PlatformActionDispatcher {
|
|
|
1335
1353
|
* `provenance` and `authorizationBinding` are also read once there and
|
|
1336
1354
|
* replaced by Host's own copies. For any other action Host uses those three
|
|
1337
1355
|
* as the caller's objects, read where and as often as before (README,
|
|
1338
|
-
* "Submission snapshot").
|
|
1356
|
+
* "Submission snapshot"). `agentProposal` is read once and deeply copied before
|
|
1357
|
+
* the first await for all actions, independently of `admitSubmission`.
|
|
1339
1358
|
*/
|
|
1340
1359
|
export interface SubmitActionInput {
|
|
1360
|
+
/** Read once and deeply copied before the first await, regardless of admission. */
|
|
1361
|
+
agentProposal?: AgentProposal;
|
|
1341
1362
|
actionId: ActionId;
|
|
1342
1363
|
parameters: Record<string, unknown>;
|
|
1343
1364
|
tenantId: string;
|
|
@@ -1481,6 +1502,11 @@ export interface PlatformHostOptions<TDb> {
|
|
|
1481
1502
|
registry?: Pick<ModuleRegistry<TDb>, "resolveAction" | "resolvePolicy" | "resolveStateMachine"> & Partial<Pick<ModuleRegistry<TDb>, "orderedModules">>;
|
|
1482
1503
|
/** Resolve vertical- or runtime-local actions without mutating the process-wide registry. */
|
|
1483
1504
|
resolveAction?: (actionId: ActionId) => ActionDefinition<TDb> | undefined;
|
|
1505
|
+
/** Host-owned identities available to parent action declarations for staged dispatch. */
|
|
1506
|
+
stagedInvocationPrincipals?: Readonly<Record<string, {
|
|
1507
|
+
actorId: string;
|
|
1508
|
+
actorType: ActorType;
|
|
1509
|
+
}>>;
|
|
1484
1510
|
adapters?: readonly AdapterImplementation[];
|
|
1485
1511
|
/**
|
|
1486
1512
|
* Supplies the circuit breaker for each adapter call. Defaults to a new
|
|
@@ -1550,7 +1576,7 @@ export interface PlatformHostOptions<TDb> {
|
|
|
1550
1576
|
shouldPublish?(event: AssetEventEnvelope): boolean;
|
|
1551
1577
|
};
|
|
1552
1578
|
/** Optional vertical-owned evaluator. When absent, agent behavior is unchanged. */
|
|
1553
|
-
hitlEvaluator?: (context:
|
|
1579
|
+
hitlEvaluator?: (context: HostHitlEvaluatorContext) => HostHitlDecision | Promise<HostHitlDecision>;
|
|
1554
1580
|
/** Positive integer milliseconds, used when the evaluator supplies no absolute deadline. */
|
|
1555
1581
|
approvalDefaultTtlMs?: number;
|
|
1556
1582
|
/** Atomic approval lifecycle events and outbox writes; defaults to false. */
|
|
@@ -1607,6 +1633,8 @@ export interface PlatformHostOptions<TDb> {
|
|
|
1607
1633
|
* copy, after the check admitted the submission.
|
|
1608
1634
|
*/
|
|
1609
1635
|
redactActionParameters?: (actionId: ActionId, parameters: Record<string, unknown>) => Record<string, unknown>;
|
|
1636
|
+
/** Runs beside parameter redaction; output is validated and copied before persistence. */
|
|
1637
|
+
redactAgentProposal?: (actionId: ActionId, proposal: AgentProposal) => AgentProposal;
|
|
1610
1638
|
/**
|
|
1611
1639
|
* The bound on an action's `admitSubmission` check. An answer that
|
|
1612
1640
|
* settles this many milliseconds or more after the check was called,
|
|
@@ -2214,11 +2242,13 @@ export declare const MAX_STAGED_INVOCATION_KEY_LENGTH = 128;
|
|
|
2214
2242
|
export declare const MAX_STAGED_INVOCATION_BYTES: number;
|
|
2215
2243
|
export declare const MAX_STAGED_INVOCATION_BATCH_BYTES: number;
|
|
2216
2244
|
export declare const STAGED_INVOCATION_KEY_PATTERN: RegExp;
|
|
2245
|
+
export declare const STAGED_INVOCATION_PRINCIPAL_PATTERN: RegExp;
|
|
2217
2246
|
interface PrepareStagedInvocationBatchInput<TDb> {
|
|
2218
2247
|
parent: Pick<ActionInvocationRecord, "id" | "tenantId" | "spaceId" | "actionId">;
|
|
2219
2248
|
parentAction: ActionDefinition<TDb>;
|
|
2220
2249
|
requests: readonly StagedInvocationRequest[];
|
|
2221
2250
|
resolveAction(actionId: ActionId): ActionDefinition<TDb> | undefined;
|
|
2251
|
+
stagedInvocationPrincipals?: Readonly<Record<string, unknown>>;
|
|
2222
2252
|
redactParameters?(actionId: ActionId, parameters: Record<string, unknown>): Record<string, unknown>;
|
|
2223
2253
|
/** Keys whose parameters already passed the redactor into a durable checkpoint. */
|
|
2224
2254
|
redactedKeys?: readonly string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionDefinition, ActionId, ActionStatus, ActorType, AdapterCircuitBreakerProvider, AdapterImplementation,
|
|
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
3
|
//#region src/observability.d.ts
|
|
4
4
|
/** Version of the vendor-neutral health/readiness contract. */
|
|
@@ -183,7 +183,7 @@ export interface IdempotencyConflict {
|
|
|
183
183
|
code: "IDEMPOTENCY_CONFLICT";
|
|
184
184
|
idempotencyKey: string;
|
|
185
185
|
existingInvocationId: string;
|
|
186
|
-
reasons: Array<"actor" | "authority_binding" | "action_version" | "parameters">;
|
|
186
|
+
reasons: Array<"actor" | "authority_binding" | "action_version" | "parameters" | "agent_proposal">;
|
|
187
187
|
}
|
|
188
188
|
export declare class IdempotencyConflictError extends Error {
|
|
189
189
|
readonly conflict: IdempotencyConflict;
|
|
@@ -275,8 +275,24 @@ export interface FinalizationCheckpoint {
|
|
|
275
275
|
export interface StagedInvocationOrigin {
|
|
276
276
|
parentInvocationId: string;
|
|
277
277
|
stageKey: string;
|
|
278
|
+
/** Host-registered principal name captured in the durable staged intent. */
|
|
279
|
+
principal?: string;
|
|
280
|
+
}
|
|
281
|
+
export interface AgentProposal {
|
|
282
|
+
confidence?: number;
|
|
283
|
+
riskTier?: AgentActionRiskTier;
|
|
284
|
+
agentSessionId?: string;
|
|
285
|
+
agentRunId?: string;
|
|
286
|
+
reason?: string;
|
|
287
|
+
evidence?: ApprovalEvidence;
|
|
288
|
+
}
|
|
289
|
+
export interface HostHitlEvaluatorContext extends AgentActionPolicyContext {
|
|
290
|
+
actionInvocationId: string;
|
|
291
|
+
/** The durable (post-redaction) invocation record as read before evaluation. */
|
|
292
|
+
invocation: Readonly<ActionInvocationRecord>;
|
|
278
293
|
}
|
|
279
294
|
export interface ActionInvocationRecord {
|
|
295
|
+
readonly agentProposal?: AgentProposal;
|
|
280
296
|
id: string;
|
|
281
297
|
tenantId: string;
|
|
282
298
|
spaceId: string;
|
|
@@ -743,6 +759,8 @@ export interface StagedInvocationRecord {
|
|
|
743
759
|
parentActionId: ActionId;
|
|
744
760
|
key: string;
|
|
745
761
|
actionId: ActionId;
|
|
762
|
+
/** Host-registered principal name selected by the parent action declaration. */
|
|
763
|
+
principal?: string;
|
|
746
764
|
expectedActionVersion: number;
|
|
747
765
|
parameters: Record<string, unknown>;
|
|
748
766
|
parameterDigest: string;
|
|
@@ -1335,9 +1353,12 @@ export interface PlatformActionDispatcher {
|
|
|
1335
1353
|
* `provenance` and `authorizationBinding` are also read once there and
|
|
1336
1354
|
* replaced by Host's own copies. For any other action Host uses those three
|
|
1337
1355
|
* as the caller's objects, read where and as often as before (README,
|
|
1338
|
-
* "Submission snapshot").
|
|
1356
|
+
* "Submission snapshot"). `agentProposal` is read once and deeply copied before
|
|
1357
|
+
* the first await for all actions, independently of `admitSubmission`.
|
|
1339
1358
|
*/
|
|
1340
1359
|
export interface SubmitActionInput {
|
|
1360
|
+
/** Read once and deeply copied before the first await, regardless of admission. */
|
|
1361
|
+
agentProposal?: AgentProposal;
|
|
1341
1362
|
actionId: ActionId;
|
|
1342
1363
|
parameters: Record<string, unknown>;
|
|
1343
1364
|
tenantId: string;
|
|
@@ -1481,6 +1502,11 @@ export interface PlatformHostOptions<TDb> {
|
|
|
1481
1502
|
registry?: Pick<ModuleRegistry<TDb>, "resolveAction" | "resolvePolicy" | "resolveStateMachine"> & Partial<Pick<ModuleRegistry<TDb>, "orderedModules">>;
|
|
1482
1503
|
/** Resolve vertical- or runtime-local actions without mutating the process-wide registry. */
|
|
1483
1504
|
resolveAction?: (actionId: ActionId) => ActionDefinition<TDb> | undefined;
|
|
1505
|
+
/** Host-owned identities available to parent action declarations for staged dispatch. */
|
|
1506
|
+
stagedInvocationPrincipals?: Readonly<Record<string, {
|
|
1507
|
+
actorId: string;
|
|
1508
|
+
actorType: ActorType;
|
|
1509
|
+
}>>;
|
|
1484
1510
|
adapters?: readonly AdapterImplementation[];
|
|
1485
1511
|
/**
|
|
1486
1512
|
* Supplies the circuit breaker for each adapter call. Defaults to a new
|
|
@@ -1550,7 +1576,7 @@ export interface PlatformHostOptions<TDb> {
|
|
|
1550
1576
|
shouldPublish?(event: AssetEventEnvelope): boolean;
|
|
1551
1577
|
};
|
|
1552
1578
|
/** Optional vertical-owned evaluator. When absent, agent behavior is unchanged. */
|
|
1553
|
-
hitlEvaluator?: (context:
|
|
1579
|
+
hitlEvaluator?: (context: HostHitlEvaluatorContext) => HostHitlDecision | Promise<HostHitlDecision>;
|
|
1554
1580
|
/** Positive integer milliseconds, used when the evaluator supplies no absolute deadline. */
|
|
1555
1581
|
approvalDefaultTtlMs?: number;
|
|
1556
1582
|
/** Atomic approval lifecycle events and outbox writes; defaults to false. */
|
|
@@ -1607,6 +1633,8 @@ export interface PlatformHostOptions<TDb> {
|
|
|
1607
1633
|
* copy, after the check admitted the submission.
|
|
1608
1634
|
*/
|
|
1609
1635
|
redactActionParameters?: (actionId: ActionId, parameters: Record<string, unknown>) => Record<string, unknown>;
|
|
1636
|
+
/** Runs beside parameter redaction; output is validated and copied before persistence. */
|
|
1637
|
+
redactAgentProposal?: (actionId: ActionId, proposal: AgentProposal) => AgentProposal;
|
|
1610
1638
|
/**
|
|
1611
1639
|
* The bound on an action's `admitSubmission` check. An answer that
|
|
1612
1640
|
* settles this many milliseconds or more after the check was called,
|
|
@@ -2214,11 +2242,13 @@ export declare const MAX_STAGED_INVOCATION_KEY_LENGTH = 128;
|
|
|
2214
2242
|
export declare const MAX_STAGED_INVOCATION_BYTES: number;
|
|
2215
2243
|
export declare const MAX_STAGED_INVOCATION_BATCH_BYTES: number;
|
|
2216
2244
|
export declare const STAGED_INVOCATION_KEY_PATTERN: RegExp;
|
|
2245
|
+
export declare const STAGED_INVOCATION_PRINCIPAL_PATTERN: RegExp;
|
|
2217
2246
|
interface PrepareStagedInvocationBatchInput<TDb> {
|
|
2218
2247
|
parent: Pick<ActionInvocationRecord, "id" | "tenantId" | "spaceId" | "actionId">;
|
|
2219
2248
|
parentAction: ActionDefinition<TDb>;
|
|
2220
2249
|
requests: readonly StagedInvocationRequest[];
|
|
2221
2250
|
resolveAction(actionId: ActionId): ActionDefinition<TDb> | undefined;
|
|
2251
|
+
stagedInvocationPrincipals?: Readonly<Record<string, unknown>>;
|
|
2222
2252
|
redactParameters?(actionId: ActionId, parameters: Record<string, unknown>): Record<string, unknown>;
|
|
2223
2253
|
/** Keys whose parameters already passed the redactor into a durable checkpoint. */
|
|
2224
2254
|
redactedKeys?: readonly string[];
|