@bike4mind/cli 0.2.29-feat-cli-sandbox.18843 → 0.2.29-feat-cli-websocket-streaming.18841

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-5GSDPBTM.js";
4
+ } from "./chunk-KPOK6V6E.js";
5
5
 
6
6
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/llmMarkdownGenerator.js
7
7
  var DEFAULT_OPTIONS = {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-5GSDPBTM.js";
4
+ } from "./chunk-KPOK6V6E.js";
5
5
 
6
6
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/markdownGenerator.js
7
7
  var DEFAULT_OPTIONS = {
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  findMostSimilarMemento,
4
4
  getRelevantMementos
5
- } from "./chunk-BCOGDPUB.js";
6
- import "./chunk-S7BPPS33.js";
7
- import "./chunk-5GSDPBTM.js";
5
+ } from "./chunk-QQL3OBKL.js";
6
+ import "./chunk-TY6Z2UV2.js";
7
+ import "./chunk-KPOK6V6E.js";
8
8
  import "./chunk-OCYRD7D6.js";
9
9
  export {
10
10
  findMostSimilarMemento,
@@ -41,6 +41,12 @@ import {
41
41
  ChatModels,
42
42
  CitableSourceSchema,
43
43
  ClaudeArtifactMimeTypes,
44
+ CliCompletionChunkAction,
45
+ CliCompletionDoneAction,
46
+ CliCompletionErrorAction,
47
+ CliCompletionRequestAction,
48
+ CliToolRequestAction,
49
+ CliToolResponseAction,
44
50
  CollectionType,
45
51
  CompletionApiUsageTransaction,
46
52
  CompletionRequestSchema,
@@ -340,7 +346,7 @@ import {
340
346
  validateReactArtifactV2,
341
347
  validateSvgArtifactV2,
342
348
  wikiMarkupToAdf
343
- } from "./chunk-5GSDPBTM.js";
349
+ } from "./chunk-KPOK6V6E.js";
344
350
  export {
345
351
  ALL_IMAGE_MODELS,
346
352
  ALL_IMAGE_SIZES,
@@ -384,6 +390,12 @@ export {
384
390
  ChatModels,
385
391
  CitableSourceSchema,
386
392
  ClaudeArtifactMimeTypes,
393
+ CliCompletionChunkAction,
394
+ CliCompletionDoneAction,
395
+ CliCompletionErrorAction,
396
+ CliCompletionRequestAction,
397
+ CliToolRequestAction,
398
+ CliToolResponseAction,
387
399
  CollectionType,
388
400
  CompletionApiUsageTransaction,
389
401
  CompletionRequestSchema,
@@ -134,8 +134,8 @@ import {
134
134
  validateMermaidSyntax,
135
135
  warmUpSettingsCache,
136
136
  withRetry
137
- } from "./chunk-S7BPPS33.js";
138
- import "./chunk-5GSDPBTM.js";
137
+ } from "./chunk-TY6Z2UV2.js";
138
+ import "./chunk-KPOK6V6E.js";
139
139
  import {
140
140
  Logger,
141
141
  NotificationDeduplicator,
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  SubtractCreditsSchema,
4
4
  subtractCredits
5
- } from "./chunk-PKKJ44C5.js";
6
- import "./chunk-S7BPPS33.js";
7
- import "./chunk-5GSDPBTM.js";
5
+ } from "./chunk-BXCARBUQ.js";
6
+ import "./chunk-TY6Z2UV2.js";
7
+ import "./chunk-KPOK6V6E.js";
8
8
  import "./chunk-OCYRD7D6.js";
9
9
  export {
10
10
  SubtractCreditsSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.29-feat-cli-sandbox.18843+467f137bc",
3
+ "version": "0.2.29-feat-cli-websocket-streaming.18841+5c940d031",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -110,10 +110,10 @@
110
110
  },
111
111
  "devDependencies": {
112
112
  "@bike4mind/agents": "0.1.0",
113
- "@bike4mind/common": "2.50.1-feat-cli-sandbox.18843+467f137bc",
114
- "@bike4mind/mcp": "1.29.1-feat-cli-sandbox.18843+467f137bc",
115
- "@bike4mind/services": "2.48.1-feat-cli-sandbox.18843+467f137bc",
116
- "@bike4mind/utils": "2.5.1-feat-cli-sandbox.18843+467f137bc",
113
+ "@bike4mind/common": "2.50.1-feat-cli-websocket-streaming.18841+5c940d031",
114
+ "@bike4mind/mcp": "1.29.1-feat-cli-websocket-streaming.18841+5c940d031",
115
+ "@bike4mind/services": "2.48.1-feat-cli-websocket-streaming.18841+5c940d031",
116
+ "@bike4mind/utils": "2.5.1-feat-cli-websocket-streaming.18841+5c940d031",
117
117
  "@types/better-sqlite3": "^7.6.13",
118
118
  "@types/diff": "^5.0.9",
119
119
  "@types/jsonwebtoken": "^9.0.4",
@@ -130,5 +130,5 @@
130
130
  "optionalDependencies": {
131
131
  "@vscode/ripgrep": "^1.17.0"
132
132
  },
133
- "gitHead": "467f137bcb738020d1665b78bc7d34de7d846df5"
133
+ "gitHead": "5c940d031610617c76d3c12cc611b71db8bb4caf"
134
134
  }
@@ -1,68 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- expandPath,
4
- isBinaryAvailable
5
- } from "./chunk-AVAD2PPK.js";
6
-
7
- // src/sandbox/runtime/BubblewrapRuntime.ts
8
- import os from "os";
9
- var SYSTEM_RO_BINDS = ["/usr", "/bin", "/lib", "/lib64", "/sbin", "/etc"];
10
- var SPECIAL_MOUNTS = {
11
- dev: "/dev",
12
- proc: "/proc",
13
- tmp: "/tmp"
14
- };
15
- var BubblewrapRuntime = class {
16
- constructor() {
17
- this.platform = "linux";
18
- this.name = "bubblewrap";
19
- }
20
- isAvailable() {
21
- return isBinaryAvailable("bwrap");
22
- }
23
- wrapCommand(options) {
24
- const { command, cwd, filesystemConfig, env } = options;
25
- const expandedDenied = filesystemConfig.deniedPaths.map(expandPath);
26
- const expandedAllowed = filesystemConfig.allowedReadPaths.map(expandPath);
27
- const args = [];
28
- for (const sysPath of SYSTEM_RO_BINDS) {
29
- args.push("--ro-bind-try", sysPath, sysPath);
30
- }
31
- args.push("--dev", SPECIAL_MOUNTS.dev);
32
- args.push("--proc", SPECIAL_MOUNTS.proc);
33
- args.push("--tmpfs", SPECIAL_MOUNTS.tmp);
34
- args.push("--bind", cwd, cwd);
35
- const homeDir = os.homedir();
36
- args.push("--ro-bind", homeDir, homeDir);
37
- for (const allowedPath of expandedAllowed) {
38
- if (!allowedPath.startsWith(homeDir)) {
39
- args.push("--ro-bind-try", allowedPath, allowedPath);
40
- }
41
- }
42
- for (const deniedPath of expandedDenied) {
43
- args.push("--tmpfs", deniedPath);
44
- }
45
- args.push("--unshare-all");
46
- args.push("--share-net");
47
- args.push("--die-with-parent");
48
- if (options.seccompProfile) {
49
- args.push("--seccomp", options.seccompProfile);
50
- }
51
- args.push("--chdir", cwd);
52
- args.push("bash", "-c", command);
53
- const commandString = ["bwrap", ...args.map(shellEscape)].join(" ");
54
- return {
55
- executable: "bwrap",
56
- args,
57
- env: env ?? {},
58
- commandString
59
- };
60
- }
61
- };
62
- function shellEscape(str) {
63
- if (/^[a-zA-Z0-9._/=:-]+$/.test(str)) return str;
64
- return `'${str.replace(/'/g, "'\\''")}'`;
65
- }
66
- export {
67
- BubblewrapRuntime
68
- };
@@ -1,110 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- DEFAULT_SANDBOX_CONFIG
4
- } from "./chunk-W4TCH4ZT.js";
5
-
6
- // src/sandbox/SandboxOrchestrator.ts
7
- var SandboxOrchestrator = class {
8
- constructor(config, runtime) {
9
- this.config = config ?? DEFAULT_SANDBOX_CONFIG;
10
- this.runtime = runtime ?? null;
11
- }
12
- /**
13
- * Determine whether a command should be sandboxed.
14
- *
15
- * Decision logic:
16
- * 1. If sandbox is disabled → unsandboxed (no permission change)
17
- * 2. If command matches an excluded command → unsandboxed (requires permission)
18
- * 3. If runtime is not available → unsandboxed with warning
19
- * 4. Otherwise → sandbox the command
20
- */
21
- shouldSandbox(command, cwd) {
22
- if (!this.config.enabled || this.config.mode === "disabled") {
23
- return { type: "unsandboxed", requiresPermission: true };
24
- }
25
- const baseCommand = this.getBaseCommand(command);
26
- if (this.isExcludedCommand(baseCommand)) {
27
- if (!this.config.allowUnsandboxedCommands) {
28
- return {
29
- type: "blocked",
30
- reason: `Command '${baseCommand}' is excluded from sandboxing and unsandboxed commands are not allowed`
31
- };
32
- }
33
- return {
34
- type: "unsandboxed",
35
- requiresPermission: true,
36
- reason: `Command '${baseCommand}' is excluded from sandboxing`
37
- };
38
- }
39
- if (!this.runtime) {
40
- return {
41
- type: "unsandboxed",
42
- requiresPermission: true,
43
- reason: "Sandbox runtime not available on this platform"
44
- };
45
- }
46
- const wrappedCommand = this.runtime.wrapCommand({
47
- command,
48
- cwd,
49
- filesystemConfig: this.config.filesystem,
50
- ...this.runtime.platform === "linux" && this.config.platform.linux.seccompProfile && {
51
- seccompProfile: this.config.platform.linux.seccompProfile
52
- }
53
- });
54
- return { type: "sandbox", wrappedCommand };
55
- }
56
- /** Get the current sandbox mode */
57
- getMode() {
58
- return this.config.mode;
59
- }
60
- /** Set the sandbox mode (does not persist — caller must save config) */
61
- setMode(mode) {
62
- this.config.mode = mode;
63
- this.config.enabled = mode !== "disabled";
64
- }
65
- /** Check if sandbox is enabled and runtime is available */
66
- isAvailable() {
67
- return this.runtime !== null && this.runtime.isAvailable();
68
- }
69
- /** Check if sandbox is currently active (enabled + available) */
70
- isActive() {
71
- return this.config.enabled && this.config.mode !== "disabled" && this.isAvailable();
72
- }
73
- /** Get the current sandbox configuration */
74
- getConfig() {
75
- return this.config;
76
- }
77
- /** Update config (does not persist — caller must save) */
78
- updateConfig(config) {
79
- this.config = config;
80
- }
81
- /** Get full status information for display */
82
- getStatus() {
83
- return {
84
- mode: this.config.mode,
85
- enabled: this.config.enabled,
86
- platform: this.runtime?.platform ?? null,
87
- runtimeAvailable: this.runtime?.isAvailable() ?? false,
88
- runtimeName: this.runtime?.name ?? null,
89
- config: this.config
90
- };
91
- }
92
- /**
93
- * Extract the base command name from a full command string.
94
- * e.g., "docker compose up -d" → "docker"
95
- */
96
- getBaseCommand(command) {
97
- const trimmed = command.trim();
98
- const withoutEnv = trimmed.replace(/^(\w+=\S+\s+)*/, "");
99
- const parts = withoutEnv.split(/\s+/);
100
- const first = parts[0] || "";
101
- return first.split("/").pop() || first;
102
- }
103
- /** Check if a command is in the excluded list */
104
- isExcludedCommand(baseCommand) {
105
- return this.config.excludedCommands.some((excluded) => baseCommand === excluded);
106
- }
107
- };
108
- export {
109
- SandboxOrchestrator
110
- };
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- createSandboxRuntime,
4
- detectPlatform,
5
- expandPath,
6
- isBinaryAvailable
7
- } from "./chunk-AVAD2PPK.js";
8
- export {
9
- createSandboxRuntime,
10
- detectPlatform,
11
- expandPath,
12
- isBinaryAvailable
13
- };
@@ -1,96 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- expandPath,
4
- isBinaryAvailable
5
- } from "./chunk-AVAD2PPK.js";
6
-
7
- // src/sandbox/runtime/SeatbeltRuntime.ts
8
- import { writeFileSync, mkdtempSync } from "fs";
9
- import path from "path";
10
- import os from "os";
11
- function escapeSeatbeltPath(p) {
12
- return p.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
13
- }
14
- var SeatbeltRuntime = class {
15
- constructor() {
16
- this.platform = "darwin";
17
- this.name = "seatbelt";
18
- }
19
- isAvailable() {
20
- return isBinaryAvailable("sandbox-exec");
21
- }
22
- /**
23
- * Generate a Seatbelt profile string from the filesystem config.
24
- *
25
- * Strategy:
26
- * - Start with (allow default) to permit most operations
27
- * - Deny all file writes globally
28
- * - Allow file writes only to the working directory
29
- * - Deny all access to explicitly denied paths
30
- * - Allow read access to explicitly allowed paths
31
- */
32
- generateProfile(options) {
33
- const { cwd, filesystemConfig } = options;
34
- const expandedDenied = filesystemConfig.deniedPaths.map(expandPath);
35
- const expandedAllowed = filesystemConfig.allowedReadPaths.map(expandPath);
36
- const lines = [
37
- "(version 1)",
38
- "",
39
- "; Start with permissive defaults (process exec, network, sysctl, etc.)",
40
- "(allow default)",
41
- ""
42
- ];
43
- if (filesystemConfig.writeOnlyToWorkingDir) {
44
- lines.push("; Deny all file writes globally");
45
- lines.push("(deny file-write*)");
46
- lines.push("");
47
- lines.push("; Allow writes to working directory");
48
- lines.push(`(allow file-write* (subpath "${escapeSeatbeltPath(cwd)}"))`);
49
- lines.push("");
50
- lines.push("; Allow writes to temp directories");
51
- lines.push(`(allow file-write* (subpath "/tmp"))`);
52
- lines.push(`(allow file-write* (subpath "/private/tmp"))`);
53
- lines.push(`(allow file-write* (subpath "${escapeSeatbeltPath(os.tmpdir())}"))`);
54
- lines.push("");
55
- }
56
- if (expandedDenied.length > 0) {
57
- lines.push("; Deny access to sensitive paths");
58
- for (const deniedPath of expandedDenied) {
59
- lines.push(`(deny file-read* file-write* (subpath "${escapeSeatbeltPath(deniedPath)}"))`);
60
- }
61
- lines.push("");
62
- }
63
- if (expandedAllowed.length > 0) {
64
- lines.push("; Explicitly allowed read paths");
65
- for (const allowedPath of expandedAllowed) {
66
- lines.push(`(allow file-read* (subpath "${escapeSeatbeltPath(allowedPath)}"))`);
67
- }
68
- lines.push("");
69
- }
70
- return lines.join("\n");
71
- }
72
- wrapCommand(options) {
73
- try {
74
- const profile = this.generateProfile(options);
75
- const tmpDir = mkdtempSync(path.join(os.tmpdir(), "b4m-sandbox-"));
76
- const profilePath = path.join(tmpDir, "sandbox.sb");
77
- writeFileSync(profilePath, profile, "utf-8");
78
- const args = ["-f", profilePath, "bash", "-c", options.command];
79
- return {
80
- executable: "sandbox-exec",
81
- args,
82
- env: options.env ?? {},
83
- commandString: `sandbox-exec -f ${profilePath} bash -c ${shellEscape(options.command)}`,
84
- cleanupPaths: [profilePath, tmpDir]
85
- };
86
- } catch (err) {
87
- throw new Error(`Failed to create sandbox profile: ${err instanceof Error ? err.message : String(err)}`);
88
- }
89
- }
90
- };
91
- function shellEscape(str) {
92
- return `'${str.replace(/'/g, "'\\''")}'`;
93
- }
94
- export {
95
- SeatbeltRuntime
96
- };
@@ -1,44 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/sandbox/runtime/SandboxRuntimeAdapter.ts
4
- import os from "os";
5
- import { execSync } from "child_process";
6
- function detectPlatform() {
7
- const platform = os.platform();
8
- if (platform === "darwin") return "darwin";
9
- if (platform === "linux") return "linux";
10
- return null;
11
- }
12
- function isBinaryAvailable(binary) {
13
- try {
14
- execSync(`which ${binary}`, { stdio: "ignore" });
15
- return true;
16
- } catch {
17
- return false;
18
- }
19
- }
20
- function expandPath(pathStr) {
21
- return pathStr.replace(/\$HOME/g, os.homedir()).replace(/\$USER/g, os.userInfo().username).replace(/~\//g, `${os.homedir()}/`);
22
- }
23
- async function createSandboxRuntime() {
24
- const platform = detectPlatform();
25
- if (!platform) return null;
26
- if (platform === "darwin") {
27
- const { SeatbeltRuntime } = await import("./SeatbeltRuntime-SL7HVS3J.js");
28
- const runtime = new SeatbeltRuntime();
29
- return runtime.isAvailable() ? runtime : null;
30
- }
31
- if (platform === "linux") {
32
- const { BubblewrapRuntime } = await import("./BubblewrapRuntime-HXTR3NQG.js");
33
- const runtime = new BubblewrapRuntime();
34
- return runtime.isAvailable() ? runtime : null;
35
- }
36
- return null;
37
- }
38
-
39
- export {
40
- detectPlatform,
41
- isBinaryAvailable,
42
- expandPath,
43
- createSandboxRuntime
44
- };
@@ -1,27 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/sandbox/types.ts
4
- var DEFAULT_SANDBOX_CONFIG = {
5
- enabled: false,
6
- mode: "disabled",
7
- filesystem: {
8
- writeOnlyToWorkingDir: true,
9
- allowedReadPaths: ["$HOME/.gitconfig", "$HOME/.npmrc", "$HOME/.node_modules"],
10
- deniedPaths: ["$HOME/.ssh", "$HOME/.aws", "$HOME/.gnupg", "$HOME/.env", "/etc/shadow", "/etc/passwd"]
11
- },
12
- excludedCommands: ["docker", "watchman", "podman"],
13
- allowUnsandboxedCommands: true,
14
- platform: {
15
- linux: {
16
- runtime: "bubblewrap"
17
- },
18
- macos: {
19
- runtime: "seatbelt",
20
- profileTemplate: "default"
21
- }
22
- }
23
- };
24
-
25
- export {
26
- DEFAULT_SANDBOX_CONFIG
27
- };
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- DEFAULT_SANDBOX_CONFIG
4
- } from "./chunk-W4TCH4ZT.js";
5
- export {
6
- DEFAULT_SANDBOX_CONFIG
7
- };