mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-08 13:12:08 +00:00
refactor(desktop): colocate hook/component families into scoped folders
Single-scoped helpers/sub-files were sitting flat in shared/grab-bag dirs.
Fold each family into its own folder (index = the export, dir resolution keeps
public import paths intact), dropping the now-redundant filename prefix:
- session/hooks/use-prompt-actions.ts (+ -utils, + tests)
-> use-prompt-actions/{index,utils}.ts (+ tests)
- components/assistant-ui/thread* + assistant/system/user message renderers
-> assistant-ui/thread/{index,content,status,message-parts,timestamp,types,
list,timeline,timeline-data,assistant-message,system-message,user-message,
user-edit-composer,user-message-text} (+ tests)
- components/assistant-ui/tool-fallback(+model)/tool-approval
-> assistant-ui/tool/{fallback,fallback-model,approval} (+ tests)
Pure move + import rewrites; no behaviour change. App-wide shared primitives
(markdown-text, directive-text, tooltip-icon-button, clarify-tool, ansi-text,
message-render-boundary) stay flat. desktop-controller intentionally left in
app/ (route root; foldering would churn ~80 relative imports for no gain).
This commit is contained in:
parent
c9269fbfb6
commit
fa7bce0789
32 changed files with 40 additions and 40 deletions
|
|
@ -1,36 +0,0 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { formatMessageTimestamp } from './thread-timestamp'
|
||||
|
||||
const labels = {
|
||||
today: (time: string) => `Today at ${time}`,
|
||||
yesterday: (time: string) => `Yesterday at ${time}`
|
||||
}
|
||||
|
||||
describe('formatMessageTimestamp', () => {
|
||||
it('returns an empty string for missing values', () => {
|
||||
expect(formatMessageTimestamp(undefined, labels)).toBe('')
|
||||
expect(formatMessageTimestamp('not-a-date', labels)).toBe('')
|
||||
})
|
||||
|
||||
it('uses the today label for timestamps earlier today', () => {
|
||||
const now = new Date()
|
||||
const earlierToday = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 30)
|
||||
expect(formatMessageTimestamp(earlierToday, labels)).toMatch(/^Today at /)
|
||||
})
|
||||
|
||||
it('uses the yesterday label for timestamps the prior day', () => {
|
||||
const now = new Date()
|
||||
const yesterday = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 8, 0)
|
||||
yesterday.setDate(yesterday.getDate() - 1)
|
||||
expect(formatMessageTimestamp(yesterday, labels)).toMatch(/^Yesterday at /)
|
||||
})
|
||||
|
||||
it('falls back to an absolute format for older timestamps', () => {
|
||||
const old = new Date(2020, 0, 15, 9, 30)
|
||||
const out = formatMessageTimestamp(old, labels)
|
||||
expect(out).not.toMatch(/^Today at /)
|
||||
expect(out).not.toMatch(/^Yesterday at /)
|
||||
expect(out.length).toBeGreaterThan(0)
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue