-
-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Problem
Multiple JSDoc examples throughout the codebase show API calls that would fail at runtime or not compile in TypeScript.
Impact
- Severity: High
- User Impact: Developers following examples will get errors
- Trust: Reduces confidence in documentation accuracy
Affected Files and Issues
src/static/rule.ts
Line 197 - Calls metadata as function:
```typescript
// WRONG
when: (agent) => agent.metadata("user_type") === "customer"
// CORRECT
when: (agent) => agent.metadata.get("user_type", "") === "customer"
```
Line 225 - Calls message() as method:
```typescript
// WRONG
when: (agent) => agent.message().length > 0
// CORRECT
when: (agent) => agent.messages.length > 0
```
src/static/message.ts
Line 214 - Shows tool_id on user message:
```typescript
// WRONG - user messages can't have tool_id
const msg = new Message({ role: 'user', content: 'Hello', tool_id: optional_id });
// CORRECT
const msg = new Message({ role: 'tool', content: 'Hello', tool_id: 'required_id' });
```
Suggested Fix
Review all @example blocks and ensure:
- Code would actually compile with TypeScript
- API calls match actual method signatures
- Examples demonstrate valid usage patterns