@bnbagent/deploy-provider-bnb 0.3.0 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bnbagent/deploy-provider-bnb",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "description": "BNB Chain trial-platform provider for @bnbagent/deploy — deploys agents to the managed free-trial runtime (bnbagent-api) over plain HTTPS: GitHub device-flow login, zip artifact upload, deploy + poll. No cloud credentials of your own.",
6
6
  "license": "Apache-2.0",
@@ -20,7 +20,7 @@
20
20
  "@bnbagent/deploy-core": "*"
21
21
  },
22
22
  "devDependencies": {
23
- "@bnbagent/deploy-core": "^0.3.0",
23
+ "@bnbagent/deploy-core": "^0.3.1",
24
24
  "@types/bun": "^1.3.0",
25
25
  "typescript": "^5.7.0"
26
26
  }
package/src/client.ts CHANGED
@@ -40,7 +40,7 @@ export function apiUrl(ctx: Context): string {
40
40
 
41
41
  /**
42
42
  * Automation/CI bearer: a platform API token (`bnbk_…`, minted with
43
- * `bnbagent-deploy token --new`) via BNBAGENT_API_TOKEN. When set it REPLACES
43
+ * `bnbagent-deploy token --provider bnb --new`) via BNBAGENT_API_TOKEN. When set it REPLACES
44
44
  * the session entirely — no device flow, no refresh, no session file.
45
45
  */
46
46
  export function envApiToken(): string | undefined {
@@ -116,7 +116,7 @@ export async function authedRequest(
116
116
  throw new BnbApiError(
117
117
  401,
118
118
  "auth.token_invalid",
119
- "BNBAGENT_API_TOKEN was rejected (revoked/expired?) — mint a new one: `bnbagent-deploy token --new` (while signed in).",
119
+ "BNBAGENT_API_TOKEN was rejected (revoked/expired?) — mint a new one: `bnbagent-deploy token --provider bnb --new` (while signed in).",
120
120
  );
121
121
  }
122
122
  throw e;
@@ -127,7 +127,7 @@ export async function authedRequest(
127
127
  throw new BnbApiError(
128
128
  401,
129
129
  "auth.signed_out",
130
- "Not signed in — run `bnbagent-deploy login` first (CI: set BNBAGENT_API_TOKEN).",
130
+ "Not signed in — run `bnbagent-deploy login --provider bnb` first (CI: set BNBAGENT_API_TOKEN).",
131
131
  );
132
132
  }
133
133
  // Host-bind the token: never send a session minted against platform A to a
@@ -138,7 +138,7 @@ export async function authedRequest(
138
138
  401,
139
139
  "auth.host_mismatch",
140
140
  `Your session was minted against ${session.apiUrl}, but this command targets ${base}. ` +
141
- `Refusing to send credentials cross-host — run \`bnbagent-deploy login\` against ${base}.`,
141
+ `Refusing to send credentials cross-host — run \`bnbagent-deploy login --provider bnb\` against ${base}.`,
142
142
  );
143
143
  }
144
144
  try {
@@ -155,7 +155,7 @@ async function refreshSession(base: string, session: Session): Promise<Session>
155
155
  return withSessionLock(async () => {
156
156
  const fresh = await loadSession();
157
157
  if (!fresh || !sameOrigin(fresh.apiUrl, base)) {
158
- throw new BnbApiError(401, "auth.expired", "Session expired — run `bnbagent-deploy login` again.");
158
+ throw new BnbApiError(401, "auth.expired", "Session expired — run `bnbagent-deploy login --provider bnb` again.");
159
159
  }
160
160
  if (fresh.refresh_token !== session.refresh_token) {
161
161
  return fresh;
@@ -170,7 +170,7 @@ async function refreshSession(base: string, session: Session): Promise<Session>
170
170
  throw new BnbApiError(
171
171
  401,
172
172
  "auth.expired",
173
- `Session expired${detail} — run \`bnbagent-deploy login\` again.`,
173
+ `Session expired${detail} — run \`bnbagent-deploy login --provider bnb\` again.`,
174
174
  );
175
175
  }
176
176
  const next: Session = { apiUrl: base, access_token: res.access_token, refresh_token: res.refresh_token };
package/src/extras.ts CHANGED
@@ -27,7 +27,7 @@ const emit = (data: unknown): void => {
27
27
  };
28
28
 
29
29
  /**
30
- * `bnbagent-deploy trial [--json]` — the structured trial-clock read
30
+ * `bnbagent-deploy trial --provider bnb [--json]` — the structured trial-clock read
31
31
  * (GET /v1/account/trial: case/started_at/expires_at/remaining_seconds).
32
32
  * Account-level: works in any directory. Orchestrators gate deploy offers on it.
33
33
  */
@@ -104,7 +104,7 @@ export async function clientsCmd(spec: DeploymentSpec | undefined, ctx: Context)
104
104
  }
105
105
 
106
106
  /**
107
- * `bnbagent-deploy token [--new | --revoke <id>] [--json]` (default: list).
107
+ * `bnbagent-deploy token --provider bnb [--new | --revoke <id>] [--json]` (default: list).
108
108
  * Account-level — usable in ANY directory (`--provider bnb` + BNBAGENT_API_URL
109
109
  * outside a project); the spec, when present, only supplies [bnb] apiUrl.
110
110
  */
@@ -138,7 +138,7 @@ export async function tokenCmd(_spec: DeploymentSpec | undefined, ctx: Context):
138
138
  return;
139
139
  }
140
140
  if (!list.tokens.length) {
141
- ctx.logger.info("No API tokens yet — mint one: bnbagent-deploy token --new");
141
+ ctx.logger.info("No API tokens yet — mint one: bnbagent-deploy token --provider bnb --new");
142
142
  return;
143
143
  }
144
144
  for (const t of list.tokens) {
@@ -146,5 +146,5 @@ export async function tokenCmd(_spec: DeploymentSpec | undefined, ctx: Context):
146
146
  `${t.prefix ?? "bnbk_…"} ${t.scope ?? "tenant"} expires ${t.expires_at ?? "never"} (id ${t.id})`,
147
147
  );
148
148
  }
149
- ctx.logger.info("Revoke one: bnbagent-deploy token --revoke <id>");
149
+ ctx.logger.info("Revoke one: bnbagent-deploy token --provider bnb --revoke <id>");
150
150
  }
package/src/index.ts CHANGED
@@ -221,7 +221,13 @@ const bnbProvider: CloudProvider = {
221
221
  if (envApiToken()) return [{ level: "info", code: "auth.ok", message: "BNBAGENT_API_TOKEN is set (CI bearer)." }];
222
222
  const session = await loadSession();
223
223
  if (!session) {
224
- return [{ level: "error", code: "auth.signed_out", message: "No session and no BNBAGENT_API_TOKEN — run `bnbagent-deploy login`." }];
224
+ return [
225
+ {
226
+ level: "error",
227
+ code: "auth.signed_out",
228
+ message: "No session and no BNBAGENT_API_TOKEN — run `bnbagent-deploy login --provider bnb`.",
229
+ },
230
+ ];
225
231
  }
226
232
  return [{ level: "info", code: "auth.ok", message: `Session present (minted against ${session.apiUrl}).` }];
227
233
  },
@@ -254,7 +260,7 @@ const bnbProvider: CloudProvider = {
254
260
  if ("status" in res && res.status === "slow_down") interval += 5;
255
261
  // authorization_pending → keep polling
256
262
  }
257
- throw new Error("Device-flow sign-in timed out — run `bnbagent-deploy login` again.");
263
+ throw new Error("Device-flow sign-in timed out — run `bnbagent-deploy login --provider bnb` again.");
258
264
  },
259
265
 
260
266
  /** Show the signed-in identity (GitHub login) + trial clock. */
@@ -262,7 +268,7 @@ const bnbProvider: CloudProvider = {
262
268
  const session = await loadSession();
263
269
  const viaToken = envApiToken();
264
270
  if (!session && !viaToken) {
265
- ctx.logger.info("Not signed in to the trial platform (run `bnbagent-deploy login`).");
271
+ ctx.logger.info("Not signed in to the trial platform (run `bnbagent-deploy login --provider bnb`).");
266
272
  return;
267
273
  }
268
274
  try {
@@ -280,7 +286,7 @@ const bnbProvider: CloudProvider = {
280
286
  }
281
287
  } catch (e) {
282
288
  if (e instanceof BnbApiError && e.status === 401) {
283
- ctx.logger.info("Session expired — run `bnbagent-deploy login` again.");
289
+ ctx.logger.info("Session expired — run `bnbagent-deploy login --provider bnb` again.");
284
290
  return;
285
291
  }
286
292
  throw e;
@@ -326,7 +332,7 @@ const bnbProvider: CloudProvider = {
326
332
  level: "error",
327
333
  code: "auth.signed_out",
328
334
  message: "Not signed in to the trial platform.",
329
- hint: "Run: bnbagent-deploy login (CI: set BNBAGENT_API_TOKEN)",
335
+ hint: "Run: bnbagent-deploy login --provider bnb (CI: set BNBAGENT_API_TOKEN)",
330
336
  });
331
337
  } else if (!apiToken && session && base && session.apiUrl && !sameOrigin(session.apiUrl, base)) {
332
338
  // Parity with authedRequest's host binding: a token minted against
@@ -336,7 +342,8 @@ const bnbProvider: CloudProvider = {
336
342
  level: "error",
337
343
  code: "auth.host_mismatch",
338
344
  message: `Signed in against ${session.apiUrl}, but this spec targets ${base} — authenticated calls would be refused.`,
339
- hint: "Run: bnbagent-deploy login (against the current apiUrl), or fix [bnb] apiUrl / BNBAGENT_API_URL.",
345
+ hint:
346
+ "Run: bnbagent-deploy login --provider bnb (against the current apiUrl), or fix [bnb] apiUrl / BNBAGENT_API_URL.",
340
347
  });
341
348
  }
342
349
  try {
package/src/init.ts CHANGED
@@ -49,7 +49,7 @@ apiUrl = "${apiUrl || "https://<the-trial-platform-host>"}"
49
49
  ctx.logger.success(`Wrote ${file}`);
50
50
  if (!apiUrl) ctx.logger.warn("Set [bnb] apiUrl (or BNBAGENT_API_URL) before deploying — there is no default.");
51
51
  ctx.logger.info("Next steps:");
52
- ctx.logger.info(" 1. bnbagent-deploy login (GitHub device flow)");
52
+ ctx.logger.info(" 1. bnbagent-deploy login --provider bnb (GitHub device flow)");
53
53
  ctx.logger.info(" 2. bnbagent-deploy pack (Python zip projects — vendors arm64 deps)");
54
54
  ctx.logger.info(" 3. bnbagent-deploy deploy");
55
55
  }