@bnbagent/studio-cli 0.0.6-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.
Files changed (55) hide show
  1. package/DISCLAIMER.md +48 -0
  2. package/LICENSE +201 -0
  3. package/dist/_agentcoreName-DZDWEYD3.js +7 -0
  4. package/dist/_twak-5XQMOFUC.js +25 -0
  5. package/dist/bag.js +19358 -0
  6. package/dist/chunk-7RAKL4AS.js +172 -0
  7. package/dist/chunk-M3ODFCA7.js +1053 -0
  8. package/dist/chunk-U7IDQ3K5.js +14 -0
  9. package/dist/deployCli-N6TPN6XA.js +40 -0
  10. package/package.json +64 -0
  11. package/recipes/agent/code/{{PKG}}/signing.ts.tmpl +287 -0
  12. package/recipes/agent/recipe.toml +35 -0
  13. package/recipes/providers/pieverse-llm/recipe.toml +16 -0
  14. package/recipes/providers/pieverse-llm/skills/funding-pieverse-llm.md +203 -0
  15. package/recipes/runtimes/agentcore/code/{{PKG}}/.dockerignore.tmpl +8 -0
  16. package/recipes/runtimes/agentcore/code/{{PKG}}/Dockerfile.tmpl +50 -0
  17. package/recipes/runtimes/agentcore/code/{{PKG}}/agentCard.ts.tmpl +135 -0
  18. package/recipes/runtimes/agentcore/code/{{PKG}}/dualMain.ts.tmpl +402 -0
  19. package/recipes/runtimes/agentcore/code/{{PKG}}/executor.ts.tmpl +147 -0
  20. package/recipes/runtimes/agentcore/code/{{PKG}}/main.ts.tmpl +344 -0
  21. package/recipes/runtimes/agentcore/code/{{PKG}}/mcpMain.ts.tmpl +677 -0
  22. package/recipes/runtimes/agentcore/code/{{PKG}}/model.ts.tmpl +117 -0
  23. package/recipes/runtimes/agentcore/code/{{PKG}}/sellerCore.ts.tmpl +503 -0
  24. package/recipes/runtimes/agentcore/code/{{PKG}}/tools.ts.tmpl +157 -0
  25. package/recipes/runtimes/agentcore/recipe.toml +97 -0
  26. package/recipes/runtimes/azure-foundry/code/{{PKG}}/.dockerignore.tmpl +8 -0
  27. package/recipes/runtimes/azure-foundry/code/{{PKG}}/Dockerfile.tmpl +47 -0
  28. package/recipes/runtimes/azure-foundry/code/{{PKG}}/agentCard.ts.tmpl +131 -0
  29. package/recipes/runtimes/azure-foundry/code/{{PKG}}/executor.ts.tmpl +504 -0
  30. package/recipes/runtimes/azure-foundry/code/{{PKG}}/foundryMain.ts.tmpl +300 -0
  31. package/recipes/runtimes/azure-foundry/code/{{PKG}}/main.ts.tmpl +196 -0
  32. package/recipes/runtimes/azure-foundry/code/{{PKG}}/mcpMain.ts.tmpl +562 -0
  33. package/recipes/runtimes/azure-foundry/code/{{PKG}}/model.ts.tmpl +117 -0
  34. package/recipes/runtimes/azure-foundry/code/{{PKG}}/tools.ts.tmpl +157 -0
  35. package/recipes/runtimes/azure-foundry/recipe.toml +88 -0
  36. package/recipes/tools-chain/code/{{PKG}}/chainTools.ts.tmpl +166 -0
  37. package/recipes/tools-chain/recipe.toml +11 -0
  38. package/recipes/wallet/recipe.toml +20 -0
  39. package/recipes/x402-buyer/code/{{PKG}}/x402Buyer.ts.tmpl +175 -0
  40. package/recipes/x402-buyer/recipe.toml +15 -0
  41. package/skills/bnbagent-studio.md +107 -0
  42. package/skills/references/bnbagent-studio-adding-to-project.md +241 -0
  43. package/skills/references/bnbagent-studio-buying-from-bazaar.md +169 -0
  44. package/skills/references/bnbagent-studio-buying-via-8183.md +222 -0
  45. package/skills/references/bnbagent-studio-extending-signing.md +227 -0
  46. package/skills/references/bnbagent-studio-operating.md +211 -0
  47. package/skills/references/bnbagent-studio-scaffolding-agent.md +536 -0
  48. package/skills/references/bnbagent-studio-selling-via-8183.md +271 -0
  49. package/skills/references/bnbagent-studio-selling-via-b402.md +194 -0
  50. package/skills/references/bnbagent-studio-use-aws-agentcore.md +208 -0
  51. package/skills/references/bnbagent-studio-use-azure-foundry.md +164 -0
  52. package/skills/references/bnbagent-studio-use-bnb-trial.md +92 -0
  53. package/skills/references/bnbagent-studio-using-altana-wallet.md +68 -0
  54. package/skills/references/bnbagent-studio-using-twak-wallet.md +260 -0
  55. package/skills/references/bnbagent-studio-wiring-llm-tools.md +338 -0
@@ -0,0 +1,172 @@
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\` does not create twak wallets.
119
+ studio never puts a wallet password on argv (upstream S-8), so it will not shell
120
+ out \`twak wallet create --password \u2026\` for you. Create the wallet ONCE
121
+ (you choose the password; pick a strong one).
122
+
123
+ RECOMMENDED \u2014 let studio drive the create step with the password OFF argv:
124
+
125
+ bag wallet twak-init --password-stdin # CI: printf %s "$PW" | bag wallet twak-init --password-stdin
126
+ bag wallet twak-init --password-file <f> # file must be chmod 600
127
+ bag wallet twak-init # interactive hidden prompt
128
+
129
+ (the one-time NaaS setup below applies to BOTH paths; the manual twak
130
+ commands follow it.)
131
+
132
+ First get Trust Wallet NaaS API credentials (one time): make an app at
133
+ https://portal.trustwallet.com/dashboard/apps \u2192 copy its Access ID + HMAC
134
+ secret, then run \`twak setup\` (without them \`twak wallet create\` fails with
135
+ "No API credentials found"):
136
+
137
+ ${fields.setupCmd}
138
+
139
+ then create the wallet \u2014 interactive (password on twak's own argv; twak warns,
140
+ and it lands in your shell history \u2014 acceptable for a throwaway hot wallet):
141
+
142
+ ${fields.createCmd}
143
+
144
+ \u2014 or, to keep the password OFF argv (CI / scripts), pass it via the
145
+ environment and let \`twak setup\` create the wallet non-interactively:
146
+
147
+ TWAK_NONINTERACTIVE=1 TWAK_SETUP_WALLET=create TWAK_WALLET_PASSWORD=<pw> ${fields.setupCmd}
148
+
149
+ (this stores the password in the OS keychain and needs one that persists;
150
+ on headless / Docker runners without a keychain it aborts \u2014 use the argv
151
+ form above there.)
152
+
153
+ then set TWAK_WALLET_PASSWORD in .studio/.env.local and re-run
154
+ bag wallet new # adopts the address into studio.toml
155
+ Guide: the bnbagent-studio-using-twak-wallet.md reference (installed by \`bag skills install\`).`;
156
+ }
157
+
158
+ export {
159
+ runCapture,
160
+ runStream,
161
+ runCaptureOut,
162
+ TWAK_CLI_VERSION,
163
+ TWAK_CLI_MIN_VERSION,
164
+ TWAK_NODE_MIN_MAJOR,
165
+ twakVersionBelowFloor,
166
+ whichTwak,
167
+ twakInstalledVersion,
168
+ twakHomeDir,
169
+ twakWalletFile,
170
+ twakDoubledHomeHint,
171
+ twakCreateGuidance
172
+ };