@pellux/goodvibes-sdk 0.33.19 → 0.33.21
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/browser-knowledge.d.ts +49 -0
- package/dist/browser-knowledge.d.ts.map +1 -1
- package/dist/browser-knowledge.js +22 -0
- package/dist/contracts/artifacts/operator-contract.json +4615 -4
- package/dist/events/agents.d.ts +11 -0
- package/dist/events/agents.d.ts.map +1 -1
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/planner.d.ts +69 -1
- package/dist/events/planner.d.ts.map +1 -1
- package/dist/platform/agents/wrfc-controller.d.ts +18 -0
- package/dist/platform/agents/wrfc-controller.d.ts.map +1 -1
- package/dist/platform/agents/wrfc-controller.js +237 -13
- package/dist/platform/agents/wrfc-types.d.ts +1 -1
- package/dist/platform/agents/wrfc-types.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-knowledge.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-knowledge.js +154 -1
- package/dist/platform/control-plane/operator-contract-schemas-project-planning.d.ts +4 -0
- package/dist/platform/control-plane/operator-contract-schemas-project-planning.d.ts.map +1 -1
- package/dist/platform/control-plane/operator-contract-schemas-project-planning.js +78 -0
- package/dist/platform/daemon/http/project-planning-routes.d.ts.map +1 -1
- package/dist/platform/daemon/http/project-planning-routes.js +67 -0
- package/dist/platform/knowledge/index.d.ts +1 -1
- package/dist/platform/knowledge/index.d.ts.map +1 -1
- package/dist/platform/knowledge/project-planning/helpers.d.ts +1 -1
- package/dist/platform/knowledge/project-planning/helpers.d.ts.map +1 -1
- package/dist/platform/knowledge/project-planning/helpers.js +4 -0
- package/dist/platform/knowledge/project-planning/index.d.ts +1 -1
- package/dist/platform/knowledge/project-planning/index.d.ts.map +1 -1
- package/dist/platform/knowledge/project-planning/service.d.ts +21 -1
- package/dist/platform/knowledge/project-planning/service.d.ts.map +1 -1
- package/dist/platform/knowledge/project-planning/service.js +502 -1
- package/dist/platform/knowledge/project-planning/types.d.ts +140 -0
- package/dist/platform/knowledge/project-planning/types.d.ts.map +1 -1
- package/dist/platform/runtime/emitters/agents.d.ts +11 -0
- package/dist/platform/runtime/emitters/agents.d.ts.map +1 -1
- package/dist/platform/runtime/emitters/planner.d.ts +22 -0
- package/dist/platform/runtime/emitters/planner.d.ts.map +1 -1
- package/dist/platform/runtime/emitters/planner.js +15 -0
- package/dist/platform/runtime/events/index.d.ts +1 -1
- package/dist/platform/runtime/events/index.d.ts.map +1 -1
- package/dist/platform/runtime/services.d.ts.map +1 -1
- package/dist/platform/runtime/services.js +2 -0
- package/dist/platform/runtime/store/domains/agents.d.ts +3 -1
- package/dist/platform/runtime/store/domains/agents.d.ts.map +1 -1
- package/dist/platform/runtime/store/helpers/reducers/lifecycle.d.ts.map +1 -1
- package/dist/platform/runtime/store/helpers/reducers/lifecycle.js +25 -6
- package/dist/platform/tools/agent/index.d.ts.map +1 -1
- package/dist/platform/tools/agent/index.js +135 -49
- package/dist/platform/tools/agent/manager.d.ts +1 -0
- package/dist/platform/tools/agent/manager.d.ts.map +1 -1
- package/dist/platform/tools/agent/manager.js +35 -5
- package/dist/platform/tools/agent/schema.js +4 -4
- package/dist/platform/tools/agent/wrfc-batch-policy.d.ts +13 -0
- package/dist/platform/tools/agent/wrfc-batch-policy.d.ts.map +1 -0
- package/dist/platform/tools/agent/wrfc-batch-policy.js +108 -0
- package/dist/platform/version.js +1 -1
- package/package.json +9 -9
package/dist/events/agents.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ export type AgentEvent =
|
|
|
12
12
|
taskId?: string | undefined;
|
|
13
13
|
task: string;
|
|
14
14
|
parentAgentId?: string | undefined;
|
|
15
|
+
wrfcId?: string | undefined;
|
|
16
|
+
wrfcRole?: 'owner' | 'engineer' | 'reviewer' | 'fixer' | 'verifier' | undefined;
|
|
17
|
+
wrfcPhaseOrder?: number | undefined;
|
|
15
18
|
orchestrationGraphId?: string | undefined;
|
|
16
19
|
parentNodeId?: string | undefined;
|
|
17
20
|
}
|
|
@@ -20,6 +23,10 @@ export type AgentEvent =
|
|
|
20
23
|
type: 'AGENT_RUNNING';
|
|
21
24
|
agentId: string;
|
|
22
25
|
taskId?: string;
|
|
26
|
+
parentAgentId?: string | undefined;
|
|
27
|
+
wrfcId?: string | undefined;
|
|
28
|
+
wrfcRole?: 'owner' | 'engineer' | 'reviewer' | 'fixer' | 'verifier' | undefined;
|
|
29
|
+
wrfcPhaseOrder?: number | undefined;
|
|
23
30
|
}
|
|
24
31
|
/** Agent emitted a textual progress update. */
|
|
25
32
|
| {
|
|
@@ -27,6 +34,10 @@ export type AgentEvent =
|
|
|
27
34
|
agentId: string;
|
|
28
35
|
taskId?: string;
|
|
29
36
|
progress: string;
|
|
37
|
+
parentAgentId?: string | undefined;
|
|
38
|
+
wrfcId?: string | undefined;
|
|
39
|
+
wrfcRole?: 'owner' | 'engineer' | 'reviewer' | 'fixer' | 'verifier' | undefined;
|
|
40
|
+
wrfcPhaseOrder?: number | undefined;
|
|
30
41
|
}
|
|
31
42
|
/** Agent streamed a chunk of output. */
|
|
32
43
|
| {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/events/agents.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF;;;;GAIG;AAEH,MAAM,MAAM,UAAU;AACpB,iDAAiD;AAC/C;IACE,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AACH,gDAAgD;GAC9C;
|
|
1
|
+
{"version":3,"file":"agents.d.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AC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnF,gDAAgD;AAChD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/events/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type { AgentEvent, AgentEventType } from './agents.js';
|
|
|
16
16
|
export type { WorkflowEvent, WorkflowEventType, Constraint, WrfcState } from './workflows.js';
|
|
17
17
|
export type { OrchestrationEvent, OrchestrationEventType, OrchestrationTaskContract } from './orchestration.js';
|
|
18
18
|
export type { CommunicationEvent, CommunicationEventType, CommunicationKind, CommunicationScope } from './communication.js';
|
|
19
|
-
export type { PlannerEvent, PlannerEventType,
|
|
19
|
+
export type { ExecutionStrategy, PlannerDecision, PlannerEvent, PlannerEventType, StrategyCandidate, WorkPlanEventBase, WorkPlanSnapshotEventRecord, WorkPlanTaskEventRecord, WorkPlanTaskStatus, } from './planner.js';
|
|
20
20
|
export type { PermissionEvent, PermissionEventType } from './permissions.js';
|
|
21
21
|
export type { PluginEvent, PluginEventType } from './plugins.js';
|
|
22
22
|
export type { McpEvent, McpEventType, McpServerRole, McpTrustMode, QuarantineReason } from './mcp.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACnE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5G,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACvE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC9E,YAAY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L,0BAA0B,EAC1B,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACtE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,SAAS,GACV,MAAM,gBAAgB,CAAC"}
|
package/dist/events/planner.d.ts
CHANGED
|
@@ -22,12 +22,80 @@ export interface PlannerDecision {
|
|
|
22
22
|
readonly taskDescription?: string | undefined;
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
+
export type WorkPlanTaskStatus = 'pending' | 'in_progress' | 'blocked' | 'done' | 'failed' | 'cancelled';
|
|
26
|
+
export interface WorkPlanTaskEventRecord {
|
|
27
|
+
readonly taskId: string;
|
|
28
|
+
readonly projectId: string;
|
|
29
|
+
readonly knowledgeSpaceId: string;
|
|
30
|
+
readonly title: string;
|
|
31
|
+
readonly notes?: string | undefined;
|
|
32
|
+
readonly owner?: string | undefined;
|
|
33
|
+
readonly status: WorkPlanTaskStatus;
|
|
34
|
+
readonly priority?: number | undefined;
|
|
35
|
+
readonly order: number;
|
|
36
|
+
readonly source?: string | undefined;
|
|
37
|
+
readonly tags: readonly string[];
|
|
38
|
+
readonly parentTaskId?: string | undefined;
|
|
39
|
+
readonly chainId?: string | undefined;
|
|
40
|
+
readonly phaseId?: string | undefined;
|
|
41
|
+
readonly agentId?: string | undefined;
|
|
42
|
+
readonly turnId?: string | undefined;
|
|
43
|
+
readonly decisionId?: string | undefined;
|
|
44
|
+
readonly sourceMessageId?: string | undefined;
|
|
45
|
+
readonly linkedArtifactIds: readonly string[];
|
|
46
|
+
readonly linkedSourceIds: readonly string[];
|
|
47
|
+
readonly linkedNodeIds: readonly string[];
|
|
48
|
+
readonly originSurface?: string | undefined;
|
|
49
|
+
readonly createdAt: number;
|
|
50
|
+
readonly updatedAt: number;
|
|
51
|
+
readonly completedAt?: number | undefined;
|
|
52
|
+
readonly metadata?: Record<string, unknown> | undefined;
|
|
53
|
+
}
|
|
54
|
+
export interface WorkPlanEventBase {
|
|
55
|
+
readonly projectId: string;
|
|
56
|
+
readonly knowledgeSpaceId: string;
|
|
57
|
+
readonly workPlanId: string;
|
|
58
|
+
}
|
|
59
|
+
export interface WorkPlanSnapshotEventRecord extends WorkPlanEventBase {
|
|
60
|
+
readonly tasks: readonly WorkPlanTaskEventRecord[];
|
|
61
|
+
readonly counts: {
|
|
62
|
+
readonly total: number;
|
|
63
|
+
readonly pending: number;
|
|
64
|
+
readonly in_progress: number;
|
|
65
|
+
readonly blocked: number;
|
|
66
|
+
readonly done: number;
|
|
67
|
+
readonly failed: number;
|
|
68
|
+
readonly cancelled: number;
|
|
69
|
+
};
|
|
70
|
+
readonly updatedAt: number;
|
|
71
|
+
}
|
|
25
72
|
export type PlannerEvent = ({
|
|
26
73
|
type: 'PLAN_STRATEGY_SELECTED';
|
|
27
74
|
} & PlannerDecision) | {
|
|
28
75
|
type: 'PLAN_STRATEGY_OVERRIDDEN';
|
|
29
76
|
strategy: ExecutionStrategy | null;
|
|
30
77
|
clearedBy?: string | undefined;
|
|
31
|
-
}
|
|
78
|
+
} | ({
|
|
79
|
+
type: 'WORK_PLAN_TASK_CREATED';
|
|
80
|
+
task: WorkPlanTaskEventRecord;
|
|
81
|
+
} & WorkPlanEventBase) | ({
|
|
82
|
+
type: 'WORK_PLAN_TASK_UPDATED';
|
|
83
|
+
task: WorkPlanTaskEventRecord;
|
|
84
|
+
previousTask: WorkPlanTaskEventRecord;
|
|
85
|
+
} & WorkPlanEventBase) | ({
|
|
86
|
+
type: 'WORK_PLAN_TASK_STATUS_CHANGED';
|
|
87
|
+
taskId: string;
|
|
88
|
+
status: WorkPlanTaskStatus;
|
|
89
|
+
previousStatus: WorkPlanTaskStatus;
|
|
90
|
+
task: WorkPlanTaskEventRecord;
|
|
91
|
+
} & WorkPlanEventBase) | ({
|
|
92
|
+
type: 'WORK_PLAN_TASK_DELETED';
|
|
93
|
+
taskId: string;
|
|
94
|
+
task: WorkPlanTaskEventRecord;
|
|
95
|
+
} & WorkPlanEventBase) | ({
|
|
96
|
+
type: 'WORK_PLAN_SNAPSHOT_INVALIDATED';
|
|
97
|
+
reason: string;
|
|
98
|
+
snapshot: WorkPlanSnapshotEventRecord;
|
|
99
|
+
} & WorkPlanEventBase);
|
|
32
100
|
export type PlannerEventType = PlannerEvent['type'];
|
|
33
101
|
//# sourceMappingURL=planner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../src/events/planner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,GAAG,QAAQ,CAAC;AAEvF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,QAAQ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,CAAC,GACpB,CAAC;IACD,IAAI,EAAE,gCAAgC,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,2BAA2B,CAAC;CACvC,GAAG,iBAAiB,CAAC,CAAC;AAEzB,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -6,9 +6,14 @@ import type { ConfigManager } from '../config/manager.js';
|
|
|
6
6
|
import type { AgentRecord } from '../tools/agent/index.js';
|
|
7
7
|
import type { ExecutionPlanManager } from '../core/execution-plan.js';
|
|
8
8
|
import type { RuntimeEventBus } from '../runtime/events/index.js';
|
|
9
|
+
import type { ProjectWorkPlanTaskCreateInput, ProjectWorkPlanTaskUpdateInput } from '../knowledge/project-planning/index.js';
|
|
9
10
|
import { type AgentManagerLike } from './wrfc-config.js';
|
|
10
11
|
export { extractScoreFromText, extractPassedFromText, extractIssuesFromText } from './wrfc-reporting.js';
|
|
11
12
|
type WrfcWorktreeOps = Pick<AgentWorktree, 'merge' | 'cleanup'>;
|
|
13
|
+
type WrfcWorkPlanService = {
|
|
14
|
+
createWorkPlanTask(input: ProjectWorkPlanTaskCreateInput): Promise<unknown>;
|
|
15
|
+
updateWorkPlanTask(input: ProjectWorkPlanTaskUpdateInput): Promise<unknown>;
|
|
16
|
+
};
|
|
12
17
|
export declare class WrfcController {
|
|
13
18
|
private readonly chains;
|
|
14
19
|
private chainQueue;
|
|
@@ -24,6 +29,8 @@ export declare class WrfcController {
|
|
|
24
29
|
private readonly configManager;
|
|
25
30
|
private readonly createWorktree;
|
|
26
31
|
private readonly selectChildRoute;
|
|
32
|
+
private workPlanService;
|
|
33
|
+
private readonly workPlanTaskQueues;
|
|
27
34
|
constructor(runtimeBus: RuntimeEventBus, messageBus: Pick<AgentMessageBus, 'registerAgent'>, deps: {
|
|
28
35
|
readonly agentManager: AgentManagerLike;
|
|
29
36
|
readonly configManager: Pick<ConfigManager, 'get' | 'getCategory'>;
|
|
@@ -37,12 +44,17 @@ export declare class WrfcController {
|
|
|
37
44
|
getWorkmap(): WrfcWorkmap;
|
|
38
45
|
setPlanManager(planManager: Pick<ExecutionPlanManager, 'getActive' | 'updateItem'>): void;
|
|
39
46
|
setRuntimeBus(runtimeBus: RuntimeEventBus): void;
|
|
47
|
+
setWorkPlanService(service: WrfcWorkPlanService | null | undefined): void;
|
|
40
48
|
getChain(chainId: string): WrfcChain | null;
|
|
41
49
|
listChains(): WrfcChain[];
|
|
42
50
|
resumeChain(chainId: string): boolean;
|
|
43
51
|
resumeAllActiveChains(): number;
|
|
44
52
|
dispose(): void;
|
|
45
53
|
private transition;
|
|
54
|
+
private applyWrfcAgentMetadata;
|
|
55
|
+
private keepOwnerAgentActive;
|
|
56
|
+
private ownerProgress;
|
|
57
|
+
private wrfcPhaseOrder;
|
|
46
58
|
private setupListeners;
|
|
47
59
|
private onAgentComplete;
|
|
48
60
|
private onAgentFailed;
|
|
@@ -74,6 +86,12 @@ export declare class WrfcController {
|
|
|
74
86
|
private withRouteReason;
|
|
75
87
|
private completeChainAsPassed;
|
|
76
88
|
private completeOwnerAgent;
|
|
89
|
+
private upsertWrfcWorkPlanTask;
|
|
90
|
+
private setWrfcWorkPlanTaskStatus;
|
|
91
|
+
private enqueueWrfcWorkPlanTaskOperation;
|
|
92
|
+
private workPlanRoleForAgent;
|
|
93
|
+
private workPlanTaskIdForAgent;
|
|
94
|
+
private workPlanTaskTitle;
|
|
77
95
|
private safeDequeueNext;
|
|
78
96
|
}
|
|
79
97
|
//# sourceMappingURL=wrfc-controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrfc-controller.d.ts","sourceRoot":"","sources":["../../../src/platform/agents/wrfc-controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AASnD,OAAO,KAAK,EAGV,SAAS,EACT,sBAAsB,
|
|
1
|
+
{"version":3,"file":"wrfc-controller.d.ts","sourceRoot":"","sources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AO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,eAAe;CAKxB"}
|
|
@@ -8,7 +8,7 @@ import { AgentWorktree } from './worktree.js';
|
|
|
8
8
|
import { completePlanItemsForAgent } from './wrfc-plan-sync.js';
|
|
9
9
|
import { logger } from '../utils/logger.js';
|
|
10
10
|
import { summarizeError } from '../utils/error-display.js';
|
|
11
|
-
import { emitAgentCompleted, emitAgentFailed, emitWorkflowChainFailed, emitWorkflowFixAttempted, emitWorkflowReviewCompleted, } from '../runtime/emitters/index.js';
|
|
11
|
+
import { emitAgentCompleted, emitAgentFailed, emitAgentProgress, emitAgentRunning, emitWorkflowChainFailed, emitWorkflowFixAttempted, emitWorkflowReviewCompleted, } from '../runtime/emitters/index.js';
|
|
12
12
|
import { getWrfcAutoCommit, getWrfcMaxFixAttempts, getWrfcScoreThreshold, } from './wrfc-config.js';
|
|
13
13
|
import { buildEngineerConstraintAddendum, } from './wrfc-prompt-addenda.js';
|
|
14
14
|
import { completeWrfcOrchestrationNode, createWrfcWorkflowContext, emitWrfcAutoCommitted, emitWrfcCascadeAbort, emitWrfcChainCreated, emitWrfcChainPassed, emitWrfcConstraintsEnumerated, emitWrfcGraphCreated, emitWrfcStateChanged, failWrfcOrchestrationNode, startWrfcOrchestrationNode, } from './wrfc-runtime-events.js';
|
|
@@ -40,6 +40,8 @@ export class WrfcController {
|
|
|
40
40
|
configManager;
|
|
41
41
|
createWorktree;
|
|
42
42
|
selectChildRoute;
|
|
43
|
+
workPlanService = null;
|
|
44
|
+
workPlanTaskQueues = new Map();
|
|
43
45
|
constructor(runtimeBus, messageBus, deps) {
|
|
44
46
|
this.runtimeBus = runtimeBus;
|
|
45
47
|
this.messageBus = messageBus;
|
|
@@ -86,6 +88,9 @@ export class WrfcController {
|
|
|
86
88
|
this.runtimeBus = runtimeBus;
|
|
87
89
|
this.setupListeners();
|
|
88
90
|
}
|
|
91
|
+
setWorkPlanService(service) {
|
|
92
|
+
this.workPlanService = service ?? null;
|
|
93
|
+
}
|
|
89
94
|
getChain(chainId) { return this.chains.get(chainId) ?? null; }
|
|
90
95
|
listChains() { return Array.from(this.chains.values()); }
|
|
91
96
|
resumeChain(chainId) {
|
|
@@ -138,9 +143,86 @@ export class WrfcController {
|
|
|
138
143
|
}
|
|
139
144
|
const from = chain.state;
|
|
140
145
|
chain.state = to;
|
|
146
|
+
if (to !== 'passed' && to !== 'failed') {
|
|
147
|
+
this.keepOwnerAgentActive(chain);
|
|
148
|
+
}
|
|
141
149
|
emitWrfcStateChanged(this.runtimeBus, this.sessionId, chain.id, from, to);
|
|
142
150
|
logger.debug('WrfcController.transition', { chainId: chain.id, from, to });
|
|
143
151
|
}
|
|
152
|
+
applyWrfcAgentMetadata(chain, record, role) {
|
|
153
|
+
record.wrfcId = chain.id;
|
|
154
|
+
record.wrfcRole = role;
|
|
155
|
+
record.wrfcPhaseOrder = this.wrfcPhaseOrder(role);
|
|
156
|
+
if (role === 'owner') {
|
|
157
|
+
record.progress = this.ownerProgress(chain);
|
|
158
|
+
}
|
|
159
|
+
if (record.status === 'pending' || record.status === 'running') {
|
|
160
|
+
emitAgentProgress(this.runtimeBus, {
|
|
161
|
+
sessionId: this.sessionId,
|
|
162
|
+
traceId: `${this.sessionId}:wrfc-agent-metadata:${record.id}`,
|
|
163
|
+
source: 'wrfc-controller',
|
|
164
|
+
agentId: record.id,
|
|
165
|
+
}, {
|
|
166
|
+
agentId: record.id,
|
|
167
|
+
progress: record.progress ?? `WRFC ${role} phase`,
|
|
168
|
+
...(record.parentAgentId ? { parentAgentId: record.parentAgentId } : {}),
|
|
169
|
+
wrfcId: chain.id,
|
|
170
|
+
wrfcRole: role,
|
|
171
|
+
wrfcPhaseOrder: record.wrfcPhaseOrder,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
keepOwnerAgentActive(chain, reason) {
|
|
176
|
+
if (chain.ownerTerminalEmitted || chain.state === 'passed' || chain.state === 'failed')
|
|
177
|
+
return;
|
|
178
|
+
const owner = this.agentManager.getStatus(chain.ownerAgentId);
|
|
179
|
+
if (!owner)
|
|
180
|
+
return;
|
|
181
|
+
this.applyWrfcAgentMetadata(chain, owner, 'owner');
|
|
182
|
+
owner.status = 'running';
|
|
183
|
+
delete owner.completedAt;
|
|
184
|
+
owner.progress = reason ? `${this.ownerProgress(chain)} - ${reason}` : this.ownerProgress(chain);
|
|
185
|
+
emitAgentRunning(this.runtimeBus, {
|
|
186
|
+
sessionId: this.sessionId,
|
|
187
|
+
traceId: `${this.sessionId}:wrfc-owner-active:${chain.id}`,
|
|
188
|
+
source: 'wrfc-controller',
|
|
189
|
+
agentId: owner.id,
|
|
190
|
+
}, {
|
|
191
|
+
agentId: owner.id,
|
|
192
|
+
wrfcId: chain.id,
|
|
193
|
+
wrfcRole: 'owner',
|
|
194
|
+
wrfcPhaseOrder: owner.wrfcPhaseOrder,
|
|
195
|
+
});
|
|
196
|
+
emitAgentProgress(this.runtimeBus, {
|
|
197
|
+
sessionId: this.sessionId,
|
|
198
|
+
traceId: `${this.sessionId}:wrfc-owner-progress:${chain.id}`,
|
|
199
|
+
source: 'wrfc-controller',
|
|
200
|
+
agentId: owner.id,
|
|
201
|
+
}, {
|
|
202
|
+
agentId: owner.id,
|
|
203
|
+
progress: owner.progress,
|
|
204
|
+
wrfcId: chain.id,
|
|
205
|
+
wrfcRole: 'owner',
|
|
206
|
+
wrfcPhaseOrder: owner.wrfcPhaseOrder,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
ownerProgress(chain) {
|
|
210
|
+
return `WRFC owner supervising child agents (${chain.state})`;
|
|
211
|
+
}
|
|
212
|
+
wrfcPhaseOrder(role) {
|
|
213
|
+
switch (role) {
|
|
214
|
+
case 'owner':
|
|
215
|
+
return 0;
|
|
216
|
+
case 'engineer':
|
|
217
|
+
return 1;
|
|
218
|
+
case 'reviewer':
|
|
219
|
+
return 2;
|
|
220
|
+
case 'fixer':
|
|
221
|
+
return 3;
|
|
222
|
+
case 'verifier':
|
|
223
|
+
return 4;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
144
226
|
setupListeners() {
|
|
145
227
|
const unsubComplete = this.runtimeBus.on('AGENT_COMPLETED', ({ payload }) => {
|
|
146
228
|
this.onAgentComplete(payload.agentId).catch((error) => {
|
|
@@ -165,7 +247,13 @@ export class WrfcController {
|
|
|
165
247
|
if (agentId === chain.ownerAgentId) {
|
|
166
248
|
if (chain.ownerTerminalEmitted)
|
|
167
249
|
return;
|
|
168
|
-
this.
|
|
250
|
+
this.keepOwnerAgentActive(chain, 'Ignored premature owner completion event; WRFC lifecycle is still active');
|
|
251
|
+
this.appendOwnerDecision(chain, 'owner_completion_ignored', 'Ignored premature owner completion because WRFC owner remains active until the full chain is terminal', { agentId });
|
|
252
|
+
logger.warn('WrfcController: ignored premature owner completion before terminal chain state', {
|
|
253
|
+
chainId: chain.id,
|
|
254
|
+
agentId,
|
|
255
|
+
state: chain.state,
|
|
256
|
+
});
|
|
169
257
|
return;
|
|
170
258
|
}
|
|
171
259
|
const record = this.agentManager.getStatus(agentId);
|
|
@@ -186,12 +274,14 @@ export class WrfcController {
|
|
|
186
274
|
}
|
|
187
275
|
if (chain.state === 'engineering' || chain.state === 'fixing') {
|
|
188
276
|
const report = parseEngineerCompletionReport(rawOutput, record?.template);
|
|
277
|
+
this.setWrfcWorkPlanTaskStatus(chain, agentId, 'done');
|
|
189
278
|
this.handleEngineerCompletion(chain, agentId, report);
|
|
190
279
|
}
|
|
191
280
|
else if (chain.state === 'reviewing') {
|
|
192
281
|
const review = parseReviewerCompletionReport(chain.id, rawOutput, getWrfcScoreThreshold(this.configManager));
|
|
193
282
|
chain.reviewerReport = review;
|
|
194
283
|
chain.reviewCycles += 1;
|
|
284
|
+
this.setWrfcWorkPlanTaskStatus(chain, agentId, 'done');
|
|
195
285
|
await this.processReview(chain, review);
|
|
196
286
|
}
|
|
197
287
|
if (this.planManager) {
|
|
@@ -208,6 +298,20 @@ export class WrfcController {
|
|
|
208
298
|
return;
|
|
209
299
|
if (agentId === chain.ownerAgentId && (chain.state === 'passed' || chain.state === 'failed'))
|
|
210
300
|
return;
|
|
301
|
+
if (agentId === chain.ownerAgentId) {
|
|
302
|
+
this.keepOwnerAgentActive(chain, 'Ignored premature owner failure event; WRFC lifecycle is still active');
|
|
303
|
+
this.appendOwnerDecision(chain, 'owner_failure_ignored', errorMessage
|
|
304
|
+
? `Ignored premature owner failure before terminal chain state: ${errorMessage}`
|
|
305
|
+
: 'Ignored premature owner failure before terminal chain state', { agentId });
|
|
306
|
+
logger.warn('WrfcController: ignored premature owner failure before terminal chain state', {
|
|
307
|
+
chainId: chain.id,
|
|
308
|
+
agentId,
|
|
309
|
+
state: chain.state,
|
|
310
|
+
error: errorMessage,
|
|
311
|
+
});
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
this.setWrfcWorkPlanTaskStatus(chain, agentId, 'failed', errorMessage ?? `Agent ${agentId} failed`);
|
|
211
315
|
this.failChain(chain, errorMessage ?? `Agent ${agentId} failed`);
|
|
212
316
|
}
|
|
213
317
|
onAgentCancelled(agentId, reason) {
|
|
@@ -215,9 +319,11 @@ export class WrfcController {
|
|
|
215
319
|
if (!chain || chain.state === 'passed' || chain.state === 'failed')
|
|
216
320
|
return;
|
|
217
321
|
if (agentId === chain.ownerAgentId) {
|
|
322
|
+
this.setWrfcWorkPlanTaskStatus(chain, agentId, 'cancelled', reason ?? 'WRFC owner agent cancelled');
|
|
218
323
|
this.cancelChain(chain, reason ?? 'WRFC owner agent cancelled');
|
|
219
324
|
return;
|
|
220
325
|
}
|
|
326
|
+
this.setWrfcWorkPlanTaskStatus(chain, agentId, 'cancelled', reason ?? `Agent ${agentId} cancelled`);
|
|
221
327
|
this.failChain(chain, reason ?? `Agent ${agentId} cancelled`);
|
|
222
328
|
}
|
|
223
329
|
startReview(chain, report) {
|
|
@@ -236,9 +342,8 @@ export class WrfcController {
|
|
|
236
342
|
}
|
|
237
343
|
const reviewerRecord = this.spawnWrfcAgent(chain, 'reviewer', 'reviewer', reviewTask, true);
|
|
238
344
|
chain.reviewerAgentId = reviewerRecord.id;
|
|
239
|
-
|
|
345
|
+
this.applyWrfcAgentMetadata(chain, reviewerRecord, 'reviewer');
|
|
240
346
|
chain.allAgentIds.push(reviewerRecord.id);
|
|
241
|
-
reviewerRecord.wrfcId = chain.id;
|
|
242
347
|
this.messageBus.registerAgent({
|
|
243
348
|
agentId: reviewerRecord.id,
|
|
244
349
|
role: 'reviewer',
|
|
@@ -254,6 +359,7 @@ export class WrfcController {
|
|
|
254
359
|
role: 'reviewer',
|
|
255
360
|
record: reviewerRecord,
|
|
256
361
|
});
|
|
362
|
+
this.upsertWrfcWorkPlanTask(chain, 'reviewer', reviewerRecord, 'in_progress');
|
|
257
363
|
}
|
|
258
364
|
async processReview(chain, review) {
|
|
259
365
|
const threshold = getWrfcScoreThreshold(this.configManager);
|
|
@@ -353,9 +459,8 @@ export class WrfcController {
|
|
|
353
459
|
});
|
|
354
460
|
const fixerRecord = this.spawnWrfcAgent(chain, 'fixer', 'engineer', buildFixTask(chain.id, chain.task, review, getWrfcScoreThreshold(this.configManager), chain.fixAttempts, chain.constraints, review.constraintFindings ?? []), true);
|
|
355
461
|
chain.fixerAgentId = fixerRecord.id;
|
|
356
|
-
|
|
462
|
+
this.applyWrfcAgentMetadata(chain, fixerRecord, 'fixer');
|
|
357
463
|
chain.allAgentIds.push(fixerRecord.id);
|
|
358
|
-
fixerRecord.wrfcId = chain.id;
|
|
359
464
|
this.messageBus.registerAgent({
|
|
360
465
|
agentId: fixerRecord.id,
|
|
361
466
|
role: 'fixer',
|
|
@@ -379,6 +484,7 @@ export class WrfcController {
|
|
|
379
484
|
role: 'fixer',
|
|
380
485
|
record: fixerRecord,
|
|
381
486
|
});
|
|
487
|
+
this.upsertWrfcWorkPlanTask(chain, 'fixer', fixerRecord, 'in_progress');
|
|
382
488
|
}
|
|
383
489
|
async runGates(chain) {
|
|
384
490
|
this.transition(chain, 'gating');
|
|
@@ -489,10 +595,9 @@ export class WrfcController {
|
|
|
489
595
|
});
|
|
490
596
|
const gateFixTask = buildGateFailureTask(chain.id, chain.task, failedGates, chain.constraints);
|
|
491
597
|
const fixerRecord = this.spawnWrfcAgent(chain, 'fixer', 'engineer', gateFixTask, true);
|
|
492
|
-
|
|
598
|
+
this.applyWrfcAgentMetadata(chain, fixerRecord, 'fixer');
|
|
493
599
|
chain.fixerAgentId = fixerRecord.id;
|
|
494
600
|
chain.allAgentIds.push(fixerRecord.id);
|
|
495
|
-
fixerRecord.wrfcId = chain.id;
|
|
496
601
|
this.messageBus.registerAgent({
|
|
497
602
|
agentId: fixerRecord.id,
|
|
498
603
|
role: 'fixer',
|
|
@@ -516,6 +621,7 @@ export class WrfcController {
|
|
|
516
621
|
role: 'fixer',
|
|
517
622
|
record: fixerRecord,
|
|
518
623
|
});
|
|
624
|
+
this.upsertWrfcWorkPlanTask(chain, 'fixer', fixerRecord, 'in_progress');
|
|
519
625
|
}
|
|
520
626
|
scheduleChainCleanup(chain) {
|
|
521
627
|
const timer = setTimeout(() => {
|
|
@@ -608,6 +714,7 @@ export class WrfcController {
|
|
|
608
714
|
}
|
|
609
715
|
chain.error = reason;
|
|
610
716
|
chain.completedAt = Date.now();
|
|
717
|
+
this.setWrfcWorkPlanTaskStatus(chain, chain.ownerAgentId, 'failed', reason);
|
|
611
718
|
this.cancelRunningChildren(chain);
|
|
612
719
|
this.appendOwnerDecision(chain, 'chain_failed', reason, {
|
|
613
720
|
agentId: chain.ownerAgentId,
|
|
@@ -655,6 +762,7 @@ export class WrfcController {
|
|
|
655
762
|
chain.error = reason;
|
|
656
763
|
chain.completedAt = Date.now();
|
|
657
764
|
chain.ownerTerminalEmitted = true;
|
|
765
|
+
this.setWrfcWorkPlanTaskStatus(chain, chain.ownerAgentId, 'cancelled', reason);
|
|
658
766
|
this.appendOwnerDecision(chain, 'chain_cancelled', reason, {
|
|
659
767
|
agentId: chain.ownerAgentId,
|
|
660
768
|
});
|
|
@@ -764,9 +872,8 @@ export class WrfcController {
|
|
|
764
872
|
};
|
|
765
873
|
this.chains.set(chain.id, chain);
|
|
766
874
|
emitWrfcGraphCreated(this.runtimeBus, this.sessionId, chain.id, `WRFC: ${ownerRecord.task}`);
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
ownerRecord.progress = 'WRFC owner supervising child agents';
|
|
875
|
+
this.applyWrfcAgentMetadata(chain, ownerRecord, 'owner');
|
|
876
|
+
this.keepOwnerAgentActive(chain);
|
|
770
877
|
this.messageBus.registerAgent({
|
|
771
878
|
agentId: ownerRecord.id,
|
|
772
879
|
template: ownerRecord.template,
|
|
@@ -775,16 +882,17 @@ export class WrfcController {
|
|
|
775
882
|
this.appendOwnerDecision(chain, 'chain_created', 'WRFC owner created for original ask', {
|
|
776
883
|
agentId: ownerRecord.id,
|
|
777
884
|
});
|
|
885
|
+
this.upsertWrfcWorkPlanTask(chain, 'owner', ownerRecord, 'pending');
|
|
778
886
|
return chain;
|
|
779
887
|
}
|
|
780
888
|
startEngineeringChain(chain, emitCreated) {
|
|
781
889
|
this.activeChainCount += 1;
|
|
782
890
|
this.transition(chain, 'engineering');
|
|
891
|
+
this.setWrfcWorkPlanTaskStatus(chain, chain.ownerAgentId, 'in_progress');
|
|
783
892
|
const engineerRecord = this.spawnWrfcAgent(chain, 'engineer', 'engineer', chain.task, true);
|
|
784
|
-
|
|
893
|
+
this.applyWrfcAgentMetadata(chain, engineerRecord, 'engineer');
|
|
785
894
|
chain.engineerAgentId = engineerRecord.id;
|
|
786
895
|
chain.allAgentIds.push(engineerRecord.id);
|
|
787
|
-
engineerRecord.wrfcId = chain.id;
|
|
788
896
|
this.messageBus.registerAgent({
|
|
789
897
|
agentId: engineerRecord.id,
|
|
790
898
|
role: 'engineer',
|
|
@@ -799,6 +907,7 @@ export class WrfcController {
|
|
|
799
907
|
role: 'engineer',
|
|
800
908
|
record: engineerRecord,
|
|
801
909
|
});
|
|
910
|
+
this.upsertWrfcWorkPlanTask(chain, 'engineer', engineerRecord, 'in_progress');
|
|
802
911
|
}
|
|
803
912
|
handleEngineerCompletion(chain, agentId, report) {
|
|
804
913
|
this.completeCurrentNode(chain, report.summary);
|
|
@@ -885,6 +994,7 @@ export class WrfcController {
|
|
|
885
994
|
this.appendOwnerDecision(chain, 'chain_passed', 'WRFC full-scope review and quality gates passed', {
|
|
886
995
|
agentId: chain.ownerAgentId,
|
|
887
996
|
});
|
|
997
|
+
this.setWrfcWorkPlanTaskStatus(chain, chain.ownerAgentId, 'done', 'WRFC full-scope review and quality gates passed');
|
|
888
998
|
this.completeOwnerAgent(chain, 'completed', `WRFC chain ${chain.id} passed`);
|
|
889
999
|
emitWrfcChainPassed(this.runtimeBus, this.sessionId, chain.id);
|
|
890
1000
|
this.scheduleChainCleanup(chain);
|
|
@@ -896,6 +1006,7 @@ export class WrfcController {
|
|
|
896
1006
|
const owner = this.agentManager.getStatus(chain.ownerAgentId);
|
|
897
1007
|
if (!owner)
|
|
898
1008
|
return;
|
|
1009
|
+
this.applyWrfcAgentMetadata(chain, owner, 'owner');
|
|
899
1010
|
owner.status = status;
|
|
900
1011
|
owner.completedAt = Date.now();
|
|
901
1012
|
owner.progress = message;
|
|
@@ -924,6 +1035,119 @@ export class WrfcController {
|
|
|
924
1035
|
});
|
|
925
1036
|
}
|
|
926
1037
|
}
|
|
1038
|
+
upsertWrfcWorkPlanTask(chain, role, record, status) {
|
|
1039
|
+
if (!this.workPlanService)
|
|
1040
|
+
return;
|
|
1041
|
+
const taskId = this.workPlanTaskIdForAgent(chain, record.id, role);
|
|
1042
|
+
const task = {
|
|
1043
|
+
taskId,
|
|
1044
|
+
title: this.workPlanTaskTitle(role, chain.task),
|
|
1045
|
+
notes: role === 'owner'
|
|
1046
|
+
? 'WRFC owner chain supervising lifecycle child agents.'
|
|
1047
|
+
: `WRFC ${role} phase for the owner chain.`,
|
|
1048
|
+
owner: role,
|
|
1049
|
+
status,
|
|
1050
|
+
source: 'wrfc',
|
|
1051
|
+
chainId: chain.id,
|
|
1052
|
+
phaseId: role,
|
|
1053
|
+
agentId: record.id,
|
|
1054
|
+
originSurface: 'daemon',
|
|
1055
|
+
tags: ['wrfc', role],
|
|
1056
|
+
parentTaskId: role === 'owner' ? undefined : this.workPlanTaskIdForAgent(chain, chain.ownerAgentId, 'owner'),
|
|
1057
|
+
metadata: {
|
|
1058
|
+
wrfcState: chain.state,
|
|
1059
|
+
agentTemplate: record.template,
|
|
1060
|
+
},
|
|
1061
|
+
};
|
|
1062
|
+
this.enqueueWrfcWorkPlanTaskOperation(taskId, async () => {
|
|
1063
|
+
try {
|
|
1064
|
+
await this.workPlanService?.createWorkPlanTask({ task });
|
|
1065
|
+
}
|
|
1066
|
+
catch (error) {
|
|
1067
|
+
if (!(error instanceof Error) || !error.message.includes('already exists'))
|
|
1068
|
+
throw error;
|
|
1069
|
+
await this.workPlanService?.updateWorkPlanTask({
|
|
1070
|
+
taskId,
|
|
1071
|
+
patch: {
|
|
1072
|
+
...task,
|
|
1073
|
+
taskId: undefined,
|
|
1074
|
+
},
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
}, {
|
|
1078
|
+
chainId: chain.id,
|
|
1079
|
+
agentId: record.id,
|
|
1080
|
+
role,
|
|
1081
|
+
action: 'upsert',
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
setWrfcWorkPlanTaskStatus(chain, agentId, status, reason) {
|
|
1085
|
+
if (!this.workPlanService)
|
|
1086
|
+
return;
|
|
1087
|
+
const role = this.workPlanRoleForAgent(chain, agentId);
|
|
1088
|
+
if (!role)
|
|
1089
|
+
return;
|
|
1090
|
+
const taskId = this.workPlanTaskIdForAgent(chain, agentId, role);
|
|
1091
|
+
this.enqueueWrfcWorkPlanTaskOperation(taskId, async () => {
|
|
1092
|
+
await this.workPlanService?.updateWorkPlanTask({
|
|
1093
|
+
taskId,
|
|
1094
|
+
patch: {
|
|
1095
|
+
status,
|
|
1096
|
+
metadata: {
|
|
1097
|
+
wrfcState: chain.state,
|
|
1098
|
+
...(reason ? { statusReason: reason } : {}),
|
|
1099
|
+
},
|
|
1100
|
+
},
|
|
1101
|
+
});
|
|
1102
|
+
}, {
|
|
1103
|
+
chainId: chain.id,
|
|
1104
|
+
agentId,
|
|
1105
|
+
role,
|
|
1106
|
+
action: 'status',
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
enqueueWrfcWorkPlanTaskOperation(taskId, operation, context) {
|
|
1110
|
+
const previous = this.workPlanTaskQueues.get(taskId) ?? Promise.resolve();
|
|
1111
|
+
let next;
|
|
1112
|
+
next = previous
|
|
1113
|
+
.catch(() => undefined)
|
|
1114
|
+
.then(operation)
|
|
1115
|
+
.catch((error) => {
|
|
1116
|
+
logger.warn('WrfcController: failed to sync work-plan task', {
|
|
1117
|
+
chainId: context.chainId,
|
|
1118
|
+
agentId: context.agentId,
|
|
1119
|
+
role: context.role,
|
|
1120
|
+
action: context.action,
|
|
1121
|
+
error: summarizeError(error),
|
|
1122
|
+
});
|
|
1123
|
+
})
|
|
1124
|
+
.finally(() => {
|
|
1125
|
+
if (this.workPlanTaskQueues.get(taskId) === next) {
|
|
1126
|
+
this.workPlanTaskQueues.delete(taskId);
|
|
1127
|
+
}
|
|
1128
|
+
});
|
|
1129
|
+
this.workPlanTaskQueues.set(taskId, next);
|
|
1130
|
+
}
|
|
1131
|
+
workPlanRoleForAgent(chain, agentId) {
|
|
1132
|
+
if (agentId === chain.ownerAgentId)
|
|
1133
|
+
return 'owner';
|
|
1134
|
+
if (agentId === chain.engineerAgentId)
|
|
1135
|
+
return 'engineer';
|
|
1136
|
+
if (agentId === chain.reviewerAgentId)
|
|
1137
|
+
return 'reviewer';
|
|
1138
|
+
if (agentId === chain.fixerAgentId)
|
|
1139
|
+
return 'fixer';
|
|
1140
|
+
return null;
|
|
1141
|
+
}
|
|
1142
|
+
workPlanTaskIdForAgent(chain, agentId, role) {
|
|
1143
|
+
return `wrfc-${chain.id}-${role}-${agentId}`;
|
|
1144
|
+
}
|
|
1145
|
+
workPlanTaskTitle(role, task) {
|
|
1146
|
+
const label = role === 'owner'
|
|
1147
|
+
? 'WRFC owner'
|
|
1148
|
+
: role.charAt(0).toUpperCase() + role.slice(1);
|
|
1149
|
+
return `${label}: ${task.slice(0, 120)}`;
|
|
1150
|
+
}
|
|
927
1151
|
safeDequeueNext() {
|
|
928
1152
|
this.dequeueNext().catch((error) => {
|
|
929
1153
|
logger.error('WrfcController.dequeueNext unhandled error', { error: summarizeError(error) });
|