@lazehq/cli 0.1.127 → 0.1.128
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/laze.mjs +59 -8
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -36960,7 +36960,7 @@ function shadowedLinkLineOf({ shadow }) {
|
|
|
36960
36960
|
}
|
|
36961
36961
|
|
|
36962
36962
|
// src/rules/cli-version.rules.ts
|
|
36963
|
-
var STAMPED = "0.1.
|
|
36963
|
+
var STAMPED = "0.1.128";
|
|
36964
36964
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
36965
36965
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
36966
36966
|
}
|
|
@@ -84976,6 +84976,40 @@ function loginValuesOf({
|
|
|
84976
84976
|
return username ? { username, password } : { password };
|
|
84977
84977
|
}
|
|
84978
84978
|
|
|
84979
|
+
// src/services/patient-poll.service.ts
|
|
84980
|
+
var BACKOFF_MS = [1e3, 2e3, 4e3, 8e3, 15e3, 3e4];
|
|
84981
|
+
var PROXY_STATUSES = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
84982
|
+
function transientFailure(error63) {
|
|
84983
|
+
if (error63 instanceof LazeApiError) {
|
|
84984
|
+
return PROXY_STATUSES.has(error63.status) ? `status ${error63.status} ${error63.code}` : void 0;
|
|
84985
|
+
}
|
|
84986
|
+
if (error63 instanceof TypeError) return error63.message;
|
|
84987
|
+
const code4 = error63?.code;
|
|
84988
|
+
return typeof code4 === "string" && /^(E[A-Z]+|UND_ERR_[A-Z_]+)$/.test(code4) ? code4 : void 0;
|
|
84989
|
+
}
|
|
84990
|
+
async function patiently({
|
|
84991
|
+
context,
|
|
84992
|
+
call,
|
|
84993
|
+
giveUpAt = Infinity
|
|
84994
|
+
}) {
|
|
84995
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
84996
|
+
try {
|
|
84997
|
+
return await call();
|
|
84998
|
+
} catch (error63) {
|
|
84999
|
+
const why = transientFailure(error63);
|
|
85000
|
+
if (why === void 0 || context.nowMs() >= giveUpAt) throw error63;
|
|
85001
|
+
if (attempt === 0) {
|
|
85002
|
+
context.err(
|
|
85003
|
+
`laze: Laze is not answering (${why}), probably restarting; still waiting...
|
|
85004
|
+
`
|
|
85005
|
+
);
|
|
85006
|
+
}
|
|
85007
|
+
const wait = BACKOFF_MS[Math.min(attempt, BACKOFF_MS.length - 1)] ?? 0;
|
|
85008
|
+
await context.sleep(Math.max(0, Math.min(wait, giveUpAt - context.nowMs())));
|
|
85009
|
+
}
|
|
85010
|
+
}
|
|
85011
|
+
}
|
|
85012
|
+
|
|
84979
85013
|
// src/services/vault-commands.service.ts
|
|
84980
85014
|
import { createHash as createHash8 } from "node:crypto";
|
|
84981
85015
|
import { readFile as readFile15, rm as rm11 } from "node:fs/promises";
|
|
@@ -85015,7 +85049,7 @@ as the calling Claude Code, Codex, Kanban or terminal session.
|
|
|
85015
85049
|
--channel <id> the conversation whose turn it runs in, when the agent answers in several
|
|
85016
85050
|
--as <name> the session's name on the card when signed in as yourself (or LAZE_SESSION_NAME)`;
|
|
85017
85051
|
var POLL_MS = 3e3;
|
|
85018
|
-
var RESTART_WAIT_MS =
|
|
85052
|
+
var RESTART_WAIT_MS = 6e5;
|
|
85019
85053
|
var RESTART_BACKOFF_MS = [1e3, 2e3, 4e3, 8e3, 1e4];
|
|
85020
85054
|
var P2562 = { name: "ECDH", namedCurve: "P-256" };
|
|
85021
85055
|
var ServerGoneError = class extends Error {
|
|
@@ -85090,7 +85124,9 @@ async function sendOnce({
|
|
|
85090
85124
|
if (init.method === "POST" && !wasRefused) throw error63;
|
|
85091
85125
|
return { restarting: wasRefused ? "connection refused" : String(error63) };
|
|
85092
85126
|
}
|
|
85093
|
-
if (response.status !== 502 && response.status !== 503
|
|
85127
|
+
if (response.status !== 502 && response.status !== 503 && response.status !== 504) {
|
|
85128
|
+
return { response };
|
|
85129
|
+
}
|
|
85094
85130
|
const code4 = codeOf(await response.clone().text());
|
|
85095
85131
|
const neverReached = response.status === 503 && code4 === "vault_not_answering";
|
|
85096
85132
|
if (init.method === "POST" && !neverReached) return { response };
|
|
@@ -85109,7 +85145,7 @@ async function reach(input2) {
|
|
|
85109
85145
|
}
|
|
85110
85146
|
if (attempt === 0) {
|
|
85111
85147
|
context.err(
|
|
85112
|
-
`laze vault: the Laze server is not answering (${sent.restarting}), probably restarting; waiting up to
|
|
85148
|
+
`laze vault: the Laze server is not answering (${sent.restarting}), probably restarting; waiting up to 10 min...
|
|
85113
85149
|
`
|
|
85114
85150
|
);
|
|
85115
85151
|
}
|
|
@@ -85294,7 +85330,11 @@ async function keyRelease({
|
|
|
85294
85330
|
extra: { channelId: flagText({ args, name: "channel" }) || null }
|
|
85295
85331
|
};
|
|
85296
85332
|
const first = await client.post(door.ask, { ...body, ...door.extra }).catch(refusedRelease);
|
|
85297
|
-
const next = (requestId) =>
|
|
85333
|
+
const next = (requestId) => patiently({
|
|
85334
|
+
context,
|
|
85335
|
+
giveUpAt: deadline,
|
|
85336
|
+
call: () => client.post(door.status, { requestId, ...door.extra })
|
|
85337
|
+
}).catch(refusedRelease);
|
|
85298
85338
|
const release2 = await untilAnswered({ context, first, next, deadline });
|
|
85299
85339
|
return settled2({ context, release: release2, run: run4, keyPath });
|
|
85300
85340
|
}
|
|
@@ -85522,7 +85562,11 @@ async function waitForDone({
|
|
|
85522
85562
|
const deadline = context.nowMs() + seconds * 1e3;
|
|
85523
85563
|
while (context.nowMs() < deadline) {
|
|
85524
85564
|
await context.sleep(Math.min(ASK_POLL_MS, Math.max(0, deadline - context.nowMs())));
|
|
85525
|
-
const now = await
|
|
85565
|
+
const now = await patiently({
|
|
85566
|
+
context,
|
|
85567
|
+
giveUpAt: deadline,
|
|
85568
|
+
call: () => client.post(BROWSER_TAB_PATHS.get, { tab: tab.id, ...channel })
|
|
85569
|
+
});
|
|
85526
85570
|
if (!now.ask) return print9(now, `${who} pressed Done. ${now.title} shows ${now.url}
|
|
85527
85571
|
`);
|
|
85528
85572
|
}
|
|
@@ -103158,7 +103202,11 @@ async function waitForAnswer({
|
|
|
103158
103202
|
let current3 = key;
|
|
103159
103203
|
while (current3.status === "pending" && context.nowMs() < giveUpAt) {
|
|
103160
103204
|
await context.sleep(POLL_MS3);
|
|
103161
|
-
current3 = await
|
|
103205
|
+
current3 = await patiently({
|
|
103206
|
+
context,
|
|
103207
|
+
giveUpAt,
|
|
103208
|
+
call: () => client.post(OPERATOR_KEY_REST_PATHS.status, { keyId: key.id })
|
|
103209
|
+
});
|
|
103162
103210
|
}
|
|
103163
103211
|
return current3;
|
|
103164
103212
|
}
|
|
@@ -104799,7 +104847,10 @@ async function doorOf({
|
|
|
104799
104847
|
throw new CliUsageError(`laze vault: the batch was refused: ${refusalText(error63)}`);
|
|
104800
104848
|
}
|
|
104801
104849
|
},
|
|
104802
|
-
status: (requestId) =>
|
|
104850
|
+
status: (requestId) => patiently({
|
|
104851
|
+
context,
|
|
104852
|
+
call: () => client.post(door.status, { requestId, ...door.extra })
|
|
104853
|
+
}).catch(refusedRelease)
|
|
104803
104854
|
};
|
|
104804
104855
|
}
|
|
104805
104856
|
async function resolveBatch({
|
package/package.json
CHANGED