Skip to content

Commit 6d68248

Browse files
committed
Merge branch 'main' into subscription-client
2 parents 4064c46 + 4b8b2e9 commit 6d68248

File tree

22 files changed

+898
-128
lines changed

22 files changed

+898
-128
lines changed

cli/release/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codebuff",
3-
"version": "1.0.607",
3+
"version": "1.0.609",
44
"description": "AI coding agent",
55
"license": "MIT",
66
"bin": {

cli/src/components/validation-error-popover.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ export const ValidationErrorPopover: React.FC<ValidationErrorPopoverProps> = ({
7777
</box>
7878

7979
<box style={{ flexDirection: 'column', paddingTop: 1, gap: 0 }}>
80-
{errors.slice(0, 3).map((error) => {
81-
const agentId = error.id.replace(/_\d+$/, '')
82-
const isNetworkError = error.id === NETWORK_ERROR_ID
80+
{errors.slice(0, 3).map((error, index) => {
81+
const errorId = error.id ?? ''
82+
const agentId = errorId.replace(/_\d+$/, '')
83+
const isNetworkError = errorId === NETWORK_ERROR_ID
8384
const agentInfo = loadedAgentsData?.agents.find(
8485
(a) => a.id === agentId,
8586
) as LocalAgentInfo | undefined
@@ -91,7 +92,7 @@ export const ValidationErrorPopover: React.FC<ValidationErrorPopoverProps> = ({
9192
if (isNetworkError) {
9293
return (
9394
<box
94-
key={error.id}
95+
key={errorId || `error-${index}`}
9596
style={{ flexDirection: 'column', paddingTop: 0.5 }}
9697
>
9798
<text style={{ fg: theme.muted, wrapMode: 'word' }}>
@@ -104,7 +105,7 @@ export const ValidationErrorPopover: React.FC<ValidationErrorPopoverProps> = ({
104105
if (agentInfo?.filePath) {
105106
return (
106107
<box
107-
key={error.id}
108+
key={errorId || `error-${index}`}
108109
style={{ flexDirection: 'column', paddingTop: 0.5 }}
109110
>
110111
<text style={{ fg: theme.muted, wrapMode: 'word' }}>
@@ -131,11 +132,11 @@ export const ValidationErrorPopover: React.FC<ValidationErrorPopoverProps> = ({
131132

132133
return (
133134
<box
134-
key={error.id}
135+
key={errorId || `error-${index}`}
135136
style={{ flexDirection: 'column', paddingTop: 0.5 }}
136137
>
137138
<text style={{ fg: theme.muted, wrapMode: 'word' }}>
138-
{`• ${agentId}`}
139+
{`• ${agentId || 'Unknown'}`}
139140
</text>
140141
<text
141142
style={{

cli/src/hooks/use-message-queue.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,7 @@ export const useMessageQueue = (
8383
return
8484
}
8585

86-
// Log why queue is blocked (only when there are messages waiting)
8786
if (!canProcessQueue) {
88-
logger.debug(
89-
{ queueLength, canProcessQueue },
90-
'[message-queue] Queue blocked: canProcessQueue disabled',
91-
)
9287
return
9388
}
9489
if (streamStatus !== 'idle') {

cli/src/hooks/use-send-message.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const useSendMessage = ({
103103
onBeforeMessageSend,
104104
mainAgentTimer,
105105
scrollToLatest,
106-
onTimerEvent = () => {},
106+
onTimerEvent = () => { },
107107
isQueuePausedRef,
108108
isProcessingQueueRef,
109109
resumeQueue,
@@ -289,12 +289,13 @@ export const useSendMessage = ({
289289
const errorsToAttach =
290290
validationResult.errors.length === 0
291291
? [
292-
{
293-
id: NETWORK_ERROR_ID,
294-
message:
295-
'Agent validation failed. This may be due to a network issue or temporary server problem. Please try again.',
296-
},
297-
]
292+
// Hide this for now, as validate endpoint may be flaky and we don't want to bother users.
293+
// {
294+
// id: NETWORK_ERROR_ID,
295+
// message:
296+
// 'Agent validation failed. This may be due to a network issue or temporary server problem. Please try again.',
297+
// },
298+
]
298299
: validationResult.errors
299300

300301
setMessages((prev) =>

cli/src/login/plain-login.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import open from 'open'
21
import { cyan, green, red, yellow, bold } from 'picocolors'
32

43
import { WEBSITE_URL } from './constants'
@@ -47,15 +46,7 @@ export async function runPlainLogin(): Promise<void> {
4746
console.log()
4847
console.log(cyan(loginData.loginUrl))
4948
console.log()
50-
51-
// Try to open browser, silently ignore failure (expected on remote servers)
52-
try {
53-
await open(loginData.loginUrl)
54-
console.log(green('Browser opened. Waiting for login...'))
55-
} catch {
56-
console.log(yellow('Could not open browser — please open the URL above manually.'))
57-
}
58-
49+
console.log(yellow('Please open the URL above manually to complete login.'))
5950
console.log()
6051
console.log('Waiting for login...')
6152

common/src/constants/grant-priorities.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import type { GrantType } from '@codebuff/common/types/grant'
22

3+
// Lower = consumed first
34
export const GRANT_PRIORITIES: Record<GrantType, number> = {
45
subscription: 10,
56
free: 20,
6-
referral: 30,
7+
referral_legacy: 30, // Legacy recurring referrals (renews monthly, consumed first)
78
ad: 40,
9+
referral: 50, // One-time referrals (never expires, preserved longer)
810
admin: 60,
911
organization: 70,
1012
purchase: 80,

common/src/constants/limits.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const MAX_DATE = new Date(86399999999999)
55
export const BILLING_PERIOD_DAYS = 30
66
export const SESSION_MAX_AGE_SECONDS = 30 * 24 * 60 * 60 // 30 days
77
export const SESSION_TIME_WINDOW_MS = 30 * 60 * 1000 // 30 minutes - used for matching sessions created around fingerprint creation
8-
export const CREDITS_REFERRAL_BONUS = 250
8+
export const CREDITS_REFERRAL_BONUS = 500
99
export const AFFILIATE_USER_REFFERAL_LIMIT = 500
1010

1111
// Default number of free credits granted per cycle

common/src/types/grant.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export type GrantType =
22
| 'free'
33
| 'referral'
4+
| 'referral_legacy'
45
| 'subscription'
56
| 'purchase'
67
| 'admin'
@@ -10,6 +11,7 @@ export type GrantType =
1011
export const GrantTypeValues = [
1112
'free',
1213
'referral',
14+
'referral_legacy',
1315
'subscription',
1416
'purchase',
1517
'admin',

0 commit comments

Comments
 (0)