mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-10 13:31:38 +00:00
The reusable base the Capabilities rework sits on:
- lib/{text,time,format,json-format}: consolidate ~30 hand-rolled string/date/
number/JSON helpers behind one set of tested utilities.
- master-detail scaffold (MasterDetail / ListColumn / DetailColumn / DetailPane /
CapRow / ListStrip / ToolChip / ICON_BUTTON) + row-hover; tabs-as-data
PageSearchShell; EmptyState + ErrorBanner; a shared LogTail terminal surface.
- framed CodeEditor + JsonDocumentEditor, wired into every in-app markdown/JSON
edit surface (profile SOUL.md, memory nodes, right-click sidebar profile).
- shared React Query cache helper (writeCache) + per-profile-switch/ debounce hooks.
15 lines
807 B
TypeScript
15 lines
807 B
TypeScript
// Canonical text micro-helpers. Do not redefine these per-page.
|
|
|
|
export const asText = (v: unknown): string => (typeof v === 'string' ? v : v == null ? '' : String(v))
|
|
|
|
export const includesQuery = (v: unknown, q: string) => asText(v).toLowerCase().includes(q)
|
|
|
|
export const prettyName = (v: string) => v.replace(/_/g, ' ').replace(/\b\w/g, c => c.toUpperCase())
|
|
|
|
/** Search-key normalization: the exact `value.trim().toLowerCase()` idiom that
|
|
* was hand-written at ~30 filter/lookup sites. */
|
|
export const normalize = (v: unknown): string => asText(v).trim().toLowerCase()
|
|
|
|
/** Uppercase the first character, leave the rest. Matches the
|
|
* `s.charAt(0).toUpperCase() + s.slice(1)` idiom (empty-safe). */
|
|
export const capitalize = (v: string): string => (v ? v.charAt(0).toUpperCase() + v.slice(1) : v)
|