@deepraxis/cli 0.2.2-dev.441fd40 → 0.2.2-dev.5a5e0cc

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 (2) hide show
  1. package/dist/praxis.js +26 -2
  2. package/package.json +1 -1
package/dist/praxis.js CHANGED
@@ -43502,6 +43502,30 @@ async function ensureContext(deps, agentId) {
43502
43502
  }
43503
43503
  }
43504
43504
  var bounded = (work, ms) => Promise.race([work, new Promise((_, reject) => setTimeout(() => reject(new Error("timed out")), ms))]);
43505
+ function refusedConnect(cause) {
43506
+ if (!(cause instanceof Error))
43507
+ return null;
43508
+ const match = /WebSocket error: \S+ (\d{3}) [^\n]*\n([\s\S]+)$/.exec(cause.message);
43509
+ if (!match)
43510
+ return null;
43511
+ const status = Number(match[1]);
43512
+ let body;
43513
+ try {
43514
+ body = JSON.parse(match[2].trim());
43515
+ } catch {
43516
+ return null;
43517
+ }
43518
+ if (typeof body?.code !== "string")
43519
+ return null;
43520
+ const retryAfter = typeof body.retryAfter === "number" && Number.isFinite(body.retryAfter) ? body.retryAfter : null;
43521
+ const message = typeof body.message === "string" ? body.message : undefined;
43522
+ return new PraxisError({
43523
+ status,
43524
+ code: body.code,
43525
+ message: `${message ?? body.code}${retryAfter === null ? "" : ` Retry after ${retryAfter} s.`}`,
43526
+ raw: body
43527
+ });
43528
+ }
43505
43529
  async function connectBrowser(deps, options = {}) {
43506
43530
  const { PRAXIS_API: api, PRAXIS_RUN_TOKEN: token, PRAXIS_AGENT_ID: agentId, PRAXIS_SESSION_ID: sessionId } = deps.env;
43507
43531
  const missing = ["PRAXIS_API", "PRAXIS_RUN_TOKEN", "PRAXIS_AGENT_ID", "PRAXIS_SESSION_ID"].filter((name) => !deps.env[name]);
@@ -43516,7 +43540,7 @@ async function connectBrowser(deps, options = {}) {
43516
43540
  try {
43517
43541
  browser = await playwright.chromium.connectOverCDP(url, { headers: { Authorization: `Bearer ${token}` }, timeout: 60000 });
43518
43542
  } catch (cause) {
43519
- throw unavailable(`Connecting to the cloud browser failed: ${cause.message.split(`
43543
+ throw refusedConnect(cause) ?? unavailable(`Connecting to the cloud browser failed: ${cause.message.split(`
43520
43544
  `)[0]}`);
43521
43545
  }
43522
43546
  const fs = node(deps, "node:fs");
@@ -46939,7 +46963,7 @@ function startProgress(ctx, write = (text) => writeOutput({ stderr: text })) {
46939
46963
  }
46940
46964
 
46941
46965
  // src/main.ts
46942
- var version = "0.2.2-dev.441fd40";
46966
+ var version = "0.2.2-dev.5a5e0cc";
46943
46967
  var commands = commandTree(operations);
46944
46968
  var manual = [...workflows.map((w) => w.words), [API_WORD]];
46945
46969
  function route(argv) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepraxis/cli",
3
- "version": "0.2.2-dev.441fd40",
3
+ "version": "0.2.2-dev.5a5e0cc",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "praxis": "dist/praxis.js"