Skip to content

compact crashes on system-only payloads once trimming kicks in #11

Description

@royalpinto007

Problem

compact({system: "x".repeat(5000)}, {maxTokens: 10}) throws Cannot read properties of undefined (reading 'length') once trimming kicks in on a system-only payload.

Where

src/index.mjs (compact: message-list handling assumes result messages exist).

Acceptance

Add a failing test first with a large system-only payload and small budget, expecting a report without throwing. Then fix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions