@equationalapplications/mcp-server 7.16.0 → 7.17.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/dist/cli.mjs CHANGED
@@ -103,12 +103,14 @@ async function registerByEmail(client, email, opts) {
103
103
  }
104
104
  let ambiguousPoll = false;
105
105
  let intervalSeconds = Math.max(1, reg.poll.interval ?? 5);
106
+ let lastRemedy = null;
107
+ let remedyBackoffSeconds = 0;
106
108
  opts.info(`Check ${email} for a SynapseTree approval link (usually within a minute; it expires in 15 minutes).`);
107
109
  opts.info(`Approve only if the page shows this code: ${reg.user_code}`);
108
110
  for (; ; ) {
109
111
  const remaining = deadline - now();
110
112
  if (remaining <= 0) throw new ClaimError("invalid_grant", EXPIRED_MESSAGE);
111
- await sleep(Math.min(Math.max(intervalSeconds, 1), 60, remaining) * 1e3);
113
+ await sleep(Math.min(Math.max(intervalSeconds + remedyBackoffSeconds, 1) * 1e3, 6e4, remaining));
112
114
  let res;
113
115
  try {
114
116
  res = await client.call("oauthToken", { form: { grant_type: reg.poll.grant, assertion: reg.claim_token } });
@@ -134,9 +136,13 @@ async function registerByEmail(client, email, opts) {
134
136
  switch (body.error) {
135
137
  case "authorization_pending":
136
138
  if (typeof body.interval === "number") intervalSeconds = Math.max(1, body.interval);
139
+ lastRemedy = null;
140
+ remedyBackoffSeconds = 0;
137
141
  continue;
138
142
  case "slow_down":
139
143
  intervalSeconds = typeof body.interval === "number" ? Math.max(1, body.interval) : intervalSeconds + 5;
144
+ lastRemedy = null;
145
+ remedyBackoffSeconds = 0;
140
146
  continue;
141
147
  case "invalid_grant":
142
148
  throw new ClaimError(
@@ -145,8 +151,13 @@ async function registerByEmail(client, email, opts) {
145
151
  );
146
152
  default:
147
153
  if (REMEDY_CODES.has(body.error)) {
148
- opts.info(`${body.error}: ${body.error_description ?? "the account owner must clear this in the dashboard"}${body.error_uri ? ` \u2014 ${body.error_uri}` : ""}`);
149
- opts.info("Waiting; approve again once it is fixed.");
154
+ if (body.error !== lastRemedy) {
155
+ opts.info(`${body.error}: ${body.error_description ?? "the account owner must clear this in the dashboard"}${body.error_uri ? ` \u2014 ${body.error_uri}` : ""}`);
156
+ opts.info("Waiting; approve again once it is fixed.");
157
+ lastRemedy = body.error;
158
+ }
159
+ if (typeof body.interval === "number") intervalSeconds = Math.max(1, body.interval);
160
+ remedyBackoffSeconds = Math.min(remedyBackoffSeconds + 5, 25);
150
161
  continue;
151
162
  }
152
163
  throw new ClaimError(body.error, `${body.error}${body.error_description ? `: ${body.error_description}` : ""}`);
@@ -4502,7 +4513,7 @@ var TOOLS = [
4502
4513
  TOOLS.map((t) => t.name);
4503
4514
 
4504
4515
  // src/version.ts
4505
- var VERSION = "7.16.0" ;
4516
+ var VERSION = "7.17.1" ;
4506
4517
 
4507
4518
  // src/server.ts
4508
4519
  var SERVER_NAME = "synapsetree";