@ouro.bot/cli 0.1.0-alpha.1113 → 0.1.0-alpha.1115

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/changelog.json CHANGED
@@ -1,6 +1,18 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.1115",
6
+ "changes": [
7
+ "An issue drain can list `ignoredLabels` (for example `agent:drain`): adding or removing one of those labels no longer wakes the drain. Labels starting with `drain:` stay ignored as before, and any other label still wakes it."
8
+ ]
9
+ },
10
+ {
11
+ "version": "0.1.0-alpha.1114",
12
+ "changes": [
13
+ "An issue drain can list `ignoredBodyTrailers` (for example `Active-at`, `Waiting-for`): an edit that changes only those `Key: value` lines of an issue body, such as a lane's hourly beat, no longer wakes the drain. Any other body edit still does, and a drain without the setting behaves as before."
14
+ ]
15
+ },
4
16
  {
5
17
  "version": "0.1.0-alpha.1113",
6
18
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1113",
2
+ "runtimeVersion": "0.1.0-alpha.1115",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-09-03T00:00:00.000Z"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
  <Container version="2">
3
3
  <Name>ouro-butler</Name>
4
- <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1113</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1115</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -188,17 +188,29 @@ function normalizeIssueDrains(rawSense, configFile) {
188
188
  const seen = new Set();
189
189
  result.issueDrains = issueDrains.map((entry, index) => {
190
190
  const item = (entry && typeof entry === "object" ? entry : {});
191
- const { repo, session, account } = item;
191
+ const { repo, session, account, ignoredBodyTrailers, ignoredLabels } = item;
192
192
  if (typeof repo !== "string" || !/^[\w.-]+\/[\w.-]+$/.test(repo))
193
193
  fail(`issueDrains[${index}].repo must be "owner/name"`);
194
194
  if (typeof session !== "string" || !session.trim())
195
195
  fail(`issueDrains[${index}].session must be a Copilot app session id`);
196
196
  if (account !== undefined && (typeof account !== "string" || !account.trim()))
197
197
  fail(`issueDrains[${index}].account must be a GitHub login`);
198
+ if (ignoredBodyTrailers !== undefined && (!Array.isArray(ignoredBodyTrailers) || ignoredBodyTrailers.some(key => typeof key !== "string" || !/^[\w][\w -]*$/.test(key.trim())))) {
199
+ fail(`issueDrains[${index}].ignoredBodyTrailers must be an array of trailer keys such as "Active-at"`);
200
+ }
201
+ if (ignoredLabels !== undefined && (!Array.isArray(ignoredLabels) || ignoredLabels.some(name => typeof name !== "string" || !name.trim()))) {
202
+ fail(`issueDrains[${index}].ignoredLabels must be an array of label names such as "agent:drain"`);
203
+ }
198
204
  if (seen.has(repo))
199
205
  fail(`issueDrains[${index}].repo ${repo} is listed twice`);
200
206
  seen.add(repo);
201
- return { repo: repo, session: session.trim(), ...(account !== undefined ? { account: account.trim() } : {}) };
207
+ return {
208
+ repo: repo,
209
+ session: session.trim(),
210
+ ...(account !== undefined ? { account: account.trim() } : {}),
211
+ ...(ignoredBodyTrailers !== undefined ? { ignoredBodyTrailers: ignoredBodyTrailers.map(key => key.trim()) } : {}),
212
+ ...(ignoredLabels !== undefined ? { ignoredLabels: ignoredLabels.map(name => name.trim()) } : {}),
213
+ };
202
214
  });
203
215
  }
204
216
  if (issuePollMinutes !== undefined) {
@@ -39,23 +39,38 @@ function wakeMessage(repo, events) {
39
39
  const more = events.length > MAX_TITLES ? `, and ${events.length - MAX_TITLES} more` : "";
40
40
  return `New or changed issues in ${repo}: ${shown.join(", ")}${more}. Drain them.`;
41
41
  }
42
- const digestOf = (issue) => (0, node_crypto_1.createHash)("sha1").update(`${issue.title}\n${issue.body ?? ""}`).digest("hex").slice(0, 16);
42
+ const escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
43
+ /** The body without its ignored trailer lines (`Active-at: …`), so an edit that touches only those lines leaves the digest alone. */
44
+ function bodyWithoutTrailers(body, keys) {
45
+ if (keys.length === 0)
46
+ return body;
47
+ const trailer = new RegExp(`^[ \\t]*(?:${keys.map(escapeRegExp).join("|")})[ \\t]*:.*(?:\\r?\\n|$)`, "gim");
48
+ return body.replace(trailer, "").trimEnd();
49
+ }
50
+ const digestOf = (issue, keys) => (0, node_crypto_1.createHash)("sha1").update(`${issue.title}\n${bodyWithoutTrailers(issue.body ?? "", keys)}`).digest("hex").slice(0, 16);
43
51
  /** The drain's own status comment: the marker, written by the polling account. Its creation and every edit are skipped. */
44
52
  const ownStatus = (comment, login) => comment.user?.login?.toLowerCase() === login.toLowerCase() && !!comment.body?.includes(exports.DRAIN_STATUS_MARKER);
45
- /** A reopen, or a label change outside the drain's own namespace. Closes, assignments, mentions and the drain's labels are not news. */
46
- const newsEvent = (event) => event.event === "reopened" || ((event.event === "labeled" || event.event === "unlabeled") && !event.label?.name?.startsWith(exports.DRAIN_LABEL_PREFIX));
53
+ /** A reopen, or a change to a label that is neither in the drain's namespace nor on its ignored list. Closes, assignments and mentions are not news. */
54
+ const newsEvent = (event, ignoredLabels) => {
55
+ if (event.event === "reopened")
56
+ return true;
57
+ if (event.event !== "labeled" && event.event !== "unlabeled")
58
+ return false;
59
+ const name = (event.label?.name ?? "").toLowerCase();
60
+ return !name.startsWith(exports.DRAIN_LABEL_PREFIX) && !ignoredLabels.includes(name);
61
+ };
47
62
  /** Whether anyone but the drain changed the issue since `before`: a new issue, an edit, another comment, a reopen or a label outside the drain's own. */
48
- async function changedByOthers(api, repo, issue, before, digest) {
63
+ async function changedByOthers(api, repo, issue, before, digest, ignored, ignoredLabels) {
49
64
  if (!before)
50
65
  return true;
51
- if (before.digest && before.digest !== digest)
66
+ if (before.digest && (before.ignored ?? "") === ignored && before.digest !== digest)
52
67
  return true;
53
68
  const since = before.updatedAt;
54
69
  const comments = (await api.comments(repo, issue.number, since)).filter(comment => comment.updated_at > since);
55
70
  if (comments.some(comment => !ownStatus(comment, api.login)))
56
71
  return true;
57
72
  const events = (await api.issueEvents(repo, issue.number)).filter(event => event.created_at > since);
58
- return events.some(newsEvent);
73
+ return events.some(event => newsEvent(event, ignoredLabels));
59
74
  }
60
75
  /** Poll one drain's repository, record what changed, then wake its session once with the whole batch. */
61
76
  async function pollDrain(drain, states, save, deps) {
@@ -64,16 +79,19 @@ async function pollDrain(drain, states, save, deps) {
64
79
  try {
65
80
  const api = await deps.connect(drain.account);
66
81
  const issues = await api.openIssues(drain.repo);
82
+ const trailers = drain.ignoredBodyTrailers ?? [];
83
+ const ignored = trailers.join(",");
84
+ const labels = (drain.ignoredLabels ?? []).map(name => name.toLowerCase());
67
85
  const seen = {};
68
86
  const recorded = [];
69
87
  for (const issue of issues) {
70
88
  const key = String(issue.number);
71
89
  const before = (0, issue_drain_state_1.seenIssue)(state.seen[key]);
72
- const digest = digestOf(issue);
73
- seen[key] = { updatedAt: issue.updated_at, digest };
90
+ const digest = digestOf(issue, trailers);
91
+ seen[key] = { updatedAt: issue.updated_at, digest, ...(ignored ? { ignored } : {}) };
74
92
  if (!state.seeded || before?.updatedAt === issue.updated_at)
75
93
  continue;
76
- if (await changedByOthers(api, drain.repo, issue, before, digest))
94
+ if (await changedByOthers(api, drain.repo, issue, before, digest, ignored, labels))
77
95
  recorded.push({ number: issue.number, title: issue.title, updatedAt: issue.updated_at });
78
96
  }
79
97
  for (const [key, entry] of Object.entries(state.seen)) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1113",
3
+ "version": "0.1.0-alpha.1115",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@ouro.bot/cli",
9
- "version": "0.1.0-alpha.1113",
9
+ "version": "0.1.0-alpha.1115",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.78.0",
12
12
  "@ouro.bot/friends": "0.1.0-alpha.18",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1113",
3
+ "version": "0.1.0-alpha.1115",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },