@atolis-hq/wake 0.2.4 → 0.2.5

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.
@@ -180,6 +180,22 @@ export async function readControlPlaneUiUrl(wakeRoot) {
180
180
  return undefined;
181
181
  }
182
182
  }
183
+ export function formatGitHubError(error) {
184
+ if (error instanceof Error) {
185
+ const octokit = error;
186
+ if (octokit.status !== undefined) {
187
+ const headers = octokit.response?.headers ?? {};
188
+ const parts = [`status=${octokit.status}`];
189
+ if (headers['x-ratelimit-remaining'] !== undefined)
190
+ parts.push(`ratelimit-remaining=${headers['x-ratelimit-remaining']}`);
191
+ if (headers['retry-after'] !== undefined)
192
+ parts.push(`retry-after=${headers['retry-after']}`);
193
+ return parts.join(' ');
194
+ }
195
+ return error.message.slice(0, 300);
196
+ }
197
+ return String(error).slice(0, 300);
198
+ }
183
199
  export function formatWakeComment(payload, controlPlaneUrl) {
184
200
  const body = typeof payload.body === 'string' ? payload.body : '';
185
201
  const kind = typeof payload.kind === 'string' ? payload.kind : undefined;
@@ -314,7 +330,7 @@ export function createGitHubIssuesWorkSource(deps) {
314
330
  });
315
331
  }
316
332
  catch (error) {
317
- console.error(`[github-work-source] poll failed for ${repoRef}, skipping this tick: ${error instanceof Error ? error.message : String(error)}`);
333
+ console.error(`[github-work-source] poll failed for ${repoRef}, skipping this tick: ${formatGitHubError(error)}`);
318
334
  }
319
335
  }
320
336
  return events;
@@ -1,6 +1,6 @@
1
1
  import { buildResourceUri } from '../../domain/resource-uri.js';
2
2
  import { createUnkeyedEventEnvelope, createEventEnvelope } from '../../lib/event-log.js';
3
- import { formatWakeComment, readControlPlaneUiUrl } from './github-issues-work-source.js';
3
+ import { formatGitHubError, formatWakeComment, readControlPlaneUiUrl, } from './github-issues-work-source.js';
4
4
  const githubPrSource = 'github-pr';
5
5
  const wakeCommentMarker = '<!-- wake:agent -->';
6
6
  function prResourceUri(repo, number) {
@@ -122,7 +122,7 @@ export function createGitHubPullRequestActivitySource(deps) {
122
122
  }
123
123
  }
124
124
  catch (error) {
125
- console.error(`[github-pr-activity-source] discovery failed for ${repoRef}, skipping this tick: ${error instanceof Error ? error.message : String(error)}`);
125
+ console.error(`[github-pr-activity-source] discovery failed for ${repoRef}, skipping this tick: ${formatGitHubError(error)}`);
126
126
  }
127
127
  }
128
128
  return { events, seenPrData, confirmedOpenRepos };
@@ -247,7 +247,7 @@ export function createGitHubPullRequestActivitySource(deps) {
247
247
  }
248
248
  }
249
249
  catch (error) {
250
- console.error(`[github-pr-activity-source] activity poll failed for ${resourceUri}, skipping this tick: ${error instanceof Error ? error.message : String(error)}`);
250
+ console.error(`[github-pr-activity-source] activity poll failed for ${resourceUri}, skipping this tick: ${formatGitHubError(error)}`);
251
251
  }
252
252
  return events;
253
253
  }
@@ -391,7 +391,7 @@ export function createGitHubPullRequestActivitySource(deps) {
391
391
  return await pollRequiredCheckFailures(ref, watchRef.resourceUri, ingestedAt, seenPrData.get(watchRef.resourceUri));
392
392
  }
393
393
  catch (error) {
394
- console.error(`[github-pr-activity-source] check poll failed for ${watchRef.resourceUri}, skipping this tick: ${error instanceof Error ? error.message : String(error)}`);
394
+ console.error(`[github-pr-activity-source] check poll failed for ${watchRef.resourceUri}, skipping this tick: ${formatGitHubError(error)}`);
395
395
  return [];
396
396
  }
397
397
  }));
@@ -1 +1 @@
1
- export const wakeVersion = "0.2.4+g59df9f2";
1
+ export const wakeVersion = "0.2.5+ga2cf757";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atolis-hq/wake",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Local autonomous agent control plane for software development",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {