class AgenticNotebook extends HTMLElement { constructor() { super(); this.attachShadow({ mode: 'open' }); this.cells = []; } static get observedAttributes() { return ['cells']; } attributeChangedCallback(name, oldValue, newValue) { if (name === 'cells') { this.cells = JSON.parse(newValue); this.render(); } } render() { this.shadowRoot.innerHTML = `

Agentic Research Notebook

${this.cells.map((cell, index) => ` 0 ? 'has-previous' : ''} > `).join('')}
`; // Add event listener for the add cell button const addCellBtn = this.shadowRoot.querySelector('.add-cell-btn'); addCellBtn.addEventListener('click', () => this.addNewCell()); // Initialize feather icons if (window.feather) { window.feather.replace(); } } addNewCell() { const newCellId = `cell-${Date.now()}`; const newCell = { id: newCellId, agentType: 'researcher', input: '', output: null, status: 'idle', timestamp: new Date().toISOString() }; this.cells.push(newCell); this.setAttribute('cells', JSON.stringify(this.cells)); } } customElements.define('agentic-notebook', AgenticNotebook);