Intermediate

Working with Custom, Prompt & Output Hub Nodes

Configuring dynamic text fields, variable inputs, consumer [ Record | Table ] toggles, and Output Hub downstream export.

# Working with Custom, Prompt & Output Hub Nodes

**Custom Nodes**, **Prompt Nodes**, and the **Output Hub** form the core authoring and compilation workhorses of your visual graph.

---

## 1. Node Anatomy

Each standard node contains:
1. **Header Bar**: Displaying node title, node type icon, and custom color badge.
2. **Text Body / Prompt Area**: Rich text area holding system instructions, narrative prose, or prompt templates.
3. **Dynamic Inputs**: Input handles on the left edge receiving upstream text or table streams.
4. **Dynamic Outputs**: Output handles on the right edge sending compiled text downstream.

---

## 2. Variable Substitutions

In any text field, wrap variable names in curly braces (e.g. `{target_audience}` or `{tone}`):
- Nodestr automatically detects the template tag and generates a corresponding **Input handle** on the left edge of the node.
- When you connect a noodle from an upstream node to `{tone}`, the compiler seamlessly injects the upstream text directly into that placeholder during prompt compilation.

---

## 3. Consumer Node `[ 📄 Record | 📊 Table ]` Toggle

When you connect a **Table Node** (`All Records` port) into a Custom or Prompt Node's input slot, a compact segmented toggle switch appears in the connected table header bar:

1. **`📄 Record` Mode (Default)**:
   - Displays the interactive record stepper (`< Record 1/N >`) and dropdown selector.
   - Exposes individual column pill tokens (e.g. `{{First Name}}`, `{{Role}}`) in the field token bar so you can interpolate specific cell values from the active row.
2. **`📊 Table` Mode (Full-Table Injection)**:
   - Switches the consumer slot from single-row stepping to full-dataset consumption, displaying a summary badge (`Full Table • N rows × M cols`).
   - Surfaces **`{{Table}}`** and **`{{TableTitle}}`** token pills in the field token bar and expanded editor modal.
   - During compilation, `{{Table}}` injects the entire table formatted as a clean GitHub-Flavored Markdown pipe table directly into your surrounding prose or prompt instructions.

---

## 4. Output Hub & Reverse Source Attribution

The **Output Hub** serves as the central real-time compilation engine for your visual workspace—combining upstream text cards, tables, files, and AI agent outputs into a unified document, while offering full reverse traceability back to original authoring sources:

- **Real-Time Markdown Synthesis**: Automatically aggregates connected upstream nodes in spatial order, compiling text fields, variable replacements, and full dataset tables into coherent Markdown.
- **Reverse Source Attribution**: While reading the compiled document in the expanded Output Hub modal (**`[ 👁 Rich Preview ]`** or **`[ 📝 Raw Markdown ]`**), hovering over any line or paragraph highlights it with a subtle dashed accent underline. The **Origin Source** bar at the top displays the exact source node title, color swatch, group hierarchy trail (e.g. `[Group ›] Node`), and field label.
- **1-Click In-Place Editing (`Alt + Click`)**: If you spot a typo, want to revise prose, or need to add headings, you never have to search through complex canvas trees or dive into nested sub-groups manually. Simply **`Alt + Click`** on any text block or click **`[✏ Edit In-Place]`**. The Output Hub modal seamlessly transitions into the full-screen **TipTap WYSIWYG editor** for that upstream node, complete with rich formatting tools (bold, italic, headings, lists), raw markdown view, search/replace, and live character counting.
- **Bidirectional Return (`← Back to Output Hub`)**: When you finish editing, clicking **`[← Back to Output Hub]`** or pressing `Escape` returns you straight to the Output Hub viewer, where your revisions are immediately recompiled and rendered in real time.
- **Canvas Camera Glide (`[🎯 Locate on Canvas]`)**: Need to see the node in its canvas context? Clicking the locate button automatically traverses into any nested groups, selects the node, and smoothly glides the canvas viewport directly to it with a toast confirmation.
- **Downstream Export via `Out` Port**: The Output Hub features a green right-hand **`Out`** port. Connect this port directly into a **Document Exporter Node** (`Document / Text` input) to convert your compiled document into formatted Word (`.docx`), Excel (`.xlsx`), PDF, Markdown, or send it directly to **Google Docs / Google Sheets** with a single click.
---

## 5. Character Capacity Safeguards

To maintain 60fps UI performance:
- **Local Mode**: Text fields are limited to **15,000 characters** per field (~3,000 words).
- **Cloud Mode**: Text fields are limited to **25,000 characters** per field (~5,000 words).

> [!NOTE]
> Character limits are enforced immediately on input. If you paste a massive document exceeding the limit, Nodestr safely caps the text to preserve canvas responsiveness.