@songsid/agend 2.3.3-beta.6 → 2.3.3-beta.8

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.
@@ -0,0 +1,45 @@
1
+ import { statSync } from "node:fs";
2
+ import { userInfo } from "node:os";
3
+ /** Only ENOENT proves it gone: a socket this process may not stat (EACCES) is not called missing. */
4
+ function socketExists(path) {
5
+ try {
6
+ statSync(path);
7
+ return true;
8
+ }
9
+ catch (error) {
10
+ return error.code !== "ENOENT";
11
+ }
12
+ }
13
+ /**
14
+ * Why a notification cannot arrive, when the socket itself says so (log only): a filesystem socket (an '@' one is
15
+ * abstract and has no file) that no longer exists. On a user unit it lives in the user manager's runtime dir,
16
+ * /run/user/<uid>; when that dir is removed (logind, at the last session's end without linger) or replaced without its
17
+ * systemd/ subdir (seen on WSL with linger on), the manager's notify socket is gone, READY and WATCHDOG never reach
18
+ * systemd and it restarts the fleet. Restarting user@<uid> recreates it. null: nothing to say.
19
+ * A module of its own, with no side effects: sd-notify.ts takes NOTIFY_SOCKET out of the environment when it loads,
20
+ * and `agend doctor` asks this too.
21
+ */
22
+ export function notifySocketProblem(socket, exists = socketExists) {
23
+ if (!socket || socket.startsWith("@"))
24
+ return null;
25
+ try {
26
+ if (exists(socket))
27
+ return null;
28
+ }
29
+ catch {
30
+ return null;
31
+ }
32
+ const runtime = /^\/run\/user\/(\d+)\//.exec(socket);
33
+ let user = "<user>";
34
+ try {
35
+ user = userInfo().username || user;
36
+ }
37
+ catch { /* no passwd entry: the placeholder */ }
38
+ // Restarting user@<uid> ends everything that manager runs, the fleet included; a user who is not root needs sudo.
39
+ const sudo = runtime && runtime[1] !== "0" ? "sudo " : "";
40
+ const hint = runtime
41
+ ? `the user manager's notify socket is gone (/run/user/${runtime[1]} was removed or replaced without its systemd/ dir): ${sudo}systemctl restart user@${runtime[1]}.service (recreates /run/user/${runtime[1]}/systemd/notify; it also restarts the fleet and everything else that user runs, so run it from a host shell, not from an agent); if \`loginctl show-user ${user} -p Linger\` says no, also ${sudo}loginctl enable-linger ${user}`
42
+ : `systemd's notify socket ${socket} does not exist`;
43
+ return { socketMissing: true, socket, hint };
44
+ }
45
+ //# sourceMappingURL=notify-socket.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notify-socket.js","sourceRoot":"","sources":["../src/notify-socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,qGAAqG;AACrG,SAAS,YAAY,CAAC,IAAY;IAChC,IAAI,CAAC;QAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAAC,OAAQ,KAA+B,CAAC,IAAI,KAAK,QAAQ,CAAC;IAAC,CAAC;AACnH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAA0B,EAAE,MAAM,GAA8B,YAAY;IAC9G,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACnD,IAAI,CAAC;QAAC,IAAI,MAAM,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrD,IAAI,IAAI,GAAG,QAAQ,CAAC;IACpB,IAAI,CAAC;QAAC,IAAI,GAAG,QAAQ,EAAE,CAAC,QAAQ,IAAI,IAAI,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC,CAAC,sCAAsC,CAAC,CAAC;IAC5F,kHAAkH;IAClH,MAAM,IAAI,GAAG,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1D,MAAM,IAAI,GAAG,OAAO;QAClB,CAAC,CAAC,uDAAuD,OAAO,CAAC,CAAC,CAAC,uDAAuD,IAAI,0BAA0B,OAAO,CAAC,CAAC,CAAC,iCAAiC,OAAO,CAAC,CAAC,CAAC,4JAA4J,IAAI,8BAA8B,IAAI,0BAA0B,IAAI,EAAE;QAC/a,CAAC,CAAC,2BAA2B,MAAM,iBAAiB,CAAC;IACvD,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A backend's quota, usage-limit or credit notice as the person reads it (user, 2026-10-30): one short line, the
3
+ * backend and what ran out — "⚠️ Codex 用量用完,已暫停" / "⚠️ Codex usage limit used up — paused". "Paused" only when
4
+ * the instance really is; a reset time only where AgEnD already reads one from the CLI. The instance's name is added
5
+ * by the lifecycle (plainNoticeLine) only where the line is posted outside its own topic. The incident's `message`
6
+ * stays the unlocalised English one, for logs and webhooks.
7
+ */
8
+ export type QuotaWhat = "usage" | "api_credits" | "api_quota" | "workspace_credits" | "workspace_usage" | "quota" | "quota_credits" | "requests" | "weekly";
9
+ export type QuotaReset = {
10
+ at: string;
11
+ } | {
12
+ in: string;
13
+ };
14
+ export declare function quotaLine(backend: string, what: QuotaWhat, opts?: {
15
+ paused?: boolean;
16
+ reset?: QuotaReset;
17
+ }): string;
18
+ /** The same line for a backend that pauses the instance. */
19
+ export declare function quotaPausedLine(backend: string, what: QuotaWhat, reset?: QuotaReset): string;
20
+ /** Claude's own words for when it continues ("at 1:50pm", "in 3h") as a reset time; anything else as said. */
21
+ export declare function claudeResetTime(when: string): QuotaReset;
22
+ /** Codex's "less than N% of your <period> limit" warning. */
23
+ export declare function quotaLowLine(period: string, percent: string): string;
@@ -0,0 +1,22 @@
1
+ import { t } from "./locale.js";
2
+ export function quotaLine(backend, what, opts = {}) {
3
+ const line = t(opts.paused ? "inst.quota_line_paused" : "inst.quota_line", backend, t(`inst.quota_what.${what}`));
4
+ if (!opts.reset)
5
+ return line;
6
+ return "at" in opts.reset ? t("inst.quota_reset_at", line, opts.reset.at) : t("inst.quota_reset_in", line, opts.reset.in);
7
+ }
8
+ /** The same line for a backend that pauses the instance. */
9
+ export function quotaPausedLine(backend, what, reset) {
10
+ return quotaLine(backend, what, { paused: true, reset });
11
+ }
12
+ /** Claude's own words for when it continues ("at 1:50pm", "in 3h") as a reset time; anything else as said. */
13
+ export function claudeResetTime(when) {
14
+ const m = /^(at|in)\s+(.+)$/i.exec(when.trim());
15
+ return m ? (m[1].toLowerCase() === "in" ? { in: m[2] } : { at: m[2] }) : { at: when.trim() };
16
+ }
17
+ /** Codex's "less than N% of your <period> limit" warning. */
18
+ export function quotaLowLine(period, percent) {
19
+ const key = `inst.quota_period.${period.toLowerCase()}`;
20
+ return t("inst.quota_low", t(key), percent);
21
+ }
22
+ //# sourceMappingURL=quota-notice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota-notice.js","sourceRoot":"","sources":["../src/quota-notice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAahC,MAAM,UAAU,SAAS,CAAC,OAAe,EAAE,IAAe,EAAE,IAAI,GAA6C,EAAE;IAC7G,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,iBAAiB,EAAE,OAAO,EAAE,CAAC,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC,CAAC;IAClH,IAAI,CAAC,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAC7B,OAAO,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,qBAAqB,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,qBAAqB,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC5H,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,eAAe,CAAC,OAAe,EAAE,IAAe,EAAE,KAAkB;IAClF,OAAO,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AAC3D,CAAC;AAED,8GAA8G;AAC9G,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,MAAM,CAAC,GAAG,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAChD,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;AAClG,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,OAAe;IAC1D,MAAM,GAAG,GAAG,qBAAqB,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC;IACxD,OAAO,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC"}
@@ -1,4 +1,6 @@
1
1
  import { execFileSync } from "node:child_process";
2
+ import { notifySocketProblem } from "./notify-socket.js";
3
+ export { notifySocketProblem };
2
4
  /**
3
5
  * Keep systemd's notification socket private to the fleet process. The socket
4
6
  * path is a capability: any child that inherits it can send READY/WATCHDOG/
@@ -31,6 +33,7 @@ export declare function sendSystemdNotificationAsync(state: string, socket: stri
31
33
  export declare function sdNotify(state: string): void;
32
34
  /** Where a skipped or failed notification is said (the fleet's logger). Unset: nothing is said. */
33
35
  export type SdNotifyWarn = (fields: Record<string, unknown>, message: string) => void;
36
+ /** The fleet sets this as it starts: the first time, a socket that is already gone is said once (log only). */
34
37
  export declare function setSdNotifyWarn(sink: SdNotifyWarn | null): void;
35
38
  /** Repeated unchanged ownership skips may coalesce; delivery failures never do. */
36
39
  export declare const SD_NOTIFY_WARN_INTERVAL_MS: number;
@@ -46,6 +49,8 @@ export interface SdNotifierDeps {
46
49
  send: (state: string, socket: string, onDone: (error: Error | null) => void) => void;
47
50
  warn: () => SdNotifyWarn | null;
48
51
  now?: () => number;
52
+ /** Why the socket cannot be reached, added to a failure's fields (notifySocketProblem). */
53
+ socketProblem?: (socket: string) => Record<string, unknown> | null;
49
54
  }
50
55
  /**
51
56
  * The notification path, with what it depends on passed in (tests). A skipped notification used to be silent: a
@@ -55,6 +60,11 @@ export interface SdNotifierDeps {
55
60
  export declare function createSdNotifier(deps: SdNotifierDeps): ((state: string) => void) & {
56
61
  cancelRetry(): void;
57
62
  };
63
+ /**
64
+ * Once at startup (log only): the socket systemd gave this process is already gone, so READY will not arrive either.
65
+ * Returns whether it said so.
66
+ */
67
+ export declare function reportNotifySocketAtStart(warn: SdNotifyWarn, socket?: string | undefined, problem?: (socket: string | undefined) => Record<string, unknown> | null): boolean;
58
68
  /**
59
69
  * Blocking variant, for the one case where the process is about to exit.
60
70
  *
@@ -63,4 +73,3 @@ export declare function createSdNotifier(deps: SdNotifierDeps): ((state: string)
63
73
  * should use this.
64
74
  */
65
75
  export declare function sdNotifyBlocking(state: string): void;
66
- export {};
package/dist/sd-notify.js CHANGED
@@ -3,6 +3,8 @@ import { execFile } from "./child-process.js";
3
3
  import { readFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
5
  import { getAgendHome } from "./paths.js";
6
+ import { notifySocketProblem } from "./notify-socket.js";
7
+ export { notifySocketProblem };
6
8
  /**
7
9
  * Keep systemd's notification socket private to the fleet process. The socket
8
10
  * path is a capability: any child that inherits it can send READY/WATCHDOG/
@@ -59,7 +61,15 @@ export function sdNotify(state) {
59
61
  defaultNotifier(state);
60
62
  }
61
63
  let warnSink = null;
62
- export function setSdNotifyWarn(sink) { warnSink = sink; }
64
+ let startChecked = false;
65
+ /** The fleet sets this as it starts: the first time, a socket that is already gone is said once (log only). */
66
+ export function setSdNotifyWarn(sink) {
67
+ warnSink = sink;
68
+ if (sink && !startChecked) {
69
+ startChecked = true;
70
+ reportNotifySocketAtStart(sink);
71
+ }
72
+ }
63
73
  /** Repeated unchanged ownership skips may coalesce; delivery failures never do. */
64
74
  export const SD_NOTIFY_WARN_INTERVAL_MS = 10 * 60_000;
65
75
  /** More opportunities within WatchdogSec=60, still driven by the main loop. */
@@ -115,9 +125,10 @@ export function createSdNotifier(deps) {
115
125
  // Every failed attempt is visible, including a failed retry. A later
116
126
  // successful ping needs no warning; only unchanged ownership skips coalesce.
117
127
  try {
128
+ const why = deps.socket ? (deps.socketProblem ?? notifySocketProblem)(deps.socket) : null;
118
129
  deps.warn()?.({ state, retry, error: error.message, code: detail.code ?? null,
119
130
  signal: detail.signal ?? null, killed: detail.killed ?? false,
120
- elapsedMs: Math.max(0, Math.round(now() - startedAt)) }, "systemd-notify failed; systemd's watchdog may not be fed");
131
+ elapsedMs: Math.max(0, Math.round(now() - startedAt)), ...why }, "systemd-notify failed; systemd's watchdog may not be fed");
121
132
  }
122
133
  catch { /* reporting must never break the ping */ }
123
134
  if (state === "WATCHDOG=1" && !retry && epoch === generation) {
@@ -150,6 +161,20 @@ const defaultNotifier = createSdNotifier({
150
161
  send: (state, socket, onDone) => sendSystemdNotificationAsync(state, socket, process.env, undefined, onDone),
151
162
  warn: () => warnSink,
152
163
  });
164
+ /**
165
+ * Once at startup (log only): the socket systemd gave this process is already gone, so READY will not arrive either.
166
+ * Returns whether it said so.
167
+ */
168
+ export function reportNotifySocketAtStart(warn, socket = notifySocket, problem = notifySocketProblem) {
169
+ const why = problem(socket);
170
+ if (!why)
171
+ return false;
172
+ try {
173
+ warn(why, "systemd's notify socket is missing; READY and WATCHDOG cannot reach systemd");
174
+ }
175
+ catch { /* best effort */ }
176
+ return true;
177
+ }
153
178
  /**
154
179
  * Blocking variant, for the one case where the process is about to exit.
155
180
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sd-notify.js","sourceRoot":"","sources":["../src/sd-notify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAA8B;IAChE,MAAM,MAAM,GAAG,WAAW,CAAC,aAAa,CAAC;IACzC,OAAO,WAAW,CAAC,aAAa,CAAC;IACjC,OAAO,MAAM,IAAI,SAAS,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,WAA8B,EAC9B,MAAc;IAEd,OAAO,EAAE,GAAG,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC;AACnD,CAAC;AAED,MAAM,YAAY,GAAG,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAEtD,gFAAgF;AAChF,MAAM,UAAU,YAAY,CAC1B,OAAO,GAAG,YAAY,EAAE,EACxB,GAAG,GAAG,OAAO,CAAC,GAAG;IAEjB,OAAO,gBAAgB,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC;AAC3C,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,gBAAgB,CAAC,OAAO,GAAG,YAAY,EAAE;IACvD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAC9B,YAAY,CAAC,I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AAE,OAAO;IAC7C,IAAI,CAAC;QACH,uBAAuB,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5D,CAAC;IAAC,MAAM,CAAC,CAAC,iBAAiB,CAAC,CAAC;AAC/B,CAAC"}
@@ -1949,8 +1949,9 @@ export class TopicCommands {
1949
1949
  if (!classic)
1950
1950
  return [];
1951
1951
  const ids = new Set();
1952
+ // The gate's own test (isClassicChannel): this bot's rooms, and an untyped legacy room the primary adapter serves.
1952
1953
  for (const room of classic.getAll())
1953
- if (room.adapterId === adapterId)
1954
+ if (classic.isClassicChannel(room.channelId, adapterId))
1954
1955
  ids.add(String(room.channelId));
1955
1956
  const d = classic.getDefaults();
1956
1957
  for (const list of [d.allowed_users, d.admin_users, d.allowed_groups])