@agent-plan/core 0.2.19-next.2 → 0.2.19-next.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 +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- 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 +157 -17
- package/dist/plan-store.d.ts.map +1 -1
- package/dist/plan-store.js +833 -172
- package/dist/recap.d.ts.map +1 -1
- package/dist/recap.js +35 -9
- package/dist/refs.d.ts +23 -0
- package/dist/refs.d.ts.map +1 -1
- package/dist/refs.js +81 -0
- package/dist/schema.d.ts +477 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +55 -4
- package/dist/task-context.d.ts +16 -0
- package/dist/task-context.d.ts.map +1 -0
- package/dist/task-context.js +48 -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAm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G,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,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
|
@@ -37,6 +37,10 @@ export const ResumeFocusSchema = z.object({
|
|
|
37
37
|
currentPhaseId: z.string().default(""),
|
|
38
38
|
inProgressTaskIds: z.array(z.string().min(1)).default([]),
|
|
39
39
|
nextSteps: z.array(z.string().min(1)).default([]),
|
|
40
|
+
/** When `nextSteps` last changed (free-text can go stale; the recap surfaces
|
|
41
|
+
* this so staleness is visible). Preserved across refreshResume (which keeps
|
|
42
|
+
* existing nextSteps); bumped only when saveResume receives new nextSteps. */
|
|
43
|
+
nextStepsUpdatedAt: z.string().default(""),
|
|
40
44
|
blockers: z.array(z.string().min(1)).default([]),
|
|
41
45
|
notes: z.string().default(""),
|
|
42
46
|
lastSessionSummary: z.string().default(""),
|
|
@@ -87,6 +91,10 @@ export const ProjectSchema = z.object({
|
|
|
87
91
|
chatLanguage: z.string().default(""),
|
|
88
92
|
workflowRules: WorkflowRulesSchema,
|
|
89
93
|
acceptedDecisions: z.array(AcceptedDecisionSchema).default([]),
|
|
94
|
+
/** Monotonic global sequence counters — assigned at creation, never reused (gaps on delete). */
|
|
95
|
+
nextFeatureNumber: z.number().int().positive().default(1),
|
|
96
|
+
nextPhaseNumber: z.number().int().positive().default(1),
|
|
97
|
+
nextTaskNumber: z.number().int().positive().default(1),
|
|
90
98
|
});
|
|
91
99
|
export const SubtaskStatusSchema = z.enum(["planned", "in-progress", "done", "blocked", "canceled", "rejected", "deferred", "waiting"]);
|
|
92
100
|
export const TaskStatusSchema = z.enum(["planned", "in-progress", "done", "blocked", "canceled", "rejected", "deferred", "waiting"]);
|
|
@@ -103,6 +111,10 @@ export const SubtaskSchema = z.object({
|
|
|
103
111
|
});
|
|
104
112
|
export const ChecklistItemSchema = z.object({
|
|
105
113
|
id: z.string().min(1),
|
|
114
|
+
/** Per-task 1-based position, displayed as C{number} (C1, C2, ...). Default 0
|
|
115
|
+
* so legacy on-disk items without a number still parse; the TaskSchema
|
|
116
|
+
* transform overwrites it with the real index+1. */
|
|
117
|
+
number: z.number().int().nonnegative().default(0),
|
|
106
118
|
title: z.string().min(1),
|
|
107
119
|
checked: z.boolean().default(false),
|
|
108
120
|
});
|
|
@@ -134,9 +146,22 @@ export const StatusLogEntrySchema = z.object({
|
|
|
134
146
|
title: z.string().min(1),
|
|
135
147
|
description: z.string().default(""),
|
|
136
148
|
});
|
|
149
|
+
/** Like StatusLogEntrySchema but for the DERIVED PHASE status, which includes
|
|
150
|
+
* the "draft" and "discovery" lifecycle states absent from TaskStatus. */
|
|
151
|
+
export const PhaseStatusLogEntrySchema = z.object({
|
|
152
|
+
id: z.string().min(1),
|
|
153
|
+
date: TimestampSchema,
|
|
154
|
+
fromStatus: PhaseStatusSchema,
|
|
155
|
+
toStatus: PhaseStatusSchema,
|
|
156
|
+
title: z.string().min(1),
|
|
157
|
+
description: z.string().default(""),
|
|
158
|
+
});
|
|
137
159
|
export const TaskSchema = z.object({
|
|
138
160
|
id: z.string(),
|
|
139
|
-
|
|
161
|
+
/** MUST be a phase UUID (not a ref like "P003"). Validated at the schema
|
|
162
|
+
* layer so no adapter can persist an unresolved ref string. */
|
|
163
|
+
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"),
|
|
164
|
+
/** Global project-wide task sequence (assigned once at creation from project.nextTaskNumber; stable, gaps on delete). Bare T00x is unambiguous. */
|
|
140
165
|
number: z.number().int().nonnegative().default(0),
|
|
141
166
|
shortId: z.string().regex(/^(|[A-Z2-9]{5})$/).default(""),
|
|
142
167
|
priority: z.number().int().nonnegative().default(0),
|
|
@@ -159,13 +184,24 @@ export const TaskSchema = z.object({
|
|
|
159
184
|
...task,
|
|
160
185
|
checklist: task.checklist
|
|
161
186
|
.map((item, index) => typeof item === "string"
|
|
162
|
-
? { id: createChecklistItemId(task.id, index + 1, item), title: item.trim(), checked: false }
|
|
163
|
-
: { ...item, id: item.id || createChecklistItemId(task.id, index + 1, item.title), title: item.title.trim(), checked: item.checked ?? false })
|
|
187
|
+
? { id: createChecklistItemId(task.id, index + 1, item), number: index + 1, title: item.trim(), checked: false }
|
|
188
|
+
: { ...item, id: item.id || createChecklistItemId(task.id, index + 1, item.title), number: index + 1, title: item.title.trim(), checked: item.checked ?? false })
|
|
164
189
|
.filter((item) => item.title.length > 0),
|
|
165
190
|
}));
|
|
191
|
+
export const HandoffHistoryEntrySchema = z.object({
|
|
192
|
+
/** Relative path under .planner/.local/handoff-archive/ (e.g. <phaseId>-<ISO>.md). */
|
|
193
|
+
file: z.string().default(""),
|
|
194
|
+
clearedAt: TimestampSchema,
|
|
195
|
+
/** Why the handoff was cleared: "task-started" | "phase-done" | "manual" | "superseded" | "imported". */
|
|
196
|
+
reason: z.string().default(""),
|
|
197
|
+
});
|
|
166
198
|
export const PhaseSchema = z.object({
|
|
167
199
|
id: z.string(),
|
|
168
|
-
|
|
200
|
+
/** MUST be a feature UUID (not a ref like "F005"). Validated at the schema
|
|
201
|
+
* layer so no adapter can persist an unresolved ref string. Optional only
|
|
202
|
+
* for legacy pre-feature phases. */
|
|
203
|
+
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(),
|
|
204
|
+
/** Global project-wide phase sequence (assigned once at creation from project.nextPhaseNumber; stable, gaps on delete). Bare P00x is unambiguous. */
|
|
169
205
|
number: z.number().int().positive(),
|
|
170
206
|
shortId: z.string().regex(/^(|[A-Z2-9]{5})$/).default(""),
|
|
171
207
|
priority: z.number().int().nonnegative().default(0),
|
|
@@ -195,9 +231,22 @@ export const PhaseSchema = z.object({
|
|
|
195
231
|
updatedAt: TimestampSchema,
|
|
196
232
|
handoff: z.string().default(""),
|
|
197
233
|
handoffUpdatedAt: z.string().default(""),
|
|
234
|
+
/** When the handoff was last read/acknowledged on recap (ISO). Non-empty means
|
|
235
|
+
* the agent has seen it; the recap won't re-prompt every turn. The handoff
|
|
236
|
+
* content is KEPT until a task in the phase starts (auto-clear) or the phase
|
|
237
|
+
* completes — so a restart between read and resume does not lose context. */
|
|
238
|
+
handoffReadAt: z.string().default(""),
|
|
239
|
+
/** Metadata for recently-cleared handoffs (newest-first, capped at 5). The
|
|
240
|
+
* full content lives as .md files in .planner/.local/handoff-archive/ (gitignored);
|
|
241
|
+
* this array only holds the pointer + clear reason + timestamp, so the phase
|
|
242
|
+
* JSON stays lean and the archive is recoverable. */
|
|
243
|
+
handoffHistory: z.array(HandoffHistoryEntrySchema).default([]),
|
|
244
|
+
/** 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"). */
|
|
245
|
+
statusLog: z.array(PhaseStatusLogEntrySchema).default([]),
|
|
198
246
|
});
|
|
199
247
|
export const FeatureSchema = z.object({
|
|
200
248
|
id: z.string(),
|
|
249
|
+
/** Global project-wide feature sequence (assigned once at creation from project.nextFeatureNumber; stable, gaps on delete). */
|
|
201
250
|
number: z.number().int().nonnegative().default(0),
|
|
202
251
|
shortId: z.string().regex(/^(|[A-Z2-9]{5})$/).default(""),
|
|
203
252
|
priority: z.number().int().nonnegative().default(0),
|
|
@@ -215,6 +264,8 @@ export const FeatureSchema = z.object({
|
|
|
215
264
|
acceptedDecisions: z.array(AcceptedDecisionSchema).default([]),
|
|
216
265
|
phaseIds: z.array(z.string().min(1)).default([]),
|
|
217
266
|
dependsOn: z.array(z.string().min(1)).default([]),
|
|
267
|
+
/** 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"). */
|
|
268
|
+
statusLog: z.array(StatusLogEntrySchema).default([]),
|
|
218
269
|
createdAt: TimestampSchema,
|
|
219
270
|
updatedAt: TimestampSchema,
|
|
220
271
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Feature, Phase } 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): 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,MAAM,aAAa,CAAC;AAGlD;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,GAAG,SAAS,GAC3B,MAAM,CAiCR"}
|
|
@@ -0,0 +1,48 @@
|
|
|
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) {
|
|
16
|
+
const lines = [];
|
|
17
|
+
const phaseRef = formatPhaseRef(phase.number, feature?.number);
|
|
18
|
+
lines.push(`\n📋 Phase context — read this BEFORE touching code:`);
|
|
19
|
+
lines.push(`Phase ${phaseRef} — ${phase.title}`);
|
|
20
|
+
if (phase.summary && phase.summary.trim()) {
|
|
21
|
+
lines.push(`Summary: ${phase.summary.trim()}`);
|
|
22
|
+
}
|
|
23
|
+
if (phase.description && phase.description.trim()) {
|
|
24
|
+
lines.push(`\nPhase description:\n${phase.description.trim()}`);
|
|
25
|
+
}
|
|
26
|
+
const bullet = (label, items) => {
|
|
27
|
+
if (items && items.length > 0) {
|
|
28
|
+
lines.push(`\n${label}:`);
|
|
29
|
+
for (const it of items)
|
|
30
|
+
lines.push(` - ${it}`);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
bullet("Goals", phase.goals);
|
|
34
|
+
bullet("Non-goals", phase.nonGoals);
|
|
35
|
+
bullet("Dependencies", phase.dependencies);
|
|
36
|
+
bullet("Risks", phase.risks);
|
|
37
|
+
bullet("Open questions", phase.openQuestions);
|
|
38
|
+
bullet("Decisions", phase.decisions);
|
|
39
|
+
bullet("Completion criteria", phase.completionCriteria);
|
|
40
|
+
if (feature) {
|
|
41
|
+
lines.push(`\nFeature F${String(feature.number).padStart(3, "0")} — ${feature.name}`);
|
|
42
|
+
if (feature.description && feature.description.trim()) {
|
|
43
|
+
lines.push(`\nFeature description:\n${feature.description.trim()}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
lines.push(`\n(End of phase context. Now proceed with the task.)`);
|
|
47
|
+
return lines.join("\n");
|
|
48
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-plan/core",
|
|
3
|
-
"version": "0.2.19-next.
|
|
3
|
+
"version": "0.2.19-next.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",
|