@bike4mind/cli 0.2.29-feat-cli-websocket-streaming.18881 → 0.2.29-feat-cli-sandbox.18927

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 (27) hide show
  1. package/dist/BubblewrapRuntime-PMIOLWKR.js +71 -0
  2. package/dist/ProxyManager-4ZZEYTD6.js +249 -0
  3. package/dist/SandboxOrchestrator-MYBNKKWL.js +162 -0
  4. package/dist/SandboxRuntimeAdapter-FQ56MAB2.js +13 -0
  5. package/dist/SeatbeltRuntime-EE3TTLEP.js +98 -0
  6. package/dist/StderrViolationParser-7OYPM2DJ.js +59 -0
  7. package/dist/ViolationLogStore-RIIUVURH.js +104 -0
  8. package/dist/{artifactExtractor-SNWW3EVH.js → artifactExtractor-5KWVJRK7.js} +1 -1
  9. package/dist/{chunk-QQL3OBKL.js → chunk-2OADXKGK.js} +2 -2
  10. package/dist/chunk-4BIBE3J7.js +48 -0
  11. package/dist/{chunk-EC2VEDD2.js → chunk-5JTIPGUF.js} +2 -2
  12. package/dist/{chunk-BXCARBUQ.js → chunk-CLA2MUX4.js} +2 -2
  13. package/dist/{chunk-KPOK6V6E.js → chunk-FKJTU7KU.js} +8 -67
  14. package/dist/{chunk-LBTTUQJM.js → chunk-M2AJGZSX.js} +87 -3
  15. package/dist/{chunk-TY6Z2UV2.js → chunk-Q7CVAY4M.js} +6 -15
  16. package/dist/chunk-QWB6ZYY4.js +48 -0
  17. package/dist/commands/mcpCommand.js +2 -1
  18. package/dist/{create-QOJPAIOR.js → create-BDV4MI3R.js} +3 -3
  19. package/dist/index.js +965 -839
  20. package/dist/{llmMarkdownGenerator-JPDNDGE4.js → llmMarkdownGenerator-UIJD4IKA.js} +1 -1
  21. package/dist/{markdownGenerator-NHN4MNEA.js → markdownGenerator-UBZZJ3YM.js} +1 -1
  22. package/dist/{mementoService-EN7FZK7B.js → mementoService-UP7777VB.js} +3 -3
  23. package/dist/{src-36AL3BJR.js → src-DOG6MRCB.js} +1 -13
  24. package/dist/{src-JZN5O6F3.js → src-G5MW2D7G.js} +2 -2
  25. package/dist/{subtractCredits-FCBMFPIP.js → subtractCredits-XGBHF6DI.js} +3 -3
  26. package/dist/types-KB5NP6T4.js +7 -0
  27. package/package.json +11 -6
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/sandbox/logging/ViolationLogStore.ts
4
+ import { promises as fs } from "fs";
5
+ import path from "path";
6
+ import { homedir } from "os";
7
+ var MAX_VIOLATIONS = 5e3;
8
+ var DEFAULT_PATH = path.join(homedir(), ".bike4mind", "violations.jsonl");
9
+ var ViolationLogStore = class {
10
+ constructor(storePath) {
11
+ this.cache = null;
12
+ this.storePath = storePath ?? DEFAULT_PATH;
13
+ }
14
+ /** Ensure parent directory exists */
15
+ async init() {
16
+ const dir = path.dirname(this.storePath);
17
+ await fs.mkdir(dir, { recursive: true });
18
+ }
19
+ /** Load all entries from disk (newest first) */
20
+ async load() {
21
+ if (this.cache) {
22
+ return this.cache;
23
+ }
24
+ try {
25
+ const data = await fs.readFile(this.storePath, "utf-8");
26
+ const lines = data.trim().split("\n").filter((line) => line.length > 0);
27
+ const entries = lines.map((line) => {
28
+ try {
29
+ return JSON.parse(line);
30
+ } catch {
31
+ return null;
32
+ }
33
+ }).filter((entry) => entry !== null);
34
+ entries.sort((a, b) => b.timestamp - a.timestamp);
35
+ this.cache = entries;
36
+ return this.cache;
37
+ } catch (error) {
38
+ if (error.code === "ENOENT") {
39
+ this.cache = [];
40
+ return this.cache;
41
+ }
42
+ throw error;
43
+ }
44
+ }
45
+ /** Record a new violation (converts Date → epoch ms, appends JSONL) */
46
+ async record(violation) {
47
+ const entry = {
48
+ type: violation.type,
49
+ command: violation.command,
50
+ blockedBy: violation.blockedBy,
51
+ timestamp: violation.timestamp.getTime(),
52
+ ...violation.path && { path: violation.path },
53
+ ...violation.domain && { domain: violation.domain },
54
+ ...violation.detail && { detail: violation.detail }
55
+ };
56
+ await this.init();
57
+ const line = JSON.stringify(entry) + "\n";
58
+ await fs.appendFile(this.storePath, line, "utf-8");
59
+ this.cache = [entry, ...this.cache ?? []];
60
+ if (this.cache.length > MAX_VIOLATIONS) {
61
+ await this.trim();
62
+ }
63
+ }
64
+ /** Get recent violations (default 50) */
65
+ async getRecent(count = 50) {
66
+ const entries = await this.load();
67
+ return entries.slice(0, count);
68
+ }
69
+ /** Count violations by type */
70
+ async countByType() {
71
+ const entries = await this.load();
72
+ let filesystem = 0;
73
+ let network = 0;
74
+ for (const entry of entries) {
75
+ if (entry.type === "filesystem") filesystem++;
76
+ else if (entry.type === "network") network++;
77
+ }
78
+ return { filesystem, network };
79
+ }
80
+ /** Clear all violations */
81
+ async clear() {
82
+ try {
83
+ await fs.unlink(this.storePath);
84
+ } catch (error) {
85
+ if (error.code !== "ENOENT") {
86
+ throw error;
87
+ }
88
+ }
89
+ this.cache = [];
90
+ }
91
+ /** Trim to MAX_VIOLATIONS (rewrite file) */
92
+ async trim() {
93
+ if (!this.cache || this.cache.length <= MAX_VIOLATIONS) {
94
+ return;
95
+ }
96
+ const trimmed = this.cache.slice(0, MAX_VIOLATIONS);
97
+ const lines = [...trimmed].reverse().map((entry) => JSON.stringify(entry)).join("\n");
98
+ await fs.writeFile(this.storePath, lines + "\n", "utf-8");
99
+ this.cache = trimmed;
100
+ }
101
+ };
102
+ export {
103
+ ViolationLogStore
104
+ };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-KPOK6V6E.js";
4
+ } from "./chunk-FKJTU7KU.js";
5
5
 
6
6
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/artifactExtractor.js
7
7
  var ARTIFACT_TAG_REGEX = /<artifact\s+(.*?)>([\s\S]*?)<\/artifact>/gi;
@@ -6,12 +6,12 @@ import {
6
6
  getSettingsByNames,
7
7
  obfuscateApiKey,
8
8
  secureParameters
9
- } from "./chunk-TY6Z2UV2.js";
9
+ } from "./chunk-Q7CVAY4M.js";
10
10
  import {
11
11
  ApiKeyType,
12
12
  MementoTier,
13
13
  isSupportedEmbeddingModel
14
- } from "./chunk-KPOK6V6E.js";
14
+ } from "./chunk-FKJTU7KU.js";
15
15
 
16
16
  // ../../b4m-core/packages/services/dist/src/apiKeyService/get.js
17
17
  import { z } from "zod";
@@ -0,0 +1,48 @@
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
+ network: {
13
+ enabled: false,
14
+ allowedDomains: [
15
+ "registry.npmjs.org",
16
+ "*.npmjs.org",
17
+ "pypi.org",
18
+ "*.pypi.org",
19
+ "files.pythonhosted.org",
20
+ "crates.io",
21
+ "*.crates.io",
22
+ "rubygems.org",
23
+ "github.com",
24
+ "*.github.com",
25
+ "gitlab.com",
26
+ "*.gitlab.com",
27
+ "bitbucket.org",
28
+ "*.bitbucket.org",
29
+ "*.githubusercontent.com",
30
+ "*.cloudflare.com"
31
+ ]
32
+ },
33
+ excludedCommands: ["docker", "watchman", "podman"],
34
+ allowUnsandboxedCommands: true,
35
+ platform: {
36
+ linux: {
37
+ runtime: "bubblewrap"
38
+ },
39
+ macos: {
40
+ runtime: "seatbelt",
41
+ profileTemplate: "default"
42
+ }
43
+ }
44
+ };
45
+
46
+ export {
47
+ DEFAULT_SANDBOX_CONFIG
48
+ };
@@ -7,11 +7,11 @@ import {
7
7
  getSettingsMap,
8
8
  getSettingsValue,
9
9
  secureParameters
10
- } from "./chunk-TY6Z2UV2.js";
10
+ } from "./chunk-Q7CVAY4M.js";
11
11
  import {
12
12
  KnowledgeType,
13
13
  SupportedFabFileMimeTypes
14
- } from "./chunk-KPOK6V6E.js";
14
+ } from "./chunk-FKJTU7KU.js";
15
15
 
16
16
  // ../../b4m-core/packages/services/dist/src/fabFileService/create.js
17
17
  import { z } from "zod";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  BadRequestError,
4
4
  secureParameters
5
- } from "./chunk-TY6Z2UV2.js";
5
+ } from "./chunk-Q7CVAY4M.js";
6
6
  import {
7
7
  CompletionApiUsageTransaction,
8
8
  GenericCreditDeductTransaction,
@@ -12,7 +12,7 @@ import {
12
12
  TextGenerationUsageTransaction,
13
13
  TransferCreditTransaction,
14
14
  VideoGenerationUsageTransaction
15
- } from "./chunk-KPOK6V6E.js";
15
+ } from "./chunk-FKJTU7KU.js";
16
16
 
17
17
  // ../../b4m-core/packages/services/dist/src/creditService/subtractCredits.js
18
18
  import { z } from "zod";
@@ -1012,29 +1012,6 @@ var VoiceSessionSendTranscriptAction = z10.object({
1012
1012
  conversationItemId: z10.string(),
1013
1013
  timestamp: z10.coerce.date().optional()
1014
1014
  });
1015
- var CliCompletionRequestAction = z10.object({
1016
- action: z10.literal("cli_completion_request"),
1017
- accessToken: z10.string(),
1018
- requestId: z10.string().uuid(),
1019
- model: z10.string(),
1020
- messages: z10.array(z10.object({
1021
- role: z10.enum(["user", "assistant", "system"]),
1022
- content: z10.union([z10.string(), z10.array(z10.unknown())])
1023
- })),
1024
- options: z10.object({
1025
- temperature: z10.number().optional(),
1026
- maxTokens: z10.number().optional(),
1027
- stream: z10.boolean().optional(),
1028
- tools: z10.array(z10.unknown()).optional()
1029
- }).optional()
1030
- });
1031
- var CliToolRequestAction = z10.object({
1032
- action: z10.literal("cli_tool_request"),
1033
- accessToken: z10.string(),
1034
- requestId: z10.string().uuid(),
1035
- toolName: z10.string(),
1036
- input: z10.record(z10.unknown())
1037
- });
1038
1015
  var VoiceSessionEndedAction = z10.object({
1039
1016
  action: z10.literal("voice_session_ended"),
1040
1017
  userId: z10.string(),
@@ -1281,36 +1258,6 @@ var ResearchModeStreamAction = z10.object({
1281
1258
  completionInfo: z10.any().optional()
1282
1259
  }).optional()
1283
1260
  });
1284
- var CliCompletionChunkAction = z10.object({
1285
- action: z10.literal("cli_completion_chunk"),
1286
- requestId: z10.string(),
1287
- chunk: z10.object({
1288
- type: z10.enum(["content", "tool_use"]),
1289
- text: z10.string(),
1290
- tools: z10.array(z10.unknown()).optional(),
1291
- usage: z10.object({
1292
- inputTokens: z10.number().optional(),
1293
- outputTokens: z10.number().optional()
1294
- }).optional(),
1295
- thinking: z10.array(z10.unknown()).optional()
1296
- })
1297
- });
1298
- var CliCompletionDoneAction = z10.object({
1299
- action: z10.literal("cli_completion_done"),
1300
- requestId: z10.string()
1301
- });
1302
- var CliCompletionErrorAction = z10.object({
1303
- action: z10.literal("cli_completion_error"),
1304
- requestId: z10.string(),
1305
- error: z10.string()
1306
- });
1307
- var CliToolResponseAction = z10.object({
1308
- action: z10.literal("cli_tool_response"),
1309
- requestId: z10.string(),
1310
- success: z10.boolean(),
1311
- content: z10.unknown().optional(),
1312
- error: z10.string().optional()
1313
- });
1314
1261
  var SessionCreatedAction = shareableDocumentSchema.extend({
1315
1262
  action: z10.literal("session.created"),
1316
1263
  id: z10.string(),
@@ -1345,9 +1292,7 @@ var MessageDataToServer = z10.discriminatedUnion("action", [
1345
1292
  DataUnsubscribeRequestAction,
1346
1293
  HeartbeatAction,
1347
1294
  VoiceSessionSendTranscriptAction,
1348
- VoiceSessionEndedAction,
1349
- CliCompletionRequestAction,
1350
- CliToolRequestAction
1295
+ VoiceSessionEndedAction
1351
1296
  ]);
1352
1297
  var MessageDataToClient = z10.discriminatedUnion("action", [
1353
1298
  DataSubscriptionUpdateAction,
@@ -1369,11 +1314,7 @@ var MessageDataToClient = z10.discriminatedUnion("action", [
1369
1314
  SpiderProgressUpdateAction,
1370
1315
  SpiderCompleteAction,
1371
1316
  SpiderErrorAction,
1372
- SessionCreatedAction,
1373
- CliCompletionChunkAction,
1374
- CliCompletionDoneAction,
1375
- CliCompletionErrorAction,
1376
- CliToolResponseAction
1317
+ SessionCreatedAction
1377
1318
  ]);
1378
1319
 
1379
1320
  // ../../b4m-core/packages/common/dist/src/schemas/cliCompletions.js
@@ -7840,6 +7781,12 @@ function buildSSEEvent(text, info) {
7840
7781
  outputTokens: info.outputTokens
7841
7782
  };
7842
7783
  }
7784
+ if (info?.creditsUsed !== void 0 || info?.usdCost !== void 0) {
7785
+ event.credits = {
7786
+ used: info.creditsUsed,
7787
+ usdCost: info.usdCost
7788
+ };
7789
+ }
7843
7790
  if (info?.thinking && info.thinking.length > 0) {
7844
7791
  event.thinking = info.thinking;
7845
7792
  }
@@ -7985,8 +7932,6 @@ export {
7985
7932
  DataUnsubscribeRequestAction,
7986
7933
  HeartbeatAction,
7987
7934
  VoiceSessionSendTranscriptAction,
7988
- CliCompletionRequestAction,
7989
- CliToolRequestAction,
7990
7935
  VoiceSessionEndedAction,
7991
7936
  DataSubscriptionUpdateAction,
7992
7937
  LLMStatusUpdateAction,
@@ -8007,10 +7952,6 @@ export {
8007
7952
  UpdateResearchTaskStatusAction,
8008
7953
  ImportHistoryJobProgressUpdateAction,
8009
7954
  ResearchModeStreamAction,
8010
- CliCompletionChunkAction,
8011
- CliCompletionDoneAction,
8012
- CliCompletionErrorAction,
8013
- CliToolResponseAction,
8014
7955
  SessionCreatedAction,
8015
7956
  MessageDataToServer,
8016
7957
  MessageDataToClient,
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ DEFAULT_SANDBOX_CONFIG
4
+ } from "./chunk-4BIBE3J7.js";
2
5
 
3
6
  // src/utils/Logger.ts
4
7
  import fs from "fs/promises";
@@ -262,6 +265,59 @@ import path2 from "path";
262
265
  import { homedir } from "os";
263
266
  import { v4 as uuidv4 } from "uuid";
264
267
  import { z } from "zod";
268
+ var SandboxFilesystemSchema = z.object({
269
+ allowedReadPaths: z.array(z.string()).default(DEFAULT_SANDBOX_CONFIG.filesystem.allowedReadPaths),
270
+ deniedPaths: z.array(z.string()).default(DEFAULT_SANDBOX_CONFIG.filesystem.deniedPaths),
271
+ writeOnlyToWorkingDir: z.boolean().default(true)
272
+ });
273
+ var SandboxNetworkSchema = z.object({
274
+ enabled: z.boolean().default(false),
275
+ allowedDomains: z.array(z.string()).default(DEFAULT_SANDBOX_CONFIG.network.allowedDomains)
276
+ });
277
+ var SandboxPlatformSchema = z.object({
278
+ linux: z.object({
279
+ runtime: z.literal("bubblewrap").default("bubblewrap"),
280
+ seccompProfile: z.string().optional()
281
+ }).default({ runtime: "bubblewrap" }),
282
+ macos: z.object({
283
+ runtime: z.literal("seatbelt").default("seatbelt"),
284
+ profileTemplate: z.string().default("default")
285
+ }).default({ runtime: "seatbelt", profileTemplate: "default" })
286
+ });
287
+ var SandboxConfigSchema = z.object({
288
+ enabled: z.boolean().default(false),
289
+ mode: z.enum(["disabled", "auto-allow", "permissions"]).default("disabled"),
290
+ filesystem: SandboxFilesystemSchema.default(DEFAULT_SANDBOX_CONFIG.filesystem),
291
+ network: SandboxNetworkSchema.default(DEFAULT_SANDBOX_CONFIG.network),
292
+ excludedCommands: z.array(z.string()).default(DEFAULT_SANDBOX_CONFIG.excludedCommands),
293
+ allowUnsandboxedCommands: z.boolean().default(true),
294
+ platform: SandboxPlatformSchema.default(DEFAULT_SANDBOX_CONFIG.platform)
295
+ }).refine(
296
+ (config) => {
297
+ if (config.enabled && config.mode === "disabled") return false;
298
+ if (!config.enabled && config.mode !== "disabled") return false;
299
+ return true;
300
+ },
301
+ {
302
+ message: 'Sandbox config inconsistency: enabled and mode must agree. If enabled=true, mode must be "auto-allow" or "permissions". If mode="disabled", enabled must be false.'
303
+ }
304
+ );
305
+ var PartialSandboxConfigSchema = z.object({
306
+ enabled: z.boolean().optional(),
307
+ mode: z.enum(["disabled", "auto-allow", "permissions"]).optional(),
308
+ filesystem: z.object({
309
+ allowedReadPaths: z.array(z.string()).optional(),
310
+ deniedPaths: z.array(z.string()).optional(),
311
+ writeOnlyToWorkingDir: z.boolean().optional()
312
+ }).optional(),
313
+ network: z.object({
314
+ enabled: z.boolean().optional(),
315
+ allowedDomains: z.array(z.string()).optional()
316
+ }).optional(),
317
+ excludedCommands: z.array(z.string()).optional(),
318
+ allowUnsandboxedCommands: z.boolean().optional(),
319
+ platform: SandboxPlatformSchema.optional()
320
+ }).optional();
265
321
  var AuthTokensSchema = z.object({
266
322
  accessToken: z.string(),
267
323
  refreshToken: z.string(),
@@ -336,7 +392,8 @@ var CliConfigSchema = z.object({
336
392
  disabled: z.array(z.string()),
337
393
  config: z.record(z.any())
338
394
  }),
339
- trustedTools: z.array(z.string()).optional().default([])
395
+ trustedTools: z.array(z.string()).optional().default([]),
396
+ sandbox: SandboxConfigSchema.optional()
340
397
  });
341
398
  var ProjectConfigSchema = z.object({
342
399
  tools: z.object({
@@ -354,7 +411,8 @@ var ProjectConfigSchema = z.object({
354
411
  theme: z.enum(["light", "dark"]).optional(),
355
412
  exportFormat: z.enum(["markdown", "json"]).optional(),
356
413
  enableSkillTool: z.boolean().optional()
357
- }).optional()
414
+ }).optional(),
415
+ sandbox: PartialSandboxConfigSchema
358
416
  });
359
417
  var ProjectLocalConfigSchema = z.object({
360
418
  trustedTools: z.array(z.string()).optional(),
@@ -371,7 +429,8 @@ var ProjectLocalConfigSchema = z.object({
371
429
  exportFormat: z.enum(["markdown", "json"]).optional(),
372
430
  enableSkillTool: z.boolean().optional()
373
431
  }).optional(),
374
- mcpServers: McpServersSchema.optional()
432
+ mcpServers: McpServersSchema.optional(),
433
+ sandbox: PartialSandboxConfigSchema
375
434
  });
376
435
  var DEFAULT_CONFIG = {
377
436
  version: "0.1.0",
@@ -496,6 +555,25 @@ function mergeMcpServers(...serverArrays) {
496
555
  }
497
556
  return Array.from(serverMap.values());
498
557
  }
558
+ function mergeSandboxConfig(base, override) {
559
+ const resolved = base ?? DEFAULT_SANDBOX_CONFIG;
560
+ if (!override) return resolved;
561
+ return {
562
+ enabled: override.enabled ?? resolved.enabled,
563
+ mode: override.mode ?? resolved.mode,
564
+ filesystem: {
565
+ ...resolved.filesystem,
566
+ ...override.filesystem ?? {}
567
+ },
568
+ network: {
569
+ ...resolved.network,
570
+ ...override.network ?? {}
571
+ },
572
+ excludedCommands: override.excludedCommands ?? resolved.excludedCommands,
573
+ allowUnsandboxedCommands: override.allowUnsandboxedCommands ?? resolved.allowUnsandboxedCommands,
574
+ platform: override.platform ?? resolved.platform
575
+ };
576
+ }
499
577
  function mergeConfigs(global, project, local) {
500
578
  const merged = { ...global };
501
579
  if (project) {
@@ -522,6 +600,9 @@ function mergeConfigs(global, project, local) {
522
600
  if (project.mcpServers) {
523
601
  merged.mcpServers = mergeMcpServers(merged.mcpServers, project.mcpServers);
524
602
  }
603
+ if (project.sandbox) {
604
+ merged.sandbox = mergeSandboxConfig(merged.sandbox, project.sandbox);
605
+ }
525
606
  }
526
607
  if (local) {
527
608
  if (local.trustedTools) {
@@ -543,6 +624,9 @@ function mergeConfigs(global, project, local) {
543
624
  if (local.mcpServers) {
544
625
  merged.mcpServers = mergeMcpServers(merged.mcpServers, local.mcpServers);
545
626
  }
627
+ if (local.sandbox) {
628
+ merged.sandbox = mergeSandboxConfig(merged.sandbox, local.sandbox);
629
+ }
546
630
  }
547
631
  return merged;
548
632
  }
@@ -15,7 +15,7 @@ import {
15
15
  dayjsConfig_default,
16
16
  extractSnippetMeta,
17
17
  settingsMap
18
- } from "./chunk-KPOK6V6E.js";
18
+ } from "./chunk-FKJTU7KU.js";
19
19
  import {
20
20
  Logger
21
21
  } from "./chunk-OCYRD7D6.js";
@@ -1797,7 +1797,6 @@ var ensureToolPairingIntegrity = (messages, logger) => {
1797
1797
  }
1798
1798
  logger.log(`Tool pairing integrity: removed ${parts.join(" and ")} after truncation`);
1799
1799
  }
1800
- let adjacencyStrippedCount = 0;
1801
1800
  for (let i = 0; i < result.length; i++) {
1802
1801
  const msg = result[i];
1803
1802
  if (msg.role !== "assistant" || !Array.isArray(msg.content))
@@ -1822,7 +1821,6 @@ var ensureToolPairingIntegrity = (messages, logger) => {
1822
1821
  const unmatchedSet = new Set(unmatchedIds);
1823
1822
  const filtered = content.filter((b) => {
1824
1823
  if (b.type === "tool_use" && "id" in b && unmatchedSet.has(b.id)) {
1825
- adjacencyStrippedCount++;
1826
1824
  return false;
1827
1825
  }
1828
1826
  return true;
@@ -7446,23 +7444,16 @@ var PipelineTimer = class {
7446
7444
  totalMs() {
7447
7445
  return Date.now() - this.start;
7448
7446
  }
7449
- /** Formatted multi-line summary table suitable for logging. */
7447
+ /** Formatted single-line summary suitable for structured loggers that prefix each line. */
7450
7448
  summary() {
7451
7449
  const total = this.totalMs();
7452
- const lines = [];
7453
- lines.push("Phase Duration % of Total");
7454
- lines.push("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
7450
+ const parts = [];
7455
7451
  for (const p of this.phases) {
7456
7452
  const dur = (p.end ?? Date.now()) - p.start;
7457
7453
  const pct = total > 0 ? (dur / total * 100).toFixed(1) : "0.0";
7458
- const name = p.name.padEnd(23);
7459
- const durStr = `${dur}ms`.padStart(9);
7460
- const pctStr = `${pct}%`.padStart(10);
7461
- lines.push(`${name} ${durStr} ${pctStr}`);
7462
- }
7463
- lines.push("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
7464
- lines.push(`${"TOTAL".padEnd(23)} ${`${total}ms`.padStart(9)}`);
7465
- return lines.join("\n");
7454
+ parts.push(`${p.name}: ${dur}ms (${pct}%)`);
7455
+ }
7456
+ return `${parts.join(" | ")} | TOTAL: ${total}ms`;
7466
7457
  }
7467
7458
  };
7468
7459
 
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/sandbox/runtime/SandboxRuntimeAdapter.ts
4
+ import os from "os";
5
+ import { accessSync, constants } from "fs";
6
+ import path from "path";
7
+ function detectPlatform() {
8
+ const platform = os.platform();
9
+ if (platform === "darwin") return "darwin";
10
+ if (platform === "linux") return "linux";
11
+ return null;
12
+ }
13
+ function isBinaryAvailable(binary) {
14
+ const pathDirs = (process.env.PATH || "").split(path.delimiter);
15
+ for (const dir of pathDirs) {
16
+ try {
17
+ accessSync(path.join(dir, binary), constants.X_OK);
18
+ return true;
19
+ } catch {
20
+ }
21
+ }
22
+ return false;
23
+ }
24
+ function expandPath(pathStr) {
25
+ return pathStr.replace(/\$HOME/g, os.homedir()).replace(/\$USER/g, os.userInfo().username).replace(/~\//g, `${os.homedir()}/`);
26
+ }
27
+ async function createSandboxRuntime() {
28
+ const platform = detectPlatform();
29
+ if (!platform) return null;
30
+ if (platform === "darwin") {
31
+ const { SeatbeltRuntime } = await import("./SeatbeltRuntime-EE3TTLEP.js");
32
+ const runtime = new SeatbeltRuntime();
33
+ return runtime.isAvailable() ? runtime : null;
34
+ }
35
+ if (platform === "linux") {
36
+ const { BubblewrapRuntime } = await import("./BubblewrapRuntime-PMIOLWKR.js");
37
+ const runtime = new BubblewrapRuntime();
38
+ return runtime.isAvailable() ? runtime : null;
39
+ }
40
+ return null;
41
+ }
42
+
43
+ export {
44
+ detectPlatform,
45
+ isBinaryAvailable,
46
+ expandPath,
47
+ createSandboxRuntime
48
+ };
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ConfigStore
4
- } from "../chunk-LBTTUQJM.js";
4
+ } from "../chunk-M2AJGZSX.js";
5
+ import "../chunk-4BIBE3J7.js";
5
6
 
6
7
  // src/commands/mcpCommand.ts
7
8
  async function handleMcpCommand(subcommand, argv) {
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  createFabFile,
4
4
  createFabFileSchema
5
- } from "./chunk-EC2VEDD2.js";
6
- import "./chunk-TY6Z2UV2.js";
7
- import "./chunk-KPOK6V6E.js";
5
+ } from "./chunk-5JTIPGUF.js";
6
+ import "./chunk-Q7CVAY4M.js";
7
+ import "./chunk-FKJTU7KU.js";
8
8
  import "./chunk-OCYRD7D6.js";
9
9
  export {
10
10
  createFabFile,