@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,208 @@
1
+ ---
2
+ name: bnbagent-studio-use-aws-agentcore
3
+ description: When the user wants to deploy or operate a bnbagent-studio project on AWS Bedrock AgentCore — deploy with `bag deploy --provider aws` (ALL cloud execution is delegated to pinned `@bnbagent/deploy-cli@0.4.14`), inspect with `bag deploy status` / `logs --provider aws` / `verify --provider aws`, and tear down with `bag deploy destroy --provider aws --execute [--purge]`. Also covers AWS credential prerequisites and the runtime-secret channel.
4
+ ---
5
+
6
+ > **Reference file** of the `bnbagent-studio` router skill — installed at `bnbagent-studio/references/` and loaded on demand (not a standalone skill). Route here via the router's decision tree.
7
+
8
+ # bnbagent-studio-use-aws-agentcore
9
+
10
+ Procedure for deploying and operating the seller Agent on **AWS Bedrock
11
+ AgentCore** via the **delegated deploy**: `bag deploy --provider aws` hands a generated
12
+ deploy spec to the pinned **`@bnbagent/deploy-cli`** (run via `bunx --bun`;
13
+ override the command with `BNBAGENT_DEPLOY_COMMAND`), which executes every
14
+ cloud step through the AWS SDK under the user's credentials. There is **no
15
+ `aws` CLI, no CDK deploy, and no `agentcore deploy`** in this path — the npm
16
+ `@aws/agentcore` CLI is used ONLY by `bag dev --container` (image-parity local
17
+ runs).
18
+
19
+ The deployed product is **one** valuable Agent that serves its selected public
20
+ faces (A2A → `0.0.0.0:9000`, MCP-only → `0.0.0.0:8000/mcp`, or A2A+MCP →
21
+ A2A-native `dualMain.ts` on `:9000` with `/mcp` tunneled by the platform, per
22
+ `app/agent/studio.toml [stack].protocols`): it holds the key, signs in-process,
23
+ and is its own public endpoint behind an OAuth2 authorizer. There is no
24
+ separate service to deploy — the agent IS the public surface, so this one
25
+ procedure is the whole runtime deploy.
26
+
27
+ ```
28
+ <workspace>/
29
+ ├── agentcore/
30
+ │ ├── agentcore.json # deploy descriptor: name (resource naming), protocol, authorizer, envVars
31
+ │ └── aws-targets.json # AWS account + region the deploy targets
32
+ └── app/agent/ # the deployed code (entrypoint lives here)
33
+ ```
34
+
35
+ > **`bag deploy --provider aws` runs the whole deploy.** It gates on readiness, builds
36
+ > the agent (`pnpm build`), collects the runtime secrets, and delegates to
37
+ > bnbagent-deploy. The old `bag deploy agent` spelling is a deprecated
38
+ > compatibility alias.
39
+
40
+ ## Prerequisites
41
+
42
+ 1. **Bun 1.3+ (`bunx`) on PATH** — the pinned `@bnbagent/deploy-cli` runs
43
+ through it (`bag deploy prepare` fails a CRITICAL check when `bunx` is
44
+ missing). Install from https://bun.sh, or point `BNBAGENT_DEPLOY_COMMAND`
45
+ at another launcher.
46
+ 2. **AWS credentials** for the deploy identity — use `bnbagent-deploy login
47
+ --provider aws` or the standard env/profile files. Studio does not inspect
48
+ credentials itself; the delegated deploy-cli validates identity and
49
+ permissions before mutation. Credentials may come from
50
+ `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` / `AWS_REGION` or the
51
+ standard `~/.aws/credentials` file. Verify you're in the RIGHT account: it must
52
+ match `agentcore/aws-targets.json` (the AWS Console's account menu shows
53
+ the active account id). Least-privilege policy JSON:
54
+ `docs/guides/agentcore-deploy-iam.md`.
55
+ 3. **Docker running — container packaging only** (`wallet.kind = "twak"` or a
56
+ scaffold with `[deploy].platform_artifact = "container"`): bnbagent-deploy
57
+ builds the scaffolded Dockerfile locally for linux/arm64 and pushes it to
58
+ ECR. A default evm-local AWS scaffold deploys as a Node zip and needs no
59
+ Docker; an evm-local platform-container scaffold remains a container when
60
+ AWS is selected later.
61
+ 4. **`@aws/agentcore` CLI — ONLY for `bag dev --container`** (needs Node ≥ 20:
62
+ `npm install -g @aws/agentcore`). Not needed to deploy.
63
+ ⚠️ Some environments carry `bedrock-agentcore-starter-toolkit`, a
64
+ **same-named but incompatible** `agentcore` shim that can shadow the npm
65
+ CLI on PATH. Check with `which -a agentcore` and remove the shim (or put
66
+ the npm `@aws/agentcore` first on PATH) if `bag dev --container`
67
+ misbehaves.
68
+
69
+ ## The runtime-secret channel (read this first)
70
+
71
+ The deployed runtime does NOT read `.env.local` — nothing ships it. Instead,
72
+ `bag deploy --provider aws` collects the runtime secrets (provider/storage keys,
73
+ `WALLET_PASSWORD`, the encrypted keystore as `WALLET_KEYSTORE_JSON` — or the
74
+ twak bundle) and hands them to bnbagent-deploy as a private (mode 0600)
75
+ tempdir envFile. The deploy CLI provisions them as ONE Secrets Manager secret
76
+ (`bnbagent/<project>/runtime`), injects the `BNBAGENT_RUNTIME_SECRET_ID`
77
+ pointer into the runtime env, and grants the runtime execution role read
78
+ access. The entrypoint loads the bundle at cold start.
79
+
80
+ > **The KEYSTORE is never bundled.** The encrypted wallet keystore lives at
81
+ > the WORKSPACE root (`.studio/wallets/`, outside `app/agent/`, so no
82
+ > packaging path can include it) and reaches the runtime ONLY via that
83
+ > Secrets Manager channel. Only put non-secret runtime config in
84
+ > `agentcore.json` `envVars[]`.
85
+
86
+ > **`--secrets-mode envvars` is testnet-only.** It inlines the secrets as
87
+ > PLAINTEXT runtime env vars in the deploy spec — use it only when you cannot
88
+ > grant `secretsmanager:CreateSecret`; it is refused on mainnet.
89
+
90
+ Provider-native overrides: the optional `studio.toml [deploy.agentcore]` table
91
+ passes verbatim deploy-spec keys through to CreateAgentRuntime /
92
+ UpdateAgentRuntime. Two keys are reserved and refused: `secretName`
93
+ (studio-managed) and `environmentVariables` (would replace the merged runtime
94
+ env, secret pointer included).
95
+
96
+ ## Command reference
97
+
98
+ Everything runs through `bag deploy` (run `bag deploy <cmd> --help` for
99
+ flags); cloud execution is the pinned bnbagent-deploy's job.
100
+
101
+ | Command | What it does |
102
+ |---|---|
103
+ | `bag deploy prepare` | The deploy-readiness sweep (incl. the `bunx` check). Run before deploying. |
104
+ | `bag deploy --provider aws [--yes]` | The whole deploy: prepare gate → AWS-permissions notice → secret hand-off → `pnpm build` → delegated deploy (artifact, runtime create/update, secret provision + role grant, Cognito inbound OAuth) → ARN capture + state stamp. Automation requires `--yes`; add `--allow-multiple` when another provider stays active. |
105
+ | `bag deploy verify [--provider aws]` | Ask bnbagent-deploy for live provider status, then reconcile ERC-8004. Provider is required only when multiple deployments are recorded. |
106
+ | `bag deploy status [--provider aws]` | List every recorded deployment and delegated live state (read-only); `--no-probe` is local-only. |
107
+ | `bag deploy logs [--provider aws] [--follow] [--since 10m]` | Delegate runtime logs to bnbagent-deploy. |
108
+ | `bag deploy destroy [--provider aws]` | Dry-run teardown plan; `--execute` delegates `destroy --yes`; `--purge` also deletes retained ECR/log resources. |
109
+ | `bag deploy provision-cognito [--wire]` | Emit (then wire) the optional Cognito CDK app for operator-managed buyer credentials. |
110
+
111
+ ## Typical workflows
112
+
113
+ ### A. Run locally
114
+
115
+ Prefer `bag dev` (auto-loads `.env.local`, runs the agent in-process, no
116
+ Docker). `bag dev --container` opts into the native `agentcore dev` container
117
+ for full image parity — the ONE flow that needs the npm `@aws/agentcore` CLI
118
+ plus a container engine.
119
+
120
+ ### B. Deploy to AWS (delegated)
121
+
122
+ > ⚠️ **First deploy: relay the AWS-permissions notice to the user.** Deploying
123
+ > provisions resources in the user's AWS account. `bag deploy --provider aws` prints a
124
+ > pre-deploy notice (required-permission guides, AWS best-practice links, and a
125
+ > disclaimer) and gates the project's FIRST deploy on an explicit acceptance —
126
+ > in a non-interactive run it exits with an error instead of prompting. When
127
+ > that happens: show the printed notice to the user **verbatim**, get their
128
+ > explicit consent, then re-run with `--accept-risk`. NEVER add `--accept-risk`
129
+ > without asking the user first.
130
+
131
+ > 🔒 **Inbound auth is auto-provisioned.** An AgentCore seller endpoint is
132
+ > **never anonymous**. When `agentcore.json` carries no authorizer of its own,
133
+ > the delegated deploy auto-provisions a Cognito inbound OAuth (account pool +
134
+ > per-agent M2M client) so the runtime is token-gated. To mint buyer
135
+ > credentials the operator manages directly, use the optional CDK path:
136
+ >
137
+ > 1. `bag deploy provision-cognito` emits a self-contained Cognito CDK app
138
+ > (UserPool + M2M app client) — the user runs `cdk deploy --outputs-file
139
+ > cdk-outputs.json` themselves.
140
+ > 2. `bag deploy provision-cognito --wire` reads that local outputs file and
141
+ > patches `agentcore.json`'s `authorizerConfiguration.customJwtAuthorizer` +
142
+ > the card's `OAUTH_TOKEN_URL` / `OAUTH_SCOPE` (no AWS call). The client
143
+ > secret is retrieved read-only in the AWS Console (Cognito → User pools →
144
+ > App clients → "Show client secret") — never persisted by studio.
145
+ >
146
+ > Buyers then reach the agent over plain HTTPS + an OAuth2 Bearer (the
147
+ > client-credentials grant) — **no AWS SigV4 / IAM credentials**. Locally,
148
+ > `bag dev` runs without Cognito env, so the card omits the scheme.
149
+
150
+ The 2026-07-20 live baseline passed both ZIP and linux/arm64 container through
151
+ deploy, status, OAuth-authenticated signed A2A negotiation, logs, destroy, and
152
+ purge. A SigV4 invoke against this custom-JWT endpoint is expected to fail; use
153
+ the buyer OAuth bearer when verifying the data plane. That baseline bypassed
154
+ local storage readiness and therefore does not prove funded delivery or durable
155
+ storage.
156
+
157
+ ```bash
158
+ # 1. Set the real AWS account + region in agentcore/aws-targets.json and
159
+ # export the deploy credentials (env vars or ~/.aws/credentials).
160
+ # 2. Check readiness, then deploy — the pinned bnbagent-deploy does the cloud work:
161
+ bag deploy prepare
162
+ bag deploy --provider aws
163
+ ```
164
+
165
+ > After deploy, ERC-8004 registration records the **AgentCore endpoint**:
166
+ > A2A uses the normalized agent-card URL (`AgentEndpoint.a2a`), while MCP records
167
+ > the `/mcp` endpoint plus access metadata. `bag deploy verify` handles this. The
168
+ > on-chain identity points buyers straight at the agent; there is no proxy or
169
+ > relay in front of it.
170
+
171
+ ### B1. Troubleshooting the delegated deploy
172
+
173
+ - **`could not start bnbagent-deploy (bunx not found)`** — install Bun 1.3+
174
+ (https://bun.sh) or set `BNBAGENT_DEPLOY_COMMAND` to a command that can run
175
+ the pinned `@bnbagent/deploy-cli`.
176
+ - **Permission denials (AccessDenied)** — the deploy identity is missing one
177
+ of the least-privilege statements; apply the policy JSON from
178
+ `docs/guides/agentcore-deploy-iam.md`. The deploy CLI preflight-simulates
179
+ its permissions when it can and names the denied actions.
180
+ - **Wrong account** — the credentials in the environment resolve to an account
181
+ that does not match `agentcore/aws-targets.json`; fix the env vars /
182
+ `~/.aws/credentials` profile, not the descriptor.
183
+ - **Container build fails / hangs** (twak) — the image is built LOCALLY for
184
+ linux/arm64 and pushed to ECR; Docker must be running (x86 machines need
185
+ buildx/containerd cross-build support).
186
+
187
+ ### C. Inspect / operate
188
+
189
+ ```bash
190
+ bag deploy status # every recorded provider + delegated live state
191
+ bag deploy logs --provider aws --since 1h # delegated CloudWatch tail
192
+ bag deploy verify --provider aws # delegated status + ERC-8004 reconcile
193
+ bag deploy destroy --provider aws # dry-run teardown plan
194
+ bag deploy destroy --provider aws --execute # delegated teardown (add --purge)
195
+ ```
196
+
197
+ ## Reference
198
+
199
+ - b402/x402 selling on self-hosted AgentCore: the rail activates in-process
200
+ when the B402 credentials are set, but there is no anonymous URL — operate
201
+ your own HTTP front that relays envelope-v1 over `InvokeAgentRuntime`. See
202
+ `bnbagent-studio-selling-via-b402` and `docs/guides/x402-selling.md`.
203
+ - `bag deploy --help` / `bag deploy <command> --help` (authoritative for commands + flags)
204
+ - `agentcore/agentcore.json` — name (resource naming continuity), protocol, authorizer, envVars
205
+ - `agentcore/aws-targets.json` — AWS account + region
206
+ - `app/agent/studio.toml [deploy.agentcore]` — provider-native deploy-spec passthrough
207
+ - `docs/guides/agentcore-deploy-iam.md` — least-privilege IAM for the delegated deploy
208
+ - `BNBAGENT_DEPLOY_COMMAND` — override the pinned `bunx --bun @bnbagent/deploy-cli@<pin>` invocation (E2E/dev)
@@ -0,0 +1,164 @@
1
+ ---
2
+ name: bnbagent-studio-use-azure-foundry
3
+ description: When the user wants to deploy or operate an A2A bnbagent-studio project on Azure AI Foundry Hosted Agents — scaffold with `bag init --runtime azure-foundry --protocol A2A`, deploy with `bag deploy --provider azure` (container-only Invocations contract; ALL cloud execution is delegated to pinned `@bnbagent/deploy-cli@0.4.14`, SDK/REST with browser login — no `az`/`azd` CLIs), and run lifecycle commands with `--provider azure` when multiple deployments exist. Native MCP deploy is not supported on Azure yet; use AgentCore for MCP.
4
+ ---
5
+
6
+ > **Reference file** of the `bnbagent-studio` router skill — installed at `bnbagent-studio/references/` and loaded on demand (not a standalone skill). Route here via the router's decision tree.
7
+
8
+ # bnbagent-studio-use-azure-foundry
9
+
10
+ > **Preview.** Azure Foundry support is fully wired and listed in the `--runtime` menu. The most recent end-to-end live verification predates the TypeScript rewrite — treat your first deploy as a verification run.
11
+
12
+ Procedure for deploying and operating the seller Agent on **Azure AI
13
+ Foundry Hosted Agents** (`[stack].runtime = "azure-foundry"`). ALL cloud
14
+ execution — browser login, Foundry onboarding, the container registry image
15
+ build/push, secret provisioning, and the RBAC self-grant — is **delegated to
16
+ the pinned `@bnbagent/deploy-cli`** (run via `bunx --bun`; override with
17
+ `BNBAGENT_DEPLOY_COMMAND`), whose Azure provider is **SDK/REST-only**. Studio
18
+ never shells out to (or requires) the `az` / `azd` CLIs.
19
+
20
+ ```
21
+ <workspace>/
22
+ ├── app/agent/ # the deployed code (src/foundryMain.ts host + Dockerfile here)
23
+ │ ├── studio.toml # [azure] block: location / account_name / subdomain / project_name / agent_endpoint
24
+ │ └── Dockerfile # the container image bnbagent-deploy builds + pushes
25
+ └── .studio/ # secrets + wallets (workspace root — never in the image)
26
+ ```
27
+
28
+ > **Deploy model: CONTAINER-ONLY.** The deploy-cli Azure provider rejects Node
29
+ > zip artifacts, so every azure-foundry deploy builds the scaffolded
30
+ > `app/agent/Dockerfile` **locally with Docker** (linux/amd64) and pushes it
31
+ > to the auto-provisioned Azure Container Registry; Foundry Agent Service
32
+ > pulls and runs the image. A running Docker daemon is required.
33
+
34
+ > **Protocol: A2A projects only for now.** The deployed Node host speaks
35
+ > Foundry's pass-through Invocations container contract on `:8088`
36
+ > (`GET /readiness`, `POST /invocations`). That endpoint is not native MCP
37
+ > streamable HTTP; `bag init` and provider selection reject azure-foundry +
38
+ > MCP instead of deploying a container that can never become ready.
39
+
40
+ > **Auth is a browser login.** The first delegated run opens a browser to sign
41
+ > in to the right tenant/subscription — there is no `az login` / `azd auth
42
+ > login` step and no CLI to install.
43
+
44
+ ## Prerequisites
45
+
46
+ 1. **Bun 1.3+ (`bunx`) on PATH** — the pinned `@bnbagent/deploy-cli` runs
47
+ through it.
48
+ 2. **Docker running** — the image is built locally (linux/amd64) before push.
49
+ 3. **An Azure subscription** the operator may provision in (Foundry
50
+ account/project, container registry, hosted agent); sign-in happens via
51
+ the browser at deploy time.
52
+
53
+ ## ⚠️ Foundry gotchas (read before deploying)
54
+
55
+ `bag deploy prepare --runtime azure-foundry` encodes these as checks, but know them:
56
+
57
+ - **Region must support Hosted Agents.** Default `eastus2`. `eastus` does NOT.
58
+ Prepare refuses an unsupported `[azure].location` (else deploy fails with
59
+ `Unsupported region for Foundry Hosted Agents`).
60
+ - **Account name MUST equal the custom subdomain.** The runtime derives
61
+ `https://{account_name}.services.ai.azure.com`; a mismatch resolves to
62
+ NXDOMAIN and the agent returns HTTP 500. `bag init` sets them equal — keep them
63
+ equal in `[azure]`.
64
+ - **Empty `APPLICATIONINSIGHTS_CONNECTION_STRING` crashes the exporter.** The
65
+ emitted entrypoint drops it when blank — don't remove that guard.
66
+ - **The hosted container contract is fixed.** Keep `AGENT_PORT=8088`,
67
+ `GET /readiness` returning HTTP 200, and `POST /invocations`. Local A2A still
68
+ runs on `:9000`; do not copy that local port into the Foundry Dockerfile.
69
+ - **Prepare checks are local-only.** They validate the scaffold (region,
70
+ subdomain, entrypoint + Dockerfile, an OpenAI-compatible `[llm]` provider,
71
+ twak readiness) without any cloud call; Azure auth happens at deploy time.
72
+
73
+ ## Runtime secrets — the delegated hand-off
74
+
75
+ `bag deploy --provider azure` bundles the runtime secrets (provider/storage keys,
76
+ `WALLET_PASSWORD`, the encrypted keystore as `WALLET_KEYSTORE_JSON` — plus the
77
+ `BNBAGENT_LLM_*` wiring the Foundry host reads) and hands them to
78
+ bnbagent-deploy as a private (mode 0600) tempdir envFile; the deploy CLI
79
+ provisions them for the hosted agent as **Foundry CustomKeys**. No vault setup,
80
+ no role assignments, and no cloud CLI on your side.
81
+
82
+ > The encrypted keystore (`.studio/wallets/`) stays at the workspace root and
83
+ > rides only that secret channel — never baked into the image.
84
+
85
+ Provider-native overrides go in the optional `studio.toml [deploy.foundry]`
86
+ table (verbatim deploy-spec keys; deploy-cli 0.4.14 consumes `account`, `cpu`,
87
+ `location`, `memory`, `project`, `projectEndpoint`, `protocol`, `registry` and
88
+ warns about anything else). The `[azure]` block's `account_name` /
89
+ `project_name` / `project_endpoint` / `location` win over conflicting
90
+ `[deploy.foundry]` keys.
91
+
92
+ ## Typical workflow
93
+
94
+ ### A. Scaffold
95
+
96
+ ```bash
97
+ bag init my-agent --runtime azure-foundry
98
+ ```
99
+
100
+ `bag init` makes no Azure calls; all cloud onboarding happens at deploy time.
101
+
102
+ ### B. Deploy
103
+
104
+ > **Preview, live E2E verified 2026-07-20.** The A2A azure-foundry path was
105
+ > verified through container build/push, CustomKeys wallet injection, hosted
106
+ > agent create/update, cold-start smoke, status, invoke, logs, a signed
107
+ > `negotiate`, and destroy. Foundry itself remains a preview service.
108
+
109
+ > ⚠️ **First deploy: relay the Azure-resource notice to the user.** `bag deploy
110
+ > --provider azure` prints a notice that the delegated deploy CREATES billable Azure
111
+ > resources (Foundry account/project, container registry, hosted agent
112
+ > container) under the signed-in subscription. Show it, get consent, then
113
+ > deploy.
114
+
115
+ ```bash
116
+ bag deploy prepare --runtime azure-foundry # local readiness gate (region/subdomain/Dockerfile)
117
+ bag deploy --provider azure # delegated: login → onboard → build+push → CustomKeys → deploy [--smoke]
118
+ ```
119
+
120
+ `bag deploy --provider azure` runs an HTTP contract smoke by default (pass
121
+ `--skip-smoke` to omit it) and captures the Foundry endpoint into
122
+ `app/agent/studio.toml [azure].agent_endpoint`. If Foundry creates the resource
123
+ but that post-create check fails, Studio still records the discovered endpoint
124
+ so `status`, `logs`, and `destroy` can manage the resource; the deploy command
125
+ continues to return non-zero.
126
+
127
+ ### C. Validate / operate
128
+
129
+ ```bash
130
+ bag deploy status # all recorded providers + live state
131
+ bag deploy logs --provider azure --limit 50 # delegated Hosted Agent logs
132
+ ```
133
+
134
+ The built-in smoke proves the container contract, not the seller signature.
135
+ For a release E2E, invoke with a complete `negotiate` envelope and require
136
+ `response.accepted=true`, a non-empty `negotiation_hash`, and `provider_sig`.
137
+ The Invocations body is `{"input":"<serialized skill JSON>"}`.
138
+
139
+ ### D. Tear down
140
+
141
+ ```bash
142
+ bag deploy destroy --provider azure # dry-run plan
143
+ bag deploy destroy --provider azure --execute # delegates `destroy --yes`
144
+ bag deploy destroy --provider azure --execute --purge # retained resources too
145
+ ```
146
+
147
+ `--purge` also removes the retained resources the deploy record tracks —
148
+ including the soft-deleted Cognitive Services account, freeing the custom
149
+ subdomain immediately (otherwise held ~48h). A successful teardown clears the
150
+ recorded `[azure].agent_endpoint`.
151
+
152
+ ## Scope note
153
+
154
+ Azure Foundry is an alternate runtime for the whole seller agent. There is no
155
+ separate keyless Layer B service to keep in sync; ERC-8183 seller delivery still
156
+ runs through the single signer runtime selected in `studio.toml [stack].runtime`.
157
+
158
+ ## Reference
159
+
160
+ - `bag deploy --help` / `bag deploy <command> --help` (authoritative for commands + flags)
161
+ - `app/agent/studio.toml [azure]` — location / account_name / subdomain /
162
+ project_name / agent_endpoint
163
+ - `app/agent/studio.toml [deploy.foundry]` — provider-native deploy-spec passthrough
164
+ - `BNBAGENT_DEPLOY_COMMAND` — override the pinned `bunx --bun @bnbagent/deploy-cli@<pin>` invocation (E2E/dev)
@@ -0,0 +1,92 @@
1
+ ---
2
+ name: bnbagent-studio-use-bnb-trial
3
+ description: Use when deploying or operating a bnbagent-studio seller on the BNB Chain managed 48h testnet trial, including GitHub device login, trial eligibility/expiry, staging verification, status, logs, verify, and destroy.
4
+ ---
5
+
6
+ > **Reference file** of the `bnbagent-studio` router skill. Load it only for
7
+ > provider `bnb` deployment work.
8
+
9
+ # Use the BNB Chain 48h trial
10
+
11
+ Treat this provider as a temporary testnet sandbox. Require a throwaway wallet,
12
+ keep `bsc-testnet`, and explain that the runtime signing material is transmitted
13
+ to the operator's managed secret store for the trial. Never use a mainnet key.
14
+
15
+ All auth and cloud lifecycle work must cross the pinned
16
+ `@bnbagent/deploy-cli@0.4.14` boundary. Do not call AWS/Azure CLIs or platform
17
+ REST routes directly.
18
+
19
+ ## Select and authenticate
20
+
21
+ Run:
22
+
23
+ ```bash
24
+ bag platform login
25
+ bag platform credit
26
+ bag deploy --provider bnb
27
+ ```
28
+
29
+ `bag platform login` must print the GitHub verification URL and device code. It
30
+ must not open a browser. Give both values to the user and wait for them to
31
+ complete verification.
32
+
33
+ Before offering BNB, inspect the trial result:
34
+
35
+ - `available`: selectable; explain that the 48h clock starts on first success.
36
+ - `active`: selectable; show remaining time and expiry immediately.
37
+ - `expired`: show the row and expiry, but mark it unavailable and do not select
38
+ it. AWS/Azure remain independently available when compatible with the
39
+ project scaffold.
40
+ - unknown/auth required: explain that eligibility cannot be confirmed until
41
+ login; the delegated deploy rechecks before building.
42
+
43
+ Every deploy/redeploy uses scheme C. Never silently reuse `[deploy].destination`
44
+ or the last provider. A sole active BNB record may produce an explicit “update
45
+ BNB” action. Switching to another compatible provider creates a coexisting
46
+ deployment; it does not destroy BNB automatically.
47
+
48
+ Automation requires `--provider bnb --yes`. When another provider remains
49
+ active, also require `--allow-multiple`.
50
+
51
+ ## Operate
52
+
53
+ ```bash
54
+ bag deploy status
55
+ bag deploy logs --provider bnb
56
+ bag deploy verify --provider bnb
57
+ bag deploy destroy --provider bnb # dry-run
58
+ bag deploy destroy --provider bnb --execute # destructive confirmation
59
+ ```
60
+
61
+ `status` lists every recorded provider and includes the live trial countdown.
62
+ Use `--no-probe` only when local records are desired. With multiple deployments,
63
+ logs/verify/destroy must select a provider interactively or pass `--provider`.
64
+
65
+ Destroy clears only the BNB lifecycle record after the delegated delete
66
+ succeeds. It does not delete the local keystore or the on-chain ERC-8004
67
+ identity. Destroyed BNB slugs are retired; choose a fresh slug before redeploy.
68
+
69
+ ## Manual staging verification
70
+
71
+ Use the staging endpoint only for the current shell:
72
+
73
+ ```bash
74
+ export BNBAGENT_API_URL=https://bnbagent-api.fe.kfkshore.org
75
+ bag platform login
76
+ bag platform credit
77
+ bag deploy --provider bnb
78
+ bag deploy status --provider bnb
79
+ bag deploy logs --provider bnb
80
+ bag deploy verify --provider bnb --skip-register
81
+ bag deploy destroy --provider bnb
82
+ ```
83
+
84
+ Do not execute the final destructive step until the user explicitly approves
85
+ `bag deploy destroy --provider bnb --execute`. For headless verification, use
86
+ `BNBAGENT_API_TOKEN`, `BNBAGENT_API_URL`, `--provider bnb`, and `--yes`.
87
+
88
+ Treat both artifact channels as required release coverage. The 2026-07-20
89
+ staging baseline passed ZIP and linux/arm64 container through deploy, status,
90
+ OAuth-authenticated signed A2A negotiation, logs, and destroy. Do not infer
91
+ funded delivery or durable-storage coverage from that smoke; those require the
92
+ separate commerce flow in `docs/guides/verification.md`.
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: bnbagent-studio-using-altana-wallet
3
+ description: Use when a bnbagent-studio project selects wallet.kind = "altana" and needs the encrypted admin keystore, bounded runtime session lifecycle, ERC-8183 quote checker, x402 allowance, local dev, or deployment limitation.
4
+ ---
5
+
6
+ # Using the Altana wallet
7
+
8
+ Altana separates trusted administration from runtime authority:
9
+
10
+ - `.studio/wallets/<address>.json` is the encrypted admin keystore.
11
+ - `.studio/wallets/altana-session.json` is the one bounded, expiring runtime
12
+ session and must stay mode `0600`.
13
+ - `WALLET_PASSWORD` is admin-only. The Agent gets `ALTANA_SESSION`, never the
14
+ password or admin keystore.
15
+ - Generic signing is refused. ERC-8183 uses `sessionQuoteSigner()` and the
16
+ approved quote checker.
17
+ - Deployment is deferred; `bag deploy --provider <provider>` hard-blocks before side effects.
18
+ - Altana refuses generic message signing, so Pieverse SIWE cannot authenticate
19
+ either `bag llm activate` or runtime credit renewal. An existing Pieverse key
20
+ is usable only with `auto/free`; use OpenRouter, OpenAI, or Anthropic for paid
21
+ models.
22
+
23
+ ## Procedure
24
+
25
+ ```bash
26
+ bag init <name> --wallet-kind altana --destination self --no-onboard
27
+ # Non-TTY defaults to OpenRouter. In a TTY, choose OpenRouter, OpenAI, or
28
+ # Anthropic from the provider menu; a flag remains available when desired:
29
+ # bag init <name> --wallet-kind altana --llm-provider anthropic --destination self
30
+ cd <name>/app/agent
31
+ export WALLET_PASSWORD='<strong password>'
32
+ bag wallet new
33
+ # fund the printed admin address with gas + U
34
+ bag wallet session grant
35
+ bag wallet session status
36
+ bag doctor
37
+ bag dev
38
+ ```
39
+
40
+ Interactive grant recommendations are 10 U/day, 30 days, register=yes. In a
41
+ non-TTY, pass `--budget-u`, `--expiry-days`, optional `--no-register`, and
42
+ `--yes`. Stdout from a successful grant is only the session public key.
43
+
44
+ If quote-checker approval fails after the paid grant, the owner-only session
45
+ file is preserved. Repair it with:
46
+
47
+ ```bash
48
+ bag wallet session grant --approve-only
49
+ ```
50
+
51
+ Replace with `grant --force`; the old on-chain revoke must succeed before the
52
+ new grant begins. Revoke with `bag wallet session revoke --yes`; the file is
53
+ deleted only after chain success.
54
+
55
+ x402 buying remains separate and exact-bounded:
56
+
57
+ ```bash
58
+ bag wallet session x402-setup --allowance-u <U> --yes
59
+ ```
60
+
61
+ Altana cannot be the b402 **seller** payout wallet (the rail allows
62
+ `evm-local` and `twak` only); init, `bag x402 sell init`, and deploy
63
+ readiness reject the combination. Only the outbound buying authority above
64
+ is available.
65
+
66
+ For troubleshooting, run `bag doctor` and `bag wallet session status`. Do not
67
+ print, parse, or copy the `signer` portion of the serialized session, and never
68
+ move `.studio/wallets/` under `app/agent/`.