Deterministically bind authorization or review to the exact JSON-compatible action that will execute.
exact-action-binding is a small host-side integrity tool from InterAI Labs. It creates a stable SHA-256 digest for a proposed action and lets you verify immediately before a side effect that the action has not changed.
import { createActionBinding, assertActionMatches } from "./index.mjs";
const action = {
tool: "wallet.sign",
args: { chainId: 8453, to: "0x...", amount: "10.00" },
};
const binding = createActionBinding(action);
// Immediately before the consequential side effect:
assertActionMatches(binding, action);An authorization is meaningful only if it still refers to the action that is actually going to execute. Arguments, destinations, amounts, tool names or nested data can be changed after review or after a remote decision.
This library gives the host a simple mutation-detection boundary:
proposed action
|
v
create binding
|
v
review / policy / authorization
|
v
rebuild final action
|
v
assert exact match
|
match? ---- no ---> stop and obtain a new decision
|
yes
v
execute
- object keys are sorted recursively before hashing;
- array order is preserved;
-0is normalized to0;- unsupported or ambiguous JavaScript values fail closed instead of being guessed;
- snapshots are detached and deeply frozen;
- matching uses a namespaced SHA-256 digest.
Rejected values include undefined, functions, symbols, BigInt, non-finite numbers, class instances, Dates, Maps and other non-plain JSON objects.
This is not an authorization engine, policy engine, signature system, replay-prevention service or proof that an action is safe.
It is also deliberately distinct from InterAI Risk Oracle's hosted CanonicalExecutionIntent, execution_intent_digest, ExecutionAuthorization, policy identity, expiry and single-use protocol. Those are service-level authorization semantics; this repository is a generic host-side binding tool.
canonicalJson(value)— deterministic JSON serialization for supported values.snapshotJson(value)— normalized detached deeply frozen snapshot.actionDigest(action, options?)— SHA-256 digest using the selected namespace.createActionBinding(action, options?)— immutable binding object.assertActionMatches(binding, action)— throws if the current action differs.ActionBindingError— typed error with a machine-readablecode.
Default namespace: interai.public-action-binding/v1.
Requires Node.js 20 or newer.
npm testNo runtime dependencies are required.
This repository is one of the open-source tools around InterAI Risk Oracle, an independent pre-execution decision layer for consequential agent actions.
Exact Action Binding is useful on its own and is also used by Agent Action Gate. It contains no Risk Oracle scoring, policy, trust-intelligence, billing, signing or private decision-engine implementation.
Hosted Risk Oracle API: https://api.interailabs.dev
Apache-2.0. See LICENSE and NOTICE.