@adcp/sdk API Reference - v7.9.0
    Preparing search index...

    Class GovernanceMiddleware

    Index

    Constructors

    • Parameters

      • governanceConfig: GovernanceConfig
      • OptionalonActivity: (activity: Activity) => void | Promise<void>
      • OptionaladcpVersion: string

        Buyer's per-instance AdCP version pin. Forwarded to the governance agent's ProtocolClient.callTool so a buyer pinned to e.g. '4.0.0-beta.1' doesn't silently fall back to the SDK default ADCP_MAJOR_VERSION constant when calling the governance agent. Defaults to undefined, which ProtocolClient.callTool resolves to the SDK constant — same shape as a no-pin call.

      Returns GovernanceMiddleware

    Accessors

    Methods

    • Run a proposed governance check before sending a tool call to a seller.

      Returns the governance result. The caller decides how to handle each status:

      • approved: proceed with execution (params may be modified by conditions)
      • denied: do not execute

      When conditions are returned with required_value, this method auto-applies them and re-checks, up to maxConditionsIterations.

      Parameters

      Returns Promise<{ result: GovernanceCheckResult; params: Record<string, unknown> }>

    • Report the outcome of a tool execution to the governance agent. Called after the seller responds (success or failure).

      Parameters

      • checkId: string
      • outcome: OutcomeType
      • OptionalsellerResponse: Record<string, unknown>
      • Optionalerror: { code?: string; message: string }
      • debugLogs: GovernanceDebugEntry[] = []
      • OptionalgovernanceContext: string

      Returns Promise<GovernanceOutcome | undefined>