Skip to content
Agent Compat

API

The stable public API of @jstn-sdk/agents.

Agents.detect(root)

Returns detected adapter surfaces ordered by confidence.

const environments = await Agents.detect('./project');

When no environment signal is found, detection returns the portable generic adapter with low confidence. Detection is repository-based and does not require vendor binaries.

Agents.compile(manifest, options)

Compiles the canonical manifest for selected adapter IDs and writes native or portable artifacts.

const result = await Agents.compile(manifest, {
  targets: ['cursor', 'codex-cli', 'claude-code'],
  output: './project',
  dryRun: true,
});

With no targets, the SDK compiles for adapters detected under output. dryRun: true returns the planned files without writing. The result includes targets, generated files, created, updated, skipped, warnings, and target-specific errors.

Agents.validate(root)

Reads actual generated files and returns per-adapter status, score, issues, and capabilities.

const report = await Agents.validate('./project');
if (!report.valid) throw new Error('Agent artifacts need attention');

Pass { targets: ['cursor'] } to validate only selected adapters. Without targets, validation uses detected adapters.

Adapter registry

Register a custom adapter without importing Meta-Architect:

Agents.register(myAdapter);
const adapters = Agents.list();

Use Agents.get(id) to inspect one adapter and Agents.reset() to restore the built-in registry in a test process.

On this page