Hooks Panel
The Hook Execution panel at /hooks shows a real-time log of every hook invocation in the EdgeStream pipeline. It is a thin wrapper around HooksMonitor from @edge-stream/observability-react.
Route and Component
// Route in App.tsx
<Route path="/hooks" element={<HooksPage />} />
// HooksPage source: packages/app-pages-react/src/HooksPage.tsx
export function HooksPage(): React.ReactElement {
return <HooksMonitor
className="page-container"
showSettings={true}
pollInterval={500}
maxLogs={100}
/>
}
// HooksMonitor from: @edge-stream/observability-react
HooksMonitor — How It Works
// HooksMonitor polls LoggingService every 500ms:
useEffect(() => {
const interval = setInterval(() => {
const logs = loggingService.getRecentLogs(maxLogs); // maxLogs = 100
setLogs(logs);
}, pollInterval); // pollInterval = 500ms
return () => clearInterval(interval);
}, [maxLogs, pollInterval]);
// Flattens hook logs from all message activity logs:
const allHookLogs = logs.flatMap((msg) => msg.hookLogs || []);
// Stats computed from allHookLogs:
const stats = {
total: allHookLogs.length,
success: allHookLogs.filter((h) => h.success).length,
failed: allHookLogs.filter((h) => !h.success).length,
};
HookLog Entry Fields
| Field | Type | Description |
|---|---|---|
| hookName | string | Name of the hook class (e.g. HookActivityLogger, ValidationHook) |
| priority | number | Execution priority — lower number runs first |
| success | boolean | Whether the hook returned HookResult.Continue or threw |
| durationMs | number | Hook execution time in milliseconds |
| result | HookResult | Continue, Stop, StopAndRespond, Pause |
| error | string? | Error message if the hook threw or returned a failure result |
| topic | string | The message topic that triggered this hook invocation |
| messageId | string | Correlates this hook log to a specific envelope via IEnvelope.meta.id |
Filter by Hook Name
// The filter input performs case-insensitive substring match on hookName:
const filtered = allHookLogs.filter((log) =>
log.hookName.toLowerCase().includes(filterText.toLowerCase())
);
// Example filters:
// "validation" → shows only ValidationHook invocations
// "decrypt" → shows only DecryptHook invocations
// "logger" → shows only HookActivityLogger invocations
// "" → shows all (no filter)
Settings Panel
When showSettings={true}, a settings panel allows adjusting poll interval and max log count without reloading:
// Settings exposed when showSettings is true:
// Poll Interval (ms) — default 500
// Max Logs — default 100
// Changing these updates the useEffect interval and the getRecentLogs() call limit.
// Setting max logs to 0 shows all logs in the ring buffer (may be slow on high-traffic servers).
Standard Hook Priority Order
The Hooks Panel clearly shows the priority order in which hooks execute. In a standard EdgeStream pipeline:
| Priority | Hook | Purpose |
|---|---|---|
| 5 | HookActivityLogger | Records message activity — must run first to capture all hook results |
| 90 | DecryptHook | Decrypts encrypted envelope body |
| 95 | VerifySignatureHook | Validates message signature |
| 100 | ValidationHook | Schema validation against registered message types |
| 110 | NormalizationHook | Normalizes envelope structure and topic casing |
| 120–199 | Pre-processing hooks | Custom hooks: rate limiting, authentication enrichment, deduplication |
| 200–299 | Processing hooks | Domain hooks: WorkflowEventPlugin, AgentMessagePlugin, UiActionPlugin |
| 300+ | Post-processing hooks | Audit, forwarding, external platform hooks (Splunk, Datadog) |
Hooks Reference Panel
The Hooks Reference at /hooks-reference shows all registered hook classes with documentation. This is read-only; it lists every hook available in the hook library with its priority, description, and configuration options:
// Route in App.tsx
<Route path="/hooks-reference" element={<HooksReferencePage />} />
// HooksReferencePage: packages/app-pages-react/src/HooksReferencePage.tsx
// Sidebar label in App.tsx: "Available Hooks"
// Also available at /help/hooks:
<Route path="/help/hooks" element={<HooksLibraryPage />} />
// HooksLibraryPage: packages/app-pages-react/src/HooksLibraryPage.tsx
Enabling Hook Logging in Your App
To populate the Hooks Panel (and Activity Stream), you must add HookActivityLogger to your pipeline. Without it, no hook logs are written to the in-memory ring buffer.
import { HookActivityLogger } from 'edge-stream-js';
// Add as the first hook (priority 5) so it captures all subsequent hook results:
server.incomingPipeline.addHook(new HookActivityLogger());
// HookActivityLogger is included automatically in EdgeStream DevTools.
// In your own app: add it manually during development, remove for production
// (or replace with an external observability hook from observability-hooks-js).
HookActivityLogger keeps an in-memory ring buffer of message activity. On high-throughput servers, this can consume memory. Set a reasonable buffer size or disable it in production and use an external platform hook (DatadogHook, SplunkLogHook, etc.) instead.