@get-bb/plugin-sdk 0.6.89 → 0.6.94

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.
@@ -4770,8 +4770,7 @@ var toolCallRequestParamsSchema = z29.object({
4770
4770
  turnId: z29.union([z29.string().min(1), z29.null()]),
4771
4771
  callId: z29.string().min(1),
4772
4772
  tool: z29.string().min(1),
4773
- arguments: z29.unknown(),
4774
- providerNativeIds: z29.boolean().optional()
4773
+ arguments: z29.unknown()
4775
4774
  }).passthrough();
4776
4775
  var toolCallResultSchema = z29.object({
4777
4776
  success: z29.boolean(),
@@ -4789,8 +4788,7 @@ var interactionRequestParamsSchema = z29.object({
4789
4788
  providerThreadId: z29.string().min(1),
4790
4789
  threadId: z29.string().min(1).optional(),
4791
4790
  turnId: z29.union([z29.string().min(1), z29.null()]),
4792
- payload: pendingInteractionPayloadSchema,
4793
- providerNativeIds: z29.boolean().optional()
4791
+ payload: pendingInteractionPayloadSchema
4794
4792
  }).passthrough();
4795
4793
 
4796
4794
  // ../provider-bridge-protocol/src/thread-event-grammar.ts
@@ -6433,6 +6431,97 @@ function whichCommandSync(command, options = {}) {
6433
6431
  return void 0;
6434
6432
  }
6435
6433
 
6434
+ // ../process-utils/src/node-network.ts
6435
+ var NODE_NETWORK_FLAGS = {
6436
+ "--use-system-ca": "NODE_USE_SYSTEM_CA",
6437
+ "--use-env-proxy": "NODE_USE_ENV_PROXY"
6438
+ };
6439
+ var ENV_PROXY_FLAG = "--use-env-proxy";
6440
+ var PROXY_KEYS = /* @__PURE__ */ new Set(["HTTP_PROXY", "HTTPS_PROXY"]);
6441
+ var NO_PROXY_KEY = "NO_PROXY";
6442
+ var LOOPBACK_HOSTS = ["localhost", "127.0.0.1", "::1", "[::1]"];
6443
+ function isNodeNetworkFlag(arg) {
6444
+ return Object.hasOwn(NODE_NETWORK_FLAGS, arg);
6445
+ }
6446
+ function isHttpProxyUrl(value) {
6447
+ if (/[\r\n]/u.test(value)) return false;
6448
+ try {
6449
+ const url = new URL(value);
6450
+ return (url.protocol === "http:" || url.protocol === "https:") && url.hostname !== "";
6451
+ } catch {
6452
+ return false;
6453
+ }
6454
+ }
6455
+ function proxyEntries(env) {
6456
+ return Object.entries(env).filter(
6457
+ (entry) => PROXY_KEYS.has(entry[0].toUpperCase()) && entry[1] !== void 0 && entry[1] !== ""
6458
+ );
6459
+ }
6460
+ function appendLoopback(value) {
6461
+ const entries = value.split(/[\s,]+/u).filter(Boolean);
6462
+ if (entries.includes("*")) return value;
6463
+ const present = new Set(entries.map((entry) => entry.toLowerCase()));
6464
+ return [
6465
+ ...entries,
6466
+ ...LOOPBACK_HOSTS.filter((host) => !present.has(host))
6467
+ ].join(",");
6468
+ }
6469
+ function withLoopbackNoProxy(env) {
6470
+ const result2 = { ...env };
6471
+ const keys = Object.keys(result2).filter(
6472
+ (key) => key.toUpperCase() === NO_PROXY_KEY && result2[key] !== void 0
6473
+ );
6474
+ for (const key of keys.length > 0 ? keys : [NO_PROXY_KEY])
6475
+ result2[key] = appendLoopback(result2[key] ?? "");
6476
+ return result2;
6477
+ }
6478
+ function nodeNetworkLaunch(nodeArgs, env) {
6479
+ const enabled = nodeArgs.filter(
6480
+ (arg) => !isNodeNetworkFlag(arg) || env[NODE_NETWORK_FLAGS[arg]] !== "0"
6481
+ );
6482
+ if (!enabled.includes(ENV_PROXY_FLAG))
6483
+ return { nodeArgs: enabled, env, rejectedProxyKeys: [] };
6484
+ const proxies = proxyEntries(env);
6485
+ const rejectedProxyKeys = proxies.filter(([, value]) => !isHttpProxyUrl(value)).map(([key]) => key);
6486
+ if (rejectedProxyKeys.length > 0)
6487
+ return {
6488
+ nodeArgs: enabled.filter((arg) => arg !== ENV_PROXY_FLAG),
6489
+ env,
6490
+ rejectedProxyKeys
6491
+ };
6492
+ return {
6493
+ nodeArgs: enabled,
6494
+ env: proxies.length > 0 ? withLoopbackNoProxy(env) : env,
6495
+ rejectedProxyKeys: []
6496
+ };
6497
+ }
6498
+ var warnedProxyKeys = /* @__PURE__ */ new Set();
6499
+ function prepareNodeNetworkLaunch(nodeArgs, env) {
6500
+ const launch = nodeNetworkLaunch(nodeArgs, env);
6501
+ const unwarned = launch.rejectedProxyKeys.filter(
6502
+ (key) => !warnedProxyKeys.has(key)
6503
+ );
6504
+ if (unwarned.length > 0) {
6505
+ for (const key of unwarned) warnedProxyKeys.add(key);
6506
+ process.emitWarning(
6507
+ `bb started a Node process without --use-env-proxy because ${unwarned.join(", ")} is not an http:// or https:// URL. Add the scheme, for example http://proxy.example:3128, so bb uses the proxy.`,
6508
+ { code: "BB_INVALID_PROXY_ENV" }
6509
+ );
6510
+ }
6511
+ return { nodeArgs: launch.nodeArgs, env: launch.env };
6512
+ }
6513
+ function prepareNodeNetworkCommand(args, env) {
6514
+ const scriptIndex = args.findIndex(
6515
+ (arg) => arg === "--" || !arg.startsWith("-")
6516
+ );
6517
+ const optionCount = scriptIndex < 0 ? args.length : scriptIndex;
6518
+ const launch = prepareNodeNetworkLaunch(args.slice(0, optionCount), env);
6519
+ return {
6520
+ args: [...launch.nodeArgs, ...args.slice(optionCount)],
6521
+ env: launch.env
6522
+ };
6523
+ }
6524
+
6436
6525
  // ../process-utils/src/host-toolchain.ts
6437
6526
  var NETWORK_KEYS = [
6438
6527
  "HTTP_PROXY",
@@ -6793,7 +6882,8 @@ var HostToolchain = class {
6793
6882
  if (/(?:^|[\\/])(?:npm|npx)-cli\.js$/u.test(args[0] ?? "")) {
6794
6883
  env.PATH = mergePath(dirname(file), env.PATH);
6795
6884
  }
6796
- return { command: file, args: [...args], env };
6885
+ const network = prepareNodeNetworkCommand(args, env);
6886
+ return { command: file, args: network.args, env: network.env };
6797
6887
  }
6798
6888
  };
6799
6889
  var toolchainKey = /* @__PURE__ */ Symbol.for("@bb/process-utils/host-toolchain");
@@ -651,6 +651,97 @@ function whichCommandSync(command, options = {}) {
651
651
  return void 0;
652
652
  }
653
653
 
654
+ // ../process-utils/src/node-network.ts
655
+ var NODE_NETWORK_FLAGS = {
656
+ "--use-system-ca": "NODE_USE_SYSTEM_CA",
657
+ "--use-env-proxy": "NODE_USE_ENV_PROXY"
658
+ };
659
+ var ENV_PROXY_FLAG = "--use-env-proxy";
660
+ var PROXY_KEYS = /* @__PURE__ */ new Set(["HTTP_PROXY", "HTTPS_PROXY"]);
661
+ var NO_PROXY_KEY = "NO_PROXY";
662
+ var LOOPBACK_HOSTS = ["localhost", "127.0.0.1", "::1", "[::1]"];
663
+ function isNodeNetworkFlag(arg) {
664
+ return Object.hasOwn(NODE_NETWORK_FLAGS, arg);
665
+ }
666
+ function isHttpProxyUrl(value) {
667
+ if (/[\r\n]/u.test(value)) return false;
668
+ try {
669
+ const url = new URL(value);
670
+ return (url.protocol === "http:" || url.protocol === "https:") && url.hostname !== "";
671
+ } catch {
672
+ return false;
673
+ }
674
+ }
675
+ function proxyEntries(env) {
676
+ return Object.entries(env).filter(
677
+ (entry2) => PROXY_KEYS.has(entry2[0].toUpperCase()) && entry2[1] !== void 0 && entry2[1] !== ""
678
+ );
679
+ }
680
+ function appendLoopback(value) {
681
+ const entries = value.split(/[\s,]+/u).filter(Boolean);
682
+ if (entries.includes("*")) return value;
683
+ const present = new Set(entries.map((entry2) => entry2.toLowerCase()));
684
+ return [
685
+ ...entries,
686
+ ...LOOPBACK_HOSTS.filter((host) => !present.has(host))
687
+ ].join(",");
688
+ }
689
+ function withLoopbackNoProxy(env) {
690
+ const result = { ...env };
691
+ const keys = Object.keys(result).filter(
692
+ (key) => key.toUpperCase() === NO_PROXY_KEY && result[key] !== void 0
693
+ );
694
+ for (const key of keys.length > 0 ? keys : [NO_PROXY_KEY])
695
+ result[key] = appendLoopback(result[key] ?? "");
696
+ return result;
697
+ }
698
+ function nodeNetworkLaunch(nodeArgs, env) {
699
+ const enabled = nodeArgs.filter(
700
+ (arg) => !isNodeNetworkFlag(arg) || env[NODE_NETWORK_FLAGS[arg]] !== "0"
701
+ );
702
+ if (!enabled.includes(ENV_PROXY_FLAG))
703
+ return { nodeArgs: enabled, env, rejectedProxyKeys: [] };
704
+ const proxies = proxyEntries(env);
705
+ const rejectedProxyKeys = proxies.filter(([, value]) => !isHttpProxyUrl(value)).map(([key]) => key);
706
+ if (rejectedProxyKeys.length > 0)
707
+ return {
708
+ nodeArgs: enabled.filter((arg) => arg !== ENV_PROXY_FLAG),
709
+ env,
710
+ rejectedProxyKeys
711
+ };
712
+ return {
713
+ nodeArgs: enabled,
714
+ env: proxies.length > 0 ? withLoopbackNoProxy(env) : env,
715
+ rejectedProxyKeys: []
716
+ };
717
+ }
718
+ var warnedProxyKeys = /* @__PURE__ */ new Set();
719
+ function prepareNodeNetworkLaunch(nodeArgs, env) {
720
+ const launch = nodeNetworkLaunch(nodeArgs, env);
721
+ const unwarned = launch.rejectedProxyKeys.filter(
722
+ (key) => !warnedProxyKeys.has(key)
723
+ );
724
+ if (unwarned.length > 0) {
725
+ for (const key of unwarned) warnedProxyKeys.add(key);
726
+ process.emitWarning(
727
+ `bb started a Node process without --use-env-proxy because ${unwarned.join(", ")} is not an http:// or https:// URL. Add the scheme, for example http://proxy.example:3128, so bb uses the proxy.`,
728
+ { code: "BB_INVALID_PROXY_ENV" }
729
+ );
730
+ }
731
+ return { nodeArgs: launch.nodeArgs, env: launch.env };
732
+ }
733
+ function prepareNodeNetworkCommand(args, env) {
734
+ const scriptIndex = args.findIndex(
735
+ (arg) => arg === "--" || !arg.startsWith("-")
736
+ );
737
+ const optionCount = scriptIndex < 0 ? args.length : scriptIndex;
738
+ const launch = prepareNodeNetworkLaunch(args.slice(0, optionCount), env);
739
+ return {
740
+ args: [...launch.nodeArgs, ...args.slice(optionCount)],
741
+ env: launch.env
742
+ };
743
+ }
744
+
654
745
  // ../process-utils/src/host-toolchain.ts
655
746
  var NETWORK_KEYS = [
656
747
  "HTTP_PROXY",
@@ -1011,7 +1102,8 @@ var HostToolchain = class {
1011
1102
  if (/(?:^|[\\/])(?:npm|npx)-cli\.js$/u.test(args[0] ?? "")) {
1012
1103
  env.PATH = mergePath(dirname(file), env.PATH);
1013
1104
  }
1014
- return { command: file, args: [...args], env };
1105
+ const network = prepareNodeNetworkCommand(args, env);
1106
+ return { command: file, args: network.args, env: network.env };
1015
1107
  }
1016
1108
  };
1017
1109
  var toolchainKey = /* @__PURE__ */ Symbol.for("@bb/process-utils/host-toolchain");
@@ -3556,8 +3556,7 @@ var toolCallRequestParamsSchema = z23.object({
3556
3556
  turnId: z23.union([z23.string().min(1), z23.null()]),
3557
3557
  callId: z23.string().min(1),
3558
3558
  tool: z23.string().min(1),
3559
- arguments: z23.unknown(),
3560
- providerNativeIds: z23.boolean().optional()
3559
+ arguments: z23.unknown()
3561
3560
  }).passthrough();
3562
3561
  var toolCallResultSchema = z23.object({
3563
3562
  success: z23.boolean(),
@@ -3575,8 +3574,7 @@ var interactionRequestParamsSchema = z23.object({
3575
3574
  providerThreadId: z23.string().min(1),
3576
3575
  threadId: z23.string().min(1).optional(),
3577
3576
  turnId: z23.union([z23.string().min(1), z23.null()]),
3578
- payload: pendingInteractionPayloadSchema,
3579
- providerNativeIds: z23.boolean().optional()
3577
+ payload: pendingInteractionPayloadSchema
3580
3578
  }).passthrough();
3581
3579
 
3582
3580
  // ../provider-bridge-protocol/src/bridge-kit/bridge-tool-calls.ts
@@ -4037,6 +4035,97 @@ function whichCommandSync(command, options = {}) {
4037
4035
  return void 0;
4038
4036
  }
4039
4037
 
4038
+ // ../process-utils/src/node-network.ts
4039
+ var NODE_NETWORK_FLAGS = {
4040
+ "--use-system-ca": "NODE_USE_SYSTEM_CA",
4041
+ "--use-env-proxy": "NODE_USE_ENV_PROXY"
4042
+ };
4043
+ var ENV_PROXY_FLAG = "--use-env-proxy";
4044
+ var PROXY_KEYS = /* @__PURE__ */ new Set(["HTTP_PROXY", "HTTPS_PROXY"]);
4045
+ var NO_PROXY_KEY = "NO_PROXY";
4046
+ var LOOPBACK_HOSTS = ["localhost", "127.0.0.1", "::1", "[::1]"];
4047
+ function isNodeNetworkFlag(arg) {
4048
+ return Object.hasOwn(NODE_NETWORK_FLAGS, arg);
4049
+ }
4050
+ function isHttpProxyUrl(value) {
4051
+ if (/[\r\n]/u.test(value)) return false;
4052
+ try {
4053
+ const url = new URL(value);
4054
+ return (url.protocol === "http:" || url.protocol === "https:") && url.hostname !== "";
4055
+ } catch {
4056
+ return false;
4057
+ }
4058
+ }
4059
+ function proxyEntries(env) {
4060
+ return Object.entries(env).filter(
4061
+ (entry) => PROXY_KEYS.has(entry[0].toUpperCase()) && entry[1] !== void 0 && entry[1] !== ""
4062
+ );
4063
+ }
4064
+ function appendLoopback(value) {
4065
+ const entries = value.split(/[\s,]+/u).filter(Boolean);
4066
+ if (entries.includes("*")) return value;
4067
+ const present = new Set(entries.map((entry) => entry.toLowerCase()));
4068
+ return [
4069
+ ...entries,
4070
+ ...LOOPBACK_HOSTS.filter((host) => !present.has(host))
4071
+ ].join(",");
4072
+ }
4073
+ function withLoopbackNoProxy(env) {
4074
+ const result = { ...env };
4075
+ const keys = Object.keys(result).filter(
4076
+ (key) => key.toUpperCase() === NO_PROXY_KEY && result[key] !== void 0
4077
+ );
4078
+ for (const key of keys.length > 0 ? keys : [NO_PROXY_KEY])
4079
+ result[key] = appendLoopback(result[key] ?? "");
4080
+ return result;
4081
+ }
4082
+ function nodeNetworkLaunch(nodeArgs, env) {
4083
+ const enabled = nodeArgs.filter(
4084
+ (arg) => !isNodeNetworkFlag(arg) || env[NODE_NETWORK_FLAGS[arg]] !== "0"
4085
+ );
4086
+ if (!enabled.includes(ENV_PROXY_FLAG))
4087
+ return { nodeArgs: enabled, env, rejectedProxyKeys: [] };
4088
+ const proxies = proxyEntries(env);
4089
+ const rejectedProxyKeys = proxies.filter(([, value]) => !isHttpProxyUrl(value)).map(([key]) => key);
4090
+ if (rejectedProxyKeys.length > 0)
4091
+ return {
4092
+ nodeArgs: enabled.filter((arg) => arg !== ENV_PROXY_FLAG),
4093
+ env,
4094
+ rejectedProxyKeys
4095
+ };
4096
+ return {
4097
+ nodeArgs: enabled,
4098
+ env: proxies.length > 0 ? withLoopbackNoProxy(env) : env,
4099
+ rejectedProxyKeys: []
4100
+ };
4101
+ }
4102
+ var warnedProxyKeys = /* @__PURE__ */ new Set();
4103
+ function prepareNodeNetworkLaunch(nodeArgs, env) {
4104
+ const launch = nodeNetworkLaunch(nodeArgs, env);
4105
+ const unwarned = launch.rejectedProxyKeys.filter(
4106
+ (key) => !warnedProxyKeys.has(key)
4107
+ );
4108
+ if (unwarned.length > 0) {
4109
+ for (const key of unwarned) warnedProxyKeys.add(key);
4110
+ process.emitWarning(
4111
+ `bb started a Node process without --use-env-proxy because ${unwarned.join(", ")} is not an http:// or https:// URL. Add the scheme, for example http://proxy.example:3128, so bb uses the proxy.`,
4112
+ { code: "BB_INVALID_PROXY_ENV" }
4113
+ );
4114
+ }
4115
+ return { nodeArgs: launch.nodeArgs, env: launch.env };
4116
+ }
4117
+ function prepareNodeNetworkCommand(args, env) {
4118
+ const scriptIndex = args.findIndex(
4119
+ (arg) => arg === "--" || !arg.startsWith("-")
4120
+ );
4121
+ const optionCount = scriptIndex < 0 ? args.length : scriptIndex;
4122
+ const launch = prepareNodeNetworkLaunch(args.slice(0, optionCount), env);
4123
+ return {
4124
+ args: [...launch.nodeArgs, ...args.slice(optionCount)],
4125
+ env: launch.env
4126
+ };
4127
+ }
4128
+
4040
4129
  // ../process-utils/src/host-toolchain.ts
4041
4130
  var NETWORK_KEYS = [
4042
4131
  "HTTP_PROXY",
@@ -4397,7 +4486,8 @@ var HostToolchain = class {
4397
4486
  if (/(?:^|[\\/])(?:npm|npx)-cli\.js$/u.test(args[0] ?? "")) {
4398
4487
  env.PATH = mergePath(dirname(file), env.PATH);
4399
4488
  }
4400
- return { command: file, args: [...args], env };
4489
+ const network = prepareNodeNetworkCommand(args, env);
4490
+ return { command: file, args: network.args, env: network.env };
4401
4491
  }
4402
4492
  };
4403
4493
  var toolchainKey = /* @__PURE__ */ Symbol.for("@bb/process-utils/host-toolchain");