@get-bb/plugin-sdk 0.5.15 → 0.5.23
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.
- package/README.md +6 -4
- package/bundled-types/bb-plugin-sdk-app.d.ts +261 -25
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +72 -60
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +1 -0
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +14 -11
- package/bundled-types/bb-plugin-sdk-testing.d.ts +2 -4
- package/bundled-types/bb-plugin-sdk.d.ts +319 -43
- package/dist/app.js +140 -44
- package/dist/host.js +2 -535
- package/dist/internal/host-policy.js +29 -77
- package/dist/provider-bridge-acp.js +24 -2
- package/dist/provider-bridge-testing.js +2 -1
- package/dist/provider-bridge.js +4 -506
- package/dist/testing/app.js +15 -0
- package/dist/testing/index.js +39 -83
- package/package.json +2 -7
- package/bundled-types/bb-plugin-sdk-ai-services.d.ts +0 -141
- package/dist/ai-services.js +0 -95
|
@@ -3281,7 +3281,8 @@ var BRIDGE_JSON_RPC_ERRORS = {
|
|
|
3281
3281
|
BRIDGE_ERROR: -32e3,
|
|
3282
3282
|
NO_ACTIVE_TURN: -32001,
|
|
3283
3283
|
SESSION_NOT_RESTORABLE: -32002,
|
|
3284
|
-
FORK_CHECKPOINT_UNSUPPORTED: -32003
|
|
3284
|
+
FORK_CHECKPOINT_UNSUPPORTED: -32003,
|
|
3285
|
+
MISSING_EXECUTABLE: -32004
|
|
3285
3286
|
};
|
|
3286
3287
|
var providerRecoveryHintSchema = z24.object({
|
|
3287
3288
|
kind: providerRecoveryKindSchema,
|
|
@@ -4618,12 +4619,33 @@ var acpLooseConfigOptionSchema = z35.object({
|
|
|
4618
4619
|
currentValue: z35.unknown().optional(),
|
|
4619
4620
|
options: z35.unknown().optional()
|
|
4620
4621
|
}).passthrough();
|
|
4622
|
+
var acpConfigOptionSelectGroupSchema = z35.object({
|
|
4623
|
+
group: z35.string(),
|
|
4624
|
+
options: z35.array(z35.unknown())
|
|
4625
|
+
}).passthrough();
|
|
4626
|
+
function flattenAcpConfigOptionGroups(option) {
|
|
4627
|
+
if (typeof option !== "object" || option === null) {
|
|
4628
|
+
return option;
|
|
4629
|
+
}
|
|
4630
|
+
const { options } = option;
|
|
4631
|
+
if (!Array.isArray(options)) {
|
|
4632
|
+
return option;
|
|
4633
|
+
}
|
|
4634
|
+
return {
|
|
4635
|
+
...option,
|
|
4636
|
+
options: options.flatMap((entry) => {
|
|
4637
|
+
const group = acpConfigOptionSelectGroupSchema.safeParse(entry);
|
|
4638
|
+
return group.success ? group.data.options : [entry];
|
|
4639
|
+
})
|
|
4640
|
+
};
|
|
4641
|
+
}
|
|
4621
4642
|
function parseAcpConfigOptions(options, ctx) {
|
|
4622
4643
|
if (options == null) {
|
|
4623
4644
|
return void 0;
|
|
4624
4645
|
}
|
|
4625
4646
|
const parsedOptions = [];
|
|
4626
|
-
for (const
|
|
4647
|
+
for (const rawOption of options) {
|
|
4648
|
+
const option = flattenAcpConfigOptionGroups(rawOption);
|
|
4627
4649
|
const loose = acpLooseConfigOptionSchema.safeParse(option);
|
|
4628
4650
|
if (!loose.success) {
|
|
4629
4651
|
continue;
|
|
@@ -4652,7 +4652,8 @@ var BRIDGE_JSON_RPC_ERRORS = {
|
|
|
4652
4652
|
BRIDGE_ERROR: -32e3,
|
|
4653
4653
|
NO_ACTIVE_TURN: -32001,
|
|
4654
4654
|
SESSION_NOT_RESTORABLE: -32002,
|
|
4655
|
-
FORK_CHECKPOINT_UNSUPPORTED: -32003
|
|
4655
|
+
FORK_CHECKPOINT_UNSUPPORTED: -32003,
|
|
4656
|
+
MISSING_EXECUTABLE: -32004
|
|
4656
4657
|
};
|
|
4657
4658
|
var providerRecoveryHintSchema = z25.object({
|
|
4658
4659
|
kind: providerRecoveryKindSchema,
|
package/dist/provider-bridge.js
CHANGED
|
@@ -4,13 +4,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
8
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
-
}) : x)(function(x) {
|
|
10
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
-
});
|
|
13
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
14
8
|
try {
|
|
15
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
16
10
|
} catch (e) {
|
|
@@ -545,503 +539,6 @@ var require_valid = __commonJS({
|
|
|
545
539
|
}
|
|
546
540
|
});
|
|
547
541
|
|
|
548
|
-
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
|
|
549
|
-
var require_windows = __commonJS({
|
|
550
|
-
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module) {
|
|
551
|
-
module.exports = isexe;
|
|
552
|
-
isexe.sync = sync;
|
|
553
|
-
var fs = __require("fs");
|
|
554
|
-
function checkPathExt(path2, options) {
|
|
555
|
-
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
556
|
-
if (!pathext) {
|
|
557
|
-
return true;
|
|
558
|
-
}
|
|
559
|
-
pathext = pathext.split(";");
|
|
560
|
-
if (pathext.indexOf("") !== -1) {
|
|
561
|
-
return true;
|
|
562
|
-
}
|
|
563
|
-
for (var i = 0; i < pathext.length; i++) {
|
|
564
|
-
var p = pathext[i].toLowerCase();
|
|
565
|
-
if (p && path2.substr(-p.length).toLowerCase() === p) {
|
|
566
|
-
return true;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
return false;
|
|
570
|
-
}
|
|
571
|
-
function checkStat(stat, path2, options) {
|
|
572
|
-
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
573
|
-
return false;
|
|
574
|
-
}
|
|
575
|
-
return checkPathExt(path2, options);
|
|
576
|
-
}
|
|
577
|
-
function isexe(path2, options, cb) {
|
|
578
|
-
fs.stat(path2, function(er, stat) {
|
|
579
|
-
cb(er, er ? false : checkStat(stat, path2, options));
|
|
580
|
-
});
|
|
581
|
-
}
|
|
582
|
-
function sync(path2, options) {
|
|
583
|
-
return checkStat(fs.statSync(path2), path2, options);
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
});
|
|
587
|
-
|
|
588
|
-
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
|
|
589
|
-
var require_mode = __commonJS({
|
|
590
|
-
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module) {
|
|
591
|
-
module.exports = isexe;
|
|
592
|
-
isexe.sync = sync;
|
|
593
|
-
var fs = __require("fs");
|
|
594
|
-
function isexe(path2, options, cb) {
|
|
595
|
-
fs.stat(path2, function(er, stat) {
|
|
596
|
-
cb(er, er ? false : checkStat(stat, options));
|
|
597
|
-
});
|
|
598
|
-
}
|
|
599
|
-
function sync(path2, options) {
|
|
600
|
-
return checkStat(fs.statSync(path2), options);
|
|
601
|
-
}
|
|
602
|
-
function checkStat(stat, options) {
|
|
603
|
-
return stat.isFile() && checkMode(stat, options);
|
|
604
|
-
}
|
|
605
|
-
function checkMode(stat, options) {
|
|
606
|
-
var mod = stat.mode;
|
|
607
|
-
var uid = stat.uid;
|
|
608
|
-
var gid = stat.gid;
|
|
609
|
-
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
610
|
-
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
611
|
-
var u = parseInt("100", 8);
|
|
612
|
-
var g = parseInt("010", 8);
|
|
613
|
-
var o = parseInt("001", 8);
|
|
614
|
-
var ug = u | g;
|
|
615
|
-
var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
616
|
-
return ret;
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
});
|
|
620
|
-
|
|
621
|
-
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
622
|
-
var require_isexe = __commonJS({
|
|
623
|
-
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module) {
|
|
624
|
-
var fs = __require("fs");
|
|
625
|
-
var core;
|
|
626
|
-
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
627
|
-
core = require_windows();
|
|
628
|
-
} else {
|
|
629
|
-
core = require_mode();
|
|
630
|
-
}
|
|
631
|
-
module.exports = isexe;
|
|
632
|
-
isexe.sync = sync;
|
|
633
|
-
function isexe(path2, options, cb) {
|
|
634
|
-
if (typeof options === "function") {
|
|
635
|
-
cb = options;
|
|
636
|
-
options = {};
|
|
637
|
-
}
|
|
638
|
-
if (!cb) {
|
|
639
|
-
if (typeof Promise !== "function") {
|
|
640
|
-
throw new TypeError("callback not provided");
|
|
641
|
-
}
|
|
642
|
-
return new Promise(function(resolve2, reject) {
|
|
643
|
-
isexe(path2, options || {}, function(er, is) {
|
|
644
|
-
if (er) {
|
|
645
|
-
reject(er);
|
|
646
|
-
} else {
|
|
647
|
-
resolve2(is);
|
|
648
|
-
}
|
|
649
|
-
});
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
core(path2, options || {}, function(er, is) {
|
|
653
|
-
if (er) {
|
|
654
|
-
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
655
|
-
er = null;
|
|
656
|
-
is = false;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
cb(er, is);
|
|
660
|
-
});
|
|
661
|
-
}
|
|
662
|
-
function sync(path2, options) {
|
|
663
|
-
try {
|
|
664
|
-
return core.sync(path2, options || {});
|
|
665
|
-
} catch (er) {
|
|
666
|
-
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
667
|
-
return false;
|
|
668
|
-
} else {
|
|
669
|
-
throw er;
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
});
|
|
675
|
-
|
|
676
|
-
// ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
677
|
-
var require_which = __commonJS({
|
|
678
|
-
"../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module) {
|
|
679
|
-
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
680
|
-
var path2 = __require("path");
|
|
681
|
-
var COLON = isWindows ? ";" : ":";
|
|
682
|
-
var isexe = require_isexe();
|
|
683
|
-
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
684
|
-
var getPathInfo = (cmd, opt) => {
|
|
685
|
-
const colon = opt.colon || COLON;
|
|
686
|
-
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
|
|
687
|
-
// windows always checks the cwd first
|
|
688
|
-
...isWindows ? [process.cwd()] : [],
|
|
689
|
-
...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
|
|
690
|
-
"").split(colon)
|
|
691
|
-
];
|
|
692
|
-
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
693
|
-
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
694
|
-
if (isWindows) {
|
|
695
|
-
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
|
|
696
|
-
pathExt.unshift("");
|
|
697
|
-
}
|
|
698
|
-
return {
|
|
699
|
-
pathEnv,
|
|
700
|
-
pathExt,
|
|
701
|
-
pathExtExe
|
|
702
|
-
};
|
|
703
|
-
};
|
|
704
|
-
var which = (cmd, opt, cb) => {
|
|
705
|
-
if (typeof opt === "function") {
|
|
706
|
-
cb = opt;
|
|
707
|
-
opt = {};
|
|
708
|
-
}
|
|
709
|
-
if (!opt)
|
|
710
|
-
opt = {};
|
|
711
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
712
|
-
const found = [];
|
|
713
|
-
const step = (i) => new Promise((resolve2, reject) => {
|
|
714
|
-
if (i === pathEnv.length)
|
|
715
|
-
return opt.all && found.length ? resolve2(found) : reject(getNotFoundError(cmd));
|
|
716
|
-
const ppRaw = pathEnv[i];
|
|
717
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
718
|
-
const pCmd = path2.join(pathPart, cmd);
|
|
719
|
-
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
720
|
-
resolve2(subStep(p, i, 0));
|
|
721
|
-
});
|
|
722
|
-
const subStep = (p, i, ii) => new Promise((resolve2, reject) => {
|
|
723
|
-
if (ii === pathExt.length)
|
|
724
|
-
return resolve2(step(i + 1));
|
|
725
|
-
const ext = pathExt[ii];
|
|
726
|
-
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
727
|
-
if (!er && is) {
|
|
728
|
-
if (opt.all)
|
|
729
|
-
found.push(p + ext);
|
|
730
|
-
else
|
|
731
|
-
return resolve2(p + ext);
|
|
732
|
-
}
|
|
733
|
-
return resolve2(subStep(p, i, ii + 1));
|
|
734
|
-
});
|
|
735
|
-
});
|
|
736
|
-
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
737
|
-
};
|
|
738
|
-
var whichSync = (cmd, opt) => {
|
|
739
|
-
opt = opt || {};
|
|
740
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
741
|
-
const found = [];
|
|
742
|
-
for (let i = 0; i < pathEnv.length; i++) {
|
|
743
|
-
const ppRaw = pathEnv[i];
|
|
744
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
745
|
-
const pCmd = path2.join(pathPart, cmd);
|
|
746
|
-
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
747
|
-
for (let j = 0; j < pathExt.length; j++) {
|
|
748
|
-
const cur = p + pathExt[j];
|
|
749
|
-
try {
|
|
750
|
-
const is = isexe.sync(cur, { pathExt: pathExtExe });
|
|
751
|
-
if (is) {
|
|
752
|
-
if (opt.all)
|
|
753
|
-
found.push(cur);
|
|
754
|
-
else
|
|
755
|
-
return cur;
|
|
756
|
-
}
|
|
757
|
-
} catch (ex) {
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
if (opt.all && found.length)
|
|
762
|
-
return found;
|
|
763
|
-
if (opt.nothrow)
|
|
764
|
-
return null;
|
|
765
|
-
throw getNotFoundError(cmd);
|
|
766
|
-
};
|
|
767
|
-
module.exports = which;
|
|
768
|
-
which.sync = whichSync;
|
|
769
|
-
}
|
|
770
|
-
});
|
|
771
|
-
|
|
772
|
-
// ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
|
|
773
|
-
var require_path_key = __commonJS({
|
|
774
|
-
"../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports, module) {
|
|
775
|
-
"use strict";
|
|
776
|
-
var pathKey = (options = {}) => {
|
|
777
|
-
const environment = options.env || process.env;
|
|
778
|
-
const platform = options.platform || process.platform;
|
|
779
|
-
if (platform !== "win32") {
|
|
780
|
-
return "PATH";
|
|
781
|
-
}
|
|
782
|
-
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
783
|
-
};
|
|
784
|
-
module.exports = pathKey;
|
|
785
|
-
module.exports.default = pathKey;
|
|
786
|
-
}
|
|
787
|
-
});
|
|
788
|
-
|
|
789
|
-
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
790
|
-
var require_resolveCommand = __commonJS({
|
|
791
|
-
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
|
|
792
|
-
"use strict";
|
|
793
|
-
var path2 = __require("path");
|
|
794
|
-
var which = require_which();
|
|
795
|
-
var getPathKey = require_path_key();
|
|
796
|
-
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
797
|
-
const env = parsed.options.env || process.env;
|
|
798
|
-
const cwd = process.cwd();
|
|
799
|
-
const hasCustomCwd = parsed.options.cwd != null;
|
|
800
|
-
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
|
801
|
-
if (shouldSwitchCwd) {
|
|
802
|
-
try {
|
|
803
|
-
process.chdir(parsed.options.cwd);
|
|
804
|
-
} catch (err) {
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
let resolved;
|
|
808
|
-
try {
|
|
809
|
-
resolved = which.sync(parsed.command, {
|
|
810
|
-
path: env[getPathKey({ env })],
|
|
811
|
-
pathExt: withoutPathExt ? path2.delimiter : void 0
|
|
812
|
-
});
|
|
813
|
-
} catch (e) {
|
|
814
|
-
} finally {
|
|
815
|
-
if (shouldSwitchCwd) {
|
|
816
|
-
process.chdir(cwd);
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
if (resolved) {
|
|
820
|
-
resolved = path2.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
821
|
-
}
|
|
822
|
-
return resolved;
|
|
823
|
-
}
|
|
824
|
-
function resolveCommand(parsed) {
|
|
825
|
-
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
826
|
-
}
|
|
827
|
-
module.exports = resolveCommand;
|
|
828
|
-
}
|
|
829
|
-
});
|
|
830
|
-
|
|
831
|
-
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
|
|
832
|
-
var require_escape = __commonJS({
|
|
833
|
-
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports, module) {
|
|
834
|
-
"use strict";
|
|
835
|
-
var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
836
|
-
function escapeCommand(arg) {
|
|
837
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
838
|
-
return arg;
|
|
839
|
-
}
|
|
840
|
-
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
841
|
-
arg = `${arg}`;
|
|
842
|
-
arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
|
|
843
|
-
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
844
|
-
arg = `"${arg}"`;
|
|
845
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
846
|
-
if (doubleEscapeMetaChars) {
|
|
847
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
848
|
-
}
|
|
849
|
-
return arg;
|
|
850
|
-
}
|
|
851
|
-
module.exports.command = escapeCommand;
|
|
852
|
-
module.exports.argument = escapeArgument;
|
|
853
|
-
}
|
|
854
|
-
});
|
|
855
|
-
|
|
856
|
-
// ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
|
|
857
|
-
var require_shebang_regex = __commonJS({
|
|
858
|
-
"../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports, module) {
|
|
859
|
-
"use strict";
|
|
860
|
-
module.exports = /^#!(.*)/;
|
|
861
|
-
}
|
|
862
|
-
});
|
|
863
|
-
|
|
864
|
-
// ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
|
|
865
|
-
var require_shebang_command = __commonJS({
|
|
866
|
-
"../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports, module) {
|
|
867
|
-
"use strict";
|
|
868
|
-
var shebangRegex = require_shebang_regex();
|
|
869
|
-
module.exports = (string = "") => {
|
|
870
|
-
const match = string.match(shebangRegex);
|
|
871
|
-
if (!match) {
|
|
872
|
-
return null;
|
|
873
|
-
}
|
|
874
|
-
const [path2, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
875
|
-
const binary = path2.split("/").pop();
|
|
876
|
-
if (binary === "env") {
|
|
877
|
-
return argument;
|
|
878
|
-
}
|
|
879
|
-
return argument ? `${binary} ${argument}` : binary;
|
|
880
|
-
};
|
|
881
|
-
}
|
|
882
|
-
});
|
|
883
|
-
|
|
884
|
-
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
|
|
885
|
-
var require_readShebang = __commonJS({
|
|
886
|
-
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
|
|
887
|
-
"use strict";
|
|
888
|
-
var fs = __require("fs");
|
|
889
|
-
var shebangCommand = require_shebang_command();
|
|
890
|
-
function readShebang(command) {
|
|
891
|
-
const size = 150;
|
|
892
|
-
const buffer = Buffer.alloc(size);
|
|
893
|
-
let fd;
|
|
894
|
-
try {
|
|
895
|
-
fd = fs.openSync(command, "r");
|
|
896
|
-
fs.readSync(fd, buffer, 0, size, 0);
|
|
897
|
-
fs.closeSync(fd);
|
|
898
|
-
} catch (e) {
|
|
899
|
-
}
|
|
900
|
-
return shebangCommand(buffer.toString());
|
|
901
|
-
}
|
|
902
|
-
module.exports = readShebang;
|
|
903
|
-
}
|
|
904
|
-
});
|
|
905
|
-
|
|
906
|
-
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
907
|
-
var require_parse2 = __commonJS({
|
|
908
|
-
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module) {
|
|
909
|
-
"use strict";
|
|
910
|
-
var path2 = __require("path");
|
|
911
|
-
var resolveCommand = require_resolveCommand();
|
|
912
|
-
var escape = require_escape();
|
|
913
|
-
var readShebang = require_readShebang();
|
|
914
|
-
var isWin = process.platform === "win32";
|
|
915
|
-
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
916
|
-
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
917
|
-
function detectShebang(parsed) {
|
|
918
|
-
parsed.file = resolveCommand(parsed);
|
|
919
|
-
const shebang = parsed.file && readShebang(parsed.file);
|
|
920
|
-
if (shebang) {
|
|
921
|
-
parsed.args.unshift(parsed.file);
|
|
922
|
-
parsed.command = shebang;
|
|
923
|
-
return resolveCommand(parsed);
|
|
924
|
-
}
|
|
925
|
-
return parsed.file;
|
|
926
|
-
}
|
|
927
|
-
function parseNonShell(parsed) {
|
|
928
|
-
if (!isWin) {
|
|
929
|
-
return parsed;
|
|
930
|
-
}
|
|
931
|
-
const commandFile = detectShebang(parsed);
|
|
932
|
-
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
933
|
-
if (parsed.options.forceShell || needsShell) {
|
|
934
|
-
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
935
|
-
parsed.command = path2.normalize(parsed.command);
|
|
936
|
-
parsed.command = escape.command(parsed.command);
|
|
937
|
-
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
938
|
-
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
939
|
-
parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
|
|
940
|
-
parsed.command = process.env.comspec || "cmd.exe";
|
|
941
|
-
parsed.options.windowsVerbatimArguments = true;
|
|
942
|
-
}
|
|
943
|
-
return parsed;
|
|
944
|
-
}
|
|
945
|
-
function parse(command, args, options) {
|
|
946
|
-
if (args && !Array.isArray(args)) {
|
|
947
|
-
options = args;
|
|
948
|
-
args = null;
|
|
949
|
-
}
|
|
950
|
-
args = args ? args.slice(0) : [];
|
|
951
|
-
options = Object.assign({}, options);
|
|
952
|
-
const parsed = {
|
|
953
|
-
command,
|
|
954
|
-
args,
|
|
955
|
-
options,
|
|
956
|
-
file: void 0,
|
|
957
|
-
original: {
|
|
958
|
-
command,
|
|
959
|
-
args
|
|
960
|
-
}
|
|
961
|
-
};
|
|
962
|
-
return options.shell ? parsed : parseNonShell(parsed);
|
|
963
|
-
}
|
|
964
|
-
module.exports = parse;
|
|
965
|
-
}
|
|
966
|
-
});
|
|
967
|
-
|
|
968
|
-
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
|
|
969
|
-
var require_enoent = __commonJS({
|
|
970
|
-
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports, module) {
|
|
971
|
-
"use strict";
|
|
972
|
-
var isWin = process.platform === "win32";
|
|
973
|
-
function notFoundError(original, syscall) {
|
|
974
|
-
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
|
975
|
-
code: "ENOENT",
|
|
976
|
-
errno: "ENOENT",
|
|
977
|
-
syscall: `${syscall} ${original.command}`,
|
|
978
|
-
path: original.command,
|
|
979
|
-
spawnargs: original.args
|
|
980
|
-
});
|
|
981
|
-
}
|
|
982
|
-
function hookChildProcess(cp, parsed) {
|
|
983
|
-
if (!isWin) {
|
|
984
|
-
return;
|
|
985
|
-
}
|
|
986
|
-
const originalEmit = cp.emit;
|
|
987
|
-
cp.emit = function(name, arg1) {
|
|
988
|
-
if (name === "exit") {
|
|
989
|
-
const err = verifyENOENT(arg1, parsed);
|
|
990
|
-
if (err) {
|
|
991
|
-
return originalEmit.call(cp, "error", err);
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
return originalEmit.apply(cp, arguments);
|
|
995
|
-
};
|
|
996
|
-
}
|
|
997
|
-
function verifyENOENT(status, parsed) {
|
|
998
|
-
if (isWin && status === 1 && !parsed.file) {
|
|
999
|
-
return notFoundError(parsed.original, "spawn");
|
|
1000
|
-
}
|
|
1001
|
-
return null;
|
|
1002
|
-
}
|
|
1003
|
-
function verifyENOENTSync(status, parsed) {
|
|
1004
|
-
if (isWin && status === 1 && !parsed.file) {
|
|
1005
|
-
return notFoundError(parsed.original, "spawnSync");
|
|
1006
|
-
}
|
|
1007
|
-
return null;
|
|
1008
|
-
}
|
|
1009
|
-
module.exports = {
|
|
1010
|
-
hookChildProcess,
|
|
1011
|
-
verifyENOENT,
|
|
1012
|
-
verifyENOENTSync,
|
|
1013
|
-
notFoundError
|
|
1014
|
-
};
|
|
1015
|
-
}
|
|
1016
|
-
});
|
|
1017
|
-
|
|
1018
|
-
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
|
|
1019
|
-
var require_cross_spawn = __commonJS({
|
|
1020
|
-
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports, module) {
|
|
1021
|
-
"use strict";
|
|
1022
|
-
var cp = __require("child_process");
|
|
1023
|
-
var parse = require_parse2();
|
|
1024
|
-
var enoent = require_enoent();
|
|
1025
|
-
function spawn(command, args, options) {
|
|
1026
|
-
const parsed = parse(command, args, options);
|
|
1027
|
-
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
1028
|
-
enoent.hookChildProcess(spawned, parsed);
|
|
1029
|
-
return spawned;
|
|
1030
|
-
}
|
|
1031
|
-
function spawnSync(command, args, options) {
|
|
1032
|
-
const parsed = parse(command, args, options);
|
|
1033
|
-
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
1034
|
-
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
1035
|
-
return result;
|
|
1036
|
-
}
|
|
1037
|
-
module.exports = spawn;
|
|
1038
|
-
module.exports.spawn = spawn;
|
|
1039
|
-
module.exports.sync = spawnSync;
|
|
1040
|
-
module.exports._parse = parse;
|
|
1041
|
-
module.exports._enoent = enoent;
|
|
1042
|
-
}
|
|
1043
|
-
});
|
|
1044
|
-
|
|
1045
542
|
// ../provider-bridge-protocol/src/bridge-kit/adapter-utils.ts
|
|
1046
543
|
import { z as z2 } from "zod";
|
|
1047
544
|
|
|
@@ -4552,7 +4049,8 @@ var BRIDGE_JSON_RPC_ERRORS = {
|
|
|
4552
4049
|
BRIDGE_ERROR: -32e3,
|
|
4553
4050
|
NO_ACTIVE_TURN: -32001,
|
|
4554
4051
|
SESSION_NOT_RESTORABLE: -32002,
|
|
4555
|
-
FORK_CHECKPOINT_UNSUPPORTED: -32003
|
|
4052
|
+
FORK_CHECKPOINT_UNSUPPORTED: -32003,
|
|
4053
|
+
MISSING_EXECUTABLE: -32004
|
|
4556
4054
|
};
|
|
4557
4055
|
var providerRecoveryHintSchema = z26.object({
|
|
4558
4056
|
kind: providerRecoveryKindSchema,
|
|
@@ -5208,7 +4706,7 @@ var threadDeltaNotificationParamsSchema = z33.object({
|
|
|
5208
4706
|
}).passthrough();
|
|
5209
4707
|
|
|
5210
4708
|
// ../process-utils/src/index.ts
|
|
5211
|
-
|
|
4709
|
+
import crossSpawn from "cross-spawn";
|
|
5212
4710
|
function sanitizeInheritedChildProcessEnv(args) {
|
|
5213
4711
|
const sanitizedEnv = {};
|
|
5214
4712
|
for (const [key, value] of Object.entries(args.env)) {
|
package/dist/testing/app.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/testing/app.tsx
|
|
2
|
+
import * as React from "react";
|
|
2
3
|
import {
|
|
3
4
|
createContext,
|
|
4
5
|
useContext,
|
|
@@ -1574,6 +1575,12 @@ var testPluginSdkApp = {
|
|
|
1574
1575
|
useBbContext() {
|
|
1575
1576
|
return useSlotEnv("useBbContext").bbContext;
|
|
1576
1577
|
},
|
|
1578
|
+
experimental_usePluginId() {
|
|
1579
|
+
return useSlotEnv("experimental_usePluginId").pluginId;
|
|
1580
|
+
},
|
|
1581
|
+
experimental_useQuestionFormHost() {
|
|
1582
|
+
return useSlotEnv("experimental_useQuestionFormHost").questionFormHost;
|
|
1583
|
+
},
|
|
1577
1584
|
useBbNavigate() {
|
|
1578
1585
|
return useSlotEnv("useBbNavigate").navigate;
|
|
1579
1586
|
},
|
|
@@ -1768,6 +1775,7 @@ function installTestPluginRuntime() {
|
|
|
1768
1775
|
const host = globalThis;
|
|
1769
1776
|
host.__bbPluginRuntime = {
|
|
1770
1777
|
...host.__bbPluginRuntime,
|
|
1778
|
+
react: host.__bbPluginRuntime?.react ?? React,
|
|
1771
1779
|
pluginSdkApp: testPluginSdkApp
|
|
1772
1780
|
};
|
|
1773
1781
|
}
|
|
@@ -1914,6 +1922,7 @@ function strictJsonRoundTrip(value, label) {
|
|
|
1914
1922
|
return JSON.parse(JSON.stringify(value));
|
|
1915
1923
|
}
|
|
1916
1924
|
function renderSlot(registration, props, options = {}) {
|
|
1925
|
+
installTestPluginRuntime();
|
|
1917
1926
|
const rpcCalls = [];
|
|
1918
1927
|
const rpcHandlers = options.rpc ?? {};
|
|
1919
1928
|
const rpcClient = {
|
|
@@ -2303,6 +2312,12 @@ ${block}
|
|
|
2303
2312
|
realtimeConnection,
|
|
2304
2313
|
settingsState: { values: options.settings, isLoading: false },
|
|
2305
2314
|
bbContext: { projectId, threadId },
|
|
2315
|
+
pluginId: options.pluginId ?? "test-plugin",
|
|
2316
|
+
questionFormHost: {
|
|
2317
|
+
shortcuts: /* @__PURE__ */ new Map(),
|
|
2318
|
+
registerChoiceHandler: () => () => {
|
|
2319
|
+
}
|
|
2320
|
+
},
|
|
2306
2321
|
navigate,
|
|
2307
2322
|
navigateCalls,
|
|
2308
2323
|
appPanel,
|