Commit a30bbca
committed
fix(agent+memory): unblock CI build (TS errors in 0.3.4 release commit)
Three TS errors broke the Release workflow on master after 0280c1a
landed structured output on session.send:
1) src/api/agent.ts:575 (TS2322)
AgentSession interface declares two overloads for send():
send(input): Promise<GenerateTextResult>
send<S>(input, opts): Promise<SessionSendStructuredResult<z.infer<S>>>
The implementation signature returned just GenerateTextResult, which
doesn't satisfy the second overload's structured return.
Fix: implementation returns the union
`Promise<GenerateTextResult | SessionSendStructuredResult<unknown>>`,
constructed by binding the impl to a local `session` const and
casting to AgentSession at the return point. Standard pattern for
typed overloaded methods in TypeScript: the impl signature stays
broader than any single overload, the public overloads narrow it
for callers.
2) src/api/agent.ts:602 (TS2345)
_responseFormat in GenerateTextOptions was typed { type: string },
too narrow for the schema-bearing payloads structuredOutputFormat.ts
produces (OpenAI json_schema with json_schema sub-object, Anthropic
_agentosUseToolForStructuredOutput marker, Gemini _gemini extra).
Fix: widen GenerateTextOptions._responseFormat to
`{ type: string } | Record<string, unknown>`. Comment updated to
explain the per-provider shapes the field carries. agent.ts no
longer needs a cast at the buildResponseFormat call site.
3) src/memory/CognitiveMemoryManager.ts:852 (TS2304)
Cannot find name 'ScoredMemoryTrace'. Trailing edge of typed-network
Phase 4.3 commit (3ca839a) left a referenced type unimported.
Fix: add the missing import alongside the other memory types.
One-line completion of 3ca839a.
(Error 4 from the CI report — TS2353 about retrievedTypedFacts not
existing in type — does not reproduce locally on a clean build with
these fixes, suggesting the diagnostic was downstream of error 3 and
clears once ScoredMemoryTrace resolves.)
Local `npm run build` clean. Release workflow should now succeed.1 parent 885d2b9 commit a30bbca
2 files changed
Lines changed: 17 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
569 | 569 | | |
570 | 570 | | |
571 | 571 | | |
572 | | - | |
| 572 | + | |
573 | 573 | | |
574 | 574 | | |
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | | - | |
| 578 | + | |
579 | 579 | | |
580 | 580 | | |
581 | 581 | | |
| |||
707 | 707 | | |
708 | 708 | | |
709 | 709 | | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
710 | 715 | | |
711 | 716 | | |
712 | 717 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
335 | | - | |
336 | | - | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
337 | 344 | | |
338 | | - | |
| 345 | + | |
339 | 346 | | |
340 | 347 | | |
341 | 348 | | |
| |||
0 commit comments