@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
package/dist/host.js
CHANGED
|
@@ -1,536 +1,3 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
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() {
|
|
14
|
-
try {
|
|
15
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
16
|
-
} catch (e) {
|
|
17
|
-
throw mod = 0, e;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
var __copyProps = (to, from, except, desc) => {
|
|
21
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
-
for (let key of __getOwnPropNames(from))
|
|
23
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
-
}
|
|
26
|
-
return to;
|
|
27
|
-
};
|
|
28
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
-
mod
|
|
35
|
-
));
|
|
36
|
-
|
|
37
|
-
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
|
|
38
|
-
var require_windows = __commonJS({
|
|
39
|
-
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module) {
|
|
40
|
-
module.exports = isexe;
|
|
41
|
-
isexe.sync = sync;
|
|
42
|
-
var fs2 = __require("fs");
|
|
43
|
-
function checkPathExt(path2, options) {
|
|
44
|
-
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
45
|
-
if (!pathext) {
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
pathext = pathext.split(";");
|
|
49
|
-
if (pathext.indexOf("") !== -1) {
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
for (var i = 0; i < pathext.length; i++) {
|
|
53
|
-
var p = pathext[i].toLowerCase();
|
|
54
|
-
if (p && path2.substr(-p.length).toLowerCase() === p) {
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
function checkStat(stat, path2, options) {
|
|
61
|
-
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
return checkPathExt(path2, options);
|
|
65
|
-
}
|
|
66
|
-
function isexe(path2, options, cb) {
|
|
67
|
-
fs2.stat(path2, function(er, stat) {
|
|
68
|
-
cb(er, er ? false : checkStat(stat, path2, options));
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
function sync(path2, options) {
|
|
72
|
-
return checkStat(fs2.statSync(path2), path2, options);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
|
|
78
|
-
var require_mode = __commonJS({
|
|
79
|
-
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module) {
|
|
80
|
-
module.exports = isexe;
|
|
81
|
-
isexe.sync = sync;
|
|
82
|
-
var fs2 = __require("fs");
|
|
83
|
-
function isexe(path2, options, cb) {
|
|
84
|
-
fs2.stat(path2, function(er, stat) {
|
|
85
|
-
cb(er, er ? false : checkStat(stat, options));
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
function sync(path2, options) {
|
|
89
|
-
return checkStat(fs2.statSync(path2), options);
|
|
90
|
-
}
|
|
91
|
-
function checkStat(stat, options) {
|
|
92
|
-
return stat.isFile() && checkMode(stat, options);
|
|
93
|
-
}
|
|
94
|
-
function checkMode(stat, options) {
|
|
95
|
-
var mod = stat.mode;
|
|
96
|
-
var uid = stat.uid;
|
|
97
|
-
var gid = stat.gid;
|
|
98
|
-
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
99
|
-
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
100
|
-
var u = parseInt("100", 8);
|
|
101
|
-
var g = parseInt("010", 8);
|
|
102
|
-
var o = parseInt("001", 8);
|
|
103
|
-
var ug = u | g;
|
|
104
|
-
var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
105
|
-
return ret;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
111
|
-
var require_isexe = __commonJS({
|
|
112
|
-
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module) {
|
|
113
|
-
var fs2 = __require("fs");
|
|
114
|
-
var core;
|
|
115
|
-
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
116
|
-
core = require_windows();
|
|
117
|
-
} else {
|
|
118
|
-
core = require_mode();
|
|
119
|
-
}
|
|
120
|
-
module.exports = isexe;
|
|
121
|
-
isexe.sync = sync;
|
|
122
|
-
function isexe(path2, options, cb) {
|
|
123
|
-
if (typeof options === "function") {
|
|
124
|
-
cb = options;
|
|
125
|
-
options = {};
|
|
126
|
-
}
|
|
127
|
-
if (!cb) {
|
|
128
|
-
if (typeof Promise !== "function") {
|
|
129
|
-
throw new TypeError("callback not provided");
|
|
130
|
-
}
|
|
131
|
-
return new Promise(function(resolve2, reject) {
|
|
132
|
-
isexe(path2, options || {}, function(er, is) {
|
|
133
|
-
if (er) {
|
|
134
|
-
reject(er);
|
|
135
|
-
} else {
|
|
136
|
-
resolve2(is);
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
core(path2, options || {}, function(er, is) {
|
|
142
|
-
if (er) {
|
|
143
|
-
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
144
|
-
er = null;
|
|
145
|
-
is = false;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
cb(er, is);
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
function sync(path2, options) {
|
|
152
|
-
try {
|
|
153
|
-
return core.sync(path2, options || {});
|
|
154
|
-
} catch (er) {
|
|
155
|
-
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
156
|
-
return false;
|
|
157
|
-
} else {
|
|
158
|
-
throw er;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
// ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
166
|
-
var require_which = __commonJS({
|
|
167
|
-
"../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module) {
|
|
168
|
-
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
169
|
-
var path2 = __require("path");
|
|
170
|
-
var COLON = isWindows ? ";" : ":";
|
|
171
|
-
var isexe = require_isexe();
|
|
172
|
-
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
173
|
-
var getPathInfo = (cmd, opt) => {
|
|
174
|
-
const colon = opt.colon || COLON;
|
|
175
|
-
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
|
|
176
|
-
// windows always checks the cwd first
|
|
177
|
-
...isWindows ? [process.cwd()] : [],
|
|
178
|
-
...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
|
|
179
|
-
"").split(colon)
|
|
180
|
-
];
|
|
181
|
-
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
182
|
-
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
183
|
-
if (isWindows) {
|
|
184
|
-
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
|
|
185
|
-
pathExt.unshift("");
|
|
186
|
-
}
|
|
187
|
-
return {
|
|
188
|
-
pathEnv,
|
|
189
|
-
pathExt,
|
|
190
|
-
pathExtExe
|
|
191
|
-
};
|
|
192
|
-
};
|
|
193
|
-
var which = (cmd, opt, cb) => {
|
|
194
|
-
if (typeof opt === "function") {
|
|
195
|
-
cb = opt;
|
|
196
|
-
opt = {};
|
|
197
|
-
}
|
|
198
|
-
if (!opt)
|
|
199
|
-
opt = {};
|
|
200
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
201
|
-
const found = [];
|
|
202
|
-
const step = (i) => new Promise((resolve2, reject) => {
|
|
203
|
-
if (i === pathEnv.length)
|
|
204
|
-
return opt.all && found.length ? resolve2(found) : reject(getNotFoundError(cmd));
|
|
205
|
-
const ppRaw = pathEnv[i];
|
|
206
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
207
|
-
const pCmd = path2.join(pathPart, cmd);
|
|
208
|
-
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
209
|
-
resolve2(subStep(p, i, 0));
|
|
210
|
-
});
|
|
211
|
-
const subStep = (p, i, ii) => new Promise((resolve2, reject) => {
|
|
212
|
-
if (ii === pathExt.length)
|
|
213
|
-
return resolve2(step(i + 1));
|
|
214
|
-
const ext = pathExt[ii];
|
|
215
|
-
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
216
|
-
if (!er && is) {
|
|
217
|
-
if (opt.all)
|
|
218
|
-
found.push(p + ext);
|
|
219
|
-
else
|
|
220
|
-
return resolve2(p + ext);
|
|
221
|
-
}
|
|
222
|
-
return resolve2(subStep(p, i, ii + 1));
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
226
|
-
};
|
|
227
|
-
var whichSync = (cmd, opt) => {
|
|
228
|
-
opt = opt || {};
|
|
229
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
230
|
-
const found = [];
|
|
231
|
-
for (let i = 0; i < pathEnv.length; i++) {
|
|
232
|
-
const ppRaw = pathEnv[i];
|
|
233
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
234
|
-
const pCmd = path2.join(pathPart, cmd);
|
|
235
|
-
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
236
|
-
for (let j = 0; j < pathExt.length; j++) {
|
|
237
|
-
const cur = p + pathExt[j];
|
|
238
|
-
try {
|
|
239
|
-
const is = isexe.sync(cur, { pathExt: pathExtExe });
|
|
240
|
-
if (is) {
|
|
241
|
-
if (opt.all)
|
|
242
|
-
found.push(cur);
|
|
243
|
-
else
|
|
244
|
-
return cur;
|
|
245
|
-
}
|
|
246
|
-
} catch (ex) {
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
if (opt.all && found.length)
|
|
251
|
-
return found;
|
|
252
|
-
if (opt.nothrow)
|
|
253
|
-
return null;
|
|
254
|
-
throw getNotFoundError(cmd);
|
|
255
|
-
};
|
|
256
|
-
module.exports = which;
|
|
257
|
-
which.sync = whichSync;
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
// ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
|
|
262
|
-
var require_path_key = __commonJS({
|
|
263
|
-
"../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports, module) {
|
|
264
|
-
"use strict";
|
|
265
|
-
var pathKey = (options = {}) => {
|
|
266
|
-
const environment = options.env || process.env;
|
|
267
|
-
const platform = options.platform || process.platform;
|
|
268
|
-
if (platform !== "win32") {
|
|
269
|
-
return "PATH";
|
|
270
|
-
}
|
|
271
|
-
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
272
|
-
};
|
|
273
|
-
module.exports = pathKey;
|
|
274
|
-
module.exports.default = pathKey;
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
279
|
-
var require_resolveCommand = __commonJS({
|
|
280
|
-
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
|
|
281
|
-
"use strict";
|
|
282
|
-
var path2 = __require("path");
|
|
283
|
-
var which = require_which();
|
|
284
|
-
var getPathKey = require_path_key();
|
|
285
|
-
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
286
|
-
const env = parsed.options.env || process.env;
|
|
287
|
-
const cwd = process.cwd();
|
|
288
|
-
const hasCustomCwd = parsed.options.cwd != null;
|
|
289
|
-
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
|
290
|
-
if (shouldSwitchCwd) {
|
|
291
|
-
try {
|
|
292
|
-
process.chdir(parsed.options.cwd);
|
|
293
|
-
} catch (err) {
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
let resolved;
|
|
297
|
-
try {
|
|
298
|
-
resolved = which.sync(parsed.command, {
|
|
299
|
-
path: env[getPathKey({ env })],
|
|
300
|
-
pathExt: withoutPathExt ? path2.delimiter : void 0
|
|
301
|
-
});
|
|
302
|
-
} catch (e) {
|
|
303
|
-
} finally {
|
|
304
|
-
if (shouldSwitchCwd) {
|
|
305
|
-
process.chdir(cwd);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
if (resolved) {
|
|
309
|
-
resolved = path2.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
310
|
-
}
|
|
311
|
-
return resolved;
|
|
312
|
-
}
|
|
313
|
-
function resolveCommand(parsed) {
|
|
314
|
-
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
315
|
-
}
|
|
316
|
-
module.exports = resolveCommand;
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
|
|
321
|
-
var require_escape = __commonJS({
|
|
322
|
-
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports, module) {
|
|
323
|
-
"use strict";
|
|
324
|
-
var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
325
|
-
function escapeCommand(arg) {
|
|
326
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
327
|
-
return arg;
|
|
328
|
-
}
|
|
329
|
-
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
330
|
-
arg = `${arg}`;
|
|
331
|
-
arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
|
|
332
|
-
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
333
|
-
arg = `"${arg}"`;
|
|
334
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
335
|
-
if (doubleEscapeMetaChars) {
|
|
336
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
337
|
-
}
|
|
338
|
-
return arg;
|
|
339
|
-
}
|
|
340
|
-
module.exports.command = escapeCommand;
|
|
341
|
-
module.exports.argument = escapeArgument;
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
// ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
|
|
346
|
-
var require_shebang_regex = __commonJS({
|
|
347
|
-
"../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports, module) {
|
|
348
|
-
"use strict";
|
|
349
|
-
module.exports = /^#!(.*)/;
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
// ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
|
|
354
|
-
var require_shebang_command = __commonJS({
|
|
355
|
-
"../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports, module) {
|
|
356
|
-
"use strict";
|
|
357
|
-
var shebangRegex = require_shebang_regex();
|
|
358
|
-
module.exports = (string = "") => {
|
|
359
|
-
const match = string.match(shebangRegex);
|
|
360
|
-
if (!match) {
|
|
361
|
-
return null;
|
|
362
|
-
}
|
|
363
|
-
const [path2, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
364
|
-
const binary = path2.split("/").pop();
|
|
365
|
-
if (binary === "env") {
|
|
366
|
-
return argument;
|
|
367
|
-
}
|
|
368
|
-
return argument ? `${binary} ${argument}` : binary;
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
|
|
374
|
-
var require_readShebang = __commonJS({
|
|
375
|
-
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
|
|
376
|
-
"use strict";
|
|
377
|
-
var fs2 = __require("fs");
|
|
378
|
-
var shebangCommand = require_shebang_command();
|
|
379
|
-
function readShebang(command) {
|
|
380
|
-
const size = 150;
|
|
381
|
-
const buffer = Buffer.alloc(size);
|
|
382
|
-
let fd;
|
|
383
|
-
try {
|
|
384
|
-
fd = fs2.openSync(command, "r");
|
|
385
|
-
fs2.readSync(fd, buffer, 0, size, 0);
|
|
386
|
-
fs2.closeSync(fd);
|
|
387
|
-
} catch (e) {
|
|
388
|
-
}
|
|
389
|
-
return shebangCommand(buffer.toString());
|
|
390
|
-
}
|
|
391
|
-
module.exports = readShebang;
|
|
392
|
-
}
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
396
|
-
var require_parse = __commonJS({
|
|
397
|
-
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module) {
|
|
398
|
-
"use strict";
|
|
399
|
-
var path2 = __require("path");
|
|
400
|
-
var resolveCommand = require_resolveCommand();
|
|
401
|
-
var escape = require_escape();
|
|
402
|
-
var readShebang = require_readShebang();
|
|
403
|
-
var isWin = process.platform === "win32";
|
|
404
|
-
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
405
|
-
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
406
|
-
function detectShebang(parsed) {
|
|
407
|
-
parsed.file = resolveCommand(parsed);
|
|
408
|
-
const shebang = parsed.file && readShebang(parsed.file);
|
|
409
|
-
if (shebang) {
|
|
410
|
-
parsed.args.unshift(parsed.file);
|
|
411
|
-
parsed.command = shebang;
|
|
412
|
-
return resolveCommand(parsed);
|
|
413
|
-
}
|
|
414
|
-
return parsed.file;
|
|
415
|
-
}
|
|
416
|
-
function parseNonShell(parsed) {
|
|
417
|
-
if (!isWin) {
|
|
418
|
-
return parsed;
|
|
419
|
-
}
|
|
420
|
-
const commandFile = detectShebang(parsed);
|
|
421
|
-
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
422
|
-
if (parsed.options.forceShell || needsShell) {
|
|
423
|
-
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
424
|
-
parsed.command = path2.normalize(parsed.command);
|
|
425
|
-
parsed.command = escape.command(parsed.command);
|
|
426
|
-
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
427
|
-
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
428
|
-
parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
|
|
429
|
-
parsed.command = process.env.comspec || "cmd.exe";
|
|
430
|
-
parsed.options.windowsVerbatimArguments = true;
|
|
431
|
-
}
|
|
432
|
-
return parsed;
|
|
433
|
-
}
|
|
434
|
-
function parse(command, args, options) {
|
|
435
|
-
if (args && !Array.isArray(args)) {
|
|
436
|
-
options = args;
|
|
437
|
-
args = null;
|
|
438
|
-
}
|
|
439
|
-
args = args ? args.slice(0) : [];
|
|
440
|
-
options = Object.assign({}, options);
|
|
441
|
-
const parsed = {
|
|
442
|
-
command,
|
|
443
|
-
args,
|
|
444
|
-
options,
|
|
445
|
-
file: void 0,
|
|
446
|
-
original: {
|
|
447
|
-
command,
|
|
448
|
-
args
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
return options.shell ? parsed : parseNonShell(parsed);
|
|
452
|
-
}
|
|
453
|
-
module.exports = parse;
|
|
454
|
-
}
|
|
455
|
-
});
|
|
456
|
-
|
|
457
|
-
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
|
|
458
|
-
var require_enoent = __commonJS({
|
|
459
|
-
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports, module) {
|
|
460
|
-
"use strict";
|
|
461
|
-
var isWin = process.platform === "win32";
|
|
462
|
-
function notFoundError(original, syscall) {
|
|
463
|
-
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
|
464
|
-
code: "ENOENT",
|
|
465
|
-
errno: "ENOENT",
|
|
466
|
-
syscall: `${syscall} ${original.command}`,
|
|
467
|
-
path: original.command,
|
|
468
|
-
spawnargs: original.args
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
function hookChildProcess(cp, parsed) {
|
|
472
|
-
if (!isWin) {
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
475
|
-
const originalEmit = cp.emit;
|
|
476
|
-
cp.emit = function(name, arg1) {
|
|
477
|
-
if (name === "exit") {
|
|
478
|
-
const err = verifyENOENT(arg1, parsed);
|
|
479
|
-
if (err) {
|
|
480
|
-
return originalEmit.call(cp, "error", err);
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
return originalEmit.apply(cp, arguments);
|
|
484
|
-
};
|
|
485
|
-
}
|
|
486
|
-
function verifyENOENT(status, parsed) {
|
|
487
|
-
if (isWin && status === 1 && !parsed.file) {
|
|
488
|
-
return notFoundError(parsed.original, "spawn");
|
|
489
|
-
}
|
|
490
|
-
return null;
|
|
491
|
-
}
|
|
492
|
-
function verifyENOENTSync(status, parsed) {
|
|
493
|
-
if (isWin && status === 1 && !parsed.file) {
|
|
494
|
-
return notFoundError(parsed.original, "spawnSync");
|
|
495
|
-
}
|
|
496
|
-
return null;
|
|
497
|
-
}
|
|
498
|
-
module.exports = {
|
|
499
|
-
hookChildProcess,
|
|
500
|
-
verifyENOENT,
|
|
501
|
-
verifyENOENTSync,
|
|
502
|
-
notFoundError
|
|
503
|
-
};
|
|
504
|
-
}
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
|
|
508
|
-
var require_cross_spawn = __commonJS({
|
|
509
|
-
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports, module) {
|
|
510
|
-
"use strict";
|
|
511
|
-
var cp = __require("child_process");
|
|
512
|
-
var parse = require_parse();
|
|
513
|
-
var enoent = require_enoent();
|
|
514
|
-
function spawn(command, args, options) {
|
|
515
|
-
const parsed = parse(command, args, options);
|
|
516
|
-
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
517
|
-
enoent.hookChildProcess(spawned, parsed);
|
|
518
|
-
return spawned;
|
|
519
|
-
}
|
|
520
|
-
function spawnSync(command, args, options) {
|
|
521
|
-
const parsed = parse(command, args, options);
|
|
522
|
-
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
523
|
-
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
524
|
-
return result;
|
|
525
|
-
}
|
|
526
|
-
module.exports = spawn;
|
|
527
|
-
module.exports.spawn = spawn;
|
|
528
|
-
module.exports.sync = spawnSync;
|
|
529
|
-
module.exports._parse = parse;
|
|
530
|
-
module.exports._enoent = enoent;
|
|
531
|
-
}
|
|
532
|
-
});
|
|
533
|
-
|
|
534
1
|
// src/host-contract.ts
|
|
535
2
|
function experimental_defineHostEntry(args) {
|
|
536
3
|
return {
|
|
@@ -1314,7 +781,6 @@ async function experimental_resolveClaudePluginRoots(args) {
|
|
|
1314
781
|
}
|
|
1315
782
|
|
|
1316
783
|
// ../process-utils/src/index.ts
|
|
1317
|
-
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
1318
784
|
import { access, lstat, readdir, readlink, realpath } from "node:fs/promises";
|
|
1319
785
|
import {
|
|
1320
786
|
basename,
|
|
@@ -1325,8 +791,9 @@ import {
|
|
|
1325
791
|
resolve,
|
|
1326
792
|
sep
|
|
1327
793
|
} from "node:path";
|
|
794
|
+
import crossSpawn from "cross-spawn";
|
|
1328
795
|
function spawnPortableProcess(request) {
|
|
1329
|
-
return (
|
|
796
|
+
return crossSpawn(request.command, request.args, {
|
|
1330
797
|
cwd: request.cwd,
|
|
1331
798
|
detached: request.detached,
|
|
1332
799
|
env: request.env,
|
|
@@ -1082,48 +1082,17 @@ function validateProviderFallbackModels(providerId, value) {
|
|
|
1082
1082
|
}
|
|
1083
1083
|
return Object.freeze(normalized);
|
|
1084
1084
|
}
|
|
1085
|
-
var
|
|
1086
|
-
|
|
1087
|
-
"
|
|
1088
|
-
"amazon-bedrock",
|
|
1089
|
-
"ant-ling",
|
|
1090
|
-
"anthropic",
|
|
1091
|
-
"azure-openai-responses",
|
|
1092
|
-
"baseten",
|
|
1093
|
-
"cerebras",
|
|
1094
|
-
"cloudflare-ai-gateway",
|
|
1095
|
-
"cloudflare-workers-ai",
|
|
1096
|
-
"deepseek",
|
|
1097
|
-
"fireworks",
|
|
1098
|
-
"github-copilot",
|
|
1099
|
-
"google",
|
|
1100
|
-
"google-vertex",
|
|
1101
|
-
"groq",
|
|
1102
|
-
"huggingface",
|
|
1103
|
-
"kimi-coding",
|
|
1104
|
-
"minimax",
|
|
1105
|
-
"minimax-cn",
|
|
1106
|
-
"mistral",
|
|
1107
|
-
"moonshotai",
|
|
1108
|
-
"moonshotai-cn",
|
|
1109
|
-
"nvidia",
|
|
1110
|
-
"openai-codex",
|
|
1111
|
-
"opencode",
|
|
1112
|
-
"opencode-go",
|
|
1113
|
-
"openrouter",
|
|
1114
|
-
"qwen-token-plan",
|
|
1115
|
-
"qwen-token-plan-cn",
|
|
1116
|
-
"radius",
|
|
1117
|
-
"together",
|
|
1118
|
-
"vercel-ai-gateway",
|
|
1119
|
-
"xai",
|
|
1120
|
-
"xiaomi",
|
|
1121
|
-
"xiaomi-token-plan-ams",
|
|
1122
|
-
"xiaomi-token-plan-cn",
|
|
1123
|
-
"xiaomi-token-plan-sgp",
|
|
1124
|
-
"zai",
|
|
1125
|
-
"zai-coding-cn"
|
|
1085
|
+
var RESERVED_AI_SERVICE_IDS = /* @__PURE__ */ new Set([
|
|
1086
|
+
"automatic",
|
|
1087
|
+
"off"
|
|
1126
1088
|
]);
|
|
1089
|
+
function optionalAiServiceFunction(id, name, value) {
|
|
1090
|
+
if (value === void 0) return null;
|
|
1091
|
+
if (typeof value !== "function") {
|
|
1092
|
+
throw new Error(`AI service "${id}" ${name} must be a function`);
|
|
1093
|
+
}
|
|
1094
|
+
return value;
|
|
1095
|
+
}
|
|
1127
1096
|
function validatePluginAiServiceDeclaration(declaration) {
|
|
1128
1097
|
if (typeof declaration !== "object" || declaration === null) {
|
|
1129
1098
|
throw new Error("AI service declaration must be an object");
|
|
@@ -1134,50 +1103,35 @@ function validatePluginAiServiceDeclaration(declaration) {
|
|
|
1134
1103
|
`invalid AI service id ${JSON.stringify(id)} \u2014 use 2-64 lowercase letters, digits, and "-", starting with a letter or digit`
|
|
1135
1104
|
);
|
|
1136
1105
|
}
|
|
1106
|
+
if (RESERVED_AI_SERVICE_IDS.has(id)) {
|
|
1107
|
+
throw new Error(
|
|
1108
|
+
`AI service id "${id}" is reserved: bb uses "automatic" and "off" as selection modes. Choose another id.`
|
|
1109
|
+
);
|
|
1110
|
+
}
|
|
1137
1111
|
const displayName = typeof declaration.displayName === "string" ? declaration.displayName.trim() : "";
|
|
1138
1112
|
if (displayName.length === 0 || displayName.length > 64) {
|
|
1139
1113
|
throw new Error(`AI service "${id}" displayName must be 1-64 characters`);
|
|
1140
1114
|
}
|
|
1141
|
-
const
|
|
1142
|
-
if (!Array.isArray(kinds) || kinds.length === 0) {
|
|
1143
|
-
throw new Error(`AI service "${id}" must declare at least one kind`);
|
|
1144
|
-
}
|
|
1145
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1146
|
-
for (const kind of kinds) {
|
|
1147
|
-
if (typeof kind !== "string" || !AI_SERVICE_KINDS.has(kind)) {
|
|
1148
|
-
throw new Error(
|
|
1149
|
-
`AI service "${id}" kind ${JSON.stringify(kind)} is not one of: ${[...AI_SERVICE_KINDS].join(", ")}`
|
|
1150
|
-
);
|
|
1151
|
-
}
|
|
1152
|
-
if (seen.has(kind)) {
|
|
1153
|
-
throw new Error(`AI service "${id}" declares kind "${kind}" twice`);
|
|
1154
|
-
}
|
|
1155
|
-
seen.add(kind);
|
|
1156
|
-
}
|
|
1157
|
-
return Object.freeze({
|
|
1115
|
+
const complete = optionalAiServiceFunction(
|
|
1158
1116
|
id,
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1117
|
+
"complete",
|
|
1118
|
+
declaration.complete
|
|
1119
|
+
);
|
|
1120
|
+
const transcribe = optionalAiServiceFunction(
|
|
1121
|
+
id,
|
|
1122
|
+
"transcribe",
|
|
1123
|
+
declaration.transcribe
|
|
1124
|
+
);
|
|
1125
|
+
const status = optionalAiServiceFunction(id, "status", declaration.status);
|
|
1126
|
+
if (complete === null && transcribe === null) {
|
|
1165
1127
|
throw new Error(
|
|
1166
|
-
`AI service
|
|
1128
|
+
`AI service "${id}" must declare complete, transcribe, or both`
|
|
1167
1129
|
);
|
|
1168
1130
|
}
|
|
1169
|
-
|
|
1170
|
-
return { artifact: args.hostArtifact, problem: null };
|
|
1171
|
-
}
|
|
1172
|
-
if (args.hostArtifactProblem !== null) {
|
|
1173
|
-
return { artifact: null, problem: args.hostArtifactProblem };
|
|
1174
|
-
}
|
|
1175
|
-
throw new Error(
|
|
1176
|
-
`AI service "${args.id}" needs a bb.host entry to run on: this plugin declares none`
|
|
1177
|
-
);
|
|
1131
|
+
return Object.freeze({ id, displayName, complete, transcribe, status });
|
|
1178
1132
|
}
|
|
1179
1133
|
function aiServiceAlreadyRegisteredMessage(id) {
|
|
1180
|
-
return `AI service "${id}" is already registered
|
|
1134
|
+
return `AI service "${id}" is already registered by this plugin.`;
|
|
1181
1135
|
}
|
|
1182
1136
|
function providerAlreadyRegisteredMessage(id) {
|
|
1183
1137
|
return `Provider "${id}" is already registered; a plugin cannot shadow an existing provider.`;
|
|
@@ -2799,11 +2753,9 @@ export {
|
|
|
2799
2753
|
PROVIDER_ID_PATTERN,
|
|
2800
2754
|
RESERVED_AGENT_TOOL_NAMES,
|
|
2801
2755
|
RESERVED_BB_CLI_COMMANDS,
|
|
2802
|
-
SERVER_DIRECT_AI_SERVICE_IDS,
|
|
2803
2756
|
SETTING_KEY_PATTERN,
|
|
2804
2757
|
adoptHttpRouteResponse,
|
|
2805
2758
|
aiServiceAlreadyRegisteredMessage,
|
|
2806
|
-
assertAiServiceRegistrable,
|
|
2807
2759
|
coerceStoredPluginSettingValue,
|
|
2808
2760
|
deriveValidatedProviderOptions,
|
|
2809
2761
|
enforcePluginCliOutputLimit,
|