@hasna/conversations 0.2.56 → 0.2.57
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/bin/index.js +50 -10
- package/bin/mcp.js +1 -1
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -15553,7 +15553,7 @@ var init_space_notifications = __esm(() => {
|
|
|
15553
15553
|
var require_package = __commonJS((exports, module) => {
|
|
15554
15554
|
module.exports = {
|
|
15555
15555
|
name: "@hasna/conversations",
|
|
15556
|
-
version: "0.2.
|
|
15556
|
+
version: "0.2.57",
|
|
15557
15557
|
description: "Real-time CLI messaging for AI agents",
|
|
15558
15558
|
type: "module",
|
|
15559
15559
|
bin: {
|
|
@@ -49913,6 +49913,44 @@ function normalizePort(value, fallback) {
|
|
|
49913
49913
|
return fallback;
|
|
49914
49914
|
return port;
|
|
49915
49915
|
}
|
|
49916
|
+
function registryTimeoutMs() {
|
|
49917
|
+
const raw = process.env.CONVERSATIONS_REGISTRY_TIMEOUT_MS;
|
|
49918
|
+
if (!raw)
|
|
49919
|
+
return DEFAULT_REGISTRY_TIMEOUT_MS;
|
|
49920
|
+
const parsed = Number(raw);
|
|
49921
|
+
if (!Number.isFinite(parsed) || parsed <= 0)
|
|
49922
|
+
return DEFAULT_REGISTRY_TIMEOUT_MS;
|
|
49923
|
+
return Math.min(Math.ceil(parsed), MAX_REGISTRY_TIMEOUT_MS);
|
|
49924
|
+
}
|
|
49925
|
+
async function fetchLatestPackageVersion() {
|
|
49926
|
+
const timeoutMs = registryTimeoutMs();
|
|
49927
|
+
const controller = new AbortController;
|
|
49928
|
+
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
49929
|
+
try {
|
|
49930
|
+
const res = await fetch(NPM_LATEST_URL, {
|
|
49931
|
+
headers: { Accept: "application/json" },
|
|
49932
|
+
signal: controller.signal
|
|
49933
|
+
});
|
|
49934
|
+
if (!res.ok) {
|
|
49935
|
+
throw new Error(`npm registry responded with ${res.status}`);
|
|
49936
|
+
}
|
|
49937
|
+
const data = await res.json();
|
|
49938
|
+
if (typeof data.version !== "string" || !data.version) {
|
|
49939
|
+
throw new Error("npm registry response did not include a version");
|
|
49940
|
+
}
|
|
49941
|
+
return data.version;
|
|
49942
|
+
} catch (e) {
|
|
49943
|
+
if (controller.signal.aborted) {
|
|
49944
|
+
throw new RegistryTimeoutError(timeoutMs);
|
|
49945
|
+
}
|
|
49946
|
+
throw e;
|
|
49947
|
+
} finally {
|
|
49948
|
+
clearTimeout(timeout);
|
|
49949
|
+
}
|
|
49950
|
+
}
|
|
49951
|
+
function registryErrorStatus(e) {
|
|
49952
|
+
return e instanceof RegistryTimeoutError ? 504 : 500;
|
|
49953
|
+
}
|
|
49916
49954
|
function isSameOrigin(req) {
|
|
49917
49955
|
const origin = req.headers.get("origin");
|
|
49918
49956
|
if (!origin)
|
|
@@ -50316,12 +50354,10 @@ function startDashboardServer(port = 0, host) {
|
|
|
50316
50354
|
try {
|
|
50317
50355
|
const pkg3 = await Promise.resolve().then(() => __toESM(require_package(), 1));
|
|
50318
50356
|
const current = pkg3.version;
|
|
50319
|
-
const
|
|
50320
|
-
const data = await res.json();
|
|
50321
|
-
const latest = data.version;
|
|
50357
|
+
const latest = await fetchLatestPackageVersion();
|
|
50322
50358
|
return jsonResponse({ current, latest, updateAvailable: current !== latest });
|
|
50323
50359
|
} catch (e) {
|
|
50324
|
-
return jsonResponse({ error: e.message },
|
|
50360
|
+
return jsonResponse({ error: e.message }, registryErrorStatus(e));
|
|
50325
50361
|
}
|
|
50326
50362
|
}
|
|
50327
50363
|
if (path === "/api/update" && req.method === "POST") {
|
|
@@ -50331,9 +50367,7 @@ function startDashboardServer(port = 0, host) {
|
|
|
50331
50367
|
try {
|
|
50332
50368
|
const pkg3 = await Promise.resolve().then(() => __toESM(require_package(), 1));
|
|
50333
50369
|
const current = pkg3.version;
|
|
50334
|
-
const
|
|
50335
|
-
const data = await res.json();
|
|
50336
|
-
const latest = data.version;
|
|
50370
|
+
const latest = await fetchLatestPackageVersion();
|
|
50337
50371
|
if (current === latest) {
|
|
50338
50372
|
return jsonResponse({ current, latest, status: "up-to-date" });
|
|
50339
50373
|
}
|
|
@@ -50350,7 +50384,7 @@ function startDashboardServer(port = 0, host) {
|
|
|
50350
50384
|
return jsonResponse({ current, latest, status: "failed", exitCode, stderr }, 500);
|
|
50351
50385
|
}
|
|
50352
50386
|
} catch (e) {
|
|
50353
|
-
return jsonResponse({ error: e.message },
|
|
50387
|
+
return jsonResponse({ error: e.message }, registryErrorStatus(e));
|
|
50354
50388
|
}
|
|
50355
50389
|
}
|
|
50356
50390
|
if (dashboardDist) {
|
|
@@ -50384,7 +50418,7 @@ function startDashboardServer(port = 0, host) {
|
|
|
50384
50418
|
console.log(`Dashboard running at http://localhost:${server2.port}`);
|
|
50385
50419
|
return server2;
|
|
50386
50420
|
}
|
|
50387
|
-
var isDirectRun2;
|
|
50421
|
+
var NPM_LATEST_URL = "https://registry.npmjs.org/@hasna/conversations/latest", DEFAULT_REGISTRY_TIMEOUT_MS = 3000, MAX_REGISTRY_TIMEOUT_MS = 30000, RegistryTimeoutError, isDirectRun2;
|
|
50388
50422
|
var init_serve = __esm(() => {
|
|
50389
50423
|
init_messages();
|
|
50390
50424
|
init_sessions();
|
|
@@ -50398,6 +50432,12 @@ var init_serve = __esm(() => {
|
|
|
50398
50432
|
init_locks();
|
|
50399
50433
|
init_http();
|
|
50400
50434
|
init_mcp2();
|
|
50435
|
+
RegistryTimeoutError = class RegistryTimeoutError extends Error {
|
|
50436
|
+
constructor(timeoutMs) {
|
|
50437
|
+
super(`npm registry request timed out after ${timeoutMs}ms`);
|
|
50438
|
+
this.name = "RegistryTimeoutError";
|
|
50439
|
+
}
|
|
50440
|
+
};
|
|
50401
50441
|
isDirectRun2 = import.meta.url === `file://${process.argv[1]}` || process.argv[1]?.endsWith("serve.ts") || process.argv[1]?.endsWith("serve.js");
|
|
50402
50442
|
if (isDirectRun2) {
|
|
50403
50443
|
const port = normalizePort(process.env.PORT, 0);
|
package/bin/mcp.js
CHANGED
|
@@ -46904,7 +46904,7 @@ function startMcpHttpServer(options) {
|
|
|
46904
46904
|
// package.json
|
|
46905
46905
|
var package_default = {
|
|
46906
46906
|
name: "@hasna/conversations",
|
|
46907
|
-
version: "0.2.
|
|
46907
|
+
version: "0.2.57",
|
|
46908
46908
|
description: "Real-time CLI messaging for AI agents",
|
|
46909
46909
|
type: "module",
|
|
46910
46910
|
bin: {
|