"use client";
import InstructionsBuilder from '../instructions-builder.jsx';
import { useDashboard } from '../dashboard-context';

export default function InstructionsTab() {
  const {
    configInstructions,
    setConfigInstructions,
    saveInstructions,
    configSaving,
    counts,
  } = useDashboard();
  const agents = counts?.agents || [];
  return (
    <div className="config-body">
      <div className="config-page-head">
        <span>Instructions</span>
        <p>System prompt — defines role, reports, delegation, and constraints. Fill the structured form or edit raw markdown directly.</p>
      </div>
      <InstructionsBuilder
        value={configInstructions}
        onChange={setConfigInstructions}
        onSave={saveInstructions}
        saving={configSaving}
        agents={agents}
      />
    </div>
  );
}
