Setup
#Getting a token
A license token comes from a Threadplane plan — grab one from threadplane.ai/pricing. Once you have it, paste it into environment.threadplaneLicense or set THREADPLANE_LICENSE in your environment, and the rest of this page wires it up. The nag warnings the library emits point at the same URL.
Most applications don't import @threadplane/licensing directly. @threadplane/chat calls runLicenseCheck() from provideChat() when you pass a license token.
Chat exposes a license option:
When no token is supplied, the licensing helper can evaluate the environment as noncommercial when the caller passes isNoncommercial: true.
#Direct use
Use the direct API when you're building a package inside the framework, or a custom integration that needs the same behavior.
runLicenseCheck() returns the evaluated LicenseStatus.
To see the status in action without a real token, mint one inline with signLicense() and log what runLicenseCheck() resolves to:
In production you verify against LICENSE_PUBLIC_KEY instead of a throwaway key, and the token comes from your environment — not from signLicense().
#Warnings
emitNag() is silent for:
licensed;noncommercial.
It warns once per package and status for:
missing;grace;expired;tampered.
The warning prefix is [threadplane], and the package keeps running.
You can inject a custom warning sink:
#Noncommercial hint
inferNoncommercial() checks globalThis.process?.env.NODE_ENV.
It returns:
truewhenNODE_ENVexists and is anything other than"production";falsewhenNODE_ENVis"production";falsewhen there is noprocessglobal.
It's only a default hint. Callers can pass isNoncommercial explicitly.
#Gotchas
runLicenseCheck() is idempotent for identical package and token values. A repeated call with the same key returns licensed without re-running the check.
That keeps repeated provider initialization quiet, but it means package authors shouldn't use repeated calls with identical inputs to poll for status.
verifyLicense() doesn't check time. Pair it with evaluateLicense() when you need expiration and grace behavior.