Skip to content

Commit 6a01a49

Browse files
committed
Move docs
1 parent 74fb4cb commit 6a01a49

File tree

8 files changed

+74
-63
lines changed

8 files changed

+74
-63
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/homebrew-tap.md

Lines changed: 0 additions & 62 deletions
This file was deleted.

internal/cmd/tools.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,18 @@ func renderAgentWithThreads(items []json.RawMessage) error {
317317
return nil
318318
}
319319

320+
// Customer-facing thread types (visible to customer).
321+
// Full HelpScout type list: beaconchat, chat, customer, forwardchild, forwardparent, lineitem, message, note, phone
322+
// Excluded: note (internal), lineitem (system event), forwardparent/forwardchild (routing)
323+
var customerFacingTypes = map[string]bool{
324+
"customer": true,
325+
"reply": true,
326+
"message": true, // agent-initiated (not a reply)
327+
"chat": true,
328+
"phone": true,
329+
"beaconchat": true, // Beacon widget chat
330+
}
331+
320332
// conversationSummary holds pre-computed metrics from embedded thread data.
321333
type conversationSummary struct {
322334
ThreadCount int
@@ -338,7 +350,9 @@ func computeSummary(c types.Conversation, threads []types.Thread) conversationSu
338350
for _, t := range threads {
339351
s.ThreadsByType[t.Type]++
340352
s.LastActivity = t.CreatedAt
341-
s.LastBy = t.Type
353+
if customerFacingTypes[t.Type] {
354+
s.LastBy = t.Type
355+
}
342356
if len(t.Attachments) > 0 {
343357
s.HasAttachments = true
344358
s.AttachmentCount += len(t.Attachments)

internal/cmd/tools_test.go

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,65 @@ func TestComputeSummary(t *testing.T) {
398398
assert.Equal(t, 1, s.ThreadCount) // still counts threads
399399
})
400400

401+
t.Run("note after reply — still shows reply", func(t *testing.T) {
402+
c := types.Conversation{CreatedAt: "2025-01-01T10:00:00Z"}
403+
threads := []types.Thread{
404+
{Type: "customer", CreatedAt: "2025-01-01T10:00:00Z"},
405+
{Type: "reply", CreatedAt: "2025-01-01T11:00:00Z"},
406+
{Type: "note", CreatedAt: "2025-01-01T12:00:00Z"},
407+
}
408+
s := computeSummary(c, threads)
409+
assert.Equal(t, "reply", s.LastBy)
410+
assert.False(t, s.AwaitingReply)
411+
})
412+
413+
t.Run("note after customer — still awaiting", func(t *testing.T) {
414+
c := types.Conversation{CreatedAt: "2025-01-01T10:00:00Z"}
415+
threads := []types.Thread{
416+
{Type: "customer", CreatedAt: "2025-01-01T10:00:00Z"},
417+
{Type: "note", CreatedAt: "2025-01-01T11:00:00Z"},
418+
}
419+
s := computeSummary(c, threads)
420+
assert.Equal(t, "customer", s.LastBy)
421+
assert.True(t, s.AwaitingReply)
422+
})
423+
424+
t.Run("lineitem after customer — still awaiting", func(t *testing.T) {
425+
c := types.Conversation{CreatedAt: "2025-01-01T10:00:00Z"}
426+
threads := []types.Thread{
427+
{Type: "customer", CreatedAt: "2025-01-01T10:00:00Z"},
428+
{Type: "reply", CreatedAt: "2025-01-01T11:00:00Z"},
429+
{Type: "customer", CreatedAt: "2025-01-01T12:00:00Z"},
430+
{Type: "lineitem", CreatedAt: "2025-01-01T13:00:00Z"},
431+
}
432+
s := computeSummary(c, threads)
433+
assert.Equal(t, "customer", s.LastBy)
434+
assert.True(t, s.AwaitingReply)
435+
})
436+
437+
t.Run("forward types ignored", func(t *testing.T) {
438+
c := types.Conversation{CreatedAt: "2025-01-01T10:00:00Z"}
439+
threads := []types.Thread{
440+
{Type: "customer", CreatedAt: "2025-01-01T10:00:00Z"},
441+
{Type: "forwardparent", CreatedAt: "2025-01-01T11:00:00Z"},
442+
{Type: "forwardchild", CreatedAt: "2025-01-01T12:00:00Z"},
443+
}
444+
s := computeSummary(c, threads)
445+
assert.Equal(t, "customer", s.LastBy)
446+
assert.True(t, s.AwaitingReply)
447+
})
448+
449+
t.Run("message type counts as agent reply", func(t *testing.T) {
450+
c := types.Conversation{CreatedAt: "2025-01-01T10:00:00Z"}
451+
threads := []types.Thread{
452+
{Type: "customer", CreatedAt: "2025-01-01T10:00:00Z"},
453+
{Type: "message", CreatedAt: "2025-01-01T11:00:00Z"},
454+
}
455+
s := computeSummary(c, threads)
456+
assert.Equal(t, "message", s.LastBy)
457+
assert.False(t, s.AwaitingReply)
458+
})
459+
401460
t.Run("attachments counted", func(t *testing.T) {
402461
c := types.Conversation{CreatedAt: "2025-01-01T10:00:00Z"}
403462
threads := []types.Thread{

0 commit comments

Comments
 (0)