agents-relay 2.0.100 → 2.0.101
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/pool.js
CHANGED
|
@@ -5,6 +5,7 @@ import { scheduleBucket } from './scheduler.js';
|
|
|
5
5
|
import { ReconcileCoordinator } from './reconcile-coordinator.js';
|
|
6
6
|
import { errorMessage, observability, withObservabilityCorrelation } from './observability.js';
|
|
7
7
|
import { jobHasActiveExecution } from './job-execution-slot.js';
|
|
8
|
+
import { unconsumedUnblockTrigger } from './unblock.js';
|
|
8
9
|
const RANK = { P0: 0, P1: 1, P2: 2, P3: 3 };
|
|
9
10
|
export function compareJobPriority(a, b) { return RANK[a.priority ?? 'P2'] - RANK[b.priority ?? 'P2'] || a.createdAt.localeCompare(b.createdAt) || a.id.localeCompare(b.id); }
|
|
10
11
|
export function runnableManagedJobs(items) { return items.filter(item => item.job.state === 'ACTIVE').map(item => item.job).sort(compareJobPriority); }
|
|
@@ -12,6 +13,8 @@ export function needsLifecycleReconciliation(job, now = Date.now()) {
|
|
|
12
13
|
// DRAFT create-only Jobs stay dormant until a caller explicitly creates work.
|
|
13
14
|
if (job.tasks.length === 0)
|
|
14
15
|
return false;
|
|
16
|
+
if (job.executionMode === 'autonomous' && unconsumedUnblockTrigger(job))
|
|
17
|
+
return true;
|
|
15
18
|
if (job.tasks.some(task => (task.state === 'QUEUED' && task.executionId === null)
|
|
16
19
|
|| (task.state === 'RUNNING' && task.adapter === 'orchestrator' && task.executionId === null)
|
|
17
20
|
|| (task.state === 'DRAFT' && task.dependencies.length > 0)))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { GraphRuntime } from './graph-v2.js';
|
|
3
3
|
import { dispatchWorkflowGraph, dispatchWorkflowGraphSync } from './dispatcher.js';
|
|
4
|
-
import { isEffectivelyBlocked } from '../unblock.js';
|
|
4
|
+
import { isEffectivelyBlocked, unconsumedUnblockTrigger } from '../unblock.js';
|
|
5
5
|
const source = readFileSync(new URL('../../workflow/planner-orchestration.mmd', import.meta.url), 'utf8');
|
|
6
6
|
const boolGuard = (name) => (facts) => facts.durableFacts[name] === true;
|
|
7
7
|
export const plannerOrchestrationV2 = new GraphRuntime(source, {
|
|
@@ -51,7 +51,7 @@ export function plannerOrchestrationFacts(job, recoverablePendingPlan) {
|
|
|
51
51
|
recoverablePendingPlan,
|
|
52
52
|
hasSeedWork: !((job.plans?.length ?? 0) === 0 && job.tasks.filter(task => task.kind !== 'planner').length === 0),
|
|
53
53
|
noActivePlanner: !scopedPlans.some(plan => plan.status === 'PLANNING'),
|
|
54
|
-
noBlockedWork: !scopedTasks.some(task => task.kind !== 'planner' && isEffectivelyBlocked(task)),
|
|
54
|
+
noBlockedWork: Boolean(unconsumedUnblockTrigger(job)) || !scopedTasks.some(task => task.kind !== 'planner' && isEffectivelyBlocked(task)),
|
|
55
55
|
noActiveImplementation: !scopedTasks.some(task => task.kind !== 'planner' && ['DRAFT', 'QUEUED', 'RUNNING'].includes(task.state)),
|
|
56
56
|
resolutionOwnedByTroubleshooter: scopedTasks.some(task => task.kind !== 'planner' && task.resolution?.owner === 'troubleshooter' && ['active', 'waiting'].includes(task.resolution.state)),
|
|
57
57
|
continuationMaterialized: !(latestObjective === 'in_progress' && latestId && !job.tasks.some(task => task.kind !== 'planner' && task.planningDecisionId === latestId)),
|