Skip to content

feat(gtm): Spec 4 — cockpit activation recipes (try-this-prompt suggestions)#388

Merged
blove merged 7 commits into
mainfrom
gtm-spec-4-cockpit-activation-recipes
May 17, 2026
Merged

feat(gtm): Spec 4 — cockpit activation recipes (try-this-prompt suggestions)#388
blove merged 7 commits into
mainfrom
gtm-spec-4-cockpit-activation-recipes

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 17, 2026

Summary

Phase 1 activation deliverable. Two cohesive changes:

  1. `ChatComponent` enhancement (`libs/chat`) — subscribes to `agent.lifecycle.streamStartedAt` and flips `CHAT_LIFECYCLE.firstMessageSent` on its first transition to non-null. Makes the lifecycle robust to programmatic `agent.submit({message})` calls (the canonical pattern used by `` click handlers). `messageCount` and `inputSubmittedAt` stay input-bound.
  2. Pre-baked `` rows on the four cockpit capability examples that map to activation signals:
    • streaming — "Stream a long answer" + "Walk me through agent tool calls"
    • persistence — "Save this thread for later"
    • interrupts — "Approve a tool call"
    • generative-ui — "Render a dashboard" + "Render a form"

A developer landing in the cockpit gets a 1-click path to firing each activation signal.

Spec & Plan

  • Spec: `docs/superpowers/specs/gtm/2026-05-16-cockpit-activation-recipes-design.md`
  • Plan: `docs/superpowers/plans/gtm/2026-05-16-cockpit-activation-recipes.md`

Notable

  • `mockAgent` gained a tiny lifecycle stub (`lifecycle.streamStartedAt` + `_internal.streamStartedAt` writable) so chat-lib tests can drive the new effect without pulling in the langgraph mock. Same `_internal` pattern used by `CHAT_LIFECYCLE` itself.
  • Duck-typed lifecycle read in the new effect — `agent.lifecycle` isn't on the base `Agent` contract (it lives on adapter types like `LangGraphAgent`). Narrow cast inside the effect keeps non-lifecycle agents as safe no-ops.
  • No new analytics events. Existing `cockpit:*` event names unchanged.
  • Out of scope (follow-ups): aimock as default backend for `cockpit:serve-`, activation progress pill in the cockpit shell, Playwright end-to-end activation suite.

Test plan

  • `nx run-many -t test -p chat,cockpit-telemetry` — green (chat suite 746 tests, including 2 new lifecycle tests)
  • `nx run cockpit-langgraph-streaming-angular:build:cockpit` — green
  • `nx run cockpit-langgraph-persistence-angular:build:cockpit` — green
  • `nx run cockpit-langgraph-interrupts-angular:build:cockpit` — green
  • `nx run cockpit-chat-generative-ui-angular:build:cockpit` — green
  • Post-merge manual smoke (requires `OPENAI_API_KEY` for the agent itself to respond): open each capability in the cockpit, click a suggestion, verify the corresponding `cockpit:*` activation event lands in PostHog Live Events.

🤖 Generated with Claude Code

blove and others added 7 commits May 16, 2026 19:18
Pre-baked "Try this prompt" suggestions on the four capability examples
that map to activation signals (streaming, persistence, interrupts,
generative-ui), plus a ChatComponent enhancement so firstMessageSent
flips on the first stream-start regardless of submit path (input,
suggestion-click, programmatic). A developer landing in the cockpit
gets a 1-click path to firing each activation signal.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ath)

ChatComponent now subscribes to agent.lifecycle.streamStartedAt and
flips CHAT_LIFECYCLE.firstMessageSent on its first transition to a
non-null value. This makes the lifecycle robust to programmatic
agent.submit() calls, including the <chat-welcome-suggestion> click
handler pattern in cockpit examples.

messageCount and inputSubmittedAt remain input-bound by design — they
measure typing engagement, not stream initiation.

Two new lifecycle tests cover the agent-driven flip + stickiness across
multiple stream-starts. The chat mock-agent gained a minimal lifecycle
stub (streamStartedAt only, with a writable _internal handle) so the
tests can drive the signal directly without a full adapter.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Two <chat-welcome-suggestion> rows in the empty-state — "Stream a long
answer" and "Walk me through agent tool calls". Clicking either calls
agent.submit({ message: ... }) which fires AGENT_LIFECYCLE.streamStartedAt
on first chunk arrival → cockpit:transport_connected. ChatComponent's
new effect (Phase 0) then flips firstMessageSent → cockpit:chat_first_message.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
One <chat-welcome-suggestion> row — "Save this thread for later" —
that prompts a project-brief conversation. After the user reloads the
page, AGENT_LIFECYCLE.threadPersistedAt fires → cockpit:thread_persisted
activation signal.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
One <chat-welcome-suggestion> row — "Approve a tool call" — that
prompts a flight-booking conversation. The graph pauses at an interrupt;
when the user approves via the ChatInterruptPanelComponent,
AGENT_LIFECYCLE.interruptResolvedAt fires → cockpit:interrupt_handled
activation signal.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Two <chat-welcome-suggestion> rows — "Render a dashboard" and
"Render a form". Clicking either prompts the agent to emit a
generative-UI payload that RenderSpecComponent mounts, firing
RENDER_LIFECYCLE.firstMountAt → cockpit:generative_component_rendered
activation signal.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cacheplane Ready Ready Preview, Comment May 17, 2026 3:30am

Request Review

@blove blove merged commit 8072283 into main May 17, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant