@nura-js/core
v0.2.0
Published
Core primitives for building AI-friendly interfaces with Nura.js
Maintainers
Readme
@nura-js/core
Core runtime and linguistic utilities for Nura.js agent ↔ UI integrations.
Installation
pnpm add @nura-js/coreUsage Example
import {
Nura,
ContextManager,
createRegistry,
defineActionSpec,
stripWake,
detectLocale,
parseNumeral,
normalizeSynonyms,
} from '@nura-js/core';
const registry = createRegistry({
actions: [
defineActionSpec({
name: 'open_orders',
type: 'open',
target: 'orders',
phrases: {
'es-CR': { canonical: ['abre órdenes'] },
},
}),
],
});
const nura = new Nura({ registry });
const context = new ContextManager({ locale: 'es-CR' });
context.set('customerId', 42);
const input = 'hey nura abre órdenes';
const withoutWake = stripWake(input, { wakeWords: ['hey nura'] });
const locale = detectLocale(withoutWake, ['es-CR', 'en-US']);
const amount = parseNumeral('quince', locale);
const normalized = normalizeSynonyms('árbol', locale);
await nura.act({
type: 'open',
target: 'orders',
meta: { desc: `Abrir ${normalized} (${amount})` },
});Key APIs
Nuraorchestrates registered actions with permission hooks.createRegistrybuilds the registry of actions, entities, and connected agents.ContextManagerkeeps follow-up context and confirmation helpers.stripWakenormalizes wake phrases.detectLocaleidentifies a locale using token heuristics.parseNumeralconverts localized numerals to numbers.normalizeSynonymsharmonizes synonyms per locale dictionary.
Type References
NAction— executable action shape.NRegistry— registry definition including actions and agents.NLocale— BCP 47 locale identifier ('es-CR','en-US').NAgent— plugin extension for the runtime.
Additional Resources
- Repository: https://github.com/nura-ia/nurajs
- Issues: https://github.com/nura-ia/nurajs/issues
