@bugcome/harnessdeck-sdk
v0.1.0
Published
Typed feature detection and Protocol 3 contracts for HarnessDeck plugins
Downloads
151
Maintainers
Readme
@duyanta123/harnessdeck-sdk
Typed, dependency-free feature detection for HarnessDeck Protocol 3. The SDK does
not create a privileged channel: it only describes and validates the narrow
window.harnessDeck object that Studio injects into pages served by its active
loopback Harness.
import { getHarnessDeck, hasHarnessDeckCapability } from '@duyanta123/harnessdeck-sdk'
const desktop = getHarnessDeck(window)
if (desktop) {
const offer = await desktop.hello()
if (hasHarnessDeckCapability(offer, 'workspace')) {
const chosen = await desktop.pick({ mode: 'directory' })
if (chosen.path) console.log(await desktop.workspace.validate(chosen.path))
}
}Use getHarnessDeck() for plugins that also run in an ordinary browser or
headless Harness. Use requireHarnessDeck() only when the entire feature is
Desktop-specific. Never retain the object across a Harness navigation/restart;
feature-detect again in the new page.
The package version follows HarnessDeck while the wire contract has its own
integer protocol. A protocol change is intentionally incompatible and must be
handled by a new SDK release. See the repository's bilingual
plugin contract for the trust boundary and
two-phase package policy.
Harness Host plugins
Host plugins can feature-detect the separate, read-only Host Protocol 1. It exposes the active generation's Studio/Harness versions and a bounded Profile roster. It deliberately cannot start commands, access native handles, install packages, or mutate Profiles.
import { getHarnessDeckHost } from '@duyanta123/harnessdeck-sdk'
export const inject = []
export function apply(ctx) {
const studio = getHarnessDeckHost(ctx)
if (!studio) return
ctx.logger.info(
`running in ${studio.studio.name} ${studio.studio.version} ` +
`with ${studio.profiles.list().length} profiles`,
)
}Use the normal Harness services for agent, model, session, tool, and workspace behavior. Package or Profile changes must continue through Studio's visible, receipt-backed native flows rather than a retained Host reference.
