@anusornneal/chat-relay 1.1.1 → 1.2.0
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/agent/local-agent.mjs +4 -0
- package/cli/relay-health.mjs +3 -2
- package/cli/tui.mjs +18 -0
- package/package.json +1 -1
package/agent/local-agent.mjs
CHANGED
|
@@ -484,6 +484,10 @@ function connect() {
|
|
|
484
484
|
}
|
|
485
485
|
return;
|
|
486
486
|
}
|
|
487
|
+
if (message?.control === "learn_activity") {
|
|
488
|
+
emitUi("learn", { change: message.change && typeof message.change === "object" ? message.change : {} });
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
487
491
|
if (message?.control === "credential_revoked") {
|
|
488
492
|
requireReauthorization("credential_revoked");
|
|
489
493
|
return;
|
package/cli/relay-health.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const RELAY_HEALTH_CHECK_INTERVAL_MS =
|
|
1
|
+
export const RELAY_HEALTH_CHECK_INTERVAL_MS = 15 * 60 * 1000;
|
|
2
2
|
export const RELAY_HEALTH_CHECK_TIMEOUT_MS = 8 * 1000;
|
|
3
3
|
export const RELAY_HEALTH_LIMITED_INTERVAL_MS = 60 * 60 * 1000;
|
|
4
4
|
export const RELAY_HEALTH_CLOUDFLARE_ERROR_INTERVAL_MS = 15 * 60 * 1000;
|
|
@@ -101,6 +101,7 @@ export async function checkRelayHealth(relayUrl, {
|
|
|
101
101
|
healthUrl.pathname = `${healthUrl.pathname.replace(/\/+$/, "")}/status`;
|
|
102
102
|
healthUrl.search = "";
|
|
103
103
|
if (agentId) healthUrl.searchParams.set("agentId", String(agentId));
|
|
104
|
+
healthUrl.searchParams.set("compact", "1");
|
|
104
105
|
healthUrl.hash = "";
|
|
105
106
|
} catch {
|
|
106
107
|
return { state: "unavailable" };
|
|
@@ -135,7 +136,7 @@ export async function checkRelayHealth(relayUrl, {
|
|
|
135
136
|
|
|
136
137
|
export function startRelayHealthMonitor(relayUrl, {
|
|
137
138
|
onStatus,
|
|
138
|
-
// Per active TUI, this adds
|
|
139
|
+
// Per active TUI, this adds 96 Worker requests and up to 288 DO fetches daily.
|
|
139
140
|
intervalMs = RELAY_HEALTH_CHECK_INTERVAL_MS,
|
|
140
141
|
...checkOptions
|
|
141
142
|
} = {}) {
|
package/cli/tui.mjs
CHANGED
|
@@ -473,6 +473,24 @@ export class RemoteTui {
|
|
|
473
473
|
item.durationMs = message.durationMs;
|
|
474
474
|
if (message.error && message.ok === false) item.summary += ` · ${truncate(message.error, 48)}`;
|
|
475
475
|
}
|
|
476
|
+
} else if (message.event === "learn") {
|
|
477
|
+
const change = message.change && typeof message.change === "object" ? message.change : {};
|
|
478
|
+
const marker = {
|
|
479
|
+
created: "+",
|
|
480
|
+
updated: "~",
|
|
481
|
+
reinforced: "^",
|
|
482
|
+
weakened: "v",
|
|
483
|
+
removed: "-",
|
|
484
|
+
}[String(change.type || "")] || "~";
|
|
485
|
+
const detail = String(change.summary || change.key || "Learn updated").replace(/\s+/g, " ").trim();
|
|
486
|
+
this.appendTransaction({
|
|
487
|
+
requestId: "learn-" + String(change.eventId || Date.now()),
|
|
488
|
+
at: change.at || message.at || new Date().toISOString(),
|
|
489
|
+
action: "learn",
|
|
490
|
+
summary: "Learn " + marker + " " + truncate(detail, 120),
|
|
491
|
+
status: "done",
|
|
492
|
+
ok: true,
|
|
493
|
+
});
|
|
476
494
|
} else if (message.event === "system") {
|
|
477
495
|
this.appendTransaction({
|
|
478
496
|
requestId: "system-" + Date.now() + "-" + Math.random(),
|
package/package.json
CHANGED