Skip to content

Commit 7dcf2ea

Browse files
Add constructor regression for malformed llm payloads
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 06d8f88 commit 7dcf2ea

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

currentState.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ HyperAgent exposes a TypeScript SDK for browser automation with three primary pa
150150
- Hardened wait-listener lifecycle cleanup against trap-prone session listener-method getters, preserving settle completion while emitting sanitized detach diagnostics.
151151
- Expanded settle-flow listener regressions to cover trap-prone `session.on` getters, ensuring timeout-based fallback remains deterministic under unreadable listener APIs.
152152
- Hardened constructor LLM validation to reject malformed non-provider/non-client `llm` payloads instead of accepting invalid runtime objects, while preserving trap-safe config reads.
153+
- Added explicit constructor regression coverage for malformed partial `llm` objects to lock in fail-fast configuration behavior.
153154
- Hardened prompt final-goal rendering against malformed/trap-prone task inputs by normalizing non-string goals into bounded readable diagnostics instead of throwing.
154155
- Hardened prompt base-message materialization with trap-safe array reads so malformed/trap-prone seed message arrays no longer crash message assembly and readable entries are preserved.
155156
- Hardened constructor custom-action ingestion with trap-safe array reads so unreadable custom-action entries are skipped while valid entries continue to register.

src/agent/__tests__/hyperagent-constructor.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,19 @@ describe("HyperAgent constructor and task controls", () => {
134134
}
135135
});
136136

137+
it("throws readable error for malformed llm payloads", () => {
138+
expect(
139+
() =>
140+
new HyperAgent({
141+
llm: {
142+
invoke: async () => ({ role: "assistant", content: "ok" }),
143+
} as unknown as HyperAgentLLM,
144+
})
145+
).toThrow(
146+
"Invalid llm configuration: expected provider config or HyperAgentLLM client"
147+
);
148+
});
149+
137150
it("continues constructor when customActions length getter traps", () => {
138151
const trappedCustomActions = new Proxy(
139152
[

0 commit comments

Comments
 (0)