@mounaji_npm/human-in-loop
v0.1.3
Published
Extensible human-in-the-loop interaction toolkit with adaptive prompt UI and flexible decision schemas.
Maintainers
Readme
@mounaji_npm/human-in-loop
Extensible human-in-the-loop toolkit for agent workflows.
It provides:
- Core prompt schema and UI inference engine (framework-agnostic)
- Prompt type registry for future extensions
- React components and hooks for rendering and collecting decisions
Install
npm install @mounaji_npm/human-in-loopQuick start (core)
import { inferPromptUI, createPromptRegistry } from '@mounaji_npm/human-in-loop';
const prompt = {
id: 'color-question',
type: 'color',
label: 'Choose primary color',
suggestions: ['#2563eb', '#10b981', '#f59e0b'],
};
const ui = inferPromptUI(prompt);
console.log(ui);Quick start (React)
import { HumanInLoopPanel } from '@mounaji_npm/human-in-loop';
<HumanInLoopPanel
prompts={prompts}
onSubmit={async (decision) => {
console.log(decision);
}}
/>Supported prompt types
- single_select
- multi_select
- redacted_agent_text
- color
- text
- number
- boolean_confirm
- date
- json
Redacted agent text options
The redacted_agent_text prompt type supports the following options by default:
- remake code from scratch
- just fix x part
- both of them
- custom answer
It always renders a custom text input, independent of the selected option.
const prompt = {
id: 'agent-redaction-response',
type: 'redacted_agent_text',
label: 'How should the agent proceed?',
required: true,
metadata: {
customTextLabel: 'Extra instruction',
},
};Extending with custom types
Use createPromptRegistry() and register custom inference/renderers progressively.
