behavior-wrapped 0.4.4 → 0.4.5
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/package.json
CHANGED
package/server/cli.mjs
CHANGED
|
@@ -126,6 +126,9 @@ async function createWrapped() {
|
|
|
126
126
|
console.log(`\n ${bright}behavior-wrapped${reset} ${muted}· the wrapped for your AI agents${reset}\n`);
|
|
127
127
|
const demo = process.argv.includes("--demo");
|
|
128
128
|
const testMode = process.argv.includes("--test") || process.argv.includes("--no-llm");
|
|
129
|
+
progress.start("Preparing local donation helper", `localhost:${port}`);
|
|
130
|
+
await ensureServer(demo);
|
|
131
|
+
progress.succeed("Local donation helper ready");
|
|
129
132
|
const daysArgument = process.argv.find((argument) => argument.startsWith("--days="));
|
|
130
133
|
const windowDays = daysArgument ? Number(daysArgument.split("=")[1]) : DEFAULT_WINDOW_DAYS;
|
|
131
134
|
if (!Number.isInteger(windowDays) || windowDays < 1 || windowDays > 3650) throw new Error("--days must be a whole number from 1 to 3650.");
|
|
@@ -262,9 +265,6 @@ async function createWrapped() {
|
|
|
262
265
|
}
|
|
263
266
|
}
|
|
264
267
|
saveReport(report);
|
|
265
|
-
progress.start("Starting local donation helper", `localhost:${port}`);
|
|
266
|
-
await ensureServer(demo);
|
|
267
|
-
progress.succeed("Local donation helper ready");
|
|
268
268
|
const localUrl = `${baseUrl}/w/${id}`;
|
|
269
269
|
const url = localOnly ? localUrl : report.managementUrl || publicUrl || localUrl;
|
|
270
270
|
const tokenLabel = formatNumber(report.stats.tokens || 0);
|
|
@@ -11,7 +11,7 @@ export function helperHealthMatches(value, { version, protocol, demo }) {
|
|
|
11
11
|
|
|
12
12
|
export function isVerifiedLauncherCommand(command, port) {
|
|
13
13
|
const escapedPort = String(port).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
14
|
-
return new RegExp(
|
|
14
|
+
return new RegExp(`(?:/(?:agent-)?behavior-wrapped/|(?:^|\\s))server/launcher\\.mjs(?:\\s|$)`, "i").test(command || "")
|
|
15
15
|
&& new RegExp(`(?:^|\\s)--port=${escapedPort}(?:\\s|$)`).test(command || "");
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -23,7 +23,8 @@ async function listeningPids(port, runCommand) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export async function stopVerifiedStaleHelper(port, advertisedPid, { runCommand = run, kill = process.kill } = {}) {
|
|
26
|
-
const
|
|
26
|
+
const listeners = await listeningPids(port, runCommand);
|
|
27
|
+
const candidates = Number.isInteger(advertisedPid) && advertisedPid > 1 ? listeners.filter((pid) => pid === advertisedPid) : listeners;
|
|
27
28
|
let stopped = false;
|
|
28
29
|
for (const pid of candidates) {
|
|
29
30
|
let command;
|