Skip to content

Commit a32c123

Browse files
mabry1985claude
andauthored
epic: M2 Home AI Agent Refinement
* test: add E2E tests for critical homeMaker cross-service flows (#64) Adds Playwright E2E tests covering four critical integration flows: 1. Sensor lifecycle: register → report reading → query history 2. Maintenance completion: create task → complete → verify XP awarded 3. Inventory + sensor: add asset → link sensor → verify readings 4. Gamification milestone: complete task → achievement unlocked Tests use API-level requests (no UI interaction required) and support both AUTOMAKER_AUTO_LOGIN dev mode and API key auth for CI environments. All four tests pass against the live dev server. * feat: add home research mode agent and research-first board task UX - Add `createHomeResearchAgent()` to agent-definitions.ts with WebSearch/WebFetch tools; produces structured reports (overview, top options, pros/cons, price ranges, recommendation) and is explicitly bounded from writing code or modifying files - Add `getHomeResearcherPrompt()` in libs/prompts/src/agents/home-researcher.ts and export it from the agents barrel - Extend `featureType` union in libs/types/src/feature.ts to include 'research' alongside 'code' and 'content' - Update add-feature-dialog to default new tasks to 'research' type with a task type selector (Research vs Code) and research-specific description placeholder examples --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 1a04b1f commit a32c123

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1562
-24
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"version": 1,
3+
"items": [
4+
{
5+
"id": "b2ebddbf-6389-49c2-9bf3-2a5f973c0a44",
6+
"actionType": "notification",
7+
"priority": "low",
8+
"title": "Feature Completed",
9+
"message": "\"Update all protoLabs Studio UI references to homeMaker\" completed successfully.",
10+
"createdAt": "2026-03-15T22:32:03.914Z",
11+
"status": "pending",
12+
"actionPayload": {
13+
"featureId": "feature-1773613295974-iq45l5rgd",
14+
"notificationId": "651ad0e4-3ca2-489d-acaa-2370fdd4301b"
15+
},
16+
"projectPath": "/Users/kj/dev/homeMaker",
17+
"read": false,
18+
"category": "notifications"
19+
},
20+
{
21+
"id": "9eaf5d52-e056-45a8-94f2-2e5be4c1cbe8",
22+
"actionType": "notification",
23+
"priority": "low",
24+
"title": "Feature Verified",
25+
"message": "\"Build vendor view components\" has been verified and is complete.",
26+
"createdAt": "2026-03-15T22:47:23.233Z",
27+
"status": "pending",
28+
"actionPayload": {
29+
"featureId": "feature-1773613295979-nly7p4xuc",
30+
"notificationId": "ad42cb18-0162-40b9-b519-b00f48694b32"
31+
},
32+
"projectPath": "/Users/kj/dev/homeMaker",
33+
"read": false,
34+
"category": "notifications"
35+
},
36+
{
37+
"id": "fa923e3f-58d7-4600-89d1-83e4e7950740",
38+
"actionType": "notification",
39+
"priority": "low",
40+
"title": "Feature Completed",
41+
"message": "\"Build HA WebSocket client service\" completed successfully.",
42+
"createdAt": "2026-03-15T23:06:20.991Z",
43+
"status": "pending",
44+
"actionPayload": {
45+
"featureId": "feature-1773613295982-6wbdl8mmw",
46+
"notificationId": "a94cb203-e0d9-4c1d-8fb6-0f560b5361c1"
47+
},
48+
"projectPath": "/Users/kj/dev/homeMaker",
49+
"read": false,
50+
"category": "notifications"
51+
}
52+
]
53+
} }
54+
]
55+
}

.automaker/memory/api.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
tags: [api]
3+
summary: api implementation decisions and patterns
4+
relevantTo: [api]
5+
importance: 0.7
6+
relatedFiles: []
7+
usageStats:
8+
loaded: 9
9+
referenced: 8
10+
successfulFeatures: 8
11+
---
12+
# api
13+
14+
#### [Gotcha] HA WebSocket protocol requires strict message ordering: auth handshake must complete (auth_ok received) before subscribe_events or get_states calls. Messages sent before auth_ok are silently ignored. (2026-03-15)
15+
- **Situation:** Implementing HA WebSocket client connection flow
16+
- **Root cause:** HA's WebSocket server enforces authentication state before processing subscriptions. This is a protocol constraint, not a performance optimization.
17+
- **How to avoid:** Requires sequential message sending (simpler correctness logic) vs potential throughput loss (negligible in practice since auth is < 100ms)
18+
19+
#### [Gotcha] get_states must be called after auth_ok to fetch initial entity states. Subscribing to state_changed events alone does not provide initial state of existing entities. (2026-03-15)
20+
- **Situation:** Newly discovered HA entities have no state value until their first state_changed event after subscription
21+
- **Root cause:** Event subscriptions only catch future changes. Existing entity state is never pushed; it must be explicitly requested via get_states. Without this, entities registered from HA remain in unknown state until they change.
22+
- **How to avoid:** Adds one extra message (get_states) per connection, but guarantees complete initial state coverage. Trade-off is negligible (typically < 1KB response)
23+
24+
#### [Pattern] Initial state fetch before event subscription: fetch current state for all selected entities on connect, then subscribe to future changes (2026-03-15)
25+
- **Problem solved:** Event subscription alone provides only future state changes, missing the current state at connection time
26+
- **Why this works:** Prevents readings from being undefined/stale between connect and first change event; ensures consistency
27+
- **Trade-offs:** Slightly larger initial payload, but guarantees complete state picture from start
28+
29+
#### [Pattern] Distinct error handling: auth errors fail permanently without retry; network errors retry with exponential backoff (2026-03-15)
30+
- **Problem solved:** Invalid token indicates configuration error; network error indicates transient connectivity issue
31+
- **Why this works:** Prevents log spam and resource waste on unrecoverable auth failures while maintaining resilience to temporary outages
32+
- **Trade-offs:** More complex error classification code, but appropriate resource usage for different failure types
33+
34+
#### [Gotcha] POST /api/maintenance/:id/complete returns nested structure `{ data: { schedule, completion } }` not flat `{ data: completion }` (2026-03-16)
35+
- **Situation:** Completion endpoint responds with both the updated schedule and the completion record in data object
36+
- **Root cause:** API design choice to provide related context (schedule) alongside the completion result in single response
37+
- **How to avoid:** One request gives more context; clients must dig deeper into response structure
38+
39+
#### [Gotcha] Achievement data uses different field names across endpoints: catalog uses `earned`/`unlockedAt`, profile uses array of `{id, unlockedAt, seen}` (2026-03-16)
40+
- **Situation:** GET /api/gamification/achievements (catalog) vs data within GET /api/gamification/profile (achievements array) have different structures
41+
- **Root cause:** Profile endpoint optimized for quick access (array of earned achievements only); catalog endpoint shows full achievement metadata
42+
- **How to avoid:** Reduces profile payload size but requires tests/clients to understand multiple representations of achievement state
43+
44+
#### [Gotcha] Gamification profile uses `xp` field (not `totalXp`); field naming inconsistency between endpoints requires explicit discovery (2026-03-16)
45+
- **Situation:** Expected `totalXp` based on common naming pattern; actual API uses abbreviated `xp`
46+
- **Root cause:** API payload optimization decision; shorter field names reduce response size at cost of less descriptive naming
47+
- **How to avoid:** Smaller JSON payloads; less self-documenting field names requiring API documentation or discovery
48+
49+
#### [Pattern] Agent factory pattern (createHomeResearchAgent) instantiates with specific tools (WebSearch + WebFetch only) and model (sonnet) rather than parameterizing them (2026-03-16)
50+
- **Problem solved:** Agent creation follows pattern used by Ava/PM/LE agents; each has fixed toolset and model
51+
- **Why this works:** Hard-coded tool/model bindings enforce explicit capability boundaries at creation time — prevents accidental capability mixing and makes agent behavior predictable and reviewable
52+
- **Trade-offs:** Rigid per-agent design makes each agent clear but requires new factory for new capability combinations; parameterization is more flexible but harder to audit

0 commit comments

Comments
 (0)