feat(booterm): structured pty_exited WS notifications. Plan-validated, impl-validated, code-reviewed green (contracts build clean, contracts test 29/29, booterm + web typecheck clean). wip: in-progress inference/provider refactor (agents.ts, provider.ts, new llama-providers.ts, removed llama-args-validator), plus arena, dispatcher, compaction, schema changes. openspec: pty-exit-notifications complete; x-agent-flags planned (not yet implemented).
1.8 KiB
1.8 KiB
1. Add llama_flags to Agent type
- 1.1 Add
llama_flags: string | nulltoAgentinterface inapps/server/src/types/api.ts - 1.2 Verify no downstream type errors (tsc --noEmit)
2. Parse llama_flags from AGENTS.md frontmatter
- 2.1 Add
llama_flags?: stringtoParsedFrontmatterinapps/server/src/services/agents.ts - 2.2 Add explicit
else if (key === 'llama_flags')branch inparseFrontmatter()before the "Unknown keys silently ignored" fallthrough (agents.ts ~line 258) - 2.3 Add
llama_flags: typeof fm.llama_flags === 'string' ? fm.llama_flags : nullto the return object inparseAgentSection()(agents.ts ~line 364)
3. Build X-Agent-Flags header
- 3.1 Add
buildAgentFlagsHeader(agent: Agent | null): string | undefinedtoapps/server/src/services/inference/stream-phase-adapter.ts - 3.2 Export the function for testability
4. Emit header on inference requests
- 4.1 In
streamCompletion(), computeagentFlagsHeaderfrom the agent parameter - 4.2 Pass
headers: { 'X-Agent-Flags': agentFlagsHeader }tostreamText()when non-empty - 4.3 Verify the header is NOT emitted when agent is null or llama_flags is null/empty
5. Fix sentinel summaries (V3)
- 5.1 In
sentinel-summaries.ts, addagentas the 8th argument to thestreamCompletion()call inrunWrapUpSummary()(aftersignal)
6. Write tests
- 6.1 Add unit test for
buildAgentFlagsHeaderinstream-phase-adapter.test.ts(null agent, null llama_flags, empty string, whitespace-only, valid flags) - 6.2 Add test verifying
streamTextreceivesheaders: { 'X-Agent-Flags': '...' }when agent has llama_flags
7. Verify end-to-end
- 7.1 Run
pnpm -C apps/server buildto confirm typecheck passes - 7.2 Run
pnpm -C apps/server testto confirm no regressions