@bike4mind/cli 0.2.80 → 0.2.81-feat-chess-agent-v2.22501
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ConfigStore-CG7DYbjy.mjs → ConfigStore-DJmY-Fv4.mjs} +105 -1
- package/dist/commands/doctorCommand.mjs +1 -1
- package/dist/commands/headlessCommand.mjs +2 -2
- package/dist/commands/mcpCommand.mjs +1 -1
- package/dist/commands/updateCommand.mjs +1 -1
- package/dist/index.mjs +21 -51
- package/dist/{tools-BYBHpm5w.mjs → tools-DgzaM7ds.mjs} +891 -67
- package/dist/{updateChecker-YklUziR2.mjs → updateChecker-C3yNlFGz.mjs} +1 -1
- package/package.json +7 -7
|
@@ -129,6 +129,7 @@ let ChatModels = /* @__PURE__ */ function(ChatModels) {
|
|
|
129
129
|
ChatModels["CLAUDE_4_5_OPUS_BEDROCK"] = "global.anthropic.claude-opus-4-5-20251101-v1:0";
|
|
130
130
|
ChatModels["CLAUDE_4_6_SONNET_BEDROCK"] = "global.anthropic.claude-sonnet-4-6";
|
|
131
131
|
ChatModels["CLAUDE_4_6_OPUS_BEDROCK"] = "global.anthropic.claude-opus-4-6-v1";
|
|
132
|
+
ChatModels["CLAUDE_4_7_OPUS_BEDROCK"] = "global.anthropic.claude-opus-4-7";
|
|
132
133
|
ChatModels["CLAUDE_3_OPUS"] = "claude-3-opus-20240229";
|
|
133
134
|
ChatModels["CLAUDE_3_5_HAIKU_ANTHROPIC"] = "claude-3-5-haiku-20241022";
|
|
134
135
|
ChatModels["CLAUDE_3_5_SONNET_ANTHROPIC"] = "claude-3-5-sonnet-20241022";
|
|
@@ -141,6 +142,7 @@ let ChatModels = /* @__PURE__ */ function(ChatModels) {
|
|
|
141
142
|
ChatModels["CLAUDE_4_5_OPUS"] = "claude-opus-4-5-20251101";
|
|
142
143
|
ChatModels["CLAUDE_4_6_SONNET"] = "claude-sonnet-4-6";
|
|
143
144
|
ChatModels["CLAUDE_4_6_OPUS"] = "claude-opus-4-6";
|
|
145
|
+
ChatModels["CLAUDE_4_7_OPUS"] = "claude-opus-4-7";
|
|
144
146
|
ChatModels["JURASSIC2_ULTRA"] = "ai21.j2-ultra-v1";
|
|
145
147
|
ChatModels["JURASSIC2_MID"] = "ai21.j2-mid-v1";
|
|
146
148
|
ChatModels["GEMINI_3_1_PRO_PREVIEW"] = "gemini-3.1-pro-preview";
|
|
@@ -194,6 +196,7 @@ const FIXED_TEMPERATURE_MODELS = new Set([
|
|
|
194
196
|
ChatModels.GPT5_1_CHAT_LATEST,
|
|
195
197
|
ChatModels.GPT5_2_CHAT_LATEST
|
|
196
198
|
]);
|
|
199
|
+
new Set([ChatModels.CLAUDE_4_7_OPUS, ChatModels.CLAUDE_4_7_OPUS_BEDROCK]);
|
|
197
200
|
/**
|
|
198
201
|
* Speech to Text Models
|
|
199
202
|
*
|
|
@@ -334,6 +337,7 @@ const b4mLLMTools = z.enum([
|
|
|
334
337
|
"iss_tracker",
|
|
335
338
|
"planet_visibility",
|
|
336
339
|
"search_knowledge_base",
|
|
340
|
+
"chess_engine",
|
|
337
341
|
"retrieve_knowledge_content",
|
|
338
342
|
"delegate_to_agent",
|
|
339
343
|
"quantum_schedule",
|
|
@@ -391,6 +395,7 @@ const ArtifactMetadataSchema = z.object({
|
|
|
391
395
|
const ArtifactTypeSchema = z.enum([
|
|
392
396
|
"mermaid",
|
|
393
397
|
"recharts",
|
|
398
|
+
"chess",
|
|
394
399
|
"python",
|
|
395
400
|
"react",
|
|
396
401
|
"html",
|
|
@@ -467,6 +472,12 @@ const ArtifactTypeSchema = z.enum([
|
|
|
467
472
|
description: "Financial pro-forma models and projections",
|
|
468
473
|
category: "finance",
|
|
469
474
|
mimeType: "application/json"
|
|
475
|
+
},
|
|
476
|
+
chess: {
|
|
477
|
+
name: "Chess Game",
|
|
478
|
+
description: "Interactive chess board with move validation and AI opponent",
|
|
479
|
+
category: "interactive",
|
|
480
|
+
mimeType: "application/json"
|
|
470
481
|
}
|
|
471
482
|
}).map((info) => info.category))];
|
|
472
483
|
const ArtifactSchema = z.object({
|
|
@@ -547,6 +558,23 @@ ArtifactSchema.extend({
|
|
|
547
558
|
colors: z.array(z.string()).optional()
|
|
548
559
|
})
|
|
549
560
|
});
|
|
561
|
+
ArtifactSchema.extend({
|
|
562
|
+
type: z.literal("chess"),
|
|
563
|
+
metadata: ArtifactMetadataSchema.extend({
|
|
564
|
+
fen: z.string().optional(),
|
|
565
|
+
turn: z.enum(["w", "b"]).optional(),
|
|
566
|
+
lastMove: z.object({
|
|
567
|
+
from: z.string(),
|
|
568
|
+
to: z.string(),
|
|
569
|
+
san: z.string().optional()
|
|
570
|
+
}).optional(),
|
|
571
|
+
isCheck: z.boolean().optional(),
|
|
572
|
+
isCheckmate: z.boolean().optional(),
|
|
573
|
+
isDraw: z.boolean().optional(),
|
|
574
|
+
isGameOver: z.boolean().optional(),
|
|
575
|
+
moveNumber: z.number().optional()
|
|
576
|
+
})
|
|
577
|
+
});
|
|
550
578
|
ArtifactSchema.extend({
|
|
551
579
|
type: z.literal("lattice"),
|
|
552
580
|
metadata: ArtifactMetadataSchema.extend({
|
|
@@ -673,6 +701,11 @@ let ApiKeyScope = /* @__PURE__ */ function(ApiKeyScope) {
|
|
|
673
701
|
ApiKeyScope["AI_CHAT"] = "ai:chat";
|
|
674
702
|
ApiKeyScope["READ_PROJECTS"] = "projects:read";
|
|
675
703
|
ApiKeyScope["WRITE_PROJECTS"] = "projects:write";
|
|
704
|
+
/** Authorizes only the cc-bridge WS actions (cc_agent_register /
|
|
705
|
+
* cc_agent_event / cc_agent_disconnect). Keys with this scope CANNOT
|
|
706
|
+
* call chat/completions — a leaked bridge key has the narrow blast
|
|
707
|
+
* radius of a sprite-spawning credential, not a billable AI key. */
|
|
708
|
+
ApiKeyScope["CC_BRIDGE"] = "cc-bridge:connect";
|
|
676
709
|
ApiKeyScope["ADMIN"] = "admin:*";
|
|
677
710
|
return ApiKeyScope;
|
|
678
711
|
}({});
|
|
@@ -1881,6 +1914,74 @@ const TavernStockUpdateAction = z.object({
|
|
|
1881
1914
|
totalValue: z.number()
|
|
1882
1915
|
}))
|
|
1883
1916
|
});
|
|
1917
|
+
/**
|
|
1918
|
+
* ========================================
|
|
1919
|
+
* Claude Code Bridge Actions
|
|
1920
|
+
*
|
|
1921
|
+
* Bridge (`@bike4mind/cc-bridge`) runs on the user's machine, hosts Claude
|
|
1922
|
+
* Code sessions, and forwards events up so each session appears as a sprite
|
|
1923
|
+
* in the Tavern. See CLAUDE_CODE_TAVERN_PLAN.md.
|
|
1924
|
+
* ========================================
|
|
1925
|
+
*/
|
|
1926
|
+
/** Lifecycle status of a Claude Code session, as seen by the Tavern. */
|
|
1927
|
+
const CcAgentStatus = z.enum([
|
|
1928
|
+
"running",
|
|
1929
|
+
"idle",
|
|
1930
|
+
"awaiting_input",
|
|
1931
|
+
"awaiting_permission",
|
|
1932
|
+
"disconnected"
|
|
1933
|
+
]);
|
|
1934
|
+
/**
|
|
1935
|
+
* Bridge → Server: announce a new Claude Code session.
|
|
1936
|
+
*
|
|
1937
|
+
* The server persists an ActiveCodeAgent record keyed by instanceId, picks a
|
|
1938
|
+
* sprite, and broadcasts an `add_entity` scene command so every connected tab
|
|
1939
|
+
* of the user's account sees the new agent appear in the Tavern.
|
|
1940
|
+
*/
|
|
1941
|
+
const CcAgentRegisterAction = z.object({
|
|
1942
|
+
action: z.literal("cc_agent_register"),
|
|
1943
|
+
accessToken: z.string().max(512).optional(),
|
|
1944
|
+
instanceId: z.string().min(1).max(128),
|
|
1945
|
+
deviceId: z.string().min(1).max(128),
|
|
1946
|
+
workspaceName: z.string().min(1).max(200),
|
|
1947
|
+
workspacePath: z.string().max(1024),
|
|
1948
|
+
claudeVersion: z.string().max(32).optional(),
|
|
1949
|
+
startedAt: z.string().max(40)
|
|
1950
|
+
});
|
|
1951
|
+
/**
|
|
1952
|
+
* Bridge → Server: stream an event for an already-registered session.
|
|
1953
|
+
*
|
|
1954
|
+
* v1 PoC carries two event variants; more (tool_call, tool_result,
|
|
1955
|
+
* permission_request, artifact) will be added as later phases land.
|
|
1956
|
+
*/
|
|
1957
|
+
const CcAgentEventPayload = z.discriminatedUnion("type", [z.object({
|
|
1958
|
+
type: z.literal("status"),
|
|
1959
|
+
status: CcAgentStatus,
|
|
1960
|
+
text: z.string().max(4e3).optional()
|
|
1961
|
+
}), z.object({
|
|
1962
|
+
type: z.literal("message"),
|
|
1963
|
+
role: z.enum(["user", "assistant"]),
|
|
1964
|
+
text: z.string().max(4e3)
|
|
1965
|
+
})]);
|
|
1966
|
+
const CcAgentEventAction = z.object({
|
|
1967
|
+
action: z.literal("cc_agent_event"),
|
|
1968
|
+
accessToken: z.string().max(512).optional(),
|
|
1969
|
+
instanceId: z.string().min(1).max(128),
|
|
1970
|
+
timestamp: z.string().max(40),
|
|
1971
|
+
event: CcAgentEventPayload
|
|
1972
|
+
});
|
|
1973
|
+
/**
|
|
1974
|
+
* Bridge → Server: the CC session ended cleanly.
|
|
1975
|
+
*
|
|
1976
|
+
* The server also sweeps `ActiveCodeAgent` records on `$disconnect`, so this
|
|
1977
|
+
* message is an optimization (immediate despawn) rather than a requirement.
|
|
1978
|
+
*/
|
|
1979
|
+
const CcAgentDisconnectAction = z.object({
|
|
1980
|
+
action: z.literal("cc_agent_disconnect"),
|
|
1981
|
+
accessToken: z.string().max(512).optional(),
|
|
1982
|
+
instanceId: z.string().min(1).max(128),
|
|
1983
|
+
reason: z.string().max(200).optional()
|
|
1984
|
+
});
|
|
1884
1985
|
const SessionCreatedAction = shareableDocumentSchema.extend({
|
|
1885
1986
|
action: z.literal("session.created"),
|
|
1886
1987
|
id: z.string(),
|
|
@@ -1930,7 +2031,10 @@ z.discriminatedUnion("action", [
|
|
|
1930
2031
|
KeepCommandRequestAction,
|
|
1931
2032
|
KeepCommandResponseAction,
|
|
1932
2033
|
TavernSceneCommandRequestAction,
|
|
1933
|
-
JupyterCellOutputAction
|
|
2034
|
+
JupyterCellOutputAction,
|
|
2035
|
+
CcAgentRegisterAction,
|
|
2036
|
+
CcAgentEventAction,
|
|
2037
|
+
CcAgentDisconnectAction
|
|
1934
2038
|
]);
|
|
1935
2039
|
z.discriminatedUnion("action", [
|
|
1936
2040
|
DataSubscriptionUpdateAction,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as version, n as fetchLatestVersion, r as forceCheckForUpdate } from "../updateChecker-
|
|
2
|
+
import { i as version, n as fetchLatestVersion, r as forceCheckForUpdate } from "../updateChecker-C3yNlFGz.mjs";
|
|
3
3
|
import { execSync } from "child_process";
|
|
4
4
|
import { constants, existsSync, promises } from "fs";
|
|
5
5
|
import { homedir } from "os";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { B as CustomCommandStore, C as getApiUrl, E as generateCliTools, I as buildCoreSystemPrompt, P as setWebSocketToolExecutor, R as isReadOnlyTool, S as loadContextFiles, T as PermissionManager, U as SessionStore, V as CheckpointStore, _ as ServerLlmBackend, a as createBackgroundAgentTools, c as AgentStore, f as ApiClient, g as WebSocketLlmBackend, h as FallbackLlmBackend, i as createWriteTodosTool, l as SubagentOrchestrator, m as WebSocketConnectionManager, n as createFindDefinitionTool, o as BackgroundAgentManager, p as WebSocketToolExecutor, r as createTodoStore, s as createAgentDelegateTool, t as createGetFileStructureTool, u as createSkillTool, v as McpManager, z as ReActAgent } from "../tools-
|
|
3
|
-
import { n as logger, t as ConfigStore } from "../ConfigStore-
|
|
2
|
+
import { B as CustomCommandStore, C as getApiUrl, E as generateCliTools, I as buildCoreSystemPrompt, P as setWebSocketToolExecutor, R as isReadOnlyTool, S as loadContextFiles, T as PermissionManager, U as SessionStore, V as CheckpointStore, _ as ServerLlmBackend, a as createBackgroundAgentTools, c as AgentStore, f as ApiClient, g as WebSocketLlmBackend, h as FallbackLlmBackend, i as createWriteTodosTool, l as SubagentOrchestrator, m as WebSocketConnectionManager, n as createFindDefinitionTool, o as BackgroundAgentManager, p as WebSocketToolExecutor, r as createTodoStore, s as createAgentDelegateTool, t as createGetFileStructureTool, u as createSkillTool, v as McpManager, z as ReActAgent } from "../tools-DgzaM7ds.mjs";
|
|
3
|
+
import { n as logger, t as ConfigStore } from "../ConfigStore-DJmY-Fv4.mjs";
|
|
4
4
|
import { t as DEFAULT_SANDBOX_CONFIG } from "../types-DBEjF9YS.mjs";
|
|
5
5
|
import { t as createSandboxRuntime } from "../SandboxRuntimeAdapter-C1B4t20N.mjs";
|
|
6
6
|
import { t as SandboxOrchestrator } from "../SandboxOrchestrator-BEW3rqYi.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as version, r as forceCheckForUpdate } from "../updateChecker-
|
|
2
|
+
import { i as version, r as forceCheckForUpdate } from "../updateChecker-C3yNlFGz.mjs";
|
|
3
3
|
import { execSync } from "child_process";
|
|
4
4
|
//#region src/commands/updateCommand.ts
|
|
5
5
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { n as useCliStore, t as selectActiveBackgroundAgents } from "./store-Dw1nZX2Y.mjs";
|
|
3
|
-
import { A as DEFAULT_RETRY_CONFIG, B as CustomCommandStore, C as getApiUrl, D as ALWAYS_DENIED_FOR_AGENTS, E as generateCliTools, F as OllamaBackend, G as hasFileReferences, H as CommandHistoryStore, I as buildCoreSystemPrompt, J as mergeCommands, K as processFileReferences, L as buildSkillsPromptSection, M as clearFeatureModuleTools, N as registerFeatureModuleTools, O as DEFAULT_AGENT_MODEL, P as setWebSocketToolExecutor, R as isReadOnlyTool, S as loadContextFiles, T as PermissionManager, U as SessionStore, V as CheckpointStore, W as OAuthClient, X as searchFiles, Y as formatFileSize, Z as warmFileCache, _ as ServerLlmBackend, a as createBackgroundAgentTools, b as formatStep, c as AgentStore, d as parseAgentConfig, f as ApiClient, g as WebSocketLlmBackend, h as FallbackLlmBackend, i as createWriteTodosTool, j as DEFAULT_THOROUGHNESS, k as DEFAULT_MAX_ITERATIONS, l as SubagentOrchestrator, m as WebSocketConnectionManager, n as createFindDefinitionTool, o as BackgroundAgentManager, p as WebSocketToolExecutor, q as searchCommands, r as createTodoStore, s as createAgentDelegateTool, t as createGetFileStructureTool, u as createSkillTool, v as McpManager, w as getEnvironmentName, x as extractCompactInstructions, y as substituteArguments, z as ReActAgent } from "./tools-
|
|
4
|
-
import { Dt as validateJupyterKernelName, Ot as validateNotebookPath$1, g as ChatModels, m as CREDIT_DEDUCT_TRANSACTION_TYPES, n as logger, t as ConfigStore } from "./ConfigStore-
|
|
5
|
-
import { i as version, t as checkForUpdate } from "./updateChecker-
|
|
3
|
+
import { A as DEFAULT_RETRY_CONFIG, B as CustomCommandStore, C as getApiUrl, D as ALWAYS_DENIED_FOR_AGENTS, E as generateCliTools, F as OllamaBackend, G as hasFileReferences, H as CommandHistoryStore, I as buildCoreSystemPrompt, J as mergeCommands, K as processFileReferences, L as buildSkillsPromptSection, M as clearFeatureModuleTools, N as registerFeatureModuleTools, O as DEFAULT_AGENT_MODEL, P as setWebSocketToolExecutor, R as isReadOnlyTool, S as loadContextFiles, T as PermissionManager, U as SessionStore, V as CheckpointStore, W as OAuthClient, X as searchFiles, Y as formatFileSize, Z as warmFileCache, _ as ServerLlmBackend, a as createBackgroundAgentTools, b as formatStep, c as AgentStore, d as parseAgentConfig, f as ApiClient, g as WebSocketLlmBackend, h as FallbackLlmBackend, i as createWriteTodosTool, j as DEFAULT_THOROUGHNESS, k as DEFAULT_MAX_ITERATIONS, l as SubagentOrchestrator, m as WebSocketConnectionManager, n as createFindDefinitionTool, o as BackgroundAgentManager, p as WebSocketToolExecutor, q as searchCommands, r as createTodoStore, s as createAgentDelegateTool, t as createGetFileStructureTool, u as createSkillTool, v as McpManager, w as getEnvironmentName, x as extractCompactInstructions, y as substituteArguments, z as ReActAgent } from "./tools-DgzaM7ds.mjs";
|
|
4
|
+
import { Dt as validateJupyterKernelName, Ot as validateNotebookPath$1, g as ChatModels, m as CREDIT_DEDUCT_TRANSACTION_TYPES, n as logger, t as ConfigStore } from "./ConfigStore-DJmY-Fv4.mjs";
|
|
5
|
+
import { i as version, t as checkForUpdate } from "./updateChecker-C3yNlFGz.mjs";
|
|
6
6
|
import React, { useCallback, useEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
7
7
|
import { Box, Static, Text, render, useApp, useInput } from "ink";
|
|
8
8
|
import { execSync } from "child_process";
|
|
@@ -4445,46 +4445,26 @@ function CliApp() {
|
|
|
4445
4445
|
console.warn("Failed to load custom commands:", error instanceof Error ? error.message : String(error));
|
|
4446
4446
|
}
|
|
4447
4447
|
const authTokens = await state.configStore.getAuthTokens();
|
|
4448
|
-
let isAuthenticated = false;
|
|
4449
4448
|
if (!authTokens) {
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
console.log("\n⚠️ Authentication token expired.");
|
|
4457
|
-
console.log("💡 Run /login to re-authenticate with your B4M account.\n");
|
|
4458
|
-
await state.configStore.clearAuthTokens();
|
|
4459
|
-
} else {
|
|
4460
|
-
isAuthenticated = true;
|
|
4461
|
-
const daysUntilExpiry = Math.floor((expiresAt.getTime() - Date.now()) / (1e3 * 60 * 60 * 24));
|
|
4462
|
-
startupLog.push(`✅ Authenticated (expires in ${daysUntilExpiry} day${daysUntilExpiry !== 1 ? "s" : ""})`);
|
|
4463
|
-
}
|
|
4449
|
+
console.log("\n🔐 Welcome to B4M CLI! Authentication is required to get started.\n");
|
|
4450
|
+
setState((prev) => ({
|
|
4451
|
+
...prev,
|
|
4452
|
+
showLoginFlow: true
|
|
4453
|
+
}));
|
|
4454
|
+
return;
|
|
4464
4455
|
}
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
name: `Session ${(/* @__PURE__ */ new Date()).toLocaleString()}`,
|
|
4470
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4471
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4472
|
-
model: "unauthenticated",
|
|
4473
|
-
messages: [],
|
|
4474
|
-
metadata: {
|
|
4475
|
-
totalTokens: 0,
|
|
4476
|
-
totalCost: 0,
|
|
4477
|
-
toolCallCount: 0
|
|
4478
|
-
}
|
|
4479
|
-
};
|
|
4456
|
+
const expiresAt = new Date(authTokens.expiresAt);
|
|
4457
|
+
if (expiresAt <= /* @__PURE__ */ new Date()) {
|
|
4458
|
+
console.log("\n🔐 Your session has expired. Let's re-authenticate.\n");
|
|
4459
|
+
await state.configStore.clearAuthTokens();
|
|
4480
4460
|
setState((prev) => ({
|
|
4481
4461
|
...prev,
|
|
4482
|
-
|
|
4483
|
-
config
|
|
4462
|
+
showLoginFlow: true
|
|
4484
4463
|
}));
|
|
4485
|
-
setIsInitialized(true);
|
|
4486
4464
|
return;
|
|
4487
4465
|
}
|
|
4466
|
+
const daysUntilExpiry = Math.floor((expiresAt.getTime() - Date.now()) / (1e3 * 60 * 60 * 24));
|
|
4467
|
+
startupLog.push(`✅ Authenticated (expires in ${daysUntilExpiry} day${daysUntilExpiry !== 1 ? "s" : ""})`);
|
|
4488
4468
|
const apiBaseURL = getApiUrl(config.apiConfig);
|
|
4489
4469
|
const envName = getEnvironmentName(config.apiConfig);
|
|
4490
4470
|
if (import.meta.url.includes("/src/") || process.env.NODE_ENV === "development" || envName !== "Bike4Mind") console.log(`🌍 API Environment: ${envName} (${apiBaseURL})`);
|
|
@@ -4979,13 +4959,7 @@ function CliApp() {
|
|
|
4979
4959
|
*/
|
|
4980
4960
|
const handleCustomCommandMessage = async (fullTemplate, displayMessage) => {
|
|
4981
4961
|
if (!state.agent || !state.session) {
|
|
4982
|
-
console.error("❌
|
|
4983
|
-
return;
|
|
4984
|
-
}
|
|
4985
|
-
const authTokens = await state.configStore.getAuthTokens();
|
|
4986
|
-
if (!authTokens || new Date(authTokens.expiresAt) <= /* @__PURE__ */ new Date()) {
|
|
4987
|
-
console.log("\n❌ Authentication required to use AI features.");
|
|
4988
|
-
console.log("💡 Run /login to authenticate with your B4M account.\n");
|
|
4962
|
+
console.error("❌ CLI failed to initialize. Try restarting b4m.\n");
|
|
4989
4963
|
return;
|
|
4990
4964
|
}
|
|
4991
4965
|
useCliStore.getState().setIsThinking(true);
|
|
@@ -5195,17 +5169,11 @@ function CliApp() {
|
|
|
5195
5169
|
};
|
|
5196
5170
|
const handleMessage = async (message) => {
|
|
5197
5171
|
if (!state.agent || !state.session) {
|
|
5198
|
-
console.error("❌
|
|
5172
|
+
console.error("❌ CLI failed to initialize. Try restarting b4m.\n");
|
|
5199
5173
|
return;
|
|
5200
5174
|
}
|
|
5201
5175
|
await state.commandHistoryStore.add(message);
|
|
5202
5176
|
setCommandHistory(await state.commandHistoryStore.list());
|
|
5203
|
-
const authTokens = await state.configStore.getAuthTokens();
|
|
5204
|
-
if (!authTokens || new Date(authTokens.expiresAt) <= /* @__PURE__ */ new Date()) {
|
|
5205
|
-
console.log("\n❌ Authentication required to use AI features.");
|
|
5206
|
-
console.log("💡 Run /login to authenticate with your B4M account.\n");
|
|
5207
|
-
return;
|
|
5208
|
-
}
|
|
5209
5177
|
const config = state.config;
|
|
5210
5178
|
let activeSession = state.session;
|
|
5211
5179
|
if (config?.preferences.autoCompact !== false && activeSession.messages.length >= 6) {
|
|
@@ -6839,7 +6807,9 @@ Multi-line Input:
|
|
|
6839
6807
|
...prev,
|
|
6840
6808
|
showLoginFlow: false
|
|
6841
6809
|
}));
|
|
6842
|
-
console.error(`\n❌ Login failed: ${error.message}
|
|
6810
|
+
console.error(`\n❌ Login failed: ${error.message}`);
|
|
6811
|
+
console.log("Run b4m again when you're ready to authenticate.\n");
|
|
6812
|
+
exit();
|
|
6843
6813
|
}
|
|
6844
6814
|
});
|
|
6845
6815
|
}
|