shadok-ai 0.3.83 → 0.3.85

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.
@@ -128,13 +128,13 @@ export declare function saveGroups(list: any[]): void;
128
128
  export declare function loadTgGroup(): number | null;
129
129
  export declare function saveTgGroup(groupId: number | null): void;
130
130
  /**
131
- * Les canaux Telegram (`bindKey`) les appels d'outils sont AFFICHÉS. Une
132
- * allowlist et pas une map clé booléen : le défaut (masqué) ne coûte aucune
133
- * entrée, et un fichier absent ou illisible se dégrade exactement en « tout est
134
- * masqué » — le défaut voulu.
131
+ * The Telegram channels (`bindKey`) where tool calls are SHOWN. An allowlist
132
+ * rather than a keyboolean map: the default (hidden) costs no entry, and a
133
+ * missing or unreadable file degrades to exactly "everything hidden" the
134
+ * intended default.
135
135
  *
136
- * Le réglage appartient au topic, pas à la session : `/new` recrée une session
137
- * dans le même topic et doit garder le choix de l'utilisateur.
136
+ * The setting belongs to the topic, not to the session: `/new` recreates a
137
+ * session in the same topic and must keep the user's choice.
138
138
  */
139
139
  export declare function loadTgToolKeys(): string[];
140
140
  /** Pure core of setTgTools — returns a new list; exported for testing. */
@@ -142,10 +142,10 @@ export declare function setToolKeys(keys: string[], key: string, on: boolean): s
142
142
  export declare function tgToolsEnabled(key: string): boolean;
143
143
  export declare function setTgTools(key: string, on: boolean): void;
144
144
  /**
145
- * Le propriétaire des messages privés : l'id Telegram du premier utilisateur à
146
- * avoir écrit au bot en DM. Sans lui, un inconnu qui trouve le bot obtient une
147
- * session Claude sur la machine — les groupes sont déjà bornés au groupe lié,
148
- * les DM ne l'étaient pas.
145
+ * The owner of direct messages: the Telegram id of the first user to write to
146
+ * the bot in a DM. Without it, a stranger who finds the bot gets a Claude
147
+ * session on the machine — groups were already bounded to the bound group,
148
+ * DMs were not.
149
149
  */
150
150
  export declare function loadTgOwner(): number | null;
151
151
  export declare function saveTgOwner(userId: number | null): void;
package/dist/channels.js CHANGED
@@ -221,13 +221,13 @@ export function saveTgGroup(groupId) {
221
221
  writeJson("telegram-group", groupId == null ? [] : [groupId]);
222
222
  }
223
223
  /**
224
- * Les canaux Telegram (`bindKey`) les appels d'outils sont AFFICHÉS. Une
225
- * allowlist et pas une map clé booléen : le défaut (masqué) ne coûte aucune
226
- * entrée, et un fichier absent ou illisible se dégrade exactement en « tout est
227
- * masqué » — le défaut voulu.
224
+ * The Telegram channels (`bindKey`) where tool calls are SHOWN. An allowlist
225
+ * rather than a keyboolean map: the default (hidden) costs no entry, and a
226
+ * missing or unreadable file degrades to exactly "everything hidden" the
227
+ * intended default.
228
228
  *
229
- * Le réglage appartient au topic, pas à la session : `/new` recrée une session
230
- * dans le même topic et doit garder le choix de l'utilisateur.
229
+ * The setting belongs to the topic, not to the session: `/new` recreates a
230
+ * session in the same topic and must keep the user's choice.
231
231
  */
232
232
  export function loadTgToolKeys() {
233
233
  return readJson("telegram-tools").filter((k) => typeof k === "string");
@@ -244,10 +244,10 @@ export function setTgTools(key, on) {
244
244
  writeJson("telegram-tools", setToolKeys(loadTgToolKeys(), key, on));
245
245
  }
246
246
  /**
247
- * Le propriétaire des messages privés : l'id Telegram du premier utilisateur à
248
- * avoir écrit au bot en DM. Sans lui, un inconnu qui trouve le bot obtient une
249
- * session Claude sur la machine — les groupes sont déjà bornés au groupe lié,
250
- * les DM ne l'étaient pas.
247
+ * The owner of direct messages: the Telegram id of the first user to write to
248
+ * the bot in a DM. Without it, a stranger who finds the bot gets a Claude
249
+ * session on the machine — groups were already bounded to the bound group,
250
+ * DMs were not.
251
251
  */
252
252
  export function loadTgOwner() {
253
253
  const v = readJson("telegram-owner")[0];
package/dist/config.d.ts CHANGED
@@ -42,9 +42,9 @@ export interface Config {
42
42
  */
43
43
  permissionMode?: string;
44
44
  /**
45
- * Fuseau IANA par défaut des crons `daily` (« Europe/Paris »). Sans lui,
46
- * l'heure suit le fuseau de la machine un serveur en UTC décale donc tous
47
- * les horaires sans rien dire. Un cron peut le surcharger via son `tz`.
45
+ * Default IANA time zone for `daily` crons ("Europe/Paris"). Without it the
46
+ * hour follows the machine's zone so a server running UTC shifts every
47
+ * schedule silently. A cron can override it through its own `tz`.
48
48
  */
49
49
  timezone?: string;
50
50
  /**
package/dist/crons.d.ts CHANGED
@@ -29,11 +29,11 @@ export interface Cron {
29
29
  */
30
30
  check?: string;
31
31
  /**
32
- * Fuseau IANA (« Europe/Paris ») dans lequel lire un horaire `daily`. Sans
33
- * lui, l'heure suit le fuseau de la MACHINE : le même `daily:09:00` tire à 9h
34
- * à Paris et à 9h UTC sur un serveur en UTC, soit 11h vécues. Résolu par
35
- * `cronTimeZone` : ce champ, sinon le défaut global (config `timezone`),
36
- * sinon le fuseau systèmedonc rien ne bouge tant que personne ne configure.
32
+ * IANA time zone ("Europe/Paris") a `daily` schedule is read in. Without it
33
+ * the hour follows the MACHINE's zone: the same `daily:09:00` fires at 09:00
34
+ * in Paris and at 09:00 UTC on a server running UTC, i.e. 11:00 as lived.
35
+ * Resolved by `cronTimeZone`: this field, else the global default (config
36
+ * `timezone`), else the system zone so nothing moves until it is set.
37
37
  */
38
38
  tz?: string;
39
39
  /** ms epoch of the last fire, and the next scheduled fire. */
@@ -77,27 +77,27 @@ export interface CronTarget {
77
77
  */
78
78
  export declare function resolveCronTarget(channels: readonly Channel[], sessionId: string, fallbackCwd: string): CronTarget;
79
79
  /**
80
- * Marque portée par le TEXTE d'un prompt envoyé par un cron.
80
+ * Mark carried by the TEXT of a prompt sent by a cron.
81
81
  *
82
- * Pourquoi dans le contenu et pas seulement dans le protocole (`origin: "cron"`)
83
- * : le prompt part dans la TUI, donc Claude Code l'écrit dans le transcript
84
- * comme n'importe quel message utilisateur. Ne masquer que l'écho direct
85
- * laissait le mur de texte le prompt PLUS la sortie de la garde, des
86
- * kilo-octets revenir au rechargement de la page et dans le backfill d'un
87
- * topic Telegram, qui relisent tous deux `loadHistory`.
82
+ * Why in the content and not only in the protocol (`origin: "cron"`): the
83
+ * prompt goes through the TUI, so Claude Code writes it into the transcript
84
+ * like any other user message. Hiding only the direct echo left the wall of
85
+ * text the prompt PLUS the guard's output, kilobytes of it coming back on
86
+ * a page reload and in a Telegram topic's backfill, both of which re-read
87
+ * `loadHistory`.
88
88
  *
89
- * Même parti pris que la sentinelle `NOTHING TO SHOW` : une marque dans le
90
- * contenu, filtrée partout l'on rend. Elle a un second effet utile l'agent
91
- * apprend que ce tour vient d'une programmation, ce que rien ne lui disait.
89
+ * Same choice as the `NOTHING TO SHOW` sentinel: a mark in the content,
90
+ * filtered wherever we render. It has a useful side effectthe agent learns
91
+ * this turn comes from a schedule, which nothing else told it.
92
92
  */
93
93
  export declare const CRON_PROMPT_MARK = "\u23F0 [cron]";
94
- /** Préfixe le prompt d'un cron. Idempotent : re-marquer ne double pas la marque. */
94
+ /** Prefix a cron's prompt. Idempotent: re-marking does not double the mark. */
95
95
  export declare function markCronPrompt(text: string): string;
96
96
  /**
97
- * Ce texte est-il un prompt de cron ? Volontairement STRICT — la marque doit
98
- * OUVRIR le message. Un agent (ou un humain) qui cite « ⏰ [cron] » au milieu
99
- * d'une phrase ne doit pas voir son message disparaître : c'est le coût d'une
100
- * heuristique trop large que rappelle l'invariant 2.
97
+ * Is this text a cron prompt? Deliberately STRICT — the mark must OPEN the
98
+ * message. An agent (or a human) quoting "⏰ [cron]" mid-sentence must not see
99
+ * its message vanish: that is the cost of an over-broad heuristic, the one
100
+ * invariant 2 is about.
101
101
  */
102
102
  export declare function isCronPrompt(text: string): boolean;
103
103
  /** Why a cron's delivery to its channel failed. Lives here (not in server.ts)
@@ -121,28 +121,28 @@ export declare function nextRunAfterFailure(nowMs: number, scheduledNextMs: numb
121
121
  };
122
122
  /**
123
123
  * Next fire time (ms epoch) for a schedule, strictly after `fromMs`.
124
- * `tz` (IANA) ne concerne que les `daily` — un intervalle est une durée, il n'a
125
- * pas de fuseau. Absent → heure locale de la machine (comportement historique).
124
+ * `tz` (IANA) only applies to `daily` — an interval is a duration, it has no
125
+ * time zone. Absent → the machine's local time (historical behaviour).
126
126
  */
127
127
  export declare function nextRunFor(s: CronSchedule, fromMs: number, tz?: string | null): number;
128
- /** Le fuseau est-il un identifiant IANA que l'ICU embarqué connaît ? */
128
+ /** Is this an IANA zone identifier the bundled ICU knows? */
129
129
  export declare function isValidTimeZone(tz: string): boolean;
130
130
  /** Validate + normalize a raw schedule object; null if invalid. */
131
131
  export declare function normalizeSchedule(raw: any): CronSchedule | null;
132
- /** Fuseau de la machine le repli quand rien n'est configuré. */
132
+ /** The machine's zonethe fallback when nothing is configured. */
133
133
  export declare function systemTimeZone(): string;
134
- /** Défaut global (config `timezone`), ignoré s'il n'est pas un fuseau valide. */
134
+ /** Global default (config `timezone`), ignored unless it is a valid zone. */
135
135
  export declare function defaultTimeZone(): string | undefined;
136
136
  /**
137
- * Fuseau effectif d'un cron : le sien, sinon le défaut global, sinon celui de
138
- * la machine. Un `tz` posé sur la config répare donc d'un coup tous les crons
139
- * existantsc'est exactement ce qu'on veut d'un serveur qui tourne en UTC.
137
+ * A cron's effective zone: its own, else the global default, else the
138
+ * machine's. Setting `tz` on the config therefore fixes every existing cron at
139
+ * onceexactly what you want on a server running UTC.
140
140
  */
141
141
  export declare function cronTimeZone(c: Pick<Cron, "tz">): string;
142
142
  /**
143
- * Human label for a schedule (UI/Telegram). Le fuseau est TOUJOURS affiché pour
144
- * un `daily` : c'est la seule façon de repérer un serveur qui n'est pas dans le
145
- * fuseau qu'on croit (un « daily at 09:00 » nu ne dit pas 9h où).
143
+ * Human label for a schedule (UI/Telegram). The zone is ALWAYS shown for a
144
+ * `daily`: it is the only way to spot a server that is not in the zone you
145
+ * assume (a bare "daily at 09:00" does not say 09:00 where).
146
146
  */
147
147
  export declare function scheduleLabel(s: CronSchedule, tz?: string): string;
148
148
  export declare function loadCrons(): Cron[];
@@ -159,12 +159,12 @@ export type CronLookup = {
159
159
  matches: number;
160
160
  };
161
161
  /**
162
- * Résout ce que l'utilisateur a tapé en un id de cron complet.
162
+ * Resolve what the user typed into a full cron id.
163
163
  *
164
- * Toutes les surfaces n'affichent QUE les 8 premiers caractères de l'id
165
- * (`list` du web, de la skill, de Telegram) : accepter un préfixe n'est donc
166
- * pas un confort, c'est la seule façon de désigner un cron avec ce qu'on a sous
167
- * les yeux. Et un préfixe vide ne doit surtout pas « matcher le premier » —
168
- * `/cron del` sans argument supprimerait un cron au hasard.
164
+ * Every surface shows ONLY the first 8 characters of the id (the web, skill
165
+ * and Telegram `list`), so accepting a prefix is not a convenience: it is the
166
+ * only way to name a cron with what is on screen. And an empty prefix must
167
+ * never "match the first one" a bare `/cron del` would delete a cron at
168
+ * random.
169
169
  */
170
170
  export declare function resolveCronId(list: Cron[], needle: string): CronLookup;
package/dist/crons.js CHANGED
@@ -23,29 +23,29 @@ export function resolveCronTarget(channels, sessionId, fallbackCwd) {
23
23
  };
24
24
  }
25
25
  /**
26
- * Marque portée par le TEXTE d'un prompt envoyé par un cron.
26
+ * Mark carried by the TEXT of a prompt sent by a cron.
27
27
  *
28
- * Pourquoi dans le contenu et pas seulement dans le protocole (`origin: "cron"`)
29
- * : le prompt part dans la TUI, donc Claude Code l'écrit dans le transcript
30
- * comme n'importe quel message utilisateur. Ne masquer que l'écho direct
31
- * laissait le mur de texte le prompt PLUS la sortie de la garde, des
32
- * kilo-octets revenir au rechargement de la page et dans le backfill d'un
33
- * topic Telegram, qui relisent tous deux `loadHistory`.
28
+ * Why in the content and not only in the protocol (`origin: "cron"`): the
29
+ * prompt goes through the TUI, so Claude Code writes it into the transcript
30
+ * like any other user message. Hiding only the direct echo left the wall of
31
+ * text the prompt PLUS the guard's output, kilobytes of it coming back on
32
+ * a page reload and in a Telegram topic's backfill, both of which re-read
33
+ * `loadHistory`.
34
34
  *
35
- * Même parti pris que la sentinelle `NOTHING TO SHOW` : une marque dans le
36
- * contenu, filtrée partout l'on rend. Elle a un second effet utile l'agent
37
- * apprend que ce tour vient d'une programmation, ce que rien ne lui disait.
35
+ * Same choice as the `NOTHING TO SHOW` sentinel: a mark in the content,
36
+ * filtered wherever we render. It has a useful side effectthe agent learns
37
+ * this turn comes from a schedule, which nothing else told it.
38
38
  */
39
39
  export const CRON_PROMPT_MARK = "⏰ [cron]";
40
- /** Préfixe le prompt d'un cron. Idempotent : re-marquer ne double pas la marque. */
40
+ /** Prefix a cron's prompt. Idempotent: re-marking does not double the mark. */
41
41
  export function markCronPrompt(text) {
42
42
  return isCronPrompt(text) ? text : `${CRON_PROMPT_MARK} ${text}`;
43
43
  }
44
44
  /**
45
- * Ce texte est-il un prompt de cron ? Volontairement STRICT — la marque doit
46
- * OUVRIR le message. Un agent (ou un humain) qui cite « ⏰ [cron] » au milieu
47
- * d'une phrase ne doit pas voir son message disparaître : c'est le coût d'une
48
- * heuristique trop large que rappelle l'invariant 2.
45
+ * Is this text a cron prompt? Deliberately STRICT — the mark must OPEN the
46
+ * message. An agent (or a human) quoting "⏰ [cron]" mid-sentence must not see
47
+ * its message vanish: that is the cost of an over-broad heuristic, the one
48
+ * invariant 2 is about.
49
49
  */
50
50
  export function isCronPrompt(text) {
51
51
  return typeof text === "string" && text.trimStart().startsWith(CRON_PROMPT_MARK);
@@ -84,8 +84,8 @@ export function nextRunAfterFailure(nowMs, scheduledNextMs, attempts) {
84
84
  }
85
85
  /**
86
86
  * Next fire time (ms epoch) for a schedule, strictly after `fromMs`.
87
- * `tz` (IANA) ne concerne que les `daily` — un intervalle est une durée, il n'a
88
- * pas de fuseau. Absent → heure locale de la machine (comportement historique).
87
+ * `tz` (IANA) only applies to `daily` — an interval is a duration, it has no
88
+ * time zone. Absent → the machine's local time (historical behaviour).
89
89
  */
90
90
  export function nextRunFor(s, fromMs, tz) {
91
91
  if (s.kind === "interval") {
@@ -93,8 +93,8 @@ export function nextRunFor(s, fromMs, tz) {
93
93
  return fromMs + step;
94
94
  }
95
95
  if (!tz || !isValidTimeZone(tz)) {
96
- // Fuseau machine. `setHours` sur une Date locale suit les bascules d'heure
97
- // d'été toute seule (9h reste 9h), d'où ce chemin conservé tel quel.
96
+ // Machine zone. `setHours` on a local Date follows daylight-saving shifts
97
+ // on its own (09:00 stays 09:00), which is why this path is kept as is.
98
98
  const next = new Date(fromMs);
99
99
  next.setHours(s.hour, s.minute, 0, 0);
100
100
  if (next.getTime() <= fromMs)
@@ -104,14 +104,14 @@ export function nextRunFor(s, fromMs, tz) {
104
104
  const today = calendarDayIn(tz, fromMs);
105
105
  let t = instantOfWallClock(tz, today.y, today.mo, today.d, s.hour, s.minute);
106
106
  if (t <= fromMs) {
107
- // Jour suivant du CALENDRIER (pas +24h : un jour de bascule d'heure d'été
108
- // dure 23 ou 25h, et l'horaire doit rester à HH:MM).
107
+ // Next CALENDAR day (not +24h: a daylight-saving switch day lasts 23 or
108
+ // 25 hours, and the schedule must stay at HH:MM).
109
109
  const nd = new Date(Date.UTC(today.y, today.mo - 1, today.d) + 86_400_000);
110
110
  t = instantOfWallClock(tz, nd.getUTCFullYear(), nd.getUTCMonth() + 1, nd.getUTCDate(), s.hour, s.minute);
111
111
  }
112
112
  return t;
113
113
  }
114
- /** Le fuseau est-il un identifiant IANA que l'ICU embarqué connaît ? */
114
+ /** Is this an IANA zone identifier the bundled ICU knows? */
115
115
  export function isValidTimeZone(tz) {
116
116
  if (!tz || typeof tz !== "string")
117
117
  return false;
@@ -123,7 +123,7 @@ export function isValidTimeZone(tz) {
123
123
  return false;
124
124
  }
125
125
  }
126
- /** Champs horloge-murale d'un instant, lus dans `tz`. */
126
+ /** Wall-clock fields of an instant, read in `tz`. */
127
127
  function wallClockIn(tz, atMs) {
128
128
  const parts = new Intl.DateTimeFormat("en-US", {
129
129
  timeZone: tz,
@@ -139,22 +139,23 @@ function wallClockIn(tz, atMs) {
139
139
  for (const p of parts)
140
140
  if (p.type !== "literal")
141
141
  out[p.type] = Number(p.value);
142
- // Certaines versions d'ICU rendent l'heure « 24 » à minuit en cycle h23.
142
+ // Some ICU versions render hour "24" at midnight in the h23 cycle.
143
143
  out.hour = out.hour % 24;
144
144
  return out;
145
145
  }
146
- /** Date du calendrier (y/mo/d) telle qu'on la vit dans `tz` à cet instant. */
146
+ /** Calendar date (y/mo/d) as lived in `tz` at that instant. */
147
147
  function calendarDayIn(tz, atMs) {
148
148
  const w = wallClockIn(tz, atMs);
149
149
  return { y: w.year, mo: w.month, d: w.day };
150
150
  }
151
151
  /**
152
- * Instant (ms epoch) auquel l'horloge murale de `tz` affiche cette date/heure.
152
+ * Instant (ms epoch) at which `tz`'s wall clock reads that date/time.
153
153
  *
154
- * Deux passes : l'écart au UTC dépend de l'instant cherché, qu'on ne connaît
155
- * qu'une fois l'écart appliqué. La première passe donne un candidat, la seconde
156
- * relit l'écart RÉEL à ce candidat ce qui corrige les bascules d'heure d'été
157
- * (une seule passe se trompait d'une heure les deux jours de changement).
154
+ * Two passes: the offset from UTC depends on the very instant we are looking
155
+ * for, which we only know once the offset is applied. The first pass gives a
156
+ * candidate, the second re-reads the REAL offset at that candidate which
157
+ * fixes daylight-saving switches (a single pass was an hour off on both
158
+ * changeover days).
158
159
  */
159
160
  function instantOfWallClock(tz, y, mo, d, h, mi) {
160
161
  const naive = Date.UTC(y, mo - 1, d, h, mi, 0, 0);
@@ -183,7 +184,7 @@ export function normalizeSchedule(raw) {
183
184
  }
184
185
  return null;
185
186
  }
186
- /** Fuseau de la machine le repli quand rien n'est configuré. */
187
+ /** The machine's zonethe fallback when nothing is configured. */
187
188
  export function systemTimeZone() {
188
189
  try {
189
190
  return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
@@ -192,16 +193,16 @@ export function systemTimeZone() {
192
193
  return "UTC";
193
194
  }
194
195
  }
195
- /** Défaut global (config `timezone`), ignoré s'il n'est pas un fuseau valide. */
196
+ /** Global default (config `timezone`), ignored unless it is a valid zone. */
196
197
  export function defaultTimeZone() {
197
198
  const raw = loadConfig().timezone;
198
199
  const tz = typeof raw === "string" ? raw.trim() : "";
199
200
  return tz && isValidTimeZone(tz) ? tz : undefined;
200
201
  }
201
202
  /**
202
- * Fuseau effectif d'un cron : le sien, sinon le défaut global, sinon celui de
203
- * la machine. Un `tz` posé sur la config répare donc d'un coup tous les crons
204
- * existantsc'est exactement ce qu'on veut d'un serveur qui tourne en UTC.
203
+ * A cron's effective zone: its own, else the global default, else the
204
+ * machine's. Setting `tz` on the config therefore fixes every existing cron at
205
+ * onceexactly what you want on a server running UTC.
205
206
  */
206
207
  export function cronTimeZone(c) {
207
208
  if (c.tz && isValidTimeZone(c.tz))
@@ -209,9 +210,9 @@ export function cronTimeZone(c) {
209
210
  return defaultTimeZone() ?? systemTimeZone();
210
211
  }
211
212
  /**
212
- * Human label for a schedule (UI/Telegram). Le fuseau est TOUJOURS affiché pour
213
- * un `daily` : c'est la seule façon de repérer un serveur qui n'est pas dans le
214
- * fuseau qu'on croit (un « daily at 09:00 » nu ne dit pas 9h où).
213
+ * Human label for a schedule (UI/Telegram). The zone is ALWAYS shown for a
214
+ * `daily`: it is the only way to spot a server that is not in the zone you
215
+ * assume (a bare "daily at 09:00" does not say 09:00 where).
215
216
  */
216
217
  export function scheduleLabel(s, tz) {
217
218
  if (s.kind === "interval") {
@@ -255,19 +256,19 @@ export function removeCron(id) {
255
256
  saveCrons(loadCrons().filter((c) => c.id !== id));
256
257
  }
257
258
  /**
258
- * Résout ce que l'utilisateur a tapé en un id de cron complet.
259
+ * Resolve what the user typed into a full cron id.
259
260
  *
260
- * Toutes les surfaces n'affichent QUE les 8 premiers caractères de l'id
261
- * (`list` du web, de la skill, de Telegram) : accepter un préfixe n'est donc
262
- * pas un confort, c'est la seule façon de désigner un cron avec ce qu'on a sous
263
- * les yeux. Et un préfixe vide ne doit surtout pas « matcher le premier » —
264
- * `/cron del` sans argument supprimerait un cron au hasard.
261
+ * Every surface shows ONLY the first 8 characters of the id (the web, skill
262
+ * and Telegram `list`), so accepting a prefix is not a convenience: it is the
263
+ * only way to name a cron with what is on screen. And an empty prefix must
264
+ * never "match the first one" a bare `/cron del` would delete a cron at
265
+ * random.
265
266
  */
266
267
  export function resolveCronId(list, needle) {
267
268
  const n = (needle ?? "").trim();
268
269
  if (!n)
269
270
  return { ok: false, error: "empty", matches: 0 };
270
- // Un id complet gagne toujours, même s'il est aussi le préfixe d'un autre.
271
+ // A full id always wins, even when it is also the prefix of another.
271
272
  if (list.some((c) => c.id === n))
272
273
  return { ok: true, id: n };
273
274
  const hits = list.filter((c) => c.id.startsWith(n));
package/dist/crons.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"crons.js","sourceRoot":"","sources":["../src/crons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAmEzC;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAA4B,EAC5B,SAAiB,EACjB,WAAmB;IAEnB,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;IAC3D,OAAO;QACL,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,WAAW;QACnC,OAAO,EAAE,EAAE,EAAE,OAAO,IAAI,IAAI;QAC5B,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,IAAI;QAC1B,IAAI,EAAE,EAAE,EAAE,IAAI,IAAI,IAAI;QACtB,KAAK,EAAE,CAAC,CAAC,EAAE;KACZ,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC;AAE3C,oFAAoF;AACpF,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,gBAAgB,IAAI,IAAI,EAAE,CAAC;AACnE,CAAC;AAED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,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IAC5E,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IACpF,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACtC,CAAC"}
package/dist/csp.d.ts CHANGED
@@ -1,45 +1,45 @@
1
1
  /**
2
- * La Content-Security-Policy du cockpit, et l'injection du nonce dans la page.
2
+ * The cockpit's Content-Security-Policy, and the nonce injection into the page.
3
3
  *
4
- * Pourquoi une CSP ici : le transcript rend du **Markdown produit par l'agent**,
5
- * donc du contenu dérivé de ce que l'agent a lu (un fichier d'un repo cloné, une
6
- * page web, un message Telegram). `marked` laisse passer le HTML brut. Sans
7
- * garde, un `<img onerror=…>` planté dans un README s'exécute dans le cockpit —
8
- * qui peut créer un cron, donc lancer une commande shell. L'assainissement
9
- * (DOMPurify, côté client) est la première barrière ; la CSP est celle qui tient
10
- * encore quand l'assainisseur a un trou.
4
+ * Why a CSP here: the transcript renders **Markdown produced by the agent**,
5
+ * i.e. content derived from what the agent read (a file in a cloned repo, a web
6
+ * page, a Telegram message). `marked` lets raw HTML through. With no guard, an
7
+ * `<img onerror=…>` planted in a README runs inside the cockpit — which can
8
+ * create a cron, hence run a shell command. Sanitising (DOMPurify, client-side)
9
+ * is the first barrier; the CSP is the one that still holds when the sanitiser
10
+ * has a hole.
11
11
  *
12
- * Tout est pur ici ; le câblage vit dans server.ts.
12
+ * Everything here is pure; the wiring lives in server.ts.
13
13
  */
14
14
  /**
15
- * Marqueur écrit en dur dans `public/index.html`, remplacé par le vrai nonce à
16
- * chaque requête.
15
+ * Marker hardcoded in `public/index.html`, replaced by the real nonce on every
16
+ * request.
17
17
  *
18
- * Un remplacement de chaîne littérale, pas une réécriture de balises : on ne
19
- * veut ni parser du HTML ni risquer de « nonce-er » un `<script` qui traînerait
20
- * dans une chaîne JavaScript. En prime, le marqueur rend l'exigence visible dans
21
- * la source — un futur bloc de script sans lui ne s'exécutera pas, ce qui se
22
- * remarque tout de suite.
18
+ * A literal string replacement, not a tag rewrite: we want neither to parse
19
+ * HTML nor to risk "nonce-ing" a `<script` that happens to sit inside a
20
+ * JavaScript string. As a bonus the marker makes the requirement visible in the
21
+ * source — a future script block without it will not run, which shows up
22
+ * immediately.
23
23
  */
24
24
  export declare const NONCE_PLACEHOLDER = "__CSP_NONCE__";
25
25
  /**
26
- * La politique servie avec chaque page.
26
+ * The policy served with every page.
27
27
  *
28
- * - `script-src` : **aucun `unsafe-inline`**. C'est la directive qui compte
29
- * elle neutralise `<img onerror>`, `<script>` injecté et `javascript:`. Les
30
- * deux blocs inline de la page portent le nonce ; le HTML injecté, lui, ne
31
- * peut pas le deviner (il est tiré au sort à chaque requête).
32
- * - `style-src` garde `unsafe-inline` : la page a une grosse feuille inline et
33
- * des attributs `style=` un peu partout. Le nonce ne couvre pas les attributs,
34
- * donc l'exiger reviendrait à réécrire le client entier pour un gain faible
35
- * l'injection de style seule ne donne pas l'exécution de code.
36
- * - `img-src` autorise `data:` : le favicon est un SVG en data-URI, et le pip de
37
- * notification le réécrit à la volée.
38
- * - `connect-src 'self'` couvre le WebSocket : `'self'` s'applique aussi au
39
- * `ws://` de même hôte et même port.
40
- * - `base-uri`/`object-src`/`frame-ancestors` à `none` : rien à réécrire, rien à
41
- * embarquer, et pas de clickjacking sur une UI qui pilote des agents.
28
+ * - `script-src`: **no `unsafe-inline`**. That is the directive that matters
29
+ * it neutralises `<img onerror>`, injected `<script>` and `javascript:`. The
30
+ * page's two inline blocks carry the nonce; injected HTML cannot guess it (it
31
+ * is drawn afresh on every request).
32
+ * - `style-src` keeps `unsafe-inline`: the page has one large inline stylesheet
33
+ * and `style=` attributes all over. The nonce does not cover attributes, so
34
+ * requiring it would mean rewriting the whole client for little gain style
35
+ * injection alone does not give code execution.
36
+ * - `img-src` allows `data:`: the favicon is an SVG data-URI, and the
37
+ * notification pip rewrites it on the fly.
38
+ * - `connect-src 'self'` covers the WebSocket: `'self'` also applies to a
39
+ * `ws://` on the same host and port.
40
+ * - `base-uri`/`object-src`/`frame-ancestors` at `none`: nothing to rewrite,
41
+ * nothing to embed, and no clickjacking on a UI that drives agents.
42
42
  */
43
43
  export declare function cspHeader(nonce: string): string;
44
- /** Remplace chaque marqueur par le nonce de cette requête. */
44
+ /** Replace every marker with this request's nonce. */
45
45
  export declare function injectNonce(html: string, nonce: string): string;