@bnbagent/studio-cli 0.0.11-alpha.5 → 0.0.11-alpha.6
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/dist/bag.js
CHANGED
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
x402SellerIsFree,
|
|
53
53
|
x402SellerPricingState,
|
|
54
54
|
x402SellerUsesB402
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-VVHPUKLV.js";
|
|
56
56
|
import {
|
|
57
57
|
TWAK_CLI_MIN_VERSION,
|
|
58
58
|
TWAK_CLI_VERSION,
|
|
@@ -230,7 +230,7 @@ import {
|
|
|
230
230
|
var CAMPAIGN_DOC_URL = "https://www.bnbchain.org/en/blog/bnb-agent-studio-is-live-on-bnb-chain-ai-agents-from-one-prompt";
|
|
231
231
|
var CAMPAIGN_CHECK_TIMEOUT_MS = 6e3;
|
|
232
232
|
async function fetchCampaignActive() {
|
|
233
|
-
const { bnbPlatformApiUrl: bnbPlatformApiUrl2 } = await import("./deployCli-
|
|
233
|
+
const { bnbPlatformApiUrl: bnbPlatformApiUrl2 } = await import("./deployCli-5DZVAKMZ.js");
|
|
234
234
|
const controller = new AbortController();
|
|
235
235
|
const timer = setTimeout(() => controller.abort(), CAMPAIGN_CHECK_TIMEOUT_MS);
|
|
236
236
|
try {
|
|
@@ -3380,6 +3380,10 @@ function recordedX402Snapshot(azure) {
|
|
|
3380
3380
|
credentialsComplete
|
|
3381
3381
|
};
|
|
3382
3382
|
}
|
|
3383
|
+
function recordedX402Carrier(azure) {
|
|
3384
|
+
const carrier = text(azure.deployed_x402_carrier);
|
|
3385
|
+
return carrier === "http-envelope-v1" || carrier === "incompatible-scaffold" ? carrier : void 0;
|
|
3386
|
+
}
|
|
3383
3387
|
function descriptorName(workspaceRoot) {
|
|
3384
3388
|
try {
|
|
3385
3389
|
const data = JSON.parse(
|
|
@@ -3438,6 +3442,7 @@ function discoverRecordedDeployments(root) {
|
|
|
3438
3442
|
const azureDeploymentId = text(azure.deployment_id);
|
|
3439
3443
|
const azureFaces = protocolFaces(azure.deployed_faces);
|
|
3440
3444
|
const azureX402 = recordedX402Snapshot(azure);
|
|
3445
|
+
const azureX402Carrier = recordedX402Carrier(azure);
|
|
3441
3446
|
if (azureEndpoint || azureDeploymentId || text(azure.last_deploy_at)) {
|
|
3442
3447
|
found.push({
|
|
3443
3448
|
provider: "azure",
|
|
@@ -3447,6 +3452,7 @@ function discoverRecordedDeployments(root) {
|
|
|
3447
3452
|
endpoint: azureEndpoint,
|
|
3448
3453
|
...azureFaces ? { faces: azureFaces } : {},
|
|
3449
3454
|
...azureX402 ? { x402: azureX402 } : {},
|
|
3455
|
+
...azureX402Carrier ? { x402Carrier: azureX402Carrier } : {},
|
|
3450
3456
|
status: "active"
|
|
3451
3457
|
});
|
|
3452
3458
|
}
|
|
@@ -4167,6 +4173,52 @@ function isFile6(p) {
|
|
|
4167
4173
|
return false;
|
|
4168
4174
|
}
|
|
4169
4175
|
}
|
|
4176
|
+
function inspectAzureX402Carrier(agentRoot2) {
|
|
4177
|
+
const dockerfile = path16.join(agentRoot2, "Dockerfile");
|
|
4178
|
+
let entryStem = null;
|
|
4179
|
+
if (isFile6(dockerfile)) {
|
|
4180
|
+
const docker = fs17.readFileSync(dockerfile, "utf8");
|
|
4181
|
+
const match = docker.match(
|
|
4182
|
+
/(?:CMD|ENTRYPOINT)\s*\[\s*["']node["']\s*,\s*["'](?:\.\/)?dist\/([^"'/]+)\.js["']\s*\]/m
|
|
4183
|
+
);
|
|
4184
|
+
entryStem = match?.[1] ?? null;
|
|
4185
|
+
}
|
|
4186
|
+
if (entryStem === null) {
|
|
4187
|
+
return {
|
|
4188
|
+
status: "incompatible-scaffold",
|
|
4189
|
+
entrypoint: null,
|
|
4190
|
+
detail: "Dockerfile does not identify the built Azure entrypoint as CMD/ENTRYPOINT node dist/<name>.js"
|
|
4191
|
+
};
|
|
4192
|
+
}
|
|
4193
|
+
const entrypoint = `src/${entryStem}.ts`;
|
|
4194
|
+
const entryFile = path16.join(agentRoot2, entrypoint);
|
|
4195
|
+
if (!isFile6(entryFile)) {
|
|
4196
|
+
return {
|
|
4197
|
+
status: "incompatible-scaffold",
|
|
4198
|
+
entrypoint,
|
|
4199
|
+
detail: `${entrypoint} is selected by Dockerfile but its source is missing`
|
|
4200
|
+
};
|
|
4201
|
+
}
|
|
4202
|
+
const source = fs17.readFileSync(entryFile, "utf8").replace(/\/\*[\s\S]*?\*\//g, "").replace(/^\s*\/\/.*$/gm, "");
|
|
4203
|
+
const hasSeller = /\bX402Seller\s*\.\s*create\s*\(/m.test(source);
|
|
4204
|
+
const hasCarrier = /\bcreateEnvelopeMiddleware\s*\(/m.test(source);
|
|
4205
|
+
if (!hasSeller || !hasCarrier) {
|
|
4206
|
+
const missing = [
|
|
4207
|
+
...hasCarrier ? [] : ["createEnvelopeMiddleware"],
|
|
4208
|
+
...hasSeller ? [] : ["X402Seller.create"]
|
|
4209
|
+
];
|
|
4210
|
+
return {
|
|
4211
|
+
status: "incompatible-scaffold",
|
|
4212
|
+
entrypoint,
|
|
4213
|
+
detail: `${entrypoint} does not mount ${missing.join(" and ")}`
|
|
4214
|
+
};
|
|
4215
|
+
}
|
|
4216
|
+
return {
|
|
4217
|
+
status: "http-envelope-v1",
|
|
4218
|
+
entrypoint,
|
|
4219
|
+
detail: `${entrypoint} mounts the X402 seller and envelope carrier`
|
|
4220
|
+
};
|
|
4221
|
+
}
|
|
4170
4222
|
function tableOf4(cfg, key) {
|
|
4171
4223
|
const v = cfg[key];
|
|
4172
4224
|
return v !== null && typeof v === "object" && !Array.isArray(v) ? v : {};
|
|
@@ -4195,11 +4247,13 @@ function recordAzureDeployment(root, data, endpoint) {
|
|
|
4195
4247
|
const tomlPath = path16.join(agentRoot2, "studio.toml");
|
|
4196
4248
|
let deployedFaces = null;
|
|
4197
4249
|
let deployedX402 = null;
|
|
4250
|
+
let deployedX402Carrier = null;
|
|
4198
4251
|
try {
|
|
4199
4252
|
const cfg = loadStudioCfg(deployWorkspaceRoot(root));
|
|
4200
4253
|
deployedFaces = stackFaces(tableOf4(cfg, "stack"), tableOf4(cfg, "payments"));
|
|
4201
4254
|
if (hasX402Face(deployedFaces)) {
|
|
4202
4255
|
deployedX402 = x402DeploymentSnapshot(agentRoot2, "self");
|
|
4256
|
+
deployedX402Carrier = inspectAzureX402Carrier(agentRoot2).status;
|
|
4203
4257
|
}
|
|
4204
4258
|
} catch {
|
|
4205
4259
|
}
|
|
@@ -4233,6 +4287,12 @@ function recordAzureDeployment(root, data, endpoint) {
|
|
|
4233
4287
|
"deployed_x402_credentials_complete",
|
|
4234
4288
|
deployedX402?.credentialsComplete ?? false
|
|
4235
4289
|
);
|
|
4290
|
+
patchTomlKv(
|
|
4291
|
+
tomlPath,
|
|
4292
|
+
"azure",
|
|
4293
|
+
"deployed_x402_carrier",
|
|
4294
|
+
deployedX402Carrier ?? ""
|
|
4295
|
+
);
|
|
4236
4296
|
}
|
|
4237
4297
|
patchTomlKv(tomlPath, "azure", "last_deploy_at", (/* @__PURE__ */ new Date()).toISOString());
|
|
4238
4298
|
} catch {
|
|
@@ -4255,6 +4315,7 @@ function clearAzureEndpoint(root) {
|
|
|
4255
4315
|
patchTomlKv(tomlPath, "azure", "deployed_x402_status", "");
|
|
4256
4316
|
patchTomlKv(tomlPath, "azure", "deployed_x402_price_mode", "");
|
|
4257
4317
|
patchTomlKv(tomlPath, "azure", "deployed_x402_credentials_complete", false);
|
|
4318
|
+
patchTomlKv(tomlPath, "azure", "deployed_x402_carrier", "");
|
|
4258
4319
|
} catch {
|
|
4259
4320
|
}
|
|
4260
4321
|
}
|
|
@@ -4551,6 +4612,20 @@ var checkEntrypointAndDockerfile = async (root, _target) => {
|
|
|
4551
4612
|
details: { entrypoint: entry }
|
|
4552
4613
|
});
|
|
4553
4614
|
}
|
|
4615
|
+
if (hasX402Face(faces)) {
|
|
4616
|
+
const carrier = inspectAzureX402Carrier(agentRoot2);
|
|
4617
|
+
if (carrier.status !== "http-envelope-v1") {
|
|
4618
|
+
findings.push({
|
|
4619
|
+
level: "CRITICAL",
|
|
4620
|
+
name: "azure_x402_entrypoint_compatible",
|
|
4621
|
+
message: `${carrier.detail}. This scaffold cannot serve X402 even though studio.toml enables it. In a clean parent directory, run \`bag init azurex402migration --runtime azure-foundry --protocols ${faces.join(",")} --no-install --no-onboard\`, then review and merge its src/unifiedMain.ts, Dockerfile, and package scripts before redeploying. Studio will not overwrite user-owned agent code.`,
|
|
4622
|
+
details: {
|
|
4623
|
+
entrypoint: carrier.entrypoint,
|
|
4624
|
+
carrier: carrier.status
|
|
4625
|
+
}
|
|
4626
|
+
});
|
|
4627
|
+
}
|
|
4628
|
+
}
|
|
4554
4629
|
if (!isFile6(path16.join(agentRoot2, "Dockerfile"))) {
|
|
4555
4630
|
findings.push({
|
|
4556
4631
|
level: "CRITICAL",
|
|
@@ -16859,17 +16934,20 @@ function printAzureInfo(root, deployment, opts) {
|
|
|
16859
16934
|
const x402State = deployment.x402 ?? currentX402;
|
|
16860
16935
|
const x402StateSource = deployment.x402 ? "deployment-record" : "current-scaffold";
|
|
16861
16936
|
const x402Drift = deployment.x402 !== void 0 && !sameX402Snapshot(deployment.x402, currentX402);
|
|
16862
|
-
const
|
|
16863
|
-
const
|
|
16937
|
+
const currentCarrier = hasX402Face(currentFaces) ? inspectAzureX402Carrier(agentRoot2).status : null;
|
|
16938
|
+
const carrierDrift = deployment.x402Carrier !== void 0 && deployment.x402Carrier !== currentCarrier;
|
|
16939
|
+
const configurationDrift = facesDrift || x402Drift || carrierDrift;
|
|
16940
|
+
const carrierVerified = deployment.x402Carrier === "http-envelope-v1";
|
|
16941
|
+
const x402Summary = hasX402 ? carrierVerified ? deployment.x402 ? x402DeploySummaryFromSnapshot(
|
|
16864
16942
|
deployment.x402,
|
|
16865
16943
|
"azure-foundry",
|
|
16866
16944
|
"self",
|
|
16867
16945
|
null
|
|
16868
|
-
) : x402DeploySummary(agentRoot2, "self", null) : "";
|
|
16869
|
-
const x402Status = x402State?.status ?? (x402Summary.includes("ACTIVE in FREE mode") ? "free" : x402Summary.startsWith("x402 rail is ACTIVE") ? "active" : "dormant");
|
|
16870
|
-
const x402Body = hasX402 ? azureX402CarrierBody() : void 0;
|
|
16871
|
-
const body = hasA2a
|
|
16872
|
-
const x402Info = hasX402 ? {
|
|
16946
|
+
) : x402DeploySummary(agentRoot2, "self", null) : deployment.x402Carrier === "incompatible-scaffold" ? "The deployed Azure entrypoint did not mount createEnvelopeMiddleware and X402Seller. Re-scaffold the unified entrypoint, review the diff, and redeploy." : "This deployment record predates X402 carrier verification, so the deployed artifact cannot be treated as X402-capable. Verify or migrate the unified entrypoint and redeploy." : "";
|
|
16947
|
+
const x402Status = carrierVerified ? x402State?.status ?? (x402Summary.includes("ACTIVE in FREE mode") ? "free" : x402Summary.startsWith("x402 rail is ACTIVE") ? "active" : "dormant") : "incompatible-scaffold";
|
|
16948
|
+
const x402Body = hasX402 && carrierVerified ? azureX402CarrierBody() : void 0;
|
|
16949
|
+
const body = hasA2a ? azureNegotiateQuickVerifyBody() : x402Body;
|
|
16950
|
+
const x402Info = hasX402 ? carrierVerified ? {
|
|
16873
16951
|
status: x402Status,
|
|
16874
16952
|
access: x402Status === "dormant" ? "dormant" : "requires-external-gateway",
|
|
16875
16953
|
public_url: null,
|
|
@@ -16885,6 +16963,12 @@ function printAzureInfo(root, deployment, opts) {
|
|
|
16885
16963
|
executes_seller_work: false
|
|
16886
16964
|
}
|
|
16887
16965
|
}
|
|
16966
|
+
} : {
|
|
16967
|
+
status: "incompatible-scaffold",
|
|
16968
|
+
access: "incompatible-scaffold",
|
|
16969
|
+
public_url: null,
|
|
16970
|
+
summary: x402Summary,
|
|
16971
|
+
state_source: deployment.x402Carrier ? "deployment-record" : "unverified-deployment"
|
|
16888
16972
|
} : void 0;
|
|
16889
16973
|
if (opts.json) {
|
|
16890
16974
|
printOut(
|
|
@@ -16903,11 +16987,11 @@ function printAzureInfo(root, deployment, opts) {
|
|
|
16903
16987
|
resource: AZURE_FOUNDRY_TOKEN_RESOURCE,
|
|
16904
16988
|
scope: AZURE_FOUNDRY_TOKEN_SCOPE
|
|
16905
16989
|
},
|
|
16906
|
-
request: {
|
|
16990
|
+
request: body ? {
|
|
16907
16991
|
method: "POST",
|
|
16908
16992
|
content_type: "application/json",
|
|
16909
16993
|
body
|
|
16910
|
-
},
|
|
16994
|
+
} : null,
|
|
16911
16995
|
...x402Info ? { x402: x402Info } : {}
|
|
16912
16996
|
},
|
|
16913
16997
|
null,
|
|
@@ -16927,10 +17011,18 @@ function printAzureInfo(root, deployment, opts) {
|
|
|
16927
17011
|
printOut(
|
|
16928
17012
|
` authentication: Microsoft Entra bearer token (resource ${AZURE_FOUNDRY_TOKEN_RESOURCE}; SDK scope ${AZURE_FOUNDRY_TOKEN_SCOPE})`
|
|
16929
17013
|
);
|
|
16930
|
-
|
|
16931
|
-
|
|
17014
|
+
if (body) {
|
|
17015
|
+
printOut(" request: POST application/json");
|
|
17016
|
+
printOut(` body: ${JSON.stringify(body)}`);
|
|
17017
|
+
} else {
|
|
17018
|
+
printOut(
|
|
17019
|
+
" request: unavailable until the X402 scaffold is migrated and redeployed"
|
|
17020
|
+
);
|
|
17021
|
+
}
|
|
16932
17022
|
if (x402Info) {
|
|
16933
|
-
if (x402Info.access === "
|
|
17023
|
+
if (x402Info.access === "incompatible-scaffold") {
|
|
17024
|
+
printOut(` x402 access: incompatible-scaffold \u2014 ${x402Info.summary}`);
|
|
17025
|
+
} else if (x402Info.access === "dormant") {
|
|
16934
17026
|
printOut(` x402 access: dormant \u2014 ${x402Info.summary}`);
|
|
16935
17027
|
} else {
|
|
16936
17028
|
printOut(
|
|
@@ -16947,7 +17039,7 @@ function printAzureInfo(root, deployment, opts) {
|
|
|
16947
17039
|
printOut(` x402 gateway guide: ${foundryX402GatewayGuideUrl()}`);
|
|
16948
17040
|
}
|
|
16949
17041
|
}
|
|
16950
|
-
if (opts.withCurl) {
|
|
17042
|
+
if (opts.withCurl && body) {
|
|
16951
17043
|
printOut(
|
|
16952
17044
|
hasA2a ? "\nQuick-verify curl:" : "\nX402 no-work route-probe curl:"
|
|
16953
17045
|
);
|
|
@@ -16964,6 +17056,10 @@ function printAzureInfo(root, deployment, opts) {
|
|
|
16964
17056
|
printOut(
|
|
16965
17057
|
"\n The Azure CLI command is only a convenient way to mint a token for this curl. Deployment itself does not require az/azd; DefaultAzureCredential or ClientSecretCredential can mint the same scope in an application."
|
|
16966
17058
|
);
|
|
17059
|
+
} else if (opts.withCurl) {
|
|
17060
|
+
printErr(
|
|
17061
|
+
"warning: no X402 curl was emitted because the recorded Azure deployment does not prove http-envelope-v1 support; migrate and redeploy first."
|
|
17062
|
+
);
|
|
16967
17063
|
}
|
|
16968
17064
|
return 0;
|
|
16969
17065
|
}
|
|
@@ -686,8 +686,8 @@ function packageRoot() {
|
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
688
|
function studioCliVersion() {
|
|
689
|
-
if ("0.0.11-alpha.
|
|
690
|
-
return "0.0.11-alpha.
|
|
689
|
+
if ("0.0.11-alpha.6") {
|
|
690
|
+
return "0.0.11-alpha.6";
|
|
691
691
|
}
|
|
692
692
|
const file = path3.join(packageRoot(), "package.json");
|
|
693
693
|
const pkg = JSON.parse(fs3.readFileSync(file, "utf-8"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bnbagent/studio-cli",
|
|
3
|
-
"version": "0.0.11-alpha.
|
|
3
|
+
"version": "0.0.11-alpha.6",
|
|
4
4
|
"description": "Skills-first toolkit and bag CLI for BNB Chain seller agents: ERC-8004 identity, ERC-8183 escrowed commerce, and x402 payments.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bnb-chain",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"tar": "^7.4.0",
|
|
55
55
|
"viem": "^2.54.0",
|
|
56
56
|
"yaml": "^2.9.0",
|
|
57
|
-
"@bnbagent/studio-runtime": "0.0.11-alpha.
|
|
57
|
+
"@bnbagent/studio-runtime": "0.0.11-alpha.6"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@a2a-js/sdk": "^0.3.14",
|