@ouro.bot/cli 0.1.0-alpha.1113 → 0.1.0-alpha.1114
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,12 @@
|
|
|
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.1114",
|
|
6
|
+
"changes": [
|
|
7
|
+
"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."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.1113",
|
|
6
12
|
"changes": [
|
|
@@ -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.
|
|
4
|
+
<Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1114</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
package/dist/heart/identity.js
CHANGED
|
@@ -188,17 +188,25 @@ 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 } = 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
|
+
}
|
|
198
201
|
if (seen.has(repo))
|
|
199
202
|
fail(`issueDrains[${index}].repo ${repo} is listed twice`);
|
|
200
203
|
seen.add(repo);
|
|
201
|
-
return {
|
|
204
|
+
return {
|
|
205
|
+
repo: repo,
|
|
206
|
+
session: session.trim(),
|
|
207
|
+
...(account !== undefined ? { account: account.trim() } : {}),
|
|
208
|
+
...(ignoredBodyTrailers !== undefined ? { ignoredBodyTrailers: ignoredBodyTrailers.map(key => key.trim()) } : {}),
|
|
209
|
+
};
|
|
202
210
|
});
|
|
203
211
|
}
|
|
204
212
|
if (issuePollMinutes !== undefined) {
|
|
@@ -39,16 +39,24 @@ 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
|
|
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
53
|
/** A reopen, or a label change outside the drain's own namespace. Closes, assignments, mentions and the drain's labels are not news. */
|
|
46
54
|
const newsEvent = (event) => event.event === "reopened" || ((event.event === "labeled" || event.event === "unlabeled") && !event.label?.name?.startsWith(exports.DRAIN_LABEL_PREFIX));
|
|
47
55
|
/** 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) {
|
|
56
|
+
async function changedByOthers(api, repo, issue, before, digest, ignored) {
|
|
49
57
|
if (!before)
|
|
50
58
|
return true;
|
|
51
|
-
if (before.digest && before.digest !== digest)
|
|
59
|
+
if (before.digest && (before.ignored ?? "") === ignored && before.digest !== digest)
|
|
52
60
|
return true;
|
|
53
61
|
const since = before.updatedAt;
|
|
54
62
|
const comments = (await api.comments(repo, issue.number, since)).filter(comment => comment.updated_at > since);
|
|
@@ -64,16 +72,18 @@ async function pollDrain(drain, states, save, deps) {
|
|
|
64
72
|
try {
|
|
65
73
|
const api = await deps.connect(drain.account);
|
|
66
74
|
const issues = await api.openIssues(drain.repo);
|
|
75
|
+
const trailers = drain.ignoredBodyTrailers ?? [];
|
|
76
|
+
const ignored = trailers.join(",");
|
|
67
77
|
const seen = {};
|
|
68
78
|
const recorded = [];
|
|
69
79
|
for (const issue of issues) {
|
|
70
80
|
const key = String(issue.number);
|
|
71
81
|
const before = (0, issue_drain_state_1.seenIssue)(state.seen[key]);
|
|
72
|
-
const digest = digestOf(issue);
|
|
73
|
-
seen[key] = { updatedAt: issue.updated_at, digest };
|
|
82
|
+
const digest = digestOf(issue, trailers);
|
|
83
|
+
seen[key] = { updatedAt: issue.updated_at, digest, ...(ignored ? { ignored } : {}) };
|
|
74
84
|
if (!state.seeded || before?.updatedAt === issue.updated_at)
|
|
75
85
|
continue;
|
|
76
|
-
if (await changedByOthers(api, drain.repo, issue, before, digest))
|
|
86
|
+
if (await changedByOthers(api, drain.repo, issue, before, digest, ignored))
|
|
77
87
|
recorded.push({ number: issue.number, title: issue.title, updatedAt: issue.updated_at });
|
|
78
88
|
}
|
|
79
89
|
for (const [key, entry] of Object.entries(state.seen)) {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1114",
|
|
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.
|
|
9
|
+
"version": "0.1.0-alpha.1114",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.78.0",
|
|
12
12
|
"@ouro.bot/friends": "0.1.0-alpha.18",
|