@lambdacurry/arbor 0.21.40 → 0.21.42

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/arbor.js +10 -6
  2. package/package.json +1 -1
package/dist/arbor.js CHANGED
@@ -16,7 +16,7 @@ var __export = (target, all) => {
16
16
  // package.json
17
17
  var package_default = {
18
18
  name: "@lambdacurry/arbor",
19
- version: "0.21.40",
19
+ version: "0.21.42",
20
20
  description: "The Arbor CLI — a shared workspace for people and agents. The human + headless-agent write path over Arbor's guarded operation surface.",
21
21
  keywords: [
22
22
  "agents",
@@ -22792,7 +22792,7 @@ async function runObjectVerb(positionals, flags, ctx) {
22792
22792
 
22793
22793
  // src/connect.ts
22794
22794
  var DEFAULT_POLL_INTERVAL_MS = 2000;
22795
- var sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
22795
+ var sleep2 = (ms) => new Promise((r) => globalThis.setTimeout(r, ms));
22796
22796
  function bareConnectUrl(apiUrl, returnedUrl) {
22797
22797
  const fallback = `${apiUrl.replace(/\/$/, "")}/connect`;
22798
22798
  if (!returnedUrl)
@@ -22821,7 +22821,7 @@ async function connect(opts) {
22821
22821
  throw new Error(`could not start pairing (${initRes.status}): ${init.error ?? "is the server reachable?"}`);
22822
22822
  }
22823
22823
  const approvalUrl = bareConnectUrl(apiUrl, init.url);
22824
- process.stderr.write(`
22824
+ writeStderr(`
22825
22825
  Pairing against ${apiUrl}
22826
22826
  ` + ` Ask the person who will manage this agent${init.agentName ? ` (“${init.agentName}”)` : ""} to approve it:
22827
22827
  ` + ` 1. open ${approvalUrl}
@@ -22836,7 +22836,6 @@ async function connect(opts) {
22836
22836
  if (Date.now() > deadline) {
22837
22837
  throw new Error("pairing timed out — ask for a new pairing key and run `arbor connect` again");
22838
22838
  }
22839
- await sleep2(pollIntervalMs);
22840
22839
  const tokRes = await fetch(`${apiUrl}/api/agent/connect/token`, {
22841
22840
  method: "POST",
22842
22841
  headers,
@@ -22847,8 +22846,13 @@ async function connect(opts) {
22847
22846
  saveConfig({ apiUrl, token: tok.apiKey });
22848
22847
  return;
22849
22848
  }
22850
- if (tok.status === "pending")
22849
+ if (tok.status === "pending") {
22850
+ if (typeof globalThis.setTimeout !== "function") {
22851
+ throw new Error("approval pending — approve it, then rerun the same `arbor connect` command to finish saving this agent's credential");
22852
+ }
22853
+ await sleep2(pollIntervalMs);
22851
22854
  continue;
22855
+ }
22852
22856
  if (tok.status === "expired")
22853
22857
  throw new Error("pairing expired — ask for a new pairing key");
22854
22858
  if (tok.status === "consumed")
@@ -22873,7 +22877,7 @@ async function login(opts) {
22873
22877
  if (!codeRes.ok)
22874
22878
  throw new Error(`could not start device login (${codeRes.status}). Is ${apiUrl} running?`);
22875
22879
  const code = await codeRes.json();
22876
- process.stderr.write(`
22880
+ writeStderr(`
22877
22881
  To authorize the Arbor CLI:
22878
22882
  ` + ` 1. open ${code.verification_uri}
22879
22883
  ` + ` 2. enter the code: ${code.user_code}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambdacurry/arbor",
3
- "version": "0.21.40",
3
+ "version": "0.21.42",
4
4
  "description": "The Arbor CLI — a shared workspace for people and agents. The human + headless-agent write path over Arbor's guarded operation surface.",
5
5
  "keywords": [
6
6
  "agents",