bnpanel 0.6.0 โ 0.6.2
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/assets/icons/biuart.svg +7 -0
- package/client.js +11 -10
- package/index.js +84 -39
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256">
|
|
2
|
+
<rect width="256" height="256" rx="56" fill="#10181b"/>
|
|
3
|
+
<rect x="16" y="16" width="224" height="224" rx="44" fill="none" stroke="#d8a24a" stroke-width="8"/>
|
|
4
|
+
<path d="M70 170c22-38 34-62 44-62 12 0 8 34 22 34 12 0 18-20 30-44" fill="none" stroke="#d8a24a" stroke-width="10" stroke-linecap="round"/>
|
|
5
|
+
<circle cx="176" cy="82" r="10" fill="#e8d9bd"/>
|
|
6
|
+
<path d="M82 190c24-8 50-8 78 0" fill="none" stroke="#e8d9bd" stroke-width="7" stroke-linecap="round" opacity=".7"/>
|
|
7
|
+
</svg>
|
package/client.js
CHANGED
|
@@ -868,8 +868,8 @@
|
|
|
868
868
|
};
|
|
869
869
|
|
|
870
870
|
const promptsOn = !!(state && state.showcase && state.showcase.promptsEnabled);
|
|
871
|
-
const AGENT_ORDER = ['biureel', 'biuremtion', 'biuvibe', 'biutalk'];
|
|
872
|
-
const AGENT_FALLBACK = { biureel: 'BiuReel', biuremtion: 'BiuRemo', biuvibe: 'BiuVibe', biutalk: 'BiuTalk' };
|
|
871
|
+
const AGENT_ORDER = ['biureel', 'biuremtion', 'biuvibe', 'biuart', 'biutalk'];
|
|
872
|
+
const AGENT_FALLBACK = { biureel: 'BiuReel', biuremtion: 'BiuRemo', biuvibe: 'BiuVibe', biuart: 'BiuArt', biutalk: 'BiuTalk' };
|
|
873
873
|
const agentName = (slug) => {
|
|
874
874
|
const hit = ((state && state.store) || []).find((item) => item.slug === slug);
|
|
875
875
|
if (hit && hit.name) return hit.name;
|
|
@@ -1125,8 +1125,12 @@
|
|
|
1125
1125
|
const campaigns = state.license && state.license.canExport ? [] : (state.campaigns || []);
|
|
1126
1126
|
const camp = campaigns.length ? campaigns[((campIdx % campaigns.length) + campaigns.length) % campaigns.length] : null;
|
|
1127
1127
|
const campIcons = { spark: 'โจ', gift: '๐', rocket: '๐', crown: '๐', star: 'โญ', bolt: 'โก', box: '๐ฆ', heart: '๐', fire: '๐ฅ', gem: '๐', party: '๐', tag: '๐ท๏ธ' };
|
|
1128
|
-
const campHref = camp
|
|
1129
|
-
?
|
|
1128
|
+
const campHref = camp
|
|
1129
|
+
? camp.kind === 'link'
|
|
1130
|
+
? String(camp.linkUrl || '')
|
|
1131
|
+
: state.buyUrl
|
|
1132
|
+
? state.buyUrl + (String(state.buyUrl).indexOf('?') >= 0 ? '&' : '?') + 'c=' + encodeURIComponent(camp.slug)
|
|
1133
|
+
: ''
|
|
1130
1134
|
: '';
|
|
1131
1135
|
|
|
1132
1136
|
return h('div', { className: 'bn-root' },
|
|
@@ -1150,8 +1154,8 @@
|
|
|
1150
1154
|
h('div', { className: 'bn-campaign-name' }, camp.name),
|
|
1151
1155
|
h('div', { className: 'bn-campaign-desc' }, camp.description || ''),
|
|
1152
1156
|
h('div', { className: 'bn-campaign-foot' },
|
|
1153
|
-
h('div', { className: 'bn-campaign-price' }, 'ยฅ' + camp.price),
|
|
1154
|
-
campHref ? h('a', { className: 'bn-campaign-go', href: campHref, target: '_blank', rel: 'noreferrer' }, 'ๅป็่ฏฆๆ
') : null,
|
|
1157
|
+
h('div', { className: 'bn-campaign-price' }, camp.kind === 'link' ? 'ๆดปๅจ' : 'ยฅ' + camp.price),
|
|
1158
|
+
campHref ? h('a', { className: 'bn-campaign-go', href: campHref, target: '_blank', rel: 'noreferrer' }, camp.kind === 'link' ? 'ๅป็็' : 'ๅป็่ฏฆๆ
') : null,
|
|
1155
1159
|
),
|
|
1156
1160
|
),
|
|
1157
1161
|
campaigns.length > 1 ? h('div', { className: 'bn-campaign-dots' },
|
|
@@ -1363,6 +1367,7 @@
|
|
|
1363
1367
|
push('biutalk', 'BiuTalk', 'ๅๅบๆช่ฟ้ๆถ็ๅ
ๅบ', 'icon://biutalk');
|
|
1364
1368
|
push('biureel', 'BiuReel', 'ๅๅบๆช่ฟ้ๆถ็ๅ
ๅบ', 'icon://biureel');
|
|
1365
1369
|
push('biuvibe', 'BiuVibe', 'ๅๅบๆช่ฟ้ๆถ็ๅ
ๅบ', 'icon://biuvibe');
|
|
1370
|
+
push('biuart', 'BiuArt', 'ๅๅบๆช่ฟ้ๆถ็ๅ
ๅบ', 'icon://biuart');
|
|
1366
1371
|
}
|
|
1367
1372
|
return opts;
|
|
1368
1373
|
})(),
|
|
@@ -1433,11 +1438,7 @@
|
|
|
1433
1438
|
},
|
|
1434
1439
|
}, 'ๅคๅถ'),
|
|
1435
1440
|
),
|
|
1436
|
-
h('p', { className: 'bn-sub', style: { marginTop: 6 } }, 'ๆๆ็บนๅ็ป็ฎก็ๅ๏ผๅฏ่ฎฉ่ฟๅฐ็ต่ไธๆพ็คบๆดปๅจใๅทฒๆๆๆๆๆ็็ต่ไผ่ชๅจ้่ใ'),
|
|
1437
1441
|
) : null,
|
|
1438
|
-
h('p', { className: 'bn-sub', style: { marginTop: 18 } }, Number(state.trialRuns) > 0
|
|
1439
|
-
? 'ๅฎ่ฃ
ๅ
่ดน๏ผๆฏไธช Agent ้ฆๆฌกๅฎ่ฃ
่ต ้ ' + state.trialRuns + ' ๆฌก่ฏ็จ็ๆใๆญฃๅผๆๆ่ฏทๅฐใๆ็ๆๆใใ'
|
|
1440
|
-
: 'ๅฎ่ฃ
ๅ
่ดนใๆญฃๅผๆๆ่ฏทๅฐใๆ็ๆๆใใ'),
|
|
1441
1442
|
checkNote ? h('p', { className: 'bn-sub', style: { marginTop: 8 } }, checkNote) : null,
|
|
1442
1443
|
h('div', { style: { marginTop: 16, display: 'flex', gap: 8, flexWrap: 'wrap' } },
|
|
1443
1444
|
h('button', {
|
package/index.js
CHANGED
|
@@ -7325,7 +7325,8 @@ var AGENT_NPM_PACKAGES = {
|
|
|
7325
7325
|
biureel: "@biunow/agent-biureel",
|
|
7326
7326
|
biutalk: "@biunow/agent-biutalk",
|
|
7327
7327
|
biuremtion: "@biunow/agent-biuremtion",
|
|
7328
|
-
biuvibe: "@biunow/agent-biuvibe"
|
|
7328
|
+
biuvibe: "@biunow/agent-biuvibe",
|
|
7329
|
+
biuart: "@biunow/agent-biuart"
|
|
7329
7330
|
};
|
|
7330
7331
|
function agentNpmPackage(slug) {
|
|
7331
7332
|
const key = String(slug || "").trim();
|
|
@@ -7488,51 +7489,70 @@ function parseRuntimeSpec(spec) {
|
|
|
7488
7489
|
if (!name2) throw new Error(`bad runtime spec "${spec}"`);
|
|
7489
7490
|
return { name: name2, major: version ? Number.parseInt(version, 10) : 0 };
|
|
7490
7491
|
}
|
|
7492
|
+
function runtimePlatform() {
|
|
7493
|
+
return `${process.platform}-${process.arch}`;
|
|
7494
|
+
}
|
|
7491
7495
|
function runtimeDir(paths, spec) {
|
|
7492
7496
|
return path5.join(paths.runtime, spec.name, String(spec.major));
|
|
7493
7497
|
}
|
|
7494
|
-
function resolveRuntime(paths, spec) {
|
|
7498
|
+
function resolveRuntime(paths, spec, platform = runtimePlatform()) {
|
|
7495
7499
|
const parsed = parseRuntimeSpec(spec);
|
|
7496
7500
|
const dir = runtimeDir(paths, parsed);
|
|
7497
|
-
|
|
7501
|
+
const manifestPath = path5.join(dir, "manifest.json");
|
|
7502
|
+
if (!fs5.existsSync(manifestPath)) return null;
|
|
7503
|
+
try {
|
|
7504
|
+
const manifest = JSON.parse(fs5.readFileSync(manifestPath, "utf8"));
|
|
7505
|
+
if (manifest?.platform && manifest.platform !== platform) return null;
|
|
7506
|
+
} catch {
|
|
7507
|
+
}
|
|
7508
|
+
return dir;
|
|
7498
7509
|
}
|
|
7499
|
-
function missingRuntime(paths, specs) {
|
|
7500
|
-
return specs.filter((s3) => !resolveRuntime(paths, s3));
|
|
7510
|
+
function missingRuntime(paths, specs, platform = runtimePlatform()) {
|
|
7511
|
+
return specs.filter((s3) => !resolveRuntime(paths, s3, platform));
|
|
7501
7512
|
}
|
|
7502
7513
|
async function ensureRuntime(paths, spec, source) {
|
|
7503
7514
|
const parsed = parseRuntimeSpec(spec);
|
|
7504
7515
|
const dir = runtimeDir(paths, parsed);
|
|
7505
|
-
|
|
7516
|
+
const exist = resolveRuntime(paths, spec);
|
|
7517
|
+
if (exist) return exist;
|
|
7506
7518
|
const staging = path5.join(paths.runtime, ".staging", `${parsed.name}-${parsed.major}-${Date.now()}`);
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7519
|
+
try {
|
|
7520
|
+
fs5.mkdirSync(staging, { recursive: true });
|
|
7521
|
+
const archive = path5.join(staging, "payload");
|
|
7522
|
+
if (source.kind === "file") {
|
|
7523
|
+
fs5.copyFileSync(source.file, archive);
|
|
7524
|
+
} else {
|
|
7525
|
+
const res = await fetch(source.url);
|
|
7526
|
+
if (!res.ok) throw new Error(`runtime download failed: ${res.status} ${res.statusText}`);
|
|
7527
|
+
const buf = Buffer.from(await res.arrayBuffer());
|
|
7528
|
+
const actual = crypto3.createHash("sha256").update(buf).digest("hex");
|
|
7529
|
+
if (actual !== source.sha256) throw new Error(`runtime checksum mismatch for ${spec}`);
|
|
7530
|
+
fs5.writeFileSync(archive, buf);
|
|
7531
|
+
}
|
|
7532
|
+
const unpacked = path5.join(staging, "unpacked");
|
|
7533
|
+
fs5.mkdirSync(unpacked, { recursive: true });
|
|
7534
|
+
await So({ file: archive, cwd: unpacked });
|
|
7535
|
+
const manifestPath = path5.join(unpacked, "manifest.json");
|
|
7536
|
+
if (!fs5.existsSync(manifestPath)) throw new Error(`runtime archive for ${spec} has no manifest.json`);
|
|
7537
|
+
const manifest = JSON.parse(fs5.readFileSync(manifestPath, "utf8"));
|
|
7538
|
+
if (manifest.platform && manifest.platform !== runtimePlatform()) {
|
|
7539
|
+
throw new Error(`runtime ${spec} \u662F\u4E3A ${manifest.platform} \u6784\u5EFA\u7684\uFF0C\u5F53\u524D\u8BBE\u5907\u4E3A ${runtimePlatform()}`);
|
|
7540
|
+
}
|
|
7541
|
+
for (const entry of manifest.files ?? []) {
|
|
7542
|
+
const file = path5.join(unpacked, entry.path);
|
|
7543
|
+
if (!fs5.existsSync(file)) throw new Error(`runtime file missing: ${entry.path}`);
|
|
7544
|
+
const hash = crypto3.createHash("sha256").update(fs5.readFileSync(file)).digest("hex");
|
|
7545
|
+
if (hash !== entry.sha256) throw new Error(`runtime file hash mismatch: ${entry.path}`);
|
|
7546
|
+
}
|
|
7547
|
+
fs5.rmSync(dir, { recursive: true, force: true });
|
|
7548
|
+
fs5.mkdirSync(path5.dirname(dir), { recursive: true });
|
|
7549
|
+
fs5.renameSync(unpacked, dir);
|
|
7550
|
+
fs5.rmSync(staging, { recursive: true, force: true });
|
|
7551
|
+
return dir;
|
|
7552
|
+
} catch (err) {
|
|
7553
|
+
fs5.rmSync(staging, { recursive: true, force: true });
|
|
7554
|
+
throw err;
|
|
7555
|
+
}
|
|
7536
7556
|
}
|
|
7537
7557
|
async function importRuntimeArchive(paths, file) {
|
|
7538
7558
|
const os5 = await import("node:os");
|
|
@@ -7568,6 +7588,23 @@ function npmModuleRoot(runtimeDirPath, manifest) {
|
|
|
7568
7588
|
const fallback = path5.join(runtimeDirPath, "node_modules");
|
|
7569
7589
|
return fs5.existsSync(fallback) ? fallback : null;
|
|
7570
7590
|
}
|
|
7591
|
+
function runtimeEnvironment(paths, specs) {
|
|
7592
|
+
const env = {};
|
|
7593
|
+
const pathPrepend = [];
|
|
7594
|
+
for (const spec of specs) {
|
|
7595
|
+
const dir = resolveRuntime(paths, spec);
|
|
7596
|
+
if (!dir) continue;
|
|
7597
|
+
const manifest = readRuntimeManifest(paths, spec);
|
|
7598
|
+
if (!manifest) continue;
|
|
7599
|
+
for (const [key, value] of Object.entries(manifest.env ?? {})) {
|
|
7600
|
+
if (typeof value === "string") env[key] = value.replaceAll("${dir}", dir);
|
|
7601
|
+
}
|
|
7602
|
+
for (const rel of manifest.pathPrepend ?? []) {
|
|
7603
|
+
if (typeof rel === "string" && rel) pathPrepend.push(path5.join(dir, rel));
|
|
7604
|
+
}
|
|
7605
|
+
}
|
|
7606
|
+
return { env, pathPrepend };
|
|
7607
|
+
}
|
|
7571
7608
|
function linkAgentNpmRuntimes(paths, agentDir2, specs) {
|
|
7572
7609
|
const engineDir = path5.join(agentDir2, "engine");
|
|
7573
7610
|
if (!fs5.existsSync(engineDir)) return [];
|
|
@@ -9259,11 +9296,12 @@ function createPanelApp(options = {}) {
|
|
|
9259
9296
|
await pipeline(Readable.fromWeb(res2.body), createWriteStream(file));
|
|
9260
9297
|
}
|
|
9261
9298
|
async function installRuntimeFromStore(name2, major) {
|
|
9262
|
-
const
|
|
9299
|
+
const platform = `${process.platform}-${process.arch}`;
|
|
9300
|
+
const url = `${settings.licenseBaseUrl}/v1/store/runtimes/download?name=${encodeURIComponent(name2)}&major=${major}&platform=${encodeURIComponent(platform)}`;
|
|
9263
9301
|
const res2 = await fetch(url, { headers: { accept: "application/json, application/gzip" } });
|
|
9264
9302
|
if (!res2.ok) throw new Error("\u7EC4\u4EF6\u6682\u65F6\u4E0B\u8F7D\u4E0D\u4E86\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");
|
|
9265
9303
|
fs14.mkdirSync(paths.downloads, { recursive: true });
|
|
9266
|
-
const file = path14.join(paths.downloads, `runtime-${name2}-${major}.tar.gz`);
|
|
9304
|
+
const file = path14.join(paths.downloads, `runtime-${name2}-${major}-${platform}.tar.gz`);
|
|
9267
9305
|
const type = String(res2.headers.get("content-type") || "");
|
|
9268
9306
|
if (type.includes("json")) {
|
|
9269
9307
|
const body = await res2.json();
|
|
@@ -9437,6 +9475,11 @@ function createPanelApp(options = {}) {
|
|
|
9437
9475
|
e.code = "RUNTIME_LINK_FAILED";
|
|
9438
9476
|
throw e;
|
|
9439
9477
|
}
|
|
9478
|
+
const runtimeEnv = runtimeEnvironment(paths, shared);
|
|
9479
|
+
if (runtimeEnv.pathPrepend.length) {
|
|
9480
|
+
const pathKey = Object.keys(process.env).find((key) => key.toUpperCase() === "PATH") || "PATH";
|
|
9481
|
+
runtimeEnv.env[pathKey] = [...runtimeEnv.pathPrepend, process.env[pathKey] || ""].filter(Boolean).join(path14.delimiter);
|
|
9482
|
+
}
|
|
9440
9483
|
const running = await supervisor.start(agent, {
|
|
9441
9484
|
engineRoot,
|
|
9442
9485
|
panelCallbackUrl: publicBase ? `${publicBase}${basePath}/agents/progress` : void 0,
|
|
@@ -9444,7 +9487,7 @@ function createPanelApp(options = {}) {
|
|
|
9444
9487
|
product: product ?? agent.id,
|
|
9445
9488
|
canExport: entitled,
|
|
9446
9489
|
trial: !licensed && trialLeft > 0,
|
|
9447
|
-
extraEnv: { PANEL_MEMBER: licensed ? "1" : "0" }
|
|
9490
|
+
extraEnv: { ...runtimeEnv.env, PANEL_MEMBER: licensed ? "1" : "0" }
|
|
9448
9491
|
});
|
|
9449
9492
|
started.set(agent.id, running);
|
|
9450
9493
|
syncAgentSkills(agent);
|
|
@@ -9644,7 +9687,9 @@ function createPanelApp(options = {}) {
|
|
|
9644
9687
|
description: String(item.description || ""),
|
|
9645
9688
|
price: Number(item.price) || 0,
|
|
9646
9689
|
compareAt: Number(item.compareAt) || 0,
|
|
9647
|
-
gradient: String(item.gradient || "lime")
|
|
9690
|
+
gradient: String(item.gradient || "lime"),
|
|
9691
|
+
kind: item.kind === "link" ? "link" : "sale",
|
|
9692
|
+
linkUrl: String(item.linkUrl || "")
|
|
9648
9693
|
})).filter((item) => item.slug && item.name);
|
|
9649
9694
|
campaignCache = { at: now, items };
|
|
9650
9695
|
return items;
|
package/package.json
CHANGED