@botconnector/bccli 0.4.0-beta.4 → 0.4.0-beta.41

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 (46) hide show
  1. package/README.md +80 -1
  2. package/dist/acp-SZWZ5EE4.js +114 -0
  3. package/dist/args-4SMOHFN5.js +13 -0
  4. package/dist/chunk-3HCOAJEQ.js +190 -0
  5. package/dist/chunk-AS7VV7D3.js +195 -0
  6. package/dist/{chunk-NGLKANMD.js → chunk-AVB6M4JE.js} +24 -2
  7. package/dist/chunk-BUHWQU3V.js +231 -0
  8. package/dist/chunk-DBHDZ5EP.js +723 -0
  9. package/dist/{chunk-GW36UMHZ.js → chunk-DSFHN5CH.js} +2 -2
  10. package/dist/chunk-EQQTTE2K.js +8 -0
  11. package/dist/{chunk-ELML4KVQ.js → chunk-GAFJEQTJ.js} +32 -2
  12. package/dist/chunk-GGNXHJL6.js +884 -0
  13. package/dist/chunk-HE33XAPZ.js +341 -0
  14. package/dist/{chunk-UESQNU4A.js → chunk-ISCT3PN3.js} +14 -9
  15. package/dist/chunk-JROUQ5YS.js +76 -0
  16. package/dist/chunk-LN32JIZR.js +56 -0
  17. package/dist/chunk-M23QBX3V.js +419 -0
  18. package/dist/chunk-M4IYXI3V.js +2125 -0
  19. package/dist/chunk-M7LLJQ7M.js +310 -0
  20. package/dist/chunk-NI5JZUZ3.js +63 -0
  21. package/dist/chunk-PSO7R5AD.js +10 -0
  22. package/dist/{chunk-U7DLMVPZ.js → chunk-SESBH44L.js} +2 -1
  23. package/dist/{chunk-SJH3YLW4.js → chunk-VM7HYAJS.js} +4 -1
  24. package/dist/cli.js +94 -1278
  25. package/dist/{config-NPSYFAFD.js → config-C4KLLDC6.js} +5 -2
  26. package/dist/integrationCli-HR7CDUSI.js +685 -0
  27. package/dist/{login-F4G5QXOU.js → login-T5S6SPZA.js} +1 -1
  28. package/dist/{mcpCli-Q2H63ISP.js → mcpCli-5QTXH7XJ.js} +42 -9
  29. package/dist/modelsCli-DKTT3UZD.js +36 -0
  30. package/dist/providerCli-DDH4ZZUY.js +15 -0
  31. package/dist/sdk.js +5179 -0
  32. package/dist/serve-I2VQUTHR.js +178 -0
  33. package/dist/serve-KQ35P4W3.js +514 -0
  34. package/dist/session-H2YL5RSB.js +12 -0
  35. package/dist/setup-45WQXUBK.js +23 -0
  36. package/dist/ui-S4QFJJIB.js +2280 -0
  37. package/dist/update-VBDEHHMR.js +109 -0
  38. package/package.json +24 -3
  39. package/dist/args-FCLPQ7TO.js +0 -11
  40. package/dist/chunk-C5AFWX7H.js +0 -328
  41. package/dist/chunk-OSWQPSA4.js +0 -252
  42. package/dist/chunk-RZUJYAQV.js +0 -112
  43. package/dist/chunk-UN7QXPCB.js +0 -82
  44. package/dist/providerCli-MXV6PD6F.js +0 -11
  45. package/dist/session-7UB77CEG.js +0 -9
  46. package/dist/ui-7FXPXXGN.js +0 -1333
@@ -35,8 +35,8 @@ function readSecret(prompt) {
35
35
  });
36
36
  }
