@bike4mind/cli 1.1.0 → 1.2.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 (28) hide show
  1. package/README.md +1 -0
  2. package/bin/bike4mind-cli.mjs +0 -5
  3. package/dist/AgentHistoryStore-B2NEOvSW.mjs +18014 -0
  4. package/dist/{ApiClient-BOWpVvTq.mjs → ApiClient-D0fQ2FT6.mjs} +2 -2
  5. package/dist/{BubblewrapRuntime-CkL9-gnG.mjs → BubblewrapRuntime-5bLPTwEC.mjs} +2 -2
  6. package/dist/{ConfigStore-DdHHCH2t.mjs → ConfigStore-qV7NrCgZ.mjs} +1154 -1365
  7. package/dist/{ProxyManager-C1-lgzEU.mjs → ProxyManager-B0-RuR2w.mjs} +21 -4
  8. package/dist/{SandboxOrchestrator-CIegJrCj.mjs → SandboxOrchestrator-BcUv9fQ3.mjs} +46 -12
  9. package/dist/{SandboxRuntimeAdapter-ChGlxSGQ.mjs → SandboxRuntimeAdapter-BgLUVTJL.mjs} +2 -2
  10. package/dist/{SandboxRuntimeAdapter-CKelGICD.mjs → SandboxRuntimeAdapter-BmHELLuM.mjs} +1 -1
  11. package/dist/{SeatbeltRuntime-Qqt19cAN.mjs → SeatbeltRuntime-C_Y8q8Mr.mjs} +9 -1
  12. package/dist/buildAgent-C-C-VGff.mjs +2001 -0
  13. package/dist/commands/acpCommand.mjs +8 -6
  14. package/dist/commands/apiCommand.mjs +1 -1
  15. package/dist/commands/doctorCommand.mjs +1 -1
  16. package/dist/commands/envCommand.mjs +1 -1
  17. package/dist/commands/headlessCommand.mjs +26 -16
  18. package/dist/commands/mcpCommand.mjs +3 -3
  19. package/dist/commands/pluginCommand.mjs +1 -1
  20. package/dist/commands/updateCommand.mjs +1 -1
  21. package/dist/index.mjs +444 -100
  22. package/dist/{package-Bqg2LSnH.mjs → package-CGZIoxcs.mjs} +1 -1
  23. package/dist/{serve-DO9Edl5S.mjs → serve-CPXqcEZr.mjs} +2 -2
  24. package/package.json +9 -10
  25. package/dist/AgentHistoryStore-kT9eNMRO.mjs +0 -39471
  26. package/dist/ProxyManager-B1jFWL7b.mjs +0 -3
  27. package/dist/SandboxOrchestrator-BbMDgjzr.mjs +0 -3
  28. package/dist/buildAgent-B_kArQ_Y.mjs +0 -833
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { $ as CustomCommandStore, A as createAgentDelegateTool, C as createTodoStore, D as createCoordinateTaskTool, F as PermissionManager, J as setWebSocketToolExecutor, L as wrapTools, O as createResumeAgentTool, Q as RemoteSkillSource, S as createFindDefinitionTool, T as createSkillTool, b as createGetFileStructureTool, et as CheckpointStore, j as FallbackLlmBackend, k as createBackgroundAgentTools, tt as SessionStore, w as createWriteTodosTool } from "../AgentHistoryStore-kT9eNMRO.mjs";
3
- import { n as logger, p as requireApiUrl, s as isReadOnlyTool, t as ConfigStore } from "../ConfigStore-DdHHCH2t.mjs";
4
- import { t as ApiClient } from "../ApiClient-BOWpVvTq.mjs";
5
- import { a as createToolSearchTool, i as buildLlmBackend, n as buildSupportingStores, o as deferredToolRegistry, r as buildSandbox, s as NotifyingLlmBackend, t as buildAgent } from "../buildAgent-B_kArQ_Y.mjs";
2
+ import { $ as CustomCommandStore, A as createAgentDelegateTool, C as createTodoStore, D as createCoordinateTaskTool, F as PermissionManager, J as setWebSocketToolExecutor, L as wrapTools, O as createResumeAgentTool, Q as RemoteSkillSource, S as createFindDefinitionTool, T as createSkillTool, b as createGetFileStructureTool, et as CheckpointStore, j as FallbackLlmBackend, k as createBackgroundAgentTools, s as buildSandbox, tt as SessionStore, w as createWriteTodosTool } from "../AgentHistoryStore-B2NEOvSW.mjs";
3
+ import { h as requireApiUrl, n as logger, s as isReadOnlyTool, t as ConfigStore } from "../ConfigStore-qV7NrCgZ.mjs";
4
+ import { a as deferredToolRegistry, i as createToolSearchTool, n as buildSupportingStores, o as NotifyingLlmBackend, r as buildLlmBackend, t as buildAgent } from "../buildAgent-C-C-VGff.mjs";
5
+ import { t as ApiClient } from "../ApiClient-D0fQ2FT6.mjs";
6
6
  import { randomUUID } from "crypto";
7
7
  import { existsSync, realpathSync, statSync } from "fs";
8
8
  import { isAbsolute } from "path";
@@ -700,8 +700,10 @@ var AcpServer = class {
700
700
  customCommandStore: this.customCommandStore,
701
701
  subagentOrchestrator: orchestrator,
702
702
  sessionId,
703
- permissionManager,
704
- promptFn: this.promptFn,
703
+ permission: {
704
+ permissionManager,
705
+ promptFn: this.promptFn
706
+ },
705
707
  allowedDirectories
706
708
  })] : []
707
709
  ], cliWrapDeps);
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { f as parseApiUrl, m as resolveApiEndpoint, t as ConfigStore } from "../ConfigStore-DdHHCH2t.mjs";
2
+ import { g as resolveApiEndpoint, m as parseApiUrl, t as ConfigStore } from "../ConfigStore-qV7NrCgZ.mjs";
3
3
  //#region src/commands/apiCommand.ts
4
4
  /**
5
5
  * External API config command (--api-url / --reset-api)
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as version } from "../package-Bqg2LSnH.mjs";
2
+ import { t as version } from "../package-CGZIoxcs.mjs";
3
3
  import { a as fetchLatestVersion, c as isNpmPrefixWritable, i as compareSemver } from "../updateChecker-CQW8bxo6.mjs";
4
4
  import { t as checkRipgrep } from "../ripgrepCheck-BmkyTK2i.mjs";
5
5
  import { execSync } from "child_process";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as ConfigStore } from "../ConfigStore-DdHHCH2t.mjs";
2
+ import { t as ConfigStore } from "../ConfigStore-qV7NrCgZ.mjs";
3
3
  //#region src/commands/envCommand.ts
4
4
  /**
5
5
  * Environment switching for the `--dev` / `--prod` launch flags.
@@ -1,12 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { $ as CustomCommandStore, A as createAgentDelegateTool, C as createTodoStore, D as createCoordinateTaskTool, F as PermissionManager, G as classifyCommandRisk, I as generateCliTools, J as setWebSocketToolExecutor, L as wrapTools, N as ReActAgent, O as createResumeAgentTool, Q as RemoteSkillSource, S as createFindDefinitionTool, T as createSkillTool, X as buildSystemPrompt, a as loadProjectContext, b as createGetFileStructureTool, et as CheckpointStore, i as buildProjectAgentStore, j as FallbackLlmBackend, k as createBackgroundAgentTools, n as BackgroundAgentManager, o as McpManager, r as SubagentOrchestrator, s as createSseBackend, t as AgentHistoryStore, tt as SessionStore, w as createWriteTodosTool, x as createWorkItemTools, z as SHELL_LIKE_TOOL_COMMAND_FIELDS } from "../AgentHistoryStore-kT9eNMRO.mjs";
3
- import { n as logger, p as requireApiUrl, s as isReadOnlyTool, t as ConfigStore } from "../ConfigStore-DdHHCH2t.mjs";
4
- import { t as ApiClient } from "../ApiClient-BOWpVvTq.mjs";
5
- import { t as DEFAULT_SANDBOX_CONFIG } from "../types-F61_hxmG.mjs";
2
+ import { $ as CustomCommandStore, A as createAgentDelegateTool, C as createTodoStore, D as createCoordinateTaskTool, F as PermissionManager, G as classifyCommandRisk, I as generateCliTools, J as setWebSocketToolExecutor, L as wrapTools, N as ReActAgent, O as createResumeAgentTool, Q as RemoteSkillSource, S as createFindDefinitionTool, T as createSkillTool, X as buildSystemPrompt, a as loadProjectContext, b as createGetFileStructureTool, c as createSseBackend, et as CheckpointStore, i as buildProjectAgentStore, j as FallbackLlmBackend, k as createBackgroundAgentTools, n as BackgroundAgentManager, o as McpManager, r as SubagentOrchestrator, s as buildSandbox, t as AgentHistoryStore, tt as SessionStore, w as createWriteTodosTool, x as createWorkItemTools, z as SHELL_LIKE_TOOL_COMMAND_FIELDS } from "../AgentHistoryStore-B2NEOvSW.mjs";
3
+ import { h as requireApiUrl, n as logger, s as isReadOnlyTool, t as ConfigStore } from "../ConfigStore-qV7NrCgZ.mjs";
4
+ import { t as ApiClient } from "../ApiClient-D0fQ2FT6.mjs";
6
5
  import { r as reconstructTurnBlocks, t as WorkItemsClient } from "../WorkItemsClient-Cow6nXx7.mjs";
7
- import { t as createSandboxRuntime } from "../SandboxRuntimeAdapter-ChGlxSGQ.mjs";
8
- import { t as SandboxOrchestrator } from "../SandboxOrchestrator-CIegJrCj.mjs";
9
- import { t as ProxyManager } from "../ProxyManager-C1-lgzEU.mjs";
10
6
  import { randomBytes } from "crypto";
11
7
  import { v4 } from "uuid";
12
8
  import { readFile } from "fs/promises";
@@ -216,6 +212,16 @@ function resolveHeadlessPermissionDecision(params) {
216
212
  * Enables non-interactive execution for CI/CD pipelines, scripting, and automation.
217
213
  * Runs the agent once with the given prompt and exits with an appropriate exit code.
218
214
  */
215
+ /**
216
+ * Sandbox status/warning sink for headless mode. Headless emits its NDJSON protocol
217
+ * on stdout, so BOTH info and warn must go to stderr - routing either to stdout would
218
+ * corrupt the protocol stream. Exported so this invariant is unit-tested (see
219
+ * headlessSandboxLog.test.ts) rather than left as an inline lambda nothing pins.
220
+ */
221
+ const headlessSandboxLog = {
222
+ info: (line) => void process.stderr.write(`${line}\n`),
223
+ warn: (line) => void process.stderr.write(`${line}\n`)
224
+ };
219
225
  /** Read all data from stdin if it's being piped (non-TTY). Returns empty string if no piped data. */
220
226
  async function readStdin() {
221
227
  if (process.stdin.isTTY) return "";
@@ -344,13 +350,15 @@ async function handleHeadlessCommand(options) {
344
350
  process.stderr.write("Warning: Agent requested user input; headless mode cannot respond interactively. Answering with empty response.\n");
345
351
  return Promise.resolve({ answers: [] });
346
352
  };
347
- const sandboxConfig = config.sandbox ?? DEFAULT_SANDBOX_CONFIG;
348
353
  const checkpointProjectDir = configStore.getProjectConfigDir() ?? process.cwd();
349
354
  const checkpointStore = new CheckpointStore(checkpointProjectDir);
350
- const [sandboxRuntime] = await Promise.all([createSandboxRuntime(), checkpointStore.init(session.id).catch(() => {})]);
351
- const proxyManager = new ProxyManager(sandboxConfig.network);
352
- const sandboxOrchestrator = new SandboxOrchestrator(sandboxConfig, sandboxRuntime, proxyManager);
353
- permissionManager.setSandboxState(sandboxConfig.mode, sandboxOrchestrator.isActive());
355
+ const { sandboxOrchestrator } = await buildSandbox({
356
+ config,
357
+ sessionId: session.id,
358
+ permissionManager,
359
+ checkpointStore,
360
+ log: headlessSandboxLog
361
+ });
354
362
  const agentContext = {
355
363
  currentAgent: null,
356
364
  observationQueue: []
@@ -406,8 +414,10 @@ async function handleHeadlessCommand(options) {
406
414
  customCommandStore,
407
415
  subagentOrchestrator: orchestrator,
408
416
  sessionId: session.id,
409
- permissionManager,
410
- promptFn,
417
+ permission: {
418
+ permissionManager,
419
+ promptFn
420
+ },
411
421
  allowedDirectories: additionalDirectories
412
422
  })], cliWrapDeps)[0] : null;
413
423
  const cliTools = [
@@ -432,7 +442,7 @@ async function handleHeadlessCommand(options) {
432
442
  const systemPrompt = buildSystemPrompt(config.preferences.promptVariant ?? "current", {
433
443
  contextContent: contextResult.mergedContent,
434
444
  agentStore,
435
- customCommands: customCommandStore.getAllCommands(),
445
+ customCommands: customCommandStore.getModelReachableCommands(),
436
446
  enableSkillTool,
437
447
  enableDynamicAgentCreation: false,
438
448
  additionalDirectories
@@ -567,4 +577,4 @@ async function handleHeadlessCommand(options) {
567
577
  }
568
578
  }
569
579
  //#endregion
570
- export { handleHeadlessCommand };
580
+ export { handleHeadlessCommand, headlessSandboxLog };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as ConfigStore } from "../ConfigStore-DdHHCH2t.mjs";
3
- import { t as version } from "../package-Bqg2LSnH.mjs";
2
+ import { t as ConfigStore } from "../ConfigStore-qV7NrCgZ.mjs";
3
+ import { t as version } from "../package-CGZIoxcs.mjs";
4
4
  //#region src/commands/mcpCommand.ts
5
5
  /**
6
6
  * External MCP commands (b4m mcp list, b4m mcp add, etc.)
@@ -70,7 +70,7 @@ async function handleMcpCommand(subcommand, argv) {
70
70
  await handleDisable(config, argv.name, configStore);
71
71
  break;
72
72
  case "serve": {
73
- const { handleMcpServeCommand } = await import("../serve-DO9Edl5S.mjs");
73
+ const { handleMcpServeCommand } = await import("../serve-CPXqcEZr.mjs");
74
74
  await handleMcpServeCommand({
75
75
  http: Boolean(argv.http),
76
76
  port: typeof argv.port === "number" ? argv.port : void 0,
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { n as getDefaultPluginsDir, r as isFeatureEnabled, t as PluginStore } from "../PluginStore-DwvOJ-G3.mjs";
3
- import { t as ConfigStore } from "../ConfigStore-DdHHCH2t.mjs";
3
+ import { t as ConfigStore } from "../ConfigStore-qV7NrCgZ.mjs";
4
4
  import { execFileSync } from "child_process";
5
5
  import { promises } from "fs";
6
6
  import path from "path";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as version } from "../package-Bqg2LSnH.mjs";
2
+ import { t as version } from "../package-CGZIoxcs.mjs";
3
3
  import { c as isNpmPrefixWritable, l as setAutoUpdatePreference, n as REEXEC_GUARD_ENV, o as forceCheckForUpdate, r as checkForUpdate, s as getAutoUpdatePreference, t as INSTALL_CMD, u as shouldAttemptAutoUpdate } from "../updateChecker-CQW8bxo6.mjs";
4
4
  import { t as checkRipgrep } from "../ripgrepCheck-BmkyTK2i.mjs";
5
5
  import { execSync, spawnSync } from "child_process";