@atolis-hq/wake 0.2.41 → 0.2.42

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.
@@ -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
- autoApprovalCommandName(comment.body) !== null &&
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
- autoApprovalCommandName(comment.body) !== null &&
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)) {
@@ -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.
@@ -124,4 +124,4 @@ export function resolveWakeVersion(options = {}) {
124
124
  }
125
125
  return '0.1.0-dev';
126
126
  }
127
- export const wakeVersion = "gecbffd3";
127
+ export const wakeVersion = "g09bbeb0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atolis-hq/wake",
3
- "version": "0.2.41",
3
+ "version": "0.2.42",
4
4
  "description": "Local autonomous agent control plane for software development",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {