bnpanel 0.5.2 → 0.5.5
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/biuvibe.svg +6 -0
- package/client.js +2 -1
- package/index.js +42 -5
- package/package.json +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
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="#14110c"/>
|
|
3
|
+
<rect x="16" y="16" width="224" height="224" rx="44" fill="none" stroke="#e2b657" stroke-width="8"/>
|
|
4
|
+
<path d="M78 168c18-52 34-78 50-78s32 26 50 78" fill="none" stroke="#e2b657" stroke-width="8" stroke-linecap="round"/>
|
|
5
|
+
<circle cx="128" cy="96" r="10" fill="#e2b657"/>
|
|
6
|
+
</svg>
|
package/client.js
CHANGED
|
@@ -697,7 +697,7 @@
|
|
|
697
697
|
setPendingPerm(agent || { id });
|
|
698
698
|
setModal('permissions');
|
|
699
699
|
} else if (err.message && err.message.indexOf('未授权') >= 0) {
|
|
700
|
-
setProductInput(id
|
|
700
|
+
setProductInput(id || 'biutalk');
|
|
701
701
|
setTab('account');
|
|
702
702
|
setToast({ text: err.message, bad: true });
|
|
703
703
|
} else {
|
|
@@ -1007,6 +1007,7 @@
|
|
|
1007
1007
|
if (!opts.length) {
|
|
1008
1008
|
push('biutalk', 'BiuTalk', '商店未连通时的兜底', 'icon://biutalk');
|
|
1009
1009
|
push('biureel', 'BiuReel', '商店未连通时的兜底', 'icon://biureel');
|
|
1010
|
+
push('biuvibe', 'BiuVibe', '商店未连通时的兜底', 'icon://biuvibe');
|
|
1010
1011
|
}
|
|
1011
1012
|
return opts;
|
|
1012
1013
|
})(),
|
package/index.js
CHANGED
|
@@ -7324,7 +7324,8 @@ import crypto2 from "node:crypto";
|
|
|
7324
7324
|
var AGENT_NPM_PACKAGES = {
|
|
7325
7325
|
biureel: "@biunow/agent-biureel",
|
|
7326
7326
|
biutalk: "@biunow/agent-biutalk",
|
|
7327
|
-
biuremtion: "@biunow/agent-biuremtion"
|
|
7327
|
+
biuremtion: "@biunow/agent-biuremtion",
|
|
7328
|
+
biuvibe: "@biunow/agent-biuvibe"
|
|
7328
7329
|
};
|
|
7329
7330
|
function agentNpmPackage(slug) {
|
|
7330
7331
|
const key = String(slug || "").trim();
|
|
@@ -8391,6 +8392,9 @@ function createChatBridge() {
|
|
|
8391
8392
|
} catch {
|
|
8392
8393
|
}
|
|
8393
8394
|
}
|
|
8395
|
+
if (typeof opts.beforePrompt === "function") {
|
|
8396
|
+
await opts.beforePrompt(sessionId);
|
|
8397
|
+
}
|
|
8394
8398
|
const requestId = crypto7.randomUUID();
|
|
8395
8399
|
await sessionController.prompt(
|
|
8396
8400
|
{
|
|
@@ -8446,6 +8450,7 @@ function chatDenialCopy(name2, kind) {
|
|
|
8446
8450
|
}
|
|
8447
8451
|
function classifyChatTurn(input) {
|
|
8448
8452
|
if (input.licensed) return { action: "allow", remember: true };
|
|
8453
|
+
if (input.trialRun && !input.seen) return { action: "allow", remember: true };
|
|
8449
8454
|
const remaining = Number(input.trialRemaining) || 0;
|
|
8450
8455
|
if (remaining > 0 && !input.seen) return { action: "allow", remember: true };
|
|
8451
8456
|
if (remaining > 0) return { action: "block", kind: "unlicensed" };
|
|
@@ -8540,7 +8545,7 @@ function createTurnGate() {
|
|
|
8540
8545
|
const cwd = cwdOf(payload?.agent);
|
|
8541
8546
|
if (!cwd) return forward();
|
|
8542
8547
|
const id = sessionIdOf(payload.agent);
|
|
8543
|
-
const verdict = assess(String(cwd), id ? seen.has(id) : false) || { action: "ignore" };
|
|
8548
|
+
const verdict = assess(String(cwd), id ? seen.has(id) : false, id) || { action: "ignore" };
|
|
8544
8549
|
const downstream = await forward();
|
|
8545
8550
|
if (downstream?.kind === "reject") return downstream;
|
|
8546
8551
|
if (verdict.action === "block" && verdict.message) {
|
|
@@ -8911,6 +8916,32 @@ function createPanelApp(options = {}) {
|
|
|
8911
8916
|
} catch {
|
|
8912
8917
|
}
|
|
8913
8918
|
}
|
|
8919
|
+
const trialRunSessions = /* @__PURE__ */ new Set();
|
|
8920
|
+
function trialRunsPath() {
|
|
8921
|
+
return path14.join(paths.root, "trial-runs.json");
|
|
8922
|
+
}
|
|
8923
|
+
function loadTrialRuns() {
|
|
8924
|
+
try {
|
|
8925
|
+
const data = JSON.parse(fs14.readFileSync(trialRunsPath(), "utf8"));
|
|
8926
|
+
const ids = Array.isArray(data?.ids) ? data.ids : [];
|
|
8927
|
+
for (const id of ids) {
|
|
8928
|
+
if (id) trialRunSessions.add(String(id));
|
|
8929
|
+
}
|
|
8930
|
+
} catch {
|
|
8931
|
+
}
|
|
8932
|
+
}
|
|
8933
|
+
function rememberTrialRun(sessionId) {
|
|
8934
|
+
const id = String(sessionId || "");
|
|
8935
|
+
if (!id || trialRunSessions.has(id)) return;
|
|
8936
|
+
trialRunSessions.add(id);
|
|
8937
|
+
const ids = [...trialRunSessions].slice(-400);
|
|
8938
|
+
try {
|
|
8939
|
+
fs14.mkdirSync(paths.root, { recursive: true });
|
|
8940
|
+
fs14.writeFileSync(trialRunsPath(), JSON.stringify({ ids }, null, 2));
|
|
8941
|
+
} catch {
|
|
8942
|
+
}
|
|
8943
|
+
}
|
|
8944
|
+
loadTrialRuns();
|
|
8914
8945
|
function canRunProduct(product) {
|
|
8915
8946
|
if (!product) return license.canExport();
|
|
8916
8947
|
if (license.canUseProduct(product)) return true;
|
|
@@ -9007,12 +9038,16 @@ function createPanelApp(options = {}) {
|
|
|
9007
9038
|
if (!dsh?.chat?.startSkillRun) {
|
|
9008
9039
|
return { ok: false, reason: "chat-unavailable", promptText: text };
|
|
9009
9040
|
}
|
|
9041
|
+
const product = agent ? productOf(agent) || agent.id : agentId;
|
|
9010
9042
|
return dsh.chat.startSkillRun({
|
|
9011
9043
|
agentId,
|
|
9012
9044
|
skill: skill || agentId,
|
|
9013
9045
|
projectPath,
|
|
9014
9046
|
promptText: text,
|
|
9015
|
-
title: title || `${skill || agentId} \xB7 \u521B\u4F5C
|
|
9047
|
+
title: title || `${skill || agentId} \xB7 \u521B\u4F5C`,
|
|
9048
|
+
beforePrompt: (sessionId) => {
|
|
9049
|
+
if (!license.canUseProduct(product)) rememberTrialRun(sessionId);
|
|
9050
|
+
}
|
|
9016
9051
|
});
|
|
9017
9052
|
}
|
|
9018
9053
|
function isRequiredNpmRuntime(spec) {
|
|
@@ -10017,16 +10052,18 @@ function createPanelApp(options = {}) {
|
|
|
10017
10052
|
}
|
|
10018
10053
|
return null;
|
|
10019
10054
|
}
|
|
10020
|
-
function assessChatTurn(cwd, seen) {
|
|
10055
|
+
function assessChatTurn(cwd, seen, sessionId) {
|
|
10021
10056
|
try {
|
|
10022
10057
|
const binding = bindChatProduct(cwd);
|
|
10023
10058
|
if (!binding) return { action: "ignore" };
|
|
10024
10059
|
const trial = trialOf(binding.product);
|
|
10060
|
+
const paidFirst = !!(sessionId && trialRunSessions.has(String(sessionId)) && !seen);
|
|
10025
10061
|
const classified = classifyChatTurn({
|
|
10026
10062
|
licensed: license.canUseProduct(binding.product),
|
|
10027
10063
|
trialRemaining: trial.remaining,
|
|
10028
10064
|
trialGranted: !!trial.granted,
|
|
10029
|
-
seen: !!seen || !binding.fresh
|
|
10065
|
+
seen: paidFirst ? false : !!seen || !binding.fresh,
|
|
10066
|
+
trialRun: paidFirst
|
|
10030
10067
|
});
|
|
10031
10068
|
if (classified.action === "allow") return { action: "allow" };
|
|
10032
10069
|
return { action: "block", message: chatDenialCopy(binding.name, classified.kind) };
|