@bike4mind/cli 4.8.0 → 4.9.0

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.
Files changed (38) hide show
  1. package/README.md +21 -0
  2. package/bin/bike4mind-cli.mjs +342 -239
  3. package/dist/{AgentHistoryStore-Bvmcy2kf.mjs → AgentHistoryStore-jktM0SmD.mjs} +125 -64
  4. package/dist/{ApiClient-Yp2LPlX3.mjs → ApiClient-CczpydlW.mjs} +3 -3
  5. package/dist/{BubblewrapRuntime-OI4qFPNB.mjs → BubblewrapRuntime-aGfDSJPY.mjs} +2 -2
  6. package/dist/ConfigStore-BAJ4hIHa.mjs +2 -0
  7. package/dist/{ConfigStore-CP1W86Ui.mjs → ConfigStore-CO6kREaL.mjs} +2 -2
  8. package/dist/{Logger-3RbeTZ9o.mjs → Logger-CHKCF5hd.mjs} +3334 -336
  9. package/dist/{SandboxOrchestrator-lpxVEFO7.mjs → SandboxOrchestrator-ULWvuUct.mjs} +1 -1
  10. package/dist/{SandboxRuntimeAdapter-C3xICJtQ.mjs → SandboxRuntimeAdapter-DpDSET-A.mjs} +2 -2
  11. package/dist/{SandboxRuntimeAdapter-u6c_IrjP.mjs → SandboxRuntimeAdapter-FpZRkE6D.mjs} +1 -1
  12. package/dist/{SeatbeltRuntime-Ccd_QbjX.mjs → SeatbeltRuntime-C0GJ3nnY.mjs} +2 -2
  13. package/dist/{WorkItemsClient-D4sFGL9X.mjs → WorkItemsClient-aCxMV_Wm.mjs} +1 -1
  14. package/dist/{buildToolSearch-CqHKSLtG.mjs → buildToolSearch-CbLeZ5wP.mjs} +2 -2
  15. package/dist/commands/acpCommand.mjs +5 -5
  16. package/dist/commands/apiCommand.mjs +1 -1
  17. package/dist/commands/doctorCommand.mjs +2 -2
  18. package/dist/commands/envCommand.mjs +1 -1
  19. package/dist/commands/headlessCommand.mjs +6 -6
  20. package/dist/commands/hostCommand.mjs +1 -1
  21. package/dist/commands/mcpCommand.mjs +3 -3
  22. package/dist/commands/mirrorCommand.mjs +2 -2
  23. package/dist/commands/modelsCommand.mjs +4 -4
  24. package/dist/commands/pluginCommand.mjs +1 -1
  25. package/dist/commands/skillsCommand.mjs +3 -3
  26. package/dist/commands/updateCommand.mjs +2 -2
  27. package/dist/{dist-BPhZ0dCz.mjs → dist-BOxr8LQA.mjs} +138 -2
  28. package/dist/{fit-BOnDsgbk.mjs → fit-BHDTSpfd.mjs} +3 -3
  29. package/dist/index.mjs +288 -30
  30. package/dist/{modelServers-B7zI5XnO.mjs → modelServers-CVufZd1f.mjs} +1 -1
  31. package/dist/{package-WlxLVpUb.mjs → package-TACInPbw.mjs} +1 -1
  32. package/dist/{serve-DpsV0mag.mjs → serve-OywSzShu.mjs} +726 -59
  33. package/dist/{store-xeJRhBtO.mjs → store-CmOg7JIt.mjs} +2 -0
  34. package/dist/store-OGMXhD4A.mjs +2 -0
  35. package/dist/{updateChecker-Boq0RruU.mjs → updateChecker-5v_8LhXy.mjs} +1 -1
  36. package/package.json +12 -12
  37. package/dist/ConfigStore-Bo4od3Eu.mjs +0 -2
  38. package/dist/store-Bpdo9Syo.mjs +0 -2
package/dist/index.mjs CHANGED
@@ -1,19 +1,20 @@
1
1
  #!/usr/bin/env node
