@pleaseai/work 0.1.2 → 0.1.3
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/index.js +30 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36906,6 +36906,31 @@ function matchesFilter(issue2, filter2) {
|
|
|
36906
36906
|
function isTrackerError(val) {
|
|
36907
36907
|
return typeof val === "object" && val !== null && "code" in val;
|
|
36908
36908
|
}
|
|
36909
|
+
function serializeCause(cause) {
|
|
36910
|
+
if (cause instanceof Error)
|
|
36911
|
+
return cause.message;
|
|
36912
|
+
if (typeof cause === "string")
|
|
36913
|
+
return cause;
|
|
36914
|
+
try {
|
|
36915
|
+
return JSON.stringify(cause) ?? String(cause);
|
|
36916
|
+
} catch {
|
|
36917
|
+
return String(cause);
|
|
36918
|
+
}
|
|
36919
|
+
}
|
|
36920
|
+
function formatTrackerError(err) {
|
|
36921
|
+
switch (err.code) {
|
|
36922
|
+
case "github_projects_api_status":
|
|
36923
|
+
case "asana_api_status":
|
|
36924
|
+
return `${err.code} (HTTP ${err.status})`;
|
|
36925
|
+
case "github_projects_graphql_errors":
|
|
36926
|
+
return `${err.code}: ${JSON.stringify(err.errors)}`;
|
|
36927
|
+
case "github_projects_api_request":
|
|
36928
|
+
case "asana_api_request":
|
|
36929
|
+
return `${err.code}: ${serializeCause(err.cause)}`;
|
|
36930
|
+
default:
|
|
36931
|
+
return err.code;
|
|
36932
|
+
}
|
|
36933
|
+
}
|
|
36909
36934
|
|
|
36910
36935
|
// src/tracker/asana.ts
|
|
36911
36936
|
var PAGE_SIZE = 50;
|
|
@@ -40415,13 +40440,13 @@ class Orchestrator {
|
|
|
40415
40440
|
}
|
|
40416
40441
|
const adapter = createTrackerAdapter(this.config);
|
|
40417
40442
|
if (isTrackerError(adapter)) {
|
|
40418
|
-
console.error(`[orchestrator] tracker adapter error: ${adapter
|
|
40443
|
+
console.error(`[orchestrator] tracker adapter error: ${formatTrackerError(adapter)}`);
|
|
40419
40444
|
this.scheduleTick(this.state.poll_interval_ms);
|
|
40420
40445
|
return;
|
|
40421
40446
|
}
|
|
40422
40447
|
const candidatesResult = await adapter.fetchCandidateIssues();
|
|
40423
40448
|
if (isTrackerError(candidatesResult)) {
|
|
40424
|
-
console.error(`[orchestrator] tracker fetch failed: ${candidatesResult
|
|
40449
|
+
console.error(`[orchestrator] tracker fetch failed: ${formatTrackerError(candidatesResult)}`);
|
|
40425
40450
|
this.scheduleTick(this.state.poll_interval_ms);
|
|
40426
40451
|
return;
|
|
40427
40452
|
}
|
|
@@ -40692,7 +40717,7 @@ class Orchestrator {
|
|
|
40692
40717
|
return;
|
|
40693
40718
|
const refreshed = await adapter.fetchIssueStatesByIds(runningIds);
|
|
40694
40719
|
if (isTrackerError(refreshed)) {
|
|
40695
|
-
console.warn(`[orchestrator] state refresh failed: ${refreshed
|
|
40720
|
+
console.warn(`[orchestrator] state refresh failed: ${formatTrackerError(refreshed)} \u2014 keeping workers running`);
|
|
40696
40721
|
return;
|
|
40697
40722
|
}
|
|
40698
40723
|
const activeStates = getActiveStates(this.config);
|
|
@@ -40736,12 +40761,12 @@ class Orchestrator {
|
|
|
40736
40761
|
const terminalStates = getTerminalStates(this.config);
|
|
40737
40762
|
const adapter = createTrackerAdapter(this.config);
|
|
40738
40763
|
if (isTrackerError(adapter)) {
|
|
40739
|
-
console.warn(`[orchestrator] startup cleanup: adapter error ${adapter
|
|
40764
|
+
console.warn(`[orchestrator] startup cleanup: adapter error ${formatTrackerError(adapter)}`);
|
|
40740
40765
|
return;
|
|
40741
40766
|
}
|
|
40742
40767
|
const result = await adapter.fetchIssuesByStates(terminalStates);
|
|
40743
40768
|
if (isTrackerError(result)) {
|
|
40744
|
-
console.warn(`[orchestrator] startup terminal cleanup failed: ${result
|
|
40769
|
+
console.warn(`[orchestrator] startup terminal cleanup failed: ${formatTrackerError(result)}`);
|
|
40745
40770
|
return;
|
|
40746
40771
|
}
|
|
40747
40772
|
for (const issue2 of result) {
|