@atolis-hq/wake 0.2.41 → 0.2.43
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/dist/src/adapters/github/github-issues-work-source.js +3 -13
- package/dist/src/adapters/http/ui-assets.js +4 -0
- package/dist/src/adapters/http/ui-data.js +1 -0
- package/dist/src/core/approval-intents.js +16 -0
- package/dist/src/core/policy-engine.js +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { autoApprovalLabel, resolveAutoApprovalIntent } from '../../core/approval-intents.js';
|
|
2
3
|
import { defaultAgentIdentity } from '../../domain/schema.js';
|
|
3
4
|
import { buildResourceUri } from '../../domain/resource-uri.js';
|
|
4
5
|
import { wakeStageLabelPrefix } from '../../domain/stages.js';
|
|
@@ -18,8 +19,6 @@ const pollOverlapMs = 60 * 60 * 1000;
|
|
|
18
19
|
// expectedEcho bookkeeping surviving a crash (#145).
|
|
19
20
|
const wakeCommentMarker = '<!-- wake:agent -->';
|
|
20
21
|
const githubSource = 'github';
|
|
21
|
-
const autoApprovalLabel = 'wake:auto';
|
|
22
|
-
const autoApprovalCommands = new Set(['yolo', 'autoapprove']);
|
|
23
22
|
export function wakeIdempotencyMarker(idempotencyKey) {
|
|
24
23
|
return typeof idempotencyKey === 'string'
|
|
25
24
|
? `<!-- wake:idempotency ${idempotencyKey} -->`
|
|
@@ -138,15 +137,6 @@ function issueAssignees(issue) {
|
|
|
138
137
|
.map((assignee) => assignee.login)
|
|
139
138
|
.filter((login) => typeof login === 'string');
|
|
140
139
|
}
|
|
141
|
-
function autoApprovalCommandName(body) {
|
|
142
|
-
for (const line of (body ?? '').split(/\r?\n/)) {
|
|
143
|
-
const match = /^\/([A-Za-z0-9_.-]+)\b/.exec(line.trim());
|
|
144
|
-
if (match?.[1] !== undefined && autoApprovalCommands.has(match[1].toLowerCase())) {
|
|
145
|
-
return match[1].toLowerCase();
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
140
|
function issueWithAutoApprovalLabel(issue) {
|
|
151
141
|
return {
|
|
152
142
|
...issue,
|
|
@@ -382,7 +372,7 @@ export function createGitHubIssuesWorkSource(deps) {
|
|
|
382
372
|
continue;
|
|
383
373
|
}
|
|
384
374
|
if (!autoApprovalLabelAdded &&
|
|
385
|
-
|
|
375
|
+
resolveAutoApprovalIntent(comment.body) !== null &&
|
|
386
376
|
comment.user?.type !== 'Bot' &&
|
|
387
377
|
!(comment.body ?? '').includes(wakeCommentMarker) &&
|
|
388
378
|
(deps.selfLogin === undefined || comment.user?.login !== deps.selfLogin)) {
|
|
@@ -466,7 +456,7 @@ export function createGitHubIssuesWorkSource(deps) {
|
|
|
466
456
|
continue;
|
|
467
457
|
}
|
|
468
458
|
if (!autoApprovalLabelAdded &&
|
|
469
|
-
|
|
459
|
+
resolveAutoApprovalIntent(comment.body) !== null &&
|
|
470
460
|
comment.user?.type !== 'Bot' &&
|
|
471
461
|
!(comment.body ?? '').includes(wakeCommentMarker) &&
|
|
472
462
|
(deps.selfLogin === undefined || comment.user?.login !== deps.selfLogin)) {
|
|
@@ -56,6 +56,7 @@ export const indexHtml = `<!DOCTYPE html>
|
|
|
56
56
|
.card .title { font-weight: 600; margin-bottom: 0.25rem; }
|
|
57
57
|
.card .meta { color: #9aa2ad; font-size: 0.72rem; }
|
|
58
58
|
.chip { display: inline-block; background: #2c313a; border-radius: 4px; padding: 0.05rem 0.35rem; font-size: 0.68rem; margin-right: 0.2rem; }
|
|
59
|
+
.chip-label { background: transparent; border: 1px solid #3a4150; color: #9aa2ad; margin-bottom: 0.2rem; }
|
|
59
60
|
table { border-collapse: collapse; width: 100%; font-size: 0.8rem; }
|
|
60
61
|
th, td { text-align: left; padding: 0.35rem 0.5rem; border-bottom: 1px solid #2c313a; }
|
|
61
62
|
th { color: #9aa2ad; font-weight: 600; }
|
|
@@ -264,6 +265,9 @@ async function renderBoard(context) {
|
|
|
264
265
|
el('span', { class: 'chip', text: item.stage }),
|
|
265
266
|
document.createTextNode(fmtMs(item.timeInStageMs) + ' in stage'),
|
|
266
267
|
]),
|
|
268
|
+
...(item.labels && item.labels.length > 0
|
|
269
|
+
? [el('div', { class: 'meta' }, item.labels.map((label) => el('span', { class: 'chip chip-label', text: label })))]
|
|
270
|
+
: []),
|
|
267
271
|
el('div', { class: 'meta', text: item.lastRunSentinel ? 'last: ' + item.lastRunAction + ' → ' + item.lastRunSentinel : item.conditionReason }),
|
|
268
272
|
]));
|
|
269
273
|
return el('div', { class: 'col' + (items.length === 0 ? ' col-empty' : '') }, [
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const autoApprovalLabel = 'wake:auto';
|
|
2
|
+
const autoApprovalCommands = new Set(['yolo', 'autoapprove']);
|
|
3
|
+
export function resolveAutoApprovalIntent(body) {
|
|
4
|
+
for (const line of (body ?? '').split(/\r?\n/)) {
|
|
5
|
+
const match = /^\/([A-Za-z0-9_.-]+)\b/.exec(line.trim());
|
|
6
|
+
const command = match?.[1]?.toLowerCase();
|
|
7
|
+
if (command !== undefined && autoApprovalCommands.has(command)) {
|
|
8
|
+
return {
|
|
9
|
+
kind: 'auto-approval-opt-in',
|
|
10
|
+
label: autoApprovalLabel,
|
|
11
|
+
command,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
@@ -2,6 +2,7 @@ import { awaitingApprovalRunnerSentinel, failedRunnerSentinel } from '../domain/
|
|
|
2
2
|
import { resolveCustomCommand } from '../domain/custom-commands.js';
|
|
3
3
|
import { builtInDefaultWorkflowDefinition, chooseAction as chooseWorkflowAction, isKnownWorkflowStage, selectWorkflowForEvent, workflowForProjection, } from '../domain/workflows.js';
|
|
4
4
|
import { alwaysManualIgnoredLabels } from '../domain/manual-labels.js';
|
|
5
|
+
import { autoApprovalLabel } from './approval-intents.js';
|
|
5
6
|
function isAwaitingApproval(issue) {
|
|
6
7
|
const context = issue.context;
|
|
7
8
|
return context.lastRunSentinel === awaitingApprovalRunnerSentinel;
|
|
@@ -23,7 +24,6 @@ const approvedCommandPattern = /^\/approved\b/i;
|
|
|
23
24
|
const changesCommandPattern = /^\/changes\b/i;
|
|
24
25
|
const prReviewApprovalMarker = '<!-- wake:pr-review-approved -->';
|
|
25
26
|
const prReviewChangesMarker = '<!-- wake:pr-review-changes-requested -->';
|
|
26
|
-
const autoApprovalLabel = 'wake:auto';
|
|
27
27
|
// The action Wake runs when a correlated PR gets new reviewer feedback while
|
|
28
28
|
// the work item is awaiting approval. Not configurable per workflow: it's a
|
|
29
29
|
// lateral response to a PR surface, not a workflow stage.
|
package/dist/src/version.js
CHANGED