37
37
  async function runLogin(providerId, cwd) {
38
- const { runProviderCommand } = await import("./providerCli-MXV6PD6F.js");
39
- const { parseCliArgs } = await import("./args-FCLPQ7TO.js");
38
+ const { runProviderCommand } = await import("./providerCli-DDH4ZZUY.js");
39
+ const { parseCliArgs } = await import("./args-4SMOHFN5.js");
40
40
  return runProviderCommand(parseCliArgs(["provider", "add", providerId]), {
41
41
  env: process.env,
42
42
  cwd,
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/version.ts
4
+ var VERSION = true ? "0.4.0-beta.41" : "0.0.0-dev";
5
+
6
+ export {
7
+ VERSION
8
+ };
@@ -6,10 +6,36 @@ var MODE_ORDER = ["default", "acceptEdits", "plan", "allowAll"];
6
6
  function nextMode(mode) {
7
7
  return MODE_ORDER[(MODE_ORDER.indexOf(mode) + 1) % MODE_ORDER.length];
8
8
  }
9
- var TWO_WORD = /* @__PURE__ */ new Set(["npm", "npx", "pnpm", "yarn", "bun", "git", "cargo", "go", "docker", "python", "python3", "uv", "make"]);
9
+ var ALWAYS_ASK_COMMANDS = /* @__PURE__ */ new Set(["sudo", "sh", "bash", "zsh", "su"]);
10
+ function isAlwaysAsk(segment) {
11
+ const words = segment.trim().split(/\s+/);
12
+ const first = words[0] ?? "";
13
+ if (ALWAYS_ASK_COMMANDS.has(first)) return true;
14
+ const flags = words.slice(1).filter((w) => w.startsWith("-"));
15
+ if (first === "rm" && flags.some((w) => w.includes("r"))) return true;
16
+ if (first === "chmod" && flags.some((w) => w.includes("R"))) return true;
17
+ if (first === "kill" && words.slice(1).includes("-9")) return true;
18
+ if (first === "git" && words[1] === "push") {
19
+ return words.slice(2).some((w) => w === "-f" || w === "--force" || w.startsWith("--force="));
20
+ }
21
+ return false;
22
+ }
10
23
  function commandKey(segment) {
11
24
  const words = segment.trim().split(/\s+/);
12
- return TWO_WORD.has(words[0]) && words[1] ? `${words[0]} ${words[1]}` : words[0];
25
+ return words[1] ? `${words[0]} ${words[1]}` : words[0];
26
+ }
27
+ function requiresSensitiveToolApproval(req) {
28
+ const target = req.target.trim();
29
+ if (req.kind === "read" || req.kind === "edit") {
30
+ return /(?:^|[/\\])(?:\.env(?:\..*)?|\.ssh|\.aws|\.config\/gcloud|secrets?|credentials?)(?:[/\\]|$)/i.test(target) || /(?:id_rsa|id_ed25519|\.pem|\.p12|\.key)$/i.test(target);
31
+ }
32
+ if (req.kind === "bash") {
33
+ return /\b(?:rm\s+-[a-z]*r[a-z]*f[a-z]*\s|rm\s+-[a-z]*f[a-z]*r[a-z]*\s|mkfs(?:\.|\s)|wipefs\b|shred\s|git\s+push\s+(?:--force|-f)\b|docker\s+(?:system\s+prune|volume\s+rm)|kubectl\s+delete\b|drop\s+(?:database|table)|npm\s+publish\b)/i.test(target) || /\b(?:deploy-service\.sh|aws\s+secretsmanager|cat\s+[^;&|]*\.env\b)/i.test(target);
34
+ }
35
+ if (req.kind === "mcp") {
36
+ return /(?:delete|remove|revoke|transfer|send_email|publish|deploy|execute_command|run_command|read_secret)/i.test(req.tool);
37
+ }
38
+ return false;
13
39
  }
14
40
  var Permissions = class {
15
41
  constructor(mode, rules = [], cwd = process.cwd()) {
@@ -30,6 +56,7 @@ var Permissions = class {
30
56
  }
31
57
  /** Rules that "[a] allow for this session" would add; undefined when it must always be asked. */
32
58
  rulesFor(req) {
59
+ if (process.env.BC_TOOL_POLICY_ENFORCE === "true" && requiresSensitiveToolApproval(req)) return void 0;
33
60
  if (req.kind === "edit") return this.editInProject(req.target) ? ["edit(project)"] : void 0;
34
61
  if (req.kind === "fetch") {
35
62
  try {
@@ -42,12 +69,15 @@ var Permissions = class {
42
69
  if (/`|\$\(|[<>]|^\s*[({]/.test(req.target)) return void 0;
43
70
  const segments = req.target.split(/&&|\|\||[;&|\n]/).map((s) => s.trim()).filter(Boolean);
44
71
  if (!segments.length) return void 0;
72
+ if (segments.some(isAlwaysAsk)) return void 0;
45
73
  return [...new Set(segments.map((s) => `bash(${commandKey(s)})`))];
46
74
  }
47
75
  if (req.kind === "mcp") return [`mcp(${req.tool})`];
48
76
  return [];
49
77
  }
50
78
  check(req) {
79
+ if (this.mode === "plan" && req.kind !== "read") return "deny";
80
+ if (process.env.BC_TOOL_POLICY_ENFORCE === "true" && requiresSensitiveToolApproval(req)) return "ask";
51
81
  if (req.kind === "read") return "allow";
52
82
  if (this.mode === "allowAll") return "allow";
53
83
  if (this.mode === "plan") return "deny";