2
- import { $ as SIGN_IN_DURING_TURN, A as createTodoStore, At as warmFileCache, B as substituteArguments, C as formatBlockersOutput, Ct as hasFileReferences, D as createGetFileStructureTool, Dt as searchCommands, E as formatDecisionsOutput, Et as SessionStore, F as createResumeAgentTool, G as DEFAULT_AGENT_MODEL, H as buildCliToolList, I as createBackgroundAgentTools, J as DEFAULT_THOROUGHNESS, K as DEFAULT_MAX_ITERATIONS, L as createAgentDelegateTool, M as createSkillTool, N as parseAgentConfig, Nt as MAX_PASTE_SIZE, O as createWorkItemTools, Ot as formatFileSize, P as createCoordinateTaskTool, Q as SIGNED_OUT_BANNER, R as FallbackLlmBackend, S as createBlockerTools, St as processFileReferences, T as createDecisionStore, Tt as CommandHistoryStore, V as PermissionManager, W as ALWAYS_DENIED_FOR_AGENTS, X as LOGGED_OUT_RESTART, Y as LOCAL_SESSION_CONTINUES, Z as NoLocalModelsError, _t as getProcessHooks, b as formatReviewGatesOutput, bt as getPlanModeFilePath, c as checkSavedSignIn, ct as signedOutCommandMessage, dt as buildSkillsPromptSection, et as SIGN_IN_EXPIRED, f as buildLlmBackend, gt as wrapTools, ht as findIterationBoundary, it as loginBlocked, j as createWriteTodosTool, jt as COMPACTION_SUMMARY_MARKER, k as createFindDefinitionTool, kt as searchFiles, l as settleSignInRefresh, lt as signedOutNoMatchMessage, nt as SIGN_IN_HINT, ot as signInUncheckedLoginMessage, q as DEFAULT_RETRY_CONFIG, s as buildSandbox, st as signInUncheckedMessage, u as startupMode, ut as buildSystemPrompt, v as createReviewGateStore, vt as setWebSocketToolExecutor, w as createDecisionLogTool, wt as CheckpointStore, x as createBlockerStore, xt as CustomCommandStore, y as createReviewGateTool, z as isConnectionDrop } from "./AgentHistoryStore-Bvmcy2kf.mjs";
3
- import { a as selectLiveSubagentTokens, i as selectLiveSubagentCredits, n as selectActiveBackgroundShells, o as useCliStore, r as selectCompletedBackgroundShells, t as selectActiveBackgroundAgents } from "./store-xeJRhBtO.mjs";
4
- import { D as sanitizeTerminalText, E as escapeTerminalControlChars, S as LOCAL_DEV_URL, T as parseApiUrl, _ as getEnvironmentName, c as ToolCatalog, g as getDefaultApiUrl, h as getCreditsUrl, m as ApiEndpointUnconfiguredError, o as extractCompactInstructions, t as ConfigStore, v as requireApiUrl, y as resolveApiEndpoint } from "./ConfigStore-CP1W86Ui.mjs";
5
- import { a as extractErrorMessage$1 } from "./dist-BPhZ0dCz.mjs";
6
- import { C as CREDIT_DEDUCT_TRANSACTION_TYPES, Jt as actorColorIndex, Kt as ACTOR_COLOR_SLOTS, Q as SUBQUEST_STATUS_VALUES, Qt as selfClaimedActorKindSchema, T as ChatModels, Xt as actorKindSchema, Y as REVIEW_GATE_STATUS_VALUES, Yt as actorKindMarker, Zt as delegationPayloadSchema, _t as isEarlyStop, n as SESSION_ID_PATTERN, qt as DELEGATION_PAYLOAD_SCHEMA_NAME, r as isValidSessionId, t as logger, zt as tokenEstimateMultiplier } from "./Logger-3RbeTZ9o.mjs";
2
+ import { $ as SIGNED_OUT_BANNER, A as createTodoStore, At as searchFiles, B as isConnectionDrop, C as formatBlockersOutput, Ct as processFileReferences, D as createGetFileStructureTool, Dt as SessionStore, E as formatDecisionsOutput, Et as CommandHistoryStore, F as createCoordinateTaskTool, G as ALWAYS_DENIED_FOR_AGENTS, H as PermissionManager, I as createResumeAgentTool, J as DEFAULT_RETRY_CONFIG, K as DEFAULT_AGENT_MODEL, L as createBackgroundAgentTools, M as resetTodoStore, Mt as COMPACTION_SUMMARY_MARKER, N as createSkillTool, O as createWorkItemTools, Ot as searchCommands, P as parseAgentConfig, Pt as MAX_PASTE_SIZE, Q as NoLocalModelsError, R as createAgentDelegateTool, S as createBlockerTools, St as CustomCommandStore, T as createDecisionStore, Tt as CheckpointStore, U as buildCliToolList, V as substituteArguments, X as LOCAL_SESSION_CONTINUES, Y as DEFAULT_THOROUGHNESS, Z as LOGGED_OUT_RESTART, _t as wrapTools, at as loginBlocked, b as formatReviewGatesOutput, c as checkSavedSignIn, ct as signInUncheckedMessage, dt as buildSystemPrompt, et as SIGN_IN_DURING_TURN, f as buildLlmBackend, ft as buildSkillsPromptSection, gt as findIterationBoundary, j as createWriteTodosTool, jt as warmFileCache, k as createFindDefinitionTool, kt as formatFileSize, l as settleSignInRefresh, lt as signedOutCommandMessage, q as DEFAULT_MAX_ITERATIONS, rt as SIGN_IN_HINT, s as buildSandbox, st as signInUncheckedLoginMessage, tt as SIGN_IN_EXPIRED, u as startupMode, ut as signedOutNoMatchMessage, v as createReviewGateStore, vt as getProcessHooks, w as createDecisionLogTool, wt as hasFileReferences, x as createBlockerStore, xt as getPlanModeFilePath, y as createReviewGateTool, yt as setWebSocketToolExecutor, z as FallbackLlmBackend } from "./AgentHistoryStore-jktM0SmD.mjs";
3
+ import { D as sanitizeTerminalText, E as escapeTerminalControlChars, S as LOCAL_DEV_URL, T as parseApiUrl, _ as getEnvironmentName, c as ToolCatalog, g as getDefaultApiUrl, h as getCreditsUrl, m as ApiEndpointUnconfiguredError, o as extractCompactInstructions, t as ConfigStore, v as requireApiUrl, y as resolveApiEndpoint } from "./ConfigStore-CO6kREaL.mjs";
4
+ import { a as selectLiveSubagentTokens, i as selectLiveSubagentCredits, n as selectActiveBackgroundShells, o as useCliStore, r as selectCompletedBackgroundShells, t as selectActiveBackgroundAgents } from "./store-CmOg7JIt.mjs";
5
+ import { a as extractErrorMessage$1 } from "./dist-BOxr8LQA.mjs";
6
+ import { $t as tokenEstimateMultiplier, Bt as planProgress, C as CREDIT_DEDUCT_TRANSACTION_TYPES, Dt as isEarlyStop, T as ChatModels, cn as actorColorIndex, dn as delegationPayloadSchema, fn as selfClaimedActorKindSchema, it as REVIEW_GATE_STATUS_VALUES, ln as actorKindMarker, n as SESSION_ID_PATTERN, on as ACTOR_COLOR_SLOTS, r as isValidSessionId, sn as DELEGATION_PAYLOAD_SCHEMA_NAME, st as SUBQUEST_STATUS_VALUES, t as logger, un as actorKindSchema, zt as planLeaves } from "./Logger-CHKCF5hd.mjs";
7
7
  import { a as rewireReservedNames, i as mergeCommands, t as RemoteSkillSource } from "./RemoteSkillSource-D_F99yBR.mjs";
8
8
  import { r as isFeatureEnabled, t as PluginStore } from "./PluginStore-DwvOJ-G3.mjs";
9
- import { i as getTokenCounter, n as ConversationContext, r as reconstructTurnBlocks, t as WorkItemsClient } from "./WorkItemsClient-D4sFGL9X.mjs";
9
+ import { i as getTokenCounter, n as ConversationContext, r as reconstructTurnBlocks, t as WorkItemsClient } from "./WorkItemsClient-aCxMV_Wm.mjs";
10
10
  import { t as getShellSessionManager } from "./ShellSessionManager-6o8KZzl1-vrbPAUTq.mjs";
11
- import { r as OAuthClient, t as ApiClient } from "./ApiClient-Yp2LPlX3.mjs";
12
- import { t as version } from "./package-WlxLVpUb.mjs";
13
- import { a as NotifyingLlmBackend, i as deferredToolRegistry, n as buildAgent, r as buildSupportingStores, t as buildToolSearch } from "./buildToolSearch-CqHKSLtG.mjs";
14
- import { s as getStartupUpdateStatus } from "./updateChecker-Boq0RruU.mjs";
15
- import React, { useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
11
+ import { r as OAuthClient, t as ApiClient } from "./ApiClient-CczpydlW.mjs";
12
+ import { t as version } from "./package-TACInPbw.mjs";
13
+ import { a as NotifyingLlmBackend, i as deferredToolRegistry, n as buildAgent, r as buildSupportingStores, t as buildToolSearch } from "./buildToolSearch-CbLeZ5wP.mjs";
14
+ import { s as getStartupUpdateStatus } from "./updateChecker-5v_8LhXy.mjs";
15
+ import React, { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
16
16
  import { Box, Static, Text, measureElement, render, useApp, useInput, usePaste, useStdin, useStdout } from "ink";
17
+ import { formatWithOptions, promisify } from "node:util";
17
18
  import { randomBytes } from "crypto";
18
19
  import { constants, existsSync, promises, readFileSync, statSync } from "fs";
19
20
  import { homedir } from "os";
@@ -26,9 +27,9 @@ import { z as z$1 } from "zod";
26
27
  import axios, { isAxiosError } from "axios";
27
28
  import Spinner from "ink-spinner";
28
29
  import { useShallow } from "zustand/react/shallow";
30
+ import wrapAnsi from "wrap-ansi";
29
31
  import TextInput from "ink-text-input";
30
32
  import { createHash as createHash$1, createHmac as createHmac$1, randomBytes as randomBytes$1, randomUUID as randomUUID$1, timingSafeEqual } from "node:crypto";
31
- import { promisify } from "node:util";
32
33
  import { homedir as homedir$1, tmpdir } from "node:os";
33
34
  import { execFile, spawn } from "child_process";
34
35
  import { promisify as promisify$1 } from "util";
@@ -44,6 +45,74 @@ import { pathToFileURL } from "url";
44
45
  import WebSocket from "ws";
45
46
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
46
47
  import { StringDecoder } from "node:string_decoder";
48
+ //#region src/components/FullscreenOutput.tsx
49
+ const OutputContext = createContext("");
50
+ const METHODS = [
51
+ "log",
52
+ "info",
53
+ "warn",
54
+ "error",
55
+ "debug"
56
+ ];
57
+ function FullscreenOutput({ children, onOutput }) {
58
+ const [output, setOutput] = useState("");
59
+ useLayoutEffect(() => {
60
+ let captured = "";
61
+ const originals = METHODS.map((method) => [method, console[method]]);
62
+ for (const method of METHODS) console[method] = (...args) => {
63
+ const text = formatWithOptions({ colors: false }, ...args);
64
+ captured = `${captured}${captured ? "\n" : ""}${text}`.slice(-65536);
65
+ onOutput(captured);
66
+ setOutput(captured);
67
+ };
68
+ return () => {
69
+ for (const [method, original] of originals) console[method] = original;
70
+ };
71
+ }, [onOutput]);
72
+ return /* @__PURE__ */ React.createElement(OutputContext.Provider, { value: output }, children);
73
+ }
74
+ function useFullscreenOutput() {
75
+ return useContext(OutputContext);
76
+ }
77
+ //#endregion
78
+ //#region src/fullscreen.ts
79
+ function fullscreenEnabled(requested = process.env.B4M_FULLSCREEN === "1", stdout = process.stdout, stdin = process.stdin) {
80
+ return requested && !!stdout.isTTY && !!stdin.isTTY;
81
+ }
82
+ function renderFullscreen(node, stdout = process.stdout, stdin = process.stdin) {
83
+ let capturedOutput = "";
84
+ const onOutput = (output) => {
85
+ capturedOutput = output;
86
+ };
87
+ const frameStream = new Proxy(stdout, { get(target, key) {
88
+ if (key === "write") return (chunk, callback) => {
89
+ if (chunk === "") return target.write("", callback);
90
+ if (chunk === "\x1B[?1049l") {
91
+ const diagnostics = capturedOutput ? sanitizeTerminalText(capturedOutput) + "\n" : "";
92
+ capturedOutput = "";
93
+ return target.write(chunk + diagnostics, callback);
94
+ }
95
+ if (/^(?:\u001b\[\?[0-9;]+[hl])+$/.test(chunk)) return target.write(chunk, callback);
96
+ if (chunk === "\n") return target.write("", callback);
97
+ return target.write("\x1B[H\x1B[2J" + chunk, callback);
98
+ };
99
+ const value = Reflect.get(target, key, target);
100
+ return typeof value === "function" ? value.bind(target) : value;
101
+ } });
102
+ return render(React.createElement(FullscreenOutput, {
103
+ onOutput,
104
+ children: node
105
+ }), {
106
+ stdout: frameStream,
107
+ stdin,
108
+ debug: true,
109
+ interactive: true,
110
+ alternateScreen: true,
111
+ exitOnCtrlC: false,
112
+ patchConsole: false
113
+ });
114
+ }
115
+ //#endregion
47
116
  //#region src/components/StatusBar.tsx
48
117
  const StatusBar = React.memo(function StatusBar({ isBashMode, model, tokenUsage, creditsUsage, subagentTokenUsage, subagentCreditsUsage, subagentActive = false }) {
49
118
  const interactionMode = useCliStore((state) => state.interactionMode);
@@ -1077,6 +1146,87 @@ function BackgroundShellStatus() {
1077
1146
  session
1078
1147
  })));
1079
1148
  }
1149
+ const GLYPH = {
1150
+ completed: { symbol: "✓" },
1151
+ in_progress: {
1152
+ symbol: "●",
1153
+ color: "cyan"
1154
+ },
1155
+ pending: { symbol: "○" },
1156
+ cancelled: {
1157
+ symbol: "✕",
1158
+ color: "gray"
1159
+ }
1160
+ };
1161
+ const flatten = (items) => items.flatMap((item) => [{
1162
+ item,
1163
+ indent: false
1164
+ }, ...(item.children ?? []).map((child) => ({
1165
+ item: child,
1166
+ indent: true
1167
+ }))]);
1168
+ /** Rows the expanded block occupies for a given cap, so App can take them off the live budget. */
1169
+ function expandedPlanRows(items, maxRows) {
1170
+ return Math.min(flatten(items).length, Math.max(0, maxRows));
1171
+ }
1172
+ const oneLine = (text) => sanitizeTerminalText(text).replace(/\s+/g, " ");
1173
+ function Row({ item, indent }) {
1174
+ const { symbol, color } = GLYPH[item.status];
1175
+ const label = oneLine(item.status === "in_progress" ? item.activeForm ?? item.content : item.content);
1176
+ return /* @__PURE__ */ React.createElement(Box, { marginLeft: indent ? 2 : 0 }, /* @__PURE__ */ React.createElement(Text, { wrap: "truncate-end" }, /* @__PURE__ */ React.createElement(Text, {
1177
+ color,
1178
+ dimColor: item.status === "completed"
1179
+ }, symbol, " "), /* @__PURE__ */ React.createElement(Text, {
1180
+ color: item.status === "in_progress" ? "cyan" : void 0,
1181
+ dimColor: item.status !== "in_progress",
1182
+ strikethrough: item.status === "completed" || item.status === "cancelled"
1183
+ }, label)));
1184
+ }
1185
+ /** Leaf the summary and the expanded window both centre on: first in progress, else first pending. */
1186
+ const currentLeaf = (items) => {
1187
+ const live = planLeaves(items);
1188
+ return live.find((item) => item.status === "in_progress") ?? live.find((item) => item.status === "pending");
1189
+ };
1190
+ /** Plan above the prompt: list while a turn runs (capped to `maxRows`), `n/m - current` once it ends. */
1191
+ function PlanBlock({ maxRows = 8 }) {
1192
+ const items = useCliStore((state) => state.plan);
1193
+ const active = useCliStore((state) => state.isThinking || state.turnInFlight);
1194
+ if (items.length === 0) return null;
1195
+ if (!active) {
1196
+ if (planLeaves(items).every((item) => item.status === "completed")) return null;
1197
+ const { done, total } = planProgress({
1198
+ version: 1,
1199
+ source: "write_todos",
1200
+ items,
1201
+ updatedAt: 0
1202
+ });
1203
+ const current = currentLeaf(items);
1204
+ return /* @__PURE__ */ React.createElement(Text, {
1205
+ dimColor: true,
1206
+ wrap: "truncate-end"
1207
+ }, done, "/", total, current ? ` - ${oneLine(current.content)}` : "");
1208
+ }
1209
+ const rows = flatten(items);
1210
+ const budget = Math.max(0, maxRows);
1211
+ if (budget === 0) return null;
1212
+ let shown = rows;
1213
+ let hidden = 0;
1214
+ if (rows.length > budget) {
1215
+ const target = currentLeaf(items);
1216
+ const anchor = Math.max(0, rows.findIndex((row) => row.item === target));
1217
+ if (budget === 1) shown = [rows[anchor]];
1218
+ else {
1219
+ const visible = budget - 1;
1220
+ const start = Math.min(Math.max(0, anchor - (visible > 1 ? 1 : 0)), rows.length - visible);
1221
+ shown = rows.slice(start, start + visible);
1222
+ hidden = rows.length - visible;
1223
+ }
1224
+ }
1225
+ return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, shown.map((row) => /* @__PURE__ */ React.createElement(Row, {
1226
+ key: row.item.id,
1227
+ ...row
1228
+ })), hidden > 0 && /* @__PURE__ */ React.createElement(Text, { dimColor: true }, "+", hidden, " more"));
1229
+ }
1080
1230
  //#endregion
1081
1231
  //#region src/components/CompletedGroupNotification.tsx
1082
1232
  /** Time to display notifications before clearing (ms) */
@@ -1163,7 +1313,7 @@ function withSessionScope(items, scope) {
1163
1313
  * Displays when a tool needs permission before execution.
1164
1314
  * Waits indefinitely for user response (like Claude Code).
1165
1315
  */
1166
- function PermissionPrompt({ toolName, toolDescription, args, preview, canBeTrusted, sessionScope, kind, onResponse }) {
1316
+ function PermissionPrompt({ viewport, toolName, toolDescription, args, preview, canBeTrusted, sessionScope, kind, onResponse }) {
1167
1317
  const isSandboxEscalation = kind === "sandbox-escalation";
1168
1318
  const hideArgs = TOOLS_WITH_HIDDEN_ARGS$1.has(toolName);
1169
1319
  const baseItems = isSandboxEscalation ? [
@@ -1213,6 +1363,15 @@ function PermissionPrompt({ toolName, toolDescription, args, preview, canBeTrust
1213
1363
  const items = isSandboxEscalation || sessionScope === void 0 ? baseItems : withSessionScope(baseItems, sessionScope);
1214
1364
  const [selectedIndex, setSelectedIndex] = useState(0);
1215
1365
  const [responded, setResponded] = useState(false);
1366
+ const [previewOffset, setPreviewOffset] = useState(0);
1367
+ const details = viewport ? wrapAnsi(escapeTerminalControlChars([
1368
+ `Tool: ${toolName}`,
1369
+ toolDescription,
1370
+ `Arguments: ${typeof args === "string" ? args : JSON.stringify(args, null, 2)}`,
1371
+ preview ? `Preview:\n${preview}` : ""
1372
+ ].filter(Boolean).join("\n")), Math.max(1, viewport.columns), { hard: true }).split("\n") : [];
1373
+ const detailRows = Math.max(1, (viewport?.rows ?? 24) - items.length - 4);
1374
+ const detailStart = Math.min(previewOffset, Math.max(0, details.length - detailRows));
1216
1375
  const handleSelect = useCallback(() => {
1217
1376
  if (responded) return;
1218
1377
  setResponded(true);
@@ -1234,6 +1393,10 @@ function PermissionPrompt({ toolName, toolDescription, args, preview, canBeTrust
1234
1393
  ]);
1235
1394
  useInput((input, key) => {
1236
1395
  if (responded) return;
1396
+ if (viewport && (key.pageUp || key.pageDown)) {
1397
+ setPreviewOffset(Math.max(0, Math.min(details.length - detailRows, detailStart + (key.pageUp ? -detailRows : detailRows))));
1398
+ return;
1399
+ }
1237
1400
  const num = parseInt(input, 10);
1238
1401
  if (num >= 1 && num <= items.length) {
1239
1402
  handleSelectIndex(num - 1);
@@ -1258,6 +1421,24 @@ function PermissionPrompt({ toolName, toolDescription, args, preview, canBeTrust
1258
1421
  const borderColor = isSandboxBlock ? "red" : "yellow";
1259
1422
  const headerColor = isSandboxBlock ? "red" : "yellow";
1260
1423
  const headerText = isSandboxBlock ? "🛑 Sandbox Blocked" : "⚠️ Permission Required";
1424
+ if (viewport) return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(Text, {
1425
+ bold: true,
1426
+ color: headerColor,
1427
+ wrap: "truncate"
1428
+ }, "Permission Required: ", escapeTerminalControlChars(toolName)), /* @__PURE__ */ React.createElement(Text, {
1429
+ dimColor: true,
1430
+ wrap: "truncate"
1431
+ }, "PgUp/PgDn: details ", detailStart + 1, "-", Math.min(details.length, detailStart + detailRows), "/", details.length), details.slice(detailStart, detailStart + detailRows).map((line, index) => /* @__PURE__ */ React.createElement(Text, {
1432
+ key: index,
1433
+ wrap: "truncate"
1434
+ }, line || " ")), items.map((item, index) => /* @__PURE__ */ React.createElement(Text, {
1435
+ key: item.value,
1436
+ wrap: "truncate",
1437
+ color: index === selectedIndex ? "cyan" : void 0
1438
+ }, index + 1, ". ", item.label)), /* @__PURE__ */ React.createElement(Text, {
1439
+ dimColor: true,
1440
+ wrap: "truncate"
1441
+ }, "1-", items.length, ", y/n, or Up/Down + Enter: decide"));
1261
1442
  return /* @__PURE__ */ React.createElement(Box, {
1262
1443
  flexDirection: "column",
1263
1444
  borderStyle: "bold",
@@ -2610,6 +2791,40 @@ const MessageItem = React.memo(function MessageItem({ message, showThoughts = tr
2610
2791
  }, (message.metadata.tokenUsage?.total || message.metadata.creditsUsed) && /* @__PURE__ */ React.createElement(Text, { dimColor: true }, "(", message.metadata.tokenUsage?.total ? `${message.metadata.tokenUsage.total.toLocaleString()} tokens` : "", message.metadata.creditsUsed && message.metadata.creditsUsed > 0 ? (message.metadata.tokenUsage?.total ? " • " : "") + `used ${message.metadata.creditsUsed.toLocaleString()} ${message.metadata.creditsUsed === 1 ? "credit" : "credits"}` : "", ")")));
2611
2792
  });
2612
2793
  //#endregion
2794
+ //#region src/components/FullscreenHistory.tsx
2795
+ function FullscreenHistory({ messages, rows, columns }) {
2796
+ const [selected, setSelected] = useState(Math.max(0, messages.length - 1));
2797
+ const [offset, setOffset] = useState(0);
2798
+ const index = Math.min(selected, Math.max(0, messages.length - 1));
2799
+ const message = messages[index];
2800
+ const lines = useMemo(() => {
2801
+ if (!message) return ["No completed messages yet."];
2802
+ const steps = message.metadata?.steps?.map((step) => JSON.stringify(step)).join("\n");
2803
+ const transcript = [message.content, steps].filter(Boolean).join("\n\n");
2804
+ return wrapAnsi(sanitizeTerminalText(transcript), Math.max(1, columns), { hard: true }).split("\n");
2805
+ }, [message, columns]);
2806
+ const pageRows = Math.max(1, rows - 3);
2807
+ const start = Math.min(offset, Math.max(0, lines.length - pageRows));
2808
+ useInput((_input, key) => {
2809
+ if (key.leftArrow || key.rightArrow) {
2810
+ setSelected(Math.max(0, Math.min(messages.length - 1, index + (key.leftArrow ? -1 : 1))));
2811
+ setOffset(0);
2812
+ }
2813
+ if (key.upArrow || key.pageUp) setOffset(Math.max(0, start - (key.pageUp ? pageRows : 1)));
2814
+ if (key.downArrow || key.pageDown) setOffset(Math.min(Math.max(0, lines.length - pageRows), start + (key.pageDown ? pageRows : 1)));
2815
+ });
2816
+ return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(Text, {
2817
+ bold: true,
2818
+ wrap: "truncate"
2819
+ }, "History ", messages.length ? index + 1 : 0, "/", messages.length, " ", message?.role), /* @__PURE__ */ React.createElement(Text, {
2820
+ dimColor: true,
2821
+ wrap: "truncate"
2822
+ }, "Left/Right: message | Up/Down/PgUp/PgDn: lines | Ctrl+O: back"), lines.slice(start, start + pageRows).map((line, i) => /* @__PURE__ */ React.createElement(Text, {
2823
+ key: i,
2824
+ wrap: "truncate"
2825
+ }, line || " ")));
2826
+ }
2827
+ //#endregion
2613
2828
  //#region src/components/App.tsx
2614
2829
  /**
2615
2830
  * Live-frame rows reserved for everything outside the step trace and any open
@@ -2630,7 +2845,7 @@ const LIVE_CHROME_ROWS = 10;
2630
2845
  /** Shown under the queued-message rows; mirrors the routing in handleSubmit and the ESC handler in index.tsx. */
2631
2846
  const QUEUE_HINT = "Enter steers this turn · Tab queues for next turn · Esc cancels and restores to input";
2632
2847
  const PEER_QUEUE_HINT = "Enter and Tab queue your next turn · Peer work does not receive your input";
2633
- function App({ onMessage, onBackgroundCompletion, onCommand, onBashCommand, onPermissionResponse, onUserQuestionResponse, onReviewGateResponse, onImageDetected, commandHistory = [], onHistoryEntry, commands = [], config, availableModels = [], pluginDescriptors = [], onSaveConfig, prefillInput, onPrefillConsumed, mcpManager }) {
2848
+ function App({ fullscreen = false, onMessage, onBackgroundCompletion, onCommand, onBashCommand, onPermissionResponse, onUserQuestionResponse, onReviewGateResponse, onImageDetected, commandHistory = [], onHistoryEntry, commands = [], config, availableModels = [], pluginDescriptors = [], onSaveConfig, prefillInput, onPrefillConsumed, mcpManager }) {
2634
2849
  const messages = useCliStore(useShallow((state) => state.session?.messages || []));
2635
2850
  const pendingMessages = useCliStore((state) => state.pendingMessages);
2636
2851
  const messageQueue = useCliStore((state) => state.messageQueue);
@@ -2695,8 +2910,23 @@ function App({ onMessage, onBackgroundCompletion, onCommand, onBashCommand, onPe
2695
2910
  useInput(() => setPromptInputTick((tick) => tick + 1), { isActive: promptKey !== "" });
2696
2911
  const promptRows = promptKey === "" ? 0 : measuredPrompt?.key === promptKey ? measuredPrompt.rows : Infinity;
2697
2912
  const [terminalCols, terminalRows] = useStdoutDimensions();
2913
+ const fullscreenOutput = useFullscreenOutput();
2914
+ const historyMessages = React.useMemo(() => fullscreenOutput ? [...messages, {
2915
+ id: "fullscreen-output",
2916
+ role: "assistant",
2917
+ content: "Command output (most recent 64K characters)\n\n" + fullscreenOutput,
2918
+ timestamp: ""
2919
+ }] : messages, [messages, fullscreenOutput]);
2920
+ const [browsingHistory, setBrowsingHistory] = useState(false);
2921
+ useInput((input, key) => {
2922
+ if (key.ctrl && input === "o") setBrowsingHistory((value) => !value);
2923
+ }, { isActive: fullscreen && !promptKey && !showConfigEditor && !showMcpViewer });
2698
2924
  const queueRows = messageQueue.length > 0 ? messageQueue.length + 1 : 0;
2699
- const liveRows = Math.max(0, terminalRows - LIVE_CHROME_ROWS - queueRows - promptRows);
2925
+ const budgetRows = Math.max(0, terminalRows - LIVE_CHROME_ROWS - queueRows - promptRows);
2926
+ const planActive = useCliStore((state) => state.isThinking || state.turnInFlight);
2927
+ const plan = useCliStore((state) => state.plan);
2928
+ const planMaxRows = Math.min(8, Math.floor(budgetRows / 2));
2929
+ const liveRows = budgetRows - (planActive ? expandedPlanRows(plan, planMaxRows) : 0);
2700
2930
  const handleSubmit = React.useCallback(async (input, options) => {
2701
2931
  const trimmed = input.trim();
2702
2932
  if (!trimmed) return;
@@ -2754,13 +2984,36 @@ function App({ onMessage, onBackgroundCompletion, onCommand, onBashCommand, onPe
2754
2984
  config,
2755
2985
  mcpManager,
2756
2986
  onClose: () => setShowMcpViewer(false)
2757
- })) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Static, { items: messages }, (message) => /* @__PURE__ */ React.createElement(Box, {
2987
+ })) : /* @__PURE__ */ React.createElement(React.Fragment, null, fullscreen && browsingHistory && !promptKey && /* @__PURE__ */ React.createElement(FullscreenHistory, {
2988
+ messages: historyMessages,
2989
+ rows: terminalRows,
2990
+ columns: terminalCols
2991
+ }), fullscreen && permissionPrompt && /* @__PURE__ */ React.createElement(PermissionPrompt, {
2992
+ key: permissionPrompt.id,
2993
+ viewport: {
2994
+ rows: terminalRows,
2995
+ columns: terminalCols
2996
+ },
2997
+ toolName: permissionPrompt.toolName,
2998
+ args: permissionPrompt.args,
2999
+ preview: permissionPrompt.preview,
3000
+ canBeTrusted: permissionPrompt.canBeTrusted,
3001
+ sessionScope: permissionPrompt.sessionScope,
3002
+ kind: permissionPrompt.kind,
3003
+ onResponse: (response) => onPermissionResponse(response, permissionPrompt.id)
3004
+ }), /* @__PURE__ */ React.createElement(Box, {
3005
+ flexDirection: "column",
3006
+ display: fullscreen && (browsingHistory && !promptKey || permissionPrompt) ? "none" : "flex"
3007
+ }, !fullscreen && /* @__PURE__ */ React.createElement(Static, { items: messages }, (message) => /* @__PURE__ */ React.createElement(Box, {
2758
3008
  key: message.id,
2759
3009
  flexDirection: "column"
2760
3010
  }, /* @__PURE__ */ React.createElement(MessageItem, {
2761
3011
  message,
2762
3012
  showThoughts
2763
- }))), /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, pendingMessages.map((message) => /* @__PURE__ */ React.createElement(Box, {
3013
+ }))), fullscreen && /* @__PURE__ */ React.createElement(Text, {
3014
+ dimColor: true,
3015
+ wrap: "truncate"
3016
+ }, "Ctrl+O: history (", messages.length, " messages", fullscreenOutput ? ", command output" : "", ")"), fullscreen && fullscreenOutput && /* @__PURE__ */ React.createElement(Text, { wrap: "truncate" }, fullscreenOutput.trimEnd().slice(fullscreenOutput.trimEnd().lastIndexOf("\n") + 1)), /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, pendingMessages.map((message) => /* @__PURE__ */ React.createElement(Box, {
2764
3017
  key: message.id,
2765
3018
  flexDirection: "column"
2766
3019
  }, /* @__PURE__ */ React.createElement(MessageItem, {
@@ -2770,7 +3023,7 @@ function App({ onMessage, onBackgroundCompletion, onCommand, onBashCommand, onPe
2770
3023
  })))), /* @__PURE__ */ React.createElement(Box, {
2771
3024
  ref: promptRef,
2772
3025
  flexDirection: "column"
2773
- }, permissionPrompt && /* @__PURE__ */ React.createElement(Box, {
3026
+ }, permissionPrompt && !fullscreen && /* @__PURE__ */ React.createElement(Box, {
2774
3027
  key: permissionPrompt.id,
2775
3028
  flexDirection: "column",
2776
3029
  paddingX: 1
@@ -2806,7 +3059,7 @@ function App({ onMessage, onBackgroundCompletion, onCommand, onBashCommand, onPe
2806
3059
  const target = exitHandoffPrompt;
2807
3060
  setExitHandoffPrompt(null);
2808
3061
  target.resolve(generate);
2809
- } }))), !permissionPrompt && !userQuestionPrompt && !reviewGatePrompt && !exitHandoffPrompt && /* @__PURE__ */ React.createElement(AgentThinking, null), /* @__PURE__ */ React.createElement(BackgroundAgentStatus, null), /* @__PURE__ */ React.createElement(BackgroundShellStatus, null), /* @__PURE__ */ React.createElement(CompletedGroupNotification, null), exitRequested && /* @__PURE__ */ React.createElement(Box, {
3062
+ } }))), !permissionPrompt && !userQuestionPrompt && !reviewGatePrompt && !exitHandoffPrompt && /* @__PURE__ */ React.createElement(AgentThinking, null), /* @__PURE__ */ React.createElement(PlanBlock, { maxRows: planMaxRows }), /* @__PURE__ */ React.createElement(BackgroundAgentStatus, null), /* @__PURE__ */ React.createElement(BackgroundShellStatus, null), /* @__PURE__ */ React.createElement(CompletedGroupNotification, null), exitRequested && /* @__PURE__ */ React.createElement(Box, {
2810
3063
  paddingX: 1,
2811
3064
  marginBottom: 1
2812
3065
  }, /* @__PURE__ */ React.createElement(Text, {
@@ -2844,7 +3097,7 @@ function App({ onMessage, onBackgroundCompletion, onCommand, onBashCommand, onPe
2844
3097
  onSubmit: handleSubmit,
2845
3098
  onBashCommand,
2846
3099
  onImageDetected,
2847
- disabled: !!permissionPrompt || !!userQuestionPrompt || !!reviewGatePrompt || !!exitHandoffPrompt,
3100
+ disabled: fullscreen && browsingHistory || !!permissionPrompt || !!userQuestionPrompt || !!reviewGatePrompt || !!exitHandoffPrompt,
2848
3101
  history: commandHistory,
2849
3102
  onHistoryEntry,
2850
3103
  commands,
@@ -2859,7 +3112,7 @@ function App({ onMessage, onBackgroundCompletion, onCommand, onBashCommand, onPe
2859
3112
  subagentTokenUsage: subagentTokens,
2860
3113
  subagentCreditsUsage: subagentCost,
2861
3114
  subagentActive
2862
- }))));
3115
+ })))));
2863
3116
  }
2864
3117
  //#endregion
2865
3118
  //#region src/components/TrustLocationSelector.tsx
@@ -3773,7 +4026,7 @@ function renderWorkflowReminder(state, options = {}) {
3773
4026
  const openBlockers = state.blockers.filter((b) => b.status === "open");
3774
4027
  const recentDecisions = state.decisions.slice(-5);
3775
4028
  let elided = state.decisions.length - recentDecisions.length;
3776
- const todoLines = openTodos.map((t, i) => `${i + 1}. [${t.status}] ${elide(t.description)}`);
4029
+ const todoLines = openTodos.map((t, i) => `${i + 1}. [${t.status}] ${elide(t.content)}`);
3777
4030
  const blockerLines = openBlockers.map((b) => `- ${elide(b.description)}`);
3778
4031
  const decisionLines = recentDecisions.map((d) => `- ${elide(d.summary)} (rationale: ${elide(d.rationale, 100)})`);
3779
4032
  if (todoLines.length === 0 && blockerLines.length === 0 && decisionLines.length === 0) return {
@@ -4116,13 +4369,13 @@ function buildLocalHandoff(session, workflowOverride) {
4116
4369
  const openTodos = todos.filter((t) => t.status === "pending" || t.status === "in_progress");
4117
4370
  const currentTask = todos.find((t) => t.status === "in_progress");
4118
4371
  const parts = [`Local handoff for session "${session.name}" (${session.messages.length} messages, model ${session.model}).`, `${decisions.length} decisions, ${openBlockers.length} open blockers, ${openTodos.length} open todos.`];
4119
- if (currentTask) parts.push(`Current task: ${currentTask.description}.`);
4372
+ if (currentTask) parts.push(`Current task: ${currentTask.content}.`);
4120
4373
  if (decisions.length > 0) parts.push(`Latest decision: ${decisions[decisions.length - 1].summary}.`);
4121
4374
  parts.push("Generated from session state without an LLM call; no narrative synthesis.");
4122
4375
  return {
4123
4376
  summary: parts.join(" "),
4124
4377
  keyFindings: decisions.map((d) => `${d.summary} (rationale: ${d.rationale})`),
4125
- nextSteps: [...openTodos.map((t) => t.description), ...openBlockers.map((b) => `Resolve blocker: ${b.description}`)],
4378
+ nextSteps: [...openTodos.map((t) => t.content), ...openBlockers.map((b) => `Resolve blocker: ${b.description}`)],
4126
4379
  pendingDecisions: [],
4127
4380
  blockers: openBlockers.map((b) => b.description),
4128
4381
  generatedAt: (/* @__PURE__ */ new Date()).toISOString()
@@ -11200,7 +11453,7 @@ async function createFreshSession(ctx) {
11200
11453
  logger.debug("=== New Session Started via /clear ===");
11201
11454
  ctx.decisionStore.decisions = [];
11202
11455
  ctx.blockerStore.blockers = [];
11203
- ctx.todoStore.todos = [];
11456
+ resetTodoStore(ctx.todoStore);
11204
11457
  ctx.checkpointStore?.setSessionId(newSession.id);
11205
11458
  useCliStore.getState().setSession(newSession);
11206
11459
  useCliStore.getState().clearPendingMessages();
@@ -11235,6 +11488,7 @@ async function resumeSession(ctx, selected) {
11235
11488
  await logger.initialize(loadedSession.id);
11236
11489
  logger.debug("=== Session Resumed ===");
11237
11490
  ctx.checkpointStore?.setSessionId(loadedSession.id);
11491
+ resetTodoStore(ctx.todoStore);
11238
11492
  const handoff = loadedSession.metadata.workflow?.handoff;
11239
11493
  const messagesForState = handoff ? injectHandoffMessage(loadedSession.messages, handoff) : injectWorkflowStateMessage(loadedSession.messages, loadedSession.metadata.workflow);
11240
11494
  const sessionForState = {
@@ -11488,7 +11742,7 @@ function CliApp() {
11488
11742
  const mcpApprovalResolvedRef = useRef(false);
11489
11743
  const detectedOllamaRef = useRef(null);
11490
11744
  const initGenerationRef = useRef(0);
11491
- const todoStoreRef = useRef(createTodoStore());
11745
+ const todoStoreRef = useRef(createTodoStore((items) => useCliStore.getState().setPlan(items)));
11492
11746
  const decisionStoreRef = useRef(createDecisionStore());
11493
11747
  const blockerStoreRef = useRef(createBlockerStore());
11494
11748
  const reviewGateStoreRef = useRef(createReviewGateStore());
@@ -11964,7 +12218,7 @@ function CliApp() {
11964
12218
  }) : toolSearchLlm;
11965
12219
  const notifyingLlm = new NotifyingLlmBackend(llmWithFallback, backgroundManager);
11966
12220
  const todoStore = todoStoreRef.current;
11967
- todoStore.todos = [];
12221
+ resetTodoStore(todoStore);
11968
12222
  const writeTodosTool = createWriteTodosTool(todoStore);
11969
12223
  const decisionLogTool = createDecisionLogTool(decisionStoreRef.current);
11970
12224
  const blockerTools = createBlockerTools(blockerStoreRef.current);
@@ -13373,8 +13627,10 @@ function CliApp() {
13373
13627
  }
13374
13628
  case "clear":
13375
13629
  case "new": {
13376
- console.clear();
13377
- renderBanner();
13630
+ if (!fullscreenEnabled()) {
13631
+ console.clear();
13632
+ renderBanner();
13633
+ }
13378
13634
  const newSession = await createFreshSession(buildLifecycleContext());
13379
13635
  console.log("New session started.");
13380
13636
  console.log(`\n📝 Session: ${newSession.name} | 🤖 Model: ${newSession.model} | 📊 Tokens: 0\n`);
@@ -14442,6 +14698,7 @@ function CliApp() {
14442
14698
  }));
14443
14699
  const allCommands = mergeCommands(state.customCommandStore.getAllCommands(), featureCommandDefs);
14444
14700
  return /* @__PURE__ */ React.createElement(App, {
14701
+ fullscreen: fullscreenEnabled(),
14445
14702
  onMessage: handleMessage,
14446
14703
  onBackgroundCompletion: handleBackgroundCompletion,
14447
14704
  onCommand: handleCommand,
@@ -14496,6 +14753,7 @@ const cachedUpdate = await getStartupUpdateStatus(version);
14496
14753
  if (cachedUpdate?.updateAvailable) console.log(`\x1b[33m \u2b06 Update available: v${cachedUpdate.currentVersion} \u2192 v${cachedUpdate.latestVersion} (run: b4m update)\x1b[0m\n`);
14497
14754
  if (import.meta.url.includes("/src/") || process.env.NODE_ENV === "development") logger.debug("🔧 Running in development mode (using TypeScript source)\n");
14498
14755
  warmFileCache();
14499
- render(/* @__PURE__ */ React.createElement(CliApp, null), { exitOnCtrlC: false });
14756
+ if (fullscreenEnabled()) renderFullscreen(/* @__PURE__ */ React.createElement(CliApp, null));
14757
+ else render(/* @__PURE__ */ React.createElement(CliApp, null), { exitOnCtrlC: false });
14500
14758
  //#endregion
14501
14759
  export {};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { D as sanitizeTerminalText } from "./ConfigStore-CP1W86Ui.mjs";
2
+ import { D as sanitizeTerminalText } from "./ConfigStore-CO6kREaL.mjs";
3
3
  import { C as trackChild, H as isPermissiveEntry, K as ollamaModelKey, L as findHubBuild, O as curatedBuildForRef, Q as PullIdleTimeoutError, R as hubBuildTag, S as signalTree, T as HUGGING_FACE_SSH_KEYS_URL, V as isHubRepoId, Y as HubAccessError, Z as ModelNotFoundError, b as lmStudioModelsSchema, c as checkReviewedLayers, d as detectRuntimes, et as parseBaseUrl, f as licensesChanged, i as OllamaRuntime, k as curatedEntryForRef, l as checkRuntime, p as manifestChange, s as checkInstalledDigest, x as productFromOwner, y as OpenAICompatibleRuntime, z as isAbliteratedModel } from "./dist-K7a9yOUb.mjs";
4
4
  import { createHash } from "crypto";
5
5
  import path from "node:path";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  //#region package.json
3
- var version = "4.8.0";
3
+ var version = "4.9.0";
4
4
  //#endregion
5
5
  export { version as t };