Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "firecrawl-cli",
"version": "1.25.1",
"version": "1.25.2",
"publishConfig": {
"tag": "latest"
},
Expand Down
18 changes: 18 additions & 0 deletions src/__tests__/alexandria-beta.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,24 @@ function runThenPoll(statusResponse: Record<string, any>) {
: statusResponse;
}

it('does not report 0 credits for a refunded credit stop', async () => {
runThenPoll({ ...creditStopped, creditsUsed: 0 });
const result = await cli([
'agent',
'Find companies.',
'--max-credits',
'25',
'--wait',
'--poll-interval',
'0.01',
]);
expect(result.code).toBe(1);
expect(result.stdout).toContain(
'Stopped at credit limit: the agent reached its credit limit before finishing.'
);
expect(result.stdout).not.toContain('used 0 credits');
});

it('returns the partial result when a waited run hits its credit limit', async () => {
runThenPoll(creditStopped);
const args = ['agent', 'Find companies.', '--max-credits', '25', '--wait'];
Expand Down
3 changes: 2 additions & 1 deletion src/commands/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,9 @@ function partialHeading(data: AgentIncompleteFields): string {
* First line of the credit-limit notice.
*/
function creditLimitHeadline(data: { creditsUsed?: number | null }): string {
// Failed runs are refunded, so the API can report 0 for a run that did work.
const used =
data.creditsUsed !== undefined && data.creditsUsed !== null
typeof data.creditsUsed === 'number' && data.creditsUsed > 0
Comment thread
rakshith48 marked this conversation as resolved.
? `used ${data.creditsUsed} credits and `
: '';
return `Stopped at credit limit: the agent ${used}reached its credit limit before finishing.`;
Expand Down
Loading