aisnitch 0.2.0 → 0.2.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/index.cjs +19 -2
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +20 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.cjs
CHANGED
|
@@ -41,7 +41,7 @@ var import_commander = require("commander");
|
|
|
41
41
|
|
|
42
42
|
// src/package-info.ts
|
|
43
43
|
var AISNITCH_PACKAGE_NAME = "aisnitch";
|
|
44
|
-
var AISNITCH_VERSION = "0.2.
|
|
44
|
+
var AISNITCH_VERSION = "0.2.1";
|
|
45
45
|
var AISNITCH_DESCRIPTION = "Universal bridge for AI coding tool activity \u2014 capture, normalize, stream.";
|
|
46
46
|
|
|
47
47
|
// src/core/events/schema.ts
|
|
@@ -719,7 +719,7 @@ async function canBindPort(port, host) {
|
|
|
719
719
|
}
|
|
720
720
|
async function resolveAvailablePort(requestedPort, options = {}) {
|
|
721
721
|
const host = options.host ?? "127.0.0.1";
|
|
722
|
-
const maxAttempts = options.maxAttempts ??
|
|
722
|
+
const maxAttempts = options.maxAttempts ?? 100;
|
|
723
723
|
for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
|
|
724
724
|
const candidatePort = requestedPort + attempt;
|
|
725
725
|
const available = await canBindPort(candidatePort, host);
|
|
@@ -11957,6 +11957,10 @@ function createCliRuntime(dependencies = {}) {
|
|
|
11957
11957
|
};
|
|
11958
11958
|
}
|
|
11959
11959
|
}
|
|
11960
|
+
const loggedFailure = await readDaemonStartupFailure(pathOptions);
|
|
11961
|
+
if (loggedFailure !== null) {
|
|
11962
|
+
throw new Error(loggedFailure);
|
|
11963
|
+
}
|
|
11960
11964
|
await sleep(DAEMON_READY_POLL_INTERVAL_MS);
|
|
11961
11965
|
}
|
|
11962
11966
|
throw new Error(
|
|
@@ -11965,6 +11969,19 @@ function createCliRuntime(dependencies = {}) {
|
|
|
11965
11969
|
)}.`
|
|
11966
11970
|
);
|
|
11967
11971
|
}
|
|
11972
|
+
async function readDaemonStartupFailure(pathOptions) {
|
|
11973
|
+
try {
|
|
11974
|
+
const daemonLog = await (0, import_promises15.readFile)(getDaemonLogPath(pathOptions), "utf8");
|
|
11975
|
+
const logLines = daemonLog.split(/\r?\n/u).map((line) => line.trim()).filter((line) => line.length > 0);
|
|
11976
|
+
const lastLine = logLines.at(-1);
|
|
11977
|
+
if (!lastLine) {
|
|
11978
|
+
return null;
|
|
11979
|
+
}
|
|
11980
|
+
return lastLine.startsWith("AISnitch CLI failed:") ? lastLine : `AISnitch daemon startup failed: ${lastLine}`;
|
|
11981
|
+
} catch {
|
|
11982
|
+
return null;
|
|
11983
|
+
}
|
|
11984
|
+
}
|
|
11968
11985
|
async function waitForProcessExit(pid) {
|
|
11969
11986
|
const deadline = Date.now() + DAEMON_STOP_TIMEOUT_MS;
|
|
11970
11987
|
while (Date.now() < deadline) {
|