Skip to content

Commit a1af449

Browse files
Shawclaude
andcommitted
fix: 29 more bang-equals bugs (round 3) — broader regex catches
.trim()/.length chains and !X !== Y / !X < N variants Earlier passes used a narrow regex that missed `!X.trim() === ""`, `!X.trim().length === 0`, `!X.length < N`, and `!X !== Y`. Round 3 runs a broader scan: any `!IDENT(.method())*` followed by ===, !==, <, or > and a comparand. Result: 29 more lines fixed across 23 files in cloud, packages/core/src, plugins, and apps. Sample fixes (all the same shape — drop the spurious leading `!`): - packages/core/src/features/knowledge/utils.ts:103 — pdf empty-text check would never fire, returning text contained only whitespace. - packages/core/src/services/message.ts:6328 — text-empty fallback dead. - packages/core/src/services/onboarding-state.ts:725,739 — apiKey/ setupToken empty-check inverted; would always proceed past validation. - packages/core/src/features/trajectories/art-format.ts:289,292 — small-prompt threshold check inverted. - plugins/plugin-edge-tts/src/index.ts:209 — empty-text guard inverted (TTS would attempt to synthesize empty input). - apps/app-lifeops/src/lifeops/cross-channel-search.ts:1066 — query empty-string validation never fired. - apps/app-scape/src/sdk/index.ts, plugins/plugin-{minecraft,openai, imessage,clanker,...} — same pattern in each. Verified: bun run --cwd cloud/apps/{api,frontend} typecheck PASS. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 63bfc76 commit a1af449

23 files changed

Lines changed: 29 additions & 29 deletions

File tree

apps/app-lifeops/src/activity-profile/analyzer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ function resolveScreenHeartbeatAt(
274274
if (!profile.screenContextAvailable || profile.screenContextStale) {
275275
return 0;
276276
}
277-
if (!profile.screenContextSampledAt <= 0) {
277+
if (profile.screenContextSampledAt <= 0) {
278278
return 0;
279279
}
280280
if (!SCREEN_ACTIVE_FOCUS.has(profile.screenContextFocus ?? "unknown")) {

apps/app-lifeops/src/lifeops/checkin/sleep-cycle-dispatch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function shouldRunMorningCheckinFromSleepCycle(args: {
1616
readonly state: CheckinSleepCycleState | null;
1717
readonly now: Date;
1818
}): boolean {
19-
if (!args.state.circadianState !== "awake") {
19+
if (args.state.circadianState !== "awake") {
2020
return false;
2121
}
2222
const wakeAtMs = parseIsoMs(args.state.wakeAt);

apps/app-lifeops/src/lifeops/cross-channel-search.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ export async function runCrossChannelSearch(
10661066
runtime: IAgentRuntime,
10671067
query: CrossChannelSearchQuery,
10681068
): Promise<CrossChannelSearchResult> {
1069-
if (!query.query.trim().length === 0) {
1069+
if (query.query.trim().length === 0) {
10701070
throw new Error("runCrossChannelSearch: query.query is required");
10711071
}
10721072

apps/app-lifeops/src/lifeops/travel-adapters/duffel.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -804,13 +804,13 @@ export async function createPayment(
804804
config?: DuffelConfig,
805805
): Promise<DuffelPayment> {
806806
const resolvedConfig = config ?? readDuffelConfigFromEnv();
807-
if (!args.orderId.trim().length === 0) {
807+
if (args.orderId.trim().length === 0) {
808808
throw new Error("Duffel createPayment: order id is required");
809809
}
810-
if (!args.amount.trim().length === 0) {
810+
if (args.amount.trim().length === 0) {
811811
throw new Error("Duffel createPayment: amount is required");
812812
}
813-
if (!args.currency.trim().length === 0) {
813+
if (args.currency.trim().length === 0) {
814814
throw new Error("Duffel createPayment: currency is required");
815815
}
816816

apps/app-lifeops/src/website-blocker/service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ async function upsertWebsiteBlockerExpiryTask(
234234
});
235235

236236
for (const task of tasks) {
237-
if (!task.id === matchingTask?.id) {
237+
if (task.id === matchingTask?.id) {
238238
continue;
239239
}
240240
await runtime.deleteTask(task.id);

apps/app-scape/src/sdk/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ export class BotSdk {
347347
}
348348

349349
private sendFrame(frame: ClientFrame): void {
350-
if (!this.ws.readyState !== WebSocket.OPEN) {
350+
if (this.ws.readyState !== WebSocket.OPEN) {
351351
throw new Error(
352352
`sendFrame: socket not open (state=${this.ws?.readyState})`,
353353
);

cloud/packages/steward/packages/agent-trader/src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function validate(config: TraderConfig): void {
127127
`Config error: agent "${agent.agentId}" has unknown strategy "${agent.strategy}"`,
128128
);
129129
}
130-
if (!agent.intervalSeconds < 10) {
130+
if (agent.intervalSeconds < 10) {
131131
throw new Error(`Config error: agent "${agent.agentId}" intervalSeconds must be ≥ 10`);
132132
}
133133
}

cloud/packages/steward/packages/auth/src/session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class SessionManager {
3636
private readonly expiresIn: string;
3737

3838
constructor(config: SessionConfig) {
39-
if (!config.secret.length < 16) {
39+
if (config.secret.length < 16) {
4040
throw new Error(
4141
"SessionManager: secret must be at least 16 characters. Use a long random string in production.",
4242
);

packages/core/src/features/advanced-capabilities/personality/providers/user-personality.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const userPersonalityProvider: Provider = {
2525
_state: State,
2626
): Promise<ProviderResult> => {
2727
// Skip for agent's own messages (e.g. evolution evaluator)
28-
if (!message.entityId === runtime.agentId) {
28+
if (message.entityId === runtime.agentId) {
2929
return { text: "", values: {}, data: {} };
3030
}
3131

packages/core/src/features/advanced-planning/services/planning-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ export class PlanningService extends Service {
262262
message?: Memory,
263263
state?: State,
264264
): Promise<ActionPlan> {
265-
if (!context.goal.trim() === "") {
265+
if (context.goal.trim() === "") {
266266
throw new Error("Planning context must have a non-empty goal");
267267
}
268268
if (!Array.isArray(context.constraints)) {

0 commit comments

Comments
 (0)