@bnbagent/studio-cli 0.0.13-alpha.8 → 0.0.14-alpha.1
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 +8 -0
- package/dist/bag.js +3556 -1565
- package/dist/{chunk-NTDWVEW2.js → chunk-QVYWAJEK.js} +228 -72
- package/dist/{deployCli-ZESBUWQB.js → deployCli-F3AOM5UO.js} +1 -2
- package/package.json +2 -2
- package/recipes/agent/code/{{PKG}}/deliveryPolicy.ts.tmpl +43 -0
- package/recipes/agent/code/{{PKG}}/readToolCatalog.ts.tmpl +102 -0
- package/recipes/agent/code/{{PKG}}/signing.ts.tmpl +7 -2
- package/recipes/agent/recipe.toml +4 -3
- package/recipes/runtimes/agentcore/code/{{PKG}}/dualMain.ts.tmpl +6 -2
- package/recipes/runtimes/agentcore/code/{{PKG}}/mcpMain.ts.tmpl +173 -134
- package/recipes/runtimes/agentcore/code/{{PKG}}/model.ts.tmpl +7 -0
- package/recipes/runtimes/agentcore/code/{{PKG}}/sellerCore.ts.tmpl +31 -46
- package/recipes/runtimes/agentcore/code/{{PKG}}/tools.ts.tmpl +19 -48
- package/recipes/runtimes/agentcore/code/{{PKG}}/unifiedMain.ts.tmpl +2 -1
- package/recipes/runtimes/azure-foundry/code/{{PKG}}/mcpMain.ts.tmpl +173 -134
- package/recipes/runtimes/azure-foundry/code/{{PKG}}/model.ts.tmpl +7 -0
- package/recipes/runtimes/azure-foundry/code/{{PKG}}/sellerCore.ts.tmpl +31 -46
- package/recipes/runtimes/azure-foundry/code/{{PKG}}/tools.ts.tmpl +19 -48
- package/recipes/runtimes/azure-foundry/code/{{PKG}}/unifiedMain.ts.tmpl +2 -1
- package/recipes/wallet/recipe.toml +3 -2
- package/skills/bnbagent-studio.md +12 -1
- package/skills/references/bnbagent-studio-operating.md +1 -0
- package/skills/references/bnbagent-studio-scaffolding-agent.md +11 -34
- package/skills/references/bnbagent-studio-selling-via-b402.md +3 -3
- package/skills/references/bnbagent-studio-using-altana-wallet.md +6 -1
- package/skills/references/bnbagent-studio-using-twak-wallet.md +24 -76
- package/dist/_twak-4XF4H5PL.js +0 -25
- package/dist/chunk-RO726HJG.js +0 -175
package/dist/chunk-RO726HJG.js
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/cli/_twak.ts
|
|
4
|
-
import * as os from "os";
|
|
5
|
-
import * as path from "path";
|
|
6
|
-
import { resolveTwakHome } from "@bnbagent/studio-runtime/wallet";
|
|
7
|
-
|
|
8
|
-
// src/cli/proc.ts
|
|
9
|
-
import { execa } from "execa";
|
|
10
|
-
async function runCapture(cmd, args, opts = {}) {
|
|
11
|
-
const result = await execa(cmd, args, {
|
|
12
|
-
cwd: opts.cwd,
|
|
13
|
-
env: opts.env,
|
|
14
|
-
input: opts.input,
|
|
15
|
-
timeout: opts.timeoutMs,
|
|
16
|
-
reject: false,
|
|
17
|
-
stripFinalNewline: false
|
|
18
|
-
});
|
|
19
|
-
return {
|
|
20
|
-
code: result.exitCode ?? 1,
|
|
21
|
-
stdout: typeof result.stdout === "string" ? result.stdout : "",
|
|
22
|
-
stderr: typeof result.stderr === "string" ? result.stderr : ""
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
async function runStream(cmd, args, opts = {}) {
|
|
26
|
-
const result = await execa(cmd, args, {
|
|
27
|
-
cwd: opts.cwd,
|
|
28
|
-
env: opts.env,
|
|
29
|
-
timeout: opts.timeoutMs,
|
|
30
|
-
reject: false,
|
|
31
|
-
stdio: "inherit"
|
|
32
|
-
});
|
|
33
|
-
return result.exitCode ?? 1;
|
|
34
|
-
}
|
|
35
|
-
async function runCaptureOut(cmd, args, opts = {}) {
|
|
36
|
-
const result = await execa(cmd, args, {
|
|
37
|
-
cwd: opts.cwd,
|
|
38
|
-
env: opts.env,
|
|
39
|
-
input: opts.input,
|
|
40
|
-
timeout: opts.timeoutMs,
|
|
41
|
-
reject: false,
|
|
42
|
-
stripFinalNewline: false,
|
|
43
|
-
stdout: "pipe",
|
|
44
|
-
stderr: "inherit"
|
|
45
|
-
});
|
|
46
|
-
return {
|
|
47
|
-
code: result.exitCode ?? 1,
|
|
48
|
-
stdout: typeof result.stdout === "string" ? result.stdout : ""
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// src/cli/_twak.ts
|
|
53
|
-
var TWAK_CLI_VERSION = "0.20.0";
|
|
54
|
-
var TWAK_CLI_MIN_VERSION = [
|
|
55
|
-
0,
|
|
56
|
-
20,
|
|
57
|
-
0
|
|
58
|
-
];
|
|
59
|
-
var TWAK_NODE_MIN_MAJOR = 20;
|
|
60
|
-
function twakVersionBelowFloor(installed) {
|
|
61
|
-
const floor = TWAK_CLI_MIN_VERSION;
|
|
62
|
-
for (let i = 0; i < floor.length; i += 1) {
|
|
63
|
-
const a = installed[i] ?? 0;
|
|
64
|
-
const b = floor[i];
|
|
65
|
-
if (a !== b) {
|
|
66
|
-
return a < b;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
async function whichTwak() {
|
|
72
|
-
const cmd = process.platform === "win32" ? "where" : "which";
|
|
73
|
-
const result = await runCapture(cmd, ["twak"]);
|
|
74
|
-
if (result.code !== 0) {
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
const line = result.stdout.split("\n")[0]?.trim();
|
|
78
|
-
return line ? line : null;
|
|
79
|
-
}
|
|
80
|
-
async function twakInstalledVersion() {
|
|
81
|
-
if (await whichTwak() === null) {
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
let out;
|
|
85
|
-
try {
|
|
86
|
-
const result = await runCapture("twak", ["--version"], {
|
|
87
|
-
timeoutMs: 15e3
|
|
88
|
-
});
|
|
89
|
-
out = result.stdout;
|
|
90
|
-
} catch {
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
const m = /(\d+)\.(\d+)\.(\d+)/.exec(out || "");
|
|
94
|
-
if (m === null) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
return [
|
|
98
|
-
Number.parseInt(m[1], 10),
|
|
99
|
-
Number.parseInt(m[2], 10),
|
|
100
|
-
Number.parseInt(m[3], 10)
|
|
101
|
-
];
|
|
102
|
-
}
|
|
103
|
-
function twakHomeDir(walletCfg, projectRoot) {
|
|
104
|
-
const home = resolveTwakHome(walletCfg ?? {}, projectRoot ?? null);
|
|
105
|
-
return path.join(home ?? os.homedir(), ".twak");
|
|
106
|
-
}
|
|
107
|
-
function twakWalletFile(walletCfg, projectRoot) {
|
|
108
|
-
return path.join(twakHomeDir(walletCfg, projectRoot), "wallet.json");
|
|
109
|
-
}
|
|
110
|
-
function twakDoubledHomeHint(walletFile) {
|
|
111
|
-
const doubled = `${path.sep}.twak${path.sep}.twak${path.sep}`;
|
|
112
|
-
if (!walletFile.includes(doubled)) {
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
return `hint: the resolved wallet path ${walletFile} nests .twak/.twak \u2014 [wallet].twak_home in studio.toml likely points at the .twak directory itself. Set it to the PARENT directory (the runtime appends .twak/wallet.json) and re-run.`;
|
|
116
|
-
}
|
|
117
|
-
function twakCreateGuidance(fields) {
|
|
118
|
-
return `error: wallet.kind = "twak" \u2014 \`bag wallet new\` only adopts an existing
|
|
119
|
-
twak wallet's address. Create the wallet ONCE (you choose the password; pick a
|
|
120
|
-
strong one).
|
|
121
|
-
|
|
122
|
-
RECOMMENDED \u2014 let studio drive the create step so you never type the password
|
|
123
|
-
on a command line (twak requires --password on its own argv, so the value does
|
|
124
|
-
reach that short-lived child process):
|
|
125
|
-
|
|
126
|
-
bag wallet twak-init --password-stdin # CI: printf %s "$PW" | bag wallet twak-init --password-stdin
|
|
127
|
-
bag wallet twak-init --password-file <f> # file must be chmod 600
|
|
128
|
-
bag wallet twak-init # interactive hidden prompt
|
|
129
|
-
|
|
130
|
-
(the one-time NaaS setup below applies to BOTH paths; the manual twak
|
|
131
|
-
commands follow it.)
|
|
132
|
-
|
|
133
|
-
First get Trust Wallet NaaS API credentials (one time): make an app at
|
|
134
|
-
https://portal.trustwallet.com/dashboard/apps \u2192 copy its Access ID + HMAC
|
|
135
|
-
secret, then run \`twak setup\` (without them \`twak wallet create\` fails with
|
|
136
|
-
"No API credentials found"):
|
|
137
|
-
|
|
138
|
-
${fields.setupCmd}
|
|
139
|
-
|
|
140
|
-
then create the wallet \u2014 interactive (you type the password on argv yourself;
|
|
141
|
-
twak warns, and it lands in your shell history \u2014 acceptable for a throwaway hot
|
|
142
|
-
wallet):
|
|
143
|
-
|
|
144
|
-
${fields.createCmd}
|
|
145
|
-
|
|
146
|
-
\u2014 or, to keep the password out of your shell history (CI / scripts), pass it
|
|
147
|
-
via the environment and let \`twak setup\` create the wallet
|
|
148
|
-
non-interactively:
|
|
149
|
-
|
|
150
|
-
TWAK_NONINTERACTIVE=1 TWAK_SETUP_WALLET=create TWAK_WALLET_PASSWORD=<pw> ${fields.setupCmd}
|
|
151
|
-
|
|
152
|
-
(this stores the password in the OS keychain and needs one that persists;
|
|
153
|
-
on headless / Docker runners without a keychain it aborts \u2014 use the argv
|
|
154
|
-
form above there.)
|
|
155
|
-
|
|
156
|
-
then set TWAK_WALLET_PASSWORD in .studio/.env.local and re-run
|
|
157
|
-
bag wallet new # adopts the address into studio.toml
|
|
158
|
-
Guide: the bnbagent-studio-using-twak-wallet.md reference (installed by \`bag skills install\`).`;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export {
|
|
162
|
-
runCapture,
|
|
163
|
-
runStream,
|
|
164
|
-
runCaptureOut,
|
|
165
|
-
TWAK_CLI_VERSION,
|
|
166
|
-
TWAK_CLI_MIN_VERSION,
|
|
167
|
-
TWAK_NODE_MIN_MAJOR,
|
|
168
|
-
twakVersionBelowFloor,
|
|
169
|
-
whichTwak,
|
|
170
|
-
twakInstalledVersion,
|
|
171
|
-
twakHomeDir,
|
|
172
|
-
twakWalletFile,
|
|
173
|
-
twakDoubledHomeHint,
|
|
174
|
-
twakCreateGuidance
|
|
175
|
-
};
|