@agent-plan/core 0.2.19-next.9 → 0.2.20
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/checklist.d.ts +16 -0
- package/dist/checklist.d.ts.map +1 -0
- package/dist/checklist.js +52 -0
- package/dist/display-status.d.ts +99 -0
- package/dist/display-status.d.ts.map +1 -0
- package/dist/display-status.js +176 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/naming.d.ts +21 -3
- package/dist/naming.d.ts.map +1 -1
- package/dist/naming.js +45 -3
- package/dist/plan-store.d.ts +156 -28
- package/dist/plan-store.d.ts.map +1 -1
- package/dist/plan-store.js +802 -140
- package/dist/recap.d.ts.map +1 -1
- package/dist/recap.js +18 -4
- package/dist/refs.d.ts.map +1 -1
- package/dist/refs.js +23 -8
- package/dist/schema.d.ts +736 -145
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +56 -9
- package/dist/task-context.d.ts +16 -0
- package/dist/task-context.d.ts.map +1 -0
- package/dist/task-context.js +65 -0
- package/dist/task-selection.d.ts +34 -0
- package/dist/task-selection.d.ts.map +1 -0
- package/dist/task-selection.js +95 -0
- package/package.json +4 -1
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,eAAe,aAAwB,CAAC;AACrD,eAAO,MAAM,UAAU,aAAiD,CAAC;AAEzE,eAAO,MAAM,kBAAkB;;;;;;;;;EAG7B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;EAK7B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAC9C,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,GAAG;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,CAAC;AAC1E,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC,GAAG;IAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAA;CAAE,CAAC"}
|
package/dist/schema.js
CHANGED
|
@@ -76,6 +76,22 @@ export const AcceptedDecisionSchema = z.object({
|
|
|
76
76
|
implementationNotes: z.string().default(""),
|
|
77
77
|
acceptedAt: TimestampSchema,
|
|
78
78
|
});
|
|
79
|
+
export const WorkDeviationSchema = z.object({
|
|
80
|
+
id: z.string().min(1),
|
|
81
|
+
/** Task the priority selector recommended when the deviation was approved. */
|
|
82
|
+
recommendedTaskId: z.string().min(1),
|
|
83
|
+
/** Task intentionally chosen instead of the recommendation. */
|
|
84
|
+
temporaryTaskId: z.string().min(1),
|
|
85
|
+
/** Task to surface explicitly after the temporary work is resolved. */
|
|
86
|
+
resumeTaskId: z.string().min(1),
|
|
87
|
+
reason: z.string().default(""),
|
|
88
|
+
requestedBy: z.enum(["agent", "user"]).default("agent"),
|
|
89
|
+
approvedBy: z.string().default("user"),
|
|
90
|
+
state: z.enum(["approved", "active", "resolved", "canceled"]).default("approved"),
|
|
91
|
+
createdAt: TimestampSchema,
|
|
92
|
+
activatedAt: z.string().default(""),
|
|
93
|
+
resolvedAt: z.string().default(""),
|
|
94
|
+
});
|
|
79
95
|
export const ProjectSchema = z.object({
|
|
80
96
|
name: z.string().min(1),
|
|
81
97
|
goal: z.string().default(""),
|
|
@@ -95,6 +111,8 @@ export const ProjectSchema = z.object({
|
|
|
95
111
|
nextFeatureNumber: z.number().int().positive().default(1),
|
|
96
112
|
nextPhaseNumber: z.number().int().positive().default(1),
|
|
97
113
|
nextTaskNumber: z.number().int().positive().default(1),
|
|
114
|
+
/** Ordered history of approved temporary work deviations; active entries form a resumable stack. */
|
|
115
|
+
workDeviations: z.array(WorkDeviationSchema).default([]),
|
|
98
116
|
});
|
|
99
117
|
export const SubtaskStatusSchema = z.enum(["planned", "in-progress", "done", "blocked", "canceled", "rejected", "deferred", "waiting"]);
|
|
100
118
|
export const TaskStatusSchema = z.enum(["planned", "in-progress", "done", "blocked", "canceled", "rejected", "deferred", "waiting"]);
|
|
@@ -111,6 +129,10 @@ export const SubtaskSchema = z.object({
|
|
|
111
129
|
});
|
|
112
130
|
export const ChecklistItemSchema = z.object({
|
|
113
131
|
id: z.string().min(1),
|
|
132
|
+
/** Per-task 1-based position, displayed as C{number} (C1, C2, ...). Default 0
|
|
133
|
+
* so legacy on-disk items without a number still parse; the TaskSchema
|
|
134
|
+
* transform overwrites it with the real index+1. */
|
|
135
|
+
number: z.number().int().nonnegative().default(0),
|
|
114
136
|
title: z.string().min(1),
|
|
115
137
|
checked: z.boolean().default(false),
|
|
116
138
|
});
|
|
@@ -142,9 +164,21 @@ export const StatusLogEntrySchema = z.object({
|
|
|
142
164
|
title: z.string().min(1),
|
|
143
165
|
description: z.string().default(""),
|
|
144
166
|
});
|
|
167
|
+
/** Like StatusLogEntrySchema but for the DERIVED PHASE status, which includes
|
|
168
|
+
* the "draft" and "discovery" lifecycle states absent from TaskStatus. */
|
|
169
|
+
export const PhaseStatusLogEntrySchema = z.object({
|
|
170
|
+
id: z.string().min(1),
|
|
171
|
+
date: TimestampSchema,
|
|
172
|
+
fromStatus: PhaseStatusSchema,
|
|
173
|
+
toStatus: PhaseStatusSchema,
|
|
174
|
+
title: z.string().min(1),
|
|
175
|
+
description: z.string().default(""),
|
|
176
|
+
});
|
|
145
177
|
export const TaskSchema = z.object({
|
|
146
178
|
id: z.string(),
|
|
147
|
-
|
|
179
|
+
/** MUST be a phase UUID (not a ref like "P003"). Validated at the schema
|
|
180
|
+
* layer so no adapter can persist an unresolved ref string. */
|
|
181
|
+
phaseId: z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, "phaseId must be a UUID, not a ref string like P003"),
|
|
148
182
|
/** Global project-wide task sequence (assigned once at creation from project.nextTaskNumber; stable, gaps on delete). Bare T00x is unambiguous. */
|
|
149
183
|
number: z.number().int().nonnegative().default(0),
|
|
150
184
|
shortId: z.string().regex(/^(|[A-Z2-9]{5})$/).default(""),
|
|
@@ -153,6 +187,8 @@ export const TaskSchema = z.object({
|
|
|
153
187
|
title: z.string().min(1),
|
|
154
188
|
status: TaskStatusSchema,
|
|
155
189
|
description: z.string().default(""),
|
|
190
|
+
/** Updated only when this task's description changes; distinct from entity updatedAt. */
|
|
191
|
+
descriptionUpdatedAt: z.string().default(""),
|
|
156
192
|
notes: z.string().default(""),
|
|
157
193
|
statusLog: z.array(StatusLogEntrySchema).default([]),
|
|
158
194
|
decisions: z.array(z.string().min(1)).default([]),
|
|
@@ -168,12 +204,12 @@ export const TaskSchema = z.object({
|
|
|
168
204
|
...task,
|
|
169
205
|
checklist: task.checklist
|
|
170
206
|
.map((item, index) => typeof item === "string"
|
|
171
|
-
? { id: createChecklistItemId(task.id, index + 1, item), title: item.trim(), checked: false }
|
|
172
|
-
: { ...item, id: item.id || createChecklistItemId(task.id, index + 1, item.title), title: item.title.trim(), checked: item.checked ?? false })
|
|
207
|
+
? { id: createChecklistItemId(task.id, index + 1, item), number: index + 1, title: item.trim(), checked: false }
|
|
208
|
+
: { ...item, id: item.id || createChecklistItemId(task.id, index + 1, item.title), number: index + 1, title: item.title.trim(), checked: item.checked ?? false })
|
|
173
209
|
.filter((item) => item.title.length > 0),
|
|
174
210
|
}));
|
|
175
211
|
export const HandoffHistoryEntrySchema = z.object({
|
|
176
|
-
/** Relative path under .planner/handoff-archive/ (e.g. <phaseId>-<ISO>.md). */
|
|
212
|
+
/** Relative path under .planner/.local/handoff-archive/ (e.g. <phaseId>-<ISO>.md). */
|
|
177
213
|
file: z.string().default(""),
|
|
178
214
|
clearedAt: TimestampSchema,
|
|
179
215
|
/** Why the handoff was cleared: "task-started" | "phase-done" | "manual" | "superseded" | "imported". */
|
|
@@ -181,7 +217,10 @@ export const HandoffHistoryEntrySchema = z.object({
|
|
|
181
217
|
});
|
|
182
218
|
export const PhaseSchema = z.object({
|
|
183
219
|
id: z.string(),
|
|
184
|
-
|
|
220
|
+
/** MUST be a feature UUID (not a ref like "F005"). Validated at the schema
|
|
221
|
+
* layer so no adapter can persist an unresolved ref string. Optional only
|
|
222
|
+
* for legacy pre-feature phases. */
|
|
223
|
+
featureId: z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, "featureId must be a UUID, not a ref string like F005").optional(),
|
|
185
224
|
/** Global project-wide phase sequence (assigned once at creation from project.nextPhaseNumber; stable, gaps on delete). Bare P00x is unambiguous. */
|
|
186
225
|
number: z.number().int().positive(),
|
|
187
226
|
shortId: z.string().regex(/^(|[A-Z2-9]{5})$/).default(""),
|
|
@@ -196,6 +235,8 @@ export const PhaseSchema = z.object({
|
|
|
196
235
|
contextReadyReason: z.string().default(""),
|
|
197
236
|
summary: z.string().default(""),
|
|
198
237
|
description: z.string().default(""),
|
|
238
|
+
/** Updated only when this phase's description changes; distinct from entity updatedAt. */
|
|
239
|
+
descriptionUpdatedAt: z.string().default(""),
|
|
199
240
|
notes: z.string().default(""),
|
|
200
241
|
goals: z.array(z.string().min(1)).default([]),
|
|
201
242
|
nonGoals: z.array(z.string().min(1)).default([]),
|
|
@@ -213,15 +254,17 @@ export const PhaseSchema = z.object({
|
|
|
213
254
|
handoff: z.string().default(""),
|
|
214
255
|
handoffUpdatedAt: z.string().default(""),
|
|
215
256
|
/** When the handoff was last read/acknowledged on recap (ISO). Non-empty means
|
|
216
|
-
* the agent has seen it; the recap won't re-prompt every turn.
|
|
217
|
-
* content
|
|
218
|
-
*
|
|
257
|
+
* the agent has seen it; the recap won't re-prompt every turn. Reading is
|
|
258
|
+
* non-mutating: content remains until every task is done/canceled, a later
|
|
259
|
+
* handoff supersedes it, or the user explicitly clears it. */
|
|
219
260
|
handoffReadAt: z.string().default(""),
|
|
220
261
|
/** Metadata for recently-cleared handoffs (newest-first, capped at 5). The
|
|
221
|
-
* full content lives as .md files in .planner/handoff-archive/ (gitignored);
|
|
262
|
+
* full content lives as .md files in .planner/.local/handoff-archive/ (gitignored);
|
|
222
263
|
* this array only holds the pointer + clear reason + timestamp, so the phase
|
|
223
264
|
* JSON stays lean and the archive is recoverable. */
|
|
224
265
|
handoffHistory: z.array(HandoffHistoryEntrySchema).default([]),
|
|
266
|
+
/** Chronological audit trail of the DERIVED status (planned/in-progress/blocked/done/...). Appended ONLY when the derived status changes during a rollup; `status` itself is NOT persisted (still computed from child tasks at read time). Empty = no transition recorded yet (treated as "planned"). */
|
|
267
|
+
statusLog: z.array(PhaseStatusLogEntrySchema).default([]),
|
|
225
268
|
});
|
|
226
269
|
export const FeatureSchema = z.object({
|
|
227
270
|
id: z.string(),
|
|
@@ -231,6 +274,8 @@ export const FeatureSchema = z.object({
|
|
|
231
274
|
priority: z.number().int().nonnegative().default(0),
|
|
232
275
|
name: z.string().min(1),
|
|
233
276
|
description: z.string().default(""),
|
|
277
|
+
/** Updated only when this feature's description changes; distinct from entity updatedAt. */
|
|
278
|
+
descriptionUpdatedAt: z.string().default(""),
|
|
234
279
|
// NOTE: `status` is intentionally ABSENT — it is DERIVED from child phases
|
|
235
280
|
// at read time and never persisted. The runtime `Feature` type re-adds it.
|
|
236
281
|
discussedAt: z.string().default(""),
|
|
@@ -243,6 +288,8 @@ export const FeatureSchema = z.object({
|
|
|
243
288
|
acceptedDecisions: z.array(AcceptedDecisionSchema).default([]),
|
|
244
289
|
phaseIds: z.array(z.string().min(1)).default([]),
|
|
245
290
|
dependsOn: z.array(z.string().min(1)).default([]),
|
|
291
|
+
/** Chronological audit trail of the DERIVED status (computed from child phases at read time). Appended ONLY when the derived status changes during a rollup; `status` itself is NOT persisted. Empty = no transition recorded yet (treated as "planned"). */
|
|
292
|
+
statusLog: z.array(StatusLogEntrySchema).default([]),
|
|
246
293
|
createdAt: TimestampSchema,
|
|
247
294
|
updatedAt: TimestampSchema,
|
|
248
295
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Feature, Phase, Requirement } from "./schema.js";
|
|
2
|
+
/**
|
|
3
|
+
* Build a compact, agent-facing context block that surfaces the PARENT PHASE
|
|
4
|
+
* (and grandparent FEATURE) description when a task is started. The phase
|
|
5
|
+
* description carries the shared design context (file:line refs, architecture,
|
|
6
|
+
* current state, behaviors to preserve) that EVERY task in the phase inherits.
|
|
7
|
+
*
|
|
8
|
+
* Injecting this into the `task_start` tool response guarantees the agent sees
|
|
9
|
+
* the phase-level context in the exact moment it begins work — instead of
|
|
10
|
+
* relying on the agent to voluntarily read it beforehand.
|
|
11
|
+
*
|
|
12
|
+
* Harness-agnostic: returns a plain markdown string. Both the Pi adapter and
|
|
13
|
+
* the MCP server append this to their `task_start` confirmation text.
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildPhaseContextBlock(phase: Phase, feature: Feature | undefined, linkedRequirements?: Requirement[], featureRequirements?: Requirement[]): string;
|
|
16
|
+
//# sourceMappingURL=task-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-context.d.ts","sourceRoot":"","sources":["../src/task-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/D;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,kBAAkB,GAAE,WAAW,EAAO,EACtC,mBAAmB,GAAE,WAAW,EAAO,GACtC,MAAM,CAkDR"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { formatPhaseRef } from "./naming.js";
|
|
2
|
+
/**
|
|
3
|
+
* Build a compact, agent-facing context block that surfaces the PARENT PHASE
|
|
4
|
+
* (and grandparent FEATURE) description when a task is started. The phase
|
|
5
|
+
* description carries the shared design context (file:line refs, architecture,
|
|
6
|
+
* current state, behaviors to preserve) that EVERY task in the phase inherits.
|
|
7
|
+
*
|
|
8
|
+
* Injecting this into the `task_start` tool response guarantees the agent sees
|
|
9
|
+
* the phase-level context in the exact moment it begins work — instead of
|
|
10
|
+
* relying on the agent to voluntarily read it beforehand.
|
|
11
|
+
*
|
|
12
|
+
* Harness-agnostic: returns a plain markdown string. Both the Pi adapter and
|
|
13
|
+
* the MCP server append this to their `task_start` confirmation text.
|
|
14
|
+
*/
|
|
15
|
+
export function buildPhaseContextBlock(phase, feature, linkedRequirements = [], featureRequirements = []) {
|
|
16
|
+
const lines = [];
|
|
17
|
+
const phaseRef = formatPhaseRef(phase.number, feature?.number);
|
|
18
|
+
const requirementsBlock = (label, requirements, empty) => {
|
|
19
|
+
lines.push(`\n${label} (${requirements.length}):`);
|
|
20
|
+
if (requirements.length === 0) {
|
|
21
|
+
lines.push(` - ${empty}`);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
for (const requirement of requirements) {
|
|
25
|
+
lines.push(` - ${requirement.title}${requirement.description?.trim() ? ` — ${requirement.description.trim()}` : ""}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
lines.push(`\n📋 Task context — read this BEFORE touching code:`);
|
|
30
|
+
if (feature) {
|
|
31
|
+
lines.push(`Feature F${String(feature.number).padStart(3, "0")} — ${feature.name}`);
|
|
32
|
+
if (feature.description && feature.description.trim()) {
|
|
33
|
+
lines.push(`\nFeature description:\n${feature.description.trim()}`);
|
|
34
|
+
}
|
|
35
|
+
requirementsBlock("Feature linked requirements", featureRequirements, "None linked to this feature.");
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
lines.push("Feature context: no parent feature linked to this phase.");
|
|
39
|
+
requirementsBlock("Feature linked requirements", [], "None linked to this feature.");
|
|
40
|
+
}
|
|
41
|
+
lines.push(`\nPhase ${phaseRef} — ${phase.title}`);
|
|
42
|
+
if (phase.summary && phase.summary.trim()) {
|
|
43
|
+
lines.push(`Summary: ${phase.summary.trim()}`);
|
|
44
|
+
}
|
|
45
|
+
if (phase.description && phase.description.trim()) {
|
|
46
|
+
lines.push(`\nPhase description:\n${phase.description.trim()}`);
|
|
47
|
+
}
|
|
48
|
+
const bullet = (label, items) => {
|
|
49
|
+
if (items && items.length > 0) {
|
|
50
|
+
lines.push(`\n${label}:`);
|
|
51
|
+
for (const it of items)
|
|
52
|
+
lines.push(` - ${it}`);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
bullet("Goals", phase.goals);
|
|
56
|
+
bullet("Non-goals", phase.nonGoals);
|
|
57
|
+
bullet("Dependencies", phase.dependencies);
|
|
58
|
+
bullet("Risks", phase.risks);
|
|
59
|
+
bullet("Open questions", phase.openQuestions);
|
|
60
|
+
bullet("Decisions", phase.decisions);
|
|
61
|
+
bullet("Completion criteria", phase.completionCriteria);
|
|
62
|
+
requirementsBlock("Phase linked requirements", linkedRequirements, "None linked to this phase.");
|
|
63
|
+
lines.push(`\n(End of phase context. Now proceed with the task.)`);
|
|
64
|
+
return lines.join("\n");
|
|
65
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Feature, Phase, Task, WorkDeviation } from "./schema.js";
|
|
2
|
+
export type TaskRecommendationKind = "active" | "resume" | "priority" | "conflict" | "none";
|
|
3
|
+
export interface TaskCandidate {
|
|
4
|
+
feature: Feature | undefined;
|
|
5
|
+
phase: Phase;
|
|
6
|
+
task: Task;
|
|
7
|
+
}
|
|
8
|
+
export interface TaskRecommendation {
|
|
9
|
+
kind: TaskRecommendationKind;
|
|
10
|
+
candidate?: TaskCandidate;
|
|
11
|
+
/** Multiple active tasks make an autonomous selection unsafe. */
|
|
12
|
+
activeCandidates?: TaskCandidate[];
|
|
13
|
+
/** The approved override that caused this recommendation, when applicable. */
|
|
14
|
+
deviation?: WorkDeviation;
|
|
15
|
+
reason: string;
|
|
16
|
+
}
|
|
17
|
+
/** Whether a user-explicit task start is valid, independent of priority advice. */
|
|
18
|
+
export interface ExplicitTaskStartEligibility {
|
|
19
|
+
eligible: boolean;
|
|
20
|
+
reason: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Validate an explicitly requested task start. Priority and existing active
|
|
24
|
+
* work remain advisory for explicit user choices; availability and dependency
|
|
25
|
+
* invariants remain mandatory.
|
|
26
|
+
*/
|
|
27
|
+
export declare function checkExplicitTaskStart(features: Feature[], phases: Phase[], taskId: string, deviations?: WorkDeviation[]): ExplicitTaskStartEligibility;
|
|
28
|
+
/**
|
|
29
|
+
* Pure, harness-agnostic work selector. It never mutates plan state: adapters
|
|
30
|
+
* may use its recommendation as a default while still allowing an explicitly
|
|
31
|
+
* approved temporary deviation.
|
|
32
|
+
*/
|
|
33
|
+
export declare function recommendNextTask(features: Feature[], phases: Phase[], deviations?: WorkDeviation[]): TaskRecommendation;
|
|
34
|
+
//# sourceMappingURL=task-selection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-selection.d.ts","sourceRoot":"","sources":["../src/task-selection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEvE,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;AAE5F,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,iEAAiE;IACjE,gBAAgB,CAAC,EAAE,aAAa,EAAE,CAAC;IACnC,8EAA8E;IAC9E,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,mFAAmF;AACnF,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AASD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,OAAO,EAAE,EACnB,MAAM,EAAE,KAAK,EAAE,EACf,MAAM,EAAE,MAAM,EACd,UAAU,GAAE,aAAa,EAAO,GAC/B,4BAA4B,CAwB9B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,OAAO,EAAE,EACnB,MAAM,EAAE,KAAK,EAAE,EACf,UAAU,GAAE,aAAa,EAAO,GAC/B,kBAAkB,CAuDpB"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
const unavailable = new Set(["blocked", "waiting", "deferred", "canceled", "rejected"]);
|
|
2
|
+
const hardUnavailable = new Set(["blocked", "deferred", "canceled", "rejected"]);
|
|
3
|
+
const terminal = new Set(["done", "canceled", "rejected"]);
|
|
4
|
+
const priority = (entity) => entity.priority && entity.priority > 0 ? entity.priority : Number.MAX_SAFE_INTEGER;
|
|
5
|
+
const compare = (a, b) => priority(a) - priority(b) || a.number - b.number;
|
|
6
|
+
/**
|
|
7
|
+
* Validate an explicitly requested task start. Priority and existing active
|
|
8
|
+
* work remain advisory for explicit user choices; availability and dependency
|
|
9
|
+
* invariants remain mandatory.
|
|
10
|
+
*/
|
|
11
|
+
export function checkExplicitTaskStart(features, phases, taskId, deviations = []) {
|
|
12
|
+
const featureById = new Map(features.map((feature) => [feature.id, feature]));
|
|
13
|
+
const candidates = phases.flatMap((phase) => phase.tasks.map((task) => ({ feature: phase.featureId ? featureById.get(phase.featureId) : undefined, phase, task })));
|
|
14
|
+
const candidate = candidates.find(({ task }) => task.id === taskId);
|
|
15
|
+
if (!candidate)
|
|
16
|
+
return { eligible: false, reason: "Requested task no longer exists." };
|
|
17
|
+
const isTemporaryOverride = deviations.some((deviation) => (deviation.state === "approved" || deviation.state === "active")
|
|
18
|
+
&& deviation.temporaryTaskId === taskId);
|
|
19
|
+
const startableStatus = candidate.task.status === "planned"
|
|
20
|
+
|| (candidate.task.status === "waiting" && isTemporaryOverride);
|
|
21
|
+
if (!startableStatus)
|
|
22
|
+
return { eligible: false, reason: `Task is not startable from ${candidate.task.status}.` };
|
|
23
|
+
const parentHasHardBlock = hardUnavailable.has(candidate.phase.status)
|
|
24
|
+
|| (candidate.feature && hardUnavailable.has(candidate.feature.status));
|
|
25
|
+
if (parentHasHardBlock || (!isTemporaryOverride && (unavailable.has(candidate.phase.status) || (candidate.feature && unavailable.has(candidate.feature.status))))) {
|
|
26
|
+
return { eligible: false, reason: "Task belongs to an unavailable phase or feature." };
|
|
27
|
+
}
|
|
28
|
+
const taskById = new Map(candidates.map((entry) => [entry.task.id, entry]));
|
|
29
|
+
if (!isTemporaryOverride && !candidate.task.dependsOn.every((id) => taskById.get(id)?.task.status === "done")) {
|
|
30
|
+
return { eligible: false, reason: "Task dependencies are not complete." };
|
|
31
|
+
}
|
|
32
|
+
return { eligible: true, reason: "Explicit task request is startable." };
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Pure, harness-agnostic work selector. It never mutates plan state: adapters
|
|
36
|
+
* may use its recommendation as a default while still allowing an explicitly
|
|
37
|
+
* approved temporary deviation.
|
|
38
|
+
*/
|
|
39
|
+
export function recommendNextTask(features, phases, deviations = []) {
|
|
40
|
+
const featureById = new Map(features.map((feature) => [feature.id, feature]));
|
|
41
|
+
const candidates = phases.flatMap((phase) => phase.tasks.map((task) => ({ feature: phase.featureId ? featureById.get(phase.featureId) : undefined, phase, task })));
|
|
42
|
+
const byTaskId = new Map(candidates.map((candidate) => [candidate.task.id, candidate]));
|
|
43
|
+
const active = candidates.filter(({ task }) => task.status === "in-progress");
|
|
44
|
+
if (active.length > 1)
|
|
45
|
+
return { kind: "conflict", activeCandidates: active, reason: "More than one task is in progress; resolve the active-work conflict before autonomous selection." };
|
|
46
|
+
if (active.length === 1)
|
|
47
|
+
return { kind: "active", candidate: active[0], reason: "Resume the single active task." };
|
|
48
|
+
const newestFirst = (left, right) => right.createdAt.localeCompare(left.createdAt);
|
|
49
|
+
const resumable = (candidate) => candidate
|
|
50
|
+
&& (candidate.task.status === "planned" || candidate.task.status === "waiting");
|
|
51
|
+
const open = deviations
|
|
52
|
+
.filter((deviation) => deviation.state === "approved" || deviation.state === "active")
|
|
53
|
+
.sort(newestFirst);
|
|
54
|
+
const top = open[0];
|
|
55
|
+
if (top) {
|
|
56
|
+
const temporary = byTaskId.get(top.temporaryTaskId);
|
|
57
|
+
const resume = byTaskId.get(top.resumeTaskId);
|
|
58
|
+
if (temporary && terminal.has(temporary.task.status) && resume && (resume.task.status === "planned" || resume.task.status === "waiting")) {
|
|
59
|
+
return { kind: "resume", candidate: resume, deviation: top, reason: "Resume the task preserved by the most recent approved deviation." };
|
|
60
|
+
}
|
|
61
|
+
// A deviation explicitly makes its temporary task eligible while it is
|
|
62
|
+
// planned or paused. Normal priority selection still excludes waiting work.
|
|
63
|
+
if (temporary && (temporary.task.status === "planned" || temporary.task.status === "waiting")) {
|
|
64
|
+
return { kind: "resume", candidate: temporary, deviation: top, reason: "Continue the temporary task of the most recent approved deviation." };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// A completed temporary task resolves its record, but its explicit resume
|
|
68
|
+
// target remains the next recommendation until that target itself changes.
|
|
69
|
+
const resolved = deviations
|
|
70
|
+
.filter((deviation) => deviation.state === "resolved")
|
|
71
|
+
.sort(newestFirst)
|
|
72
|
+
.find((deviation) => resumable(byTaskId.get(deviation.resumeTaskId)));
|
|
73
|
+
if (resolved) {
|
|
74
|
+
const candidate = byTaskId.get(resolved.resumeTaskId);
|
|
75
|
+
if (candidate && resumable(candidate)) {
|
|
76
|
+
return {
|
|
77
|
+
kind: "resume",
|
|
78
|
+
candidate,
|
|
79
|
+
deviation: resolved,
|
|
80
|
+
reason: "Resume the task preserved by the most recently resolved deviation.",
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const ready = candidates.filter(({ feature, phase, task }) => {
|
|
85
|
+
if (task.status !== "planned")
|
|
86
|
+
return false;
|
|
87
|
+
if (unavailable.has(phase.status) || (feature && unavailable.has(feature.status)))
|
|
88
|
+
return false;
|
|
89
|
+
return task.dependsOn.every((id) => byTaskId.get(id)?.task.status === "done");
|
|
90
|
+
});
|
|
91
|
+
ready.sort((a, b) => compare(a.feature ?? { priority: 0, number: 0 }, b.feature ?? { priority: 0, number: 0 }) || compare(a.phase, b.phase) || compare(a.task, b.task));
|
|
92
|
+
return ready[0]
|
|
93
|
+
? { kind: "priority", candidate: ready[0], reason: "Highest-priority ready task by feature, phase, then task." }
|
|
94
|
+
: { kind: "none", reason: "No ready task is available." };
|
|
95
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-plan/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.20",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Harness-agnostic core for Agent Plan: schemas, persistence, ordering, status rollups, and markdown rendering.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,6 +40,9 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"zod": "^3.24.0"
|
|
42
42
|
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"zod-to-json-schema": "^3.25.2"
|
|
45
|
+
},
|
|
43
46
|
"scripts": {
|
|
44
47
|
"build": "tsc -p tsconfig.json",
|
|
45
48
|
"check": "tsc -p tsconfig.json --noEmit",
|