@tensflare/sk
v0.1.0
Published
Semantic Kernel middleware that injects Truss recording into function invocations
Readme

@tensflare/sk
Semantic Kernel middleware — wraps function invocations to record them as Truss actions.
What is Truss?
Truss is an accountability layer for AI agents — it records every agent action as a cryptographically signed, tamper-evident audit trail. Learn more →
Overview
Wrap any Semantic Kernel function to automatically capture its arguments and return value, compute SHA-256 hashes, and POST a sk_invoke action record to the Truss API. Supports both sync and async functions. Fail-open — the function executes normally even if recording fails.
Installation
npm install @tensflare/skQuick start
import { TrussSemanticKernelMiddleware } from "@tensflare/sk";
const truss = new TrussSemanticKernelMiddleware({
apiUrl: "http://localhost:4000",
apiKey: "tr_your_api_key",
mandateId: "mnd_001",
});
// Wrap any Semantic Kernel function
const wrappedFn = truss.wrapFunction(myKernelFunction, "myFunctionName");API
new TrussSemanticKernelMiddleware(options)
| Option | Type | Description |
|---|---|---|
| apiUrl | string | Truss API base URL |
| apiKey | string | Truss API key |
| mandateId | string | Mandate ID |
middleware.wrapFunction(fn, name?)
Wraps an async function (input: unknown) => Promise<unknown>. Records action type sk_invoke with the function name and SHA-256 hashed input/output.
Related packages
| Package | Description | |---|---| | @tensflare/llamaindex | LlamaIndex middleware (same pattern) | | @tensflare/openai | OpenAI Agents SDK middleware (same pattern) | | @tensflare/truss-sdk | TypeScript SDK | | @tensflare/tap | Core Zod schemas |
Development
npm install
npm run build
npm testContributing
Pull requests are welcome. Please see the contribution guidelines.
License
Apache 2.0 — see LICENSE